1   package com.trendmicro.grid.acl.l0;
2   
3   import com.trendmicro.grid.acl.PublicRequestContext;
4   import com.trendmicro.grid.acl.RequiredRoles;
5   import com.trendmicro.grid.acl.Service;
6   import com.trendmicro.grid.acl.l0.datatypes.*;
7   
8   import javax.jws.WebMethod;
9   import javax.jws.WebParam;
10  import javax.jws.WebResult;
11  import javax.jws.WebService;
12  import javax.servlet.annotation.WebServlet;
13  import javax.xml.ws.ResponseWrapper;
14  import java.util.Collection;
15  
16  import static com.trendmicro.grid.acl.l0.KnownQueryContexts.CONTEXT_TAG_MATCHING_QUERY;
17  import static com.trendmicro.grid.acl.l0.KnownRoles.*;
18  
19  /**
20   * Defines package related web services, accessible to the outside world.
21   *
22   * @author Juergen_Kellerer, 2010-04-23
23   * @version 1.0
24   */
25  @PublicRequestContext
26  @WebServlet("/ws/level-0/packages")
27  @WebService(targetNamespace = Level0Constants.NAMESPACE)
28  public interface PublicPackageService extends Service {
29  
30  	/**
31  	 * Returns all known vendor names.
32  	 *
33  	 * @param pageNumber The number of the list page to return, starting from 0 for the first chunk.
34  	 * @return A page of known vendor names or 'null' if no page exists under the given number.
35  	 * @throws AuthenticationException In case of this service requires authentication and the current user session
36  	 *                                 is not authenticated or doesn't have the right to access the service.
37  	 */
38  	@WebMethod
39  	@WebResult(name = "vendorNames")
40  	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
41  	NameListPage getVendorNames(
42  			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
43  
44  	/**
45  	 * Returns the displaynames for the given reference names.
46  	 *
47  	 * @param vendorNames the names of the vendors to return the display names for.
48  	 * @return a collection of displaynames for the given names, never 'null'.
49  	 * @throws AuthenticationException In case of this service requires authentication and the current user session
50  	 *                                 is not authenticated or doesn't have the right to access the service.
51  	 */
52  	@WebMethod
53  	@WebResult(name = "displayName")
54  	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
55  	Collection<String> getVendorDisplayNames(
56  			@WebParam(name = "name") BatchCollection<String> vendorNames) throws AuthenticationException;
57  
58  	/**
59  	 * Returns all known package family names.
60  	 *
61  	 * @param pageNumber The number of the list page to return, starting from 0 for the first chunk.
62  	 * @return A page of known package family names or 'null' if no page exists under the given number.
63  	 * @throws AuthenticationException In case of this service requires authentication and the current user session
64  	 *                                 is not authenticated or doesn't have the right to access the service.
65  	 */
66  	@WebMethod
67  	@WebResult(name = "packageFamilyNames")
68  	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
69  	NameListPage getPackageFamilyNames(
70  			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
71  
72  	/**
73  	 * Returns the displaynames for the given reference names.
74  	 *
75  	 * @param packageFamilyNames the names of the package families to return the display names for.
76  	 * @return a collection of displaynames for the given names, never 'null'.
77  	 * @throws AuthenticationException In case of this service requires authentication and the current user session
78  	 *                                 is not authenticated or doesn't have the right to access the service.
79  	 */
80  	@WebMethod
81  	@WebResult(name = "displayName")
82  	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
83  	Collection<String> getPackageFamilyDisplayNames(
84  			@WebParam(name = "name") BatchCollection<String> packageFamilyNames) throws AuthenticationException;
85  
86  	/**
87  	 * Returns all known package family names for the given vendor.
88  	 *
89  	 * @param vendorName the name of the vendor to query package families from.
90  	 * @param pageNumber The number of the list page to return, starting from 0 for the first chunk.
91  	 * @return A page of known package family names or 'null' if no page exists under the given number.
92  	 * @throws AuthenticationException In case of this service requires authentication and the current user session
93  	 *                                 is not authenticated or doesn't have the right to access the service.
94  	 */
95  	@WebMethod
96  	@WebResult(name = "packageFamilyNames")
97  	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
98  	NameListPage getPackageFamilyNamesForVendor(
99  			@WebParam(name = "vendorName") String vendorName,
100 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
101 
102 	/**
103 	 * Returns all package names that are members of the given package family.
104 	 *
105 	 * @param packageFamilyName the name of the package family to query package names from.
106 	 * @param pageNumber		The number of the list page to return, starting from 0 for the first chunk.
107 	 * @return A page of package names or 'null' if no page exists under the given number.
108 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
109 	 *                                 is not authenticated or doesn't have the right to access the service.
110 	 */
111 	@WebMethod
112 	@WebResult(name = "packageNames")
113 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
114 	NameListPage getPackageNamesInFamily(
115 			@WebParam(name = "packageFamilyName") String packageFamilyName,
116 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
117 
118 	/**
119 	 * Returns the displaynames for the given reference names.
120 	 *
121 	 * @param packageNames the names of the packages to return the display names for.
122 	 * @return a collection of displaynames for the given names, never 'null'.
123 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
124 	 *                                 is not authenticated or doesn't have the right to access the service.
125 	 */
126 	@WebMethod
127 	@WebResult(name = "displayName")
128 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
129 	Collection<String> getPackageDisplayNames(
130 			@WebParam(name = "name") BatchCollection<String> packageNames) throws AuthenticationException;
131 
132 	/**
133 	 * Returns true if the given package is tagged with the specified tags.
134 	 *
135 	 * @param file The package file to verify.
136 	 * @param tags The tags to check against.
137 	 * @return True if the tags apply to the package, false if not, 'null'
138 	 *         if the package is unknown or the file id references a ordinary file not a package.
139 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
140 	 *                                 is not authenticated or doesn't have the right to access the service.
141 	 * @deprecated Please use {@link #isPackageTaggedWithAllById(FileIdentifier, String[])} instead.
142 	 */
143 	@Deprecated
144 	@WebMethod
145 	@WebResult(name = "result")
146 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
147 	Boolean isPackageTaggedWithById(
148 			@WebParam(name = "file") FileIdentifier file,
149 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
150 
151 	/**
152 	 * Returns true if the given packages are tagged with the specified tags.
153 	 * <p/>
154 	 * Implements a batch query for {@link #isPackageTaggedWithById(FileIdentifier, String[])}.
155 	 * <p/>
156 	 * <b>Important Note:</b> This method returned incorrect data when 'null' values were contained in the result.
157 	 * 'Null' values are swallowed by the XML serialization framework, because it considers the booleans
158 	 * as primitive types. Therefore starting from GACL 1.2, this method substitutes 'null' with 'false'.
159 	 * Use {@link #isPackagesTaggedWithAllById(BatchCollection, String[])} instead, to get a 3-way result.
160 	 *
161 	 * @param files The package files to verify.
162 	 * @param tags  The tags to check against.
163 	 * @return True if the tags apply to the package, false if not.
164 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
165 	 *                                 is not authenticated or doesn't have the right to access the service.
166 	 * @deprecated Please use {@link #isPackagesTaggedWithAllById(BatchCollection, String[])} instead.
167 	 */
168 	@Deprecated
169 	@WebMethod
170 	@WebResult(name = "result")
171 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
172 	Collection<Boolean> isPackagesTaggedWithById(
173 			@WebParam(name = "file") BatchCollection<FileIdentifier> files,
174 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
175 
176 	/**
177 	 * Returns 'Yes' if the given package is tagged with the specified tags.
178 	 * <p/>
179 	 * When querying multiple packages, {@link #isPackagesTaggedWithAllById(BatchCollection, String[])}, may
180 	 * be more efficient.
181 	 * <p/>
182 	 * Note: This method is a replacement for {@link #isPackageTaggedWithById(FileIdentifier, String[])} as a 3-way
183 	 * boolean is not obvious and not supported in all programming languages.
184 	 *
185 	 * @param file The package file to verify.
186 	 * @param tags The tags to check against.
187 	 * @return 'Yes' if the tags apply to the package, 'No' if not, 'NotKnown'
188 	 *         if the package is unknown or the file id references a ordinary file not a package.
189 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
190 	 *                                 is not authenticated or doesn't have the right to access the service.
191 	 * @see #isPackageTaggedWithAllByName(String, String[])
192 	 */
193 	@WebMethod
194 	@WebResult(name = "result")
195 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
196 	IsTrueResult isPackageTaggedWithAllById(
197 			@WebParam(name = "file") FileIdentifier file,
198 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
199 
200 	/**
201 	 * Returns 'Yes' if the given packages are tagged with the specified tags.
202 	 * <p/>
203 	 * Implements a batch query for {@link #isPackageTaggedWithAllById(FileIdentifier, String[])}.
204 	 * <p/>
205 	 * Note: This method is a replacement for {@link #isPackagesTaggedWithById(BatchCollection, String[])} as
206 	 * a 3-way boolean is not obvious and not supported in all programming languages.
207 	 *
208 	 * @param files The package files to verify.
209 	 * @param tags  The tags to check against.
210 	 * @return 'Yes' if the tags apply to the package, 'No' if not, 'NotKnown'
211 	 *         if the package is unknown or the file id references a ordinary file not a package.
212 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
213 	 *                                 is not authenticated or doesn't have the right to access the service.
214 	 * @see #isPackagesTaggedWithAllByName(BatchCollection, String[])
215 	 */
216 	@WebMethod
217 	@WebResult(name = "result")
218 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
219 	Collection<IsTrueResult> isPackagesTaggedWithAllById(
220 			@WebParam(name = "file") BatchCollection<FileIdentifier> files,
221 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
222 
223 	/**
224 	 * Returns true if the given package is tagged with the specified tags.
225 	 *
226 	 * @param packageName The package to verify.
227 	 * @param tags		The tags to check against.
228 	 * @return True if the tags apply to the package, false if not, 'null' if the package is unknown.
229 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
230 	 *                                 is not authenticated or doesn't have the right to access the service.
231 	 * @deprecated Please use {@link #isPackageTaggedWithAllByName(String, String[])} instead.
232 	 */
233 	@Deprecated
234 	@WebMethod
235 	@WebResult(name = "result")
236 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
237 	Boolean isPackageTaggedWithByName(
238 			@WebParam(name = "packageName") String packageName,
239 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
240 
241 	/**
242 	 * Returns true if the given packages are tagged with the specified tags.
243 	 * <p/>
244 	 * Implements a batch query for {@link #isPackageTaggedWithByName(String, String[])}.
245 	 * <p/>
246 	 * <b>Important Note:</b> This method returned incorrect data when 'null' values were contained in the result.
247 	 * 'Null' values are swallowed by the XML serialization framework, because it considers the booleans
248 	 * as primitive types. Therefore starting from GACL 1.2, this method substitutes 'null' with 'false'.
249 	 * Use {@link #isPackagesTaggedWithAllByName(BatchCollection, String[])} instead, to get a 3-way result.
250 	 *
251 	 * @param packageNames The package to verify.
252 	 * @param tags		 The tags to check against.
253 	 * @return True if the tags apply to the package, false if not.
254 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
255 	 *                                 is not authenticated or doesn't have the right to access the service.
256 	 * @deprecated Please use {@link #isPackagesTaggedWithAllByName(BatchCollection, String[])} instead.
257 	 */
258 	@Deprecated
259 	@WebMethod
260 	@WebResult(name = "result")
261 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
262 	Collection<Boolean> isPackagesTaggedWithByName(
263 			@WebParam(name = "packageName") BatchCollection<String> packageNames,
264 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
265 
266 	/**
267 	 * Returns 'Yes' if the given package is tagged with the specified tags.
268 	 * <p/>
269 	 * When querying multiple packages, {@link #isPackagesTaggedWithAllByName(BatchCollection, String[])}, may
270 	 * be more efficient.
271 	 * <p/>
272 	 * Note: This method is a replacement for {@link #isPackageTaggedWithByName(String, String[])} as a 3-way boolean
273 	 * is not obvious and not supported in all programming languages.
274 	 *
275 	 * @param packageName The package to verify.
276 	 * @param tags		The tags to check against.
277 	 * @return 'Yes' if the tags apply to the package, 'No' if not, 'NotKnown' if the package is unknown.
278 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
279 	 *                                 is not authenticated or doesn't have the right to access the service.
280 	 * @see #isPackageTaggedWithAllById(com.trendmicro.grid.acl.l0.datatypes.FileIdentifier, String[])
281 	 */
282 	@WebMethod
283 	@WebResult(name = "result")
284 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
285 	IsTrueResult isPackageTaggedWithAllByName(
286 			@WebParam(name = "packageName") String packageName,
287 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
288 
289 	/**
290 	 * Returns 'Yes' if the given packages are tagged with the specified tags.
291 	 * <p/>
292 	 * Implements a batch query for {@link #isPackageTaggedWithAllByName(String, String[])}.
293 	 * <p/>
294 	 * Note: This method is a replacement for {@link #isPackagesTaggedWithByName(BatchCollection, String[])} as
295 	 * a 3-way boolean is not obvious and not supported in all programming languages.
296 	 *
297 	 * @param packageNames The package to verify.
298 	 * @param tags		 The tags to check against.
299 	 * @return 'Yes' if the tags apply to the package, 'No' if not, 'NotKnown' if the package is unknown.
300 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
301 	 *                                 is not authenticated or doesn't have the right to access the service.
302 	 * @see #isPackagesTaggedWithAllById(BatchCollection, String[])
303 	 */
304 	@WebMethod
305 	@WebResult(name = "result")
306 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
307 	Collection<IsTrueResult> isPackagesTaggedWithAllByName(
308 			@WebParam(name = "packageName") BatchCollection<String> packageNames,
309 			@WebParam(name = "tag") String[] tags) throws AuthenticationException;
310 
311 	/**
312 	 * Returns all known package names that are tagged with the given list of tags.
313 	 *
314 	 * @param tags	   The tags to get the files for.
315 	 * @param pageNumber The number of the list page to return, starting from 0 for the first chunk.
316 	 * @return A page of package names for the packages tagged with the given tags or
317 	 *         'null' if no page exists under the given number.
318 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
319 	 *                                 is not authenticated or doesn't have the right to access the service.
320 	 */
321 	@WebMethod
322 	@WebResult(name = "packageNames")
323 	@PublicRequestContext(CONTEXT_TAG_MATCHING_QUERY)
324 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_TAG_MATCHING_QUERIES})
325 	NameListPage getPackageNamesTaggedWith(
326 			@WebParam(name = "tag") String[] tags,
327 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
328 
329 	/**
330 	 * Returns all known packages that are matched by the given tag expression.
331 	 * <p/>
332 	 * <b>Tag Query Grammar</b><br/>
333 	 * A common tag query uses a simple search gramar also common for most search engines:
334 	 * <ul>
335 	 * <li>Tags are delimted by whitespaces</li>
336 	 * <li>Adding "-" in front of a tag negates the search (the tag must not be included in results)</li>
337 	 * <li>Groups can be built by adding braces arround tags. Multiple groups are combined with OR
338 	 * (the same as if multiple individual queries would be combined).</li>
339 	 * <li>Tags in one group are combined with AND (all have to be included (or excluded when prefixed with "-"))</li>
340 	 * </ul>
341 	 * Example query: {@code (mustbe1Group1 -mustnotbe1Group1) (mustbe1Group2 -mustnotbe1Group2 mustbe2Group2)}
342 	 *
343 	 * @param tagExpression		An expression following the tag query grammar used to identify packages.
344 	 * @param tagExpressionVersion The version of the expression (the most recent version is assumed if ommitted).
345 	 * @param pageNumber		   The number of the list page to return, starting from 0 for the first chunk.
346 	 * @return A page of package names for the packages, matching the given expression or
347 	 *         'null' if no page exists under the given number.
348 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
349 	 *                                 is not authenticated or doesn't have the right to access the service.
350 	 */
351 	@WebMethod
352 	@WebResult(name = "packageNames")
353 	@PublicRequestContext(CONTEXT_TAG_MATCHING_QUERY)
354 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_TAG_MATCHING_QUERIES})
355 	NameListPage getMatchingPackageNames(
356 			@WebParam(name = "tagQueryExpression") String tagExpression,
357 			@WebParam(name = "tagQueryExpressionVersion") String tagExpressionVersion,
358 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
359 
360 	/**
361 	 * Returns all known packages that are matched by the given tag expression and are in the given range.
362 	 *
363 	 * @param tagExpression		An expression following the tag query grammar used to identify packages.
364 	 * @param tagExpressionVersion The version of the expression (the most recent version is assumed if ommitted).
365 	 * @param range				The range limiting the output.
366 	 * @param pageNumber		   The number of the list page to return, starting from 0 for the first chunk.
367 	 * @return A page of package names for the packages, matching the given expression or
368 	 *         'null' if no page exists under the given number.
369 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
370 	 *                                 is not authenticated or doesn't have the right to access the service.
371 	 */
372 	@WebMethod
373 	@WebResult(name = "packageNames")
374 	@PublicRequestContext(CONTEXT_TAG_MATCHING_QUERY)
375 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_TAG_MATCHING_QUERIES})
376 	NameListPage getMatchingPackageNamesInRange(
377 			@WebParam(name = "tagQueryExpression") String tagExpression,
378 			@WebParam(name = "tagQueryExpressionVersion") String tagExpressionVersion,
379 			@WebParam(name = "range") Range range,
380 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
381 
382 	/**
383 	 * Returns the names of all packages that reference the given file directly.
384 	 * <p/>
385 	 * A package references a file if the file is a direct child of the package.
386 	 *
387 	 * @param file	   The file to return the referencing package names for.
388 	 * @param pageNumber The number of the list page to return, starting from 0 for the first page.
389 	 * @return A page of package names or 'null' if no page exists under the given number.
390 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
391 	 *                                 is not authenticated or doesn't have the right to access the service.
392 	 */
393 	@WebMethod
394 	@WebResult(name = "packageNames")
395 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
396 	NameListPage getReferencingPackageNamesById(
397 			@WebParam(name = "fileId") FileIdentifier file,
398 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
399 
400 	/**
401 	 * Returns the names of all packages that reference the given package directly.
402 	 *
403 	 * @param packageName The package name to return the names of referencing packages.
404 	 * @param pageNumber  The number of the list page to return, starting from 0 for the first page.
405 	 * @return A page of package names or 'null' if no page exists under the given name or pageNumber.
406 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
407 	 *                                 is not authenticated or doesn't have the right to access the service.
408 	 */
409 	@WebMethod
410 	@WebResult(name = "packageNames")
411 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
412 	NameListPage getReferencingPackageNames(
413 			@WebParam(name = "packageName") String packageName,
414 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
415 
416 	/**
417 	 * Returns the ids of all files contained inside the given package.
418 	 *
419 	 * @param packageFile The id of the package file to look for its children.
420 	 * @param pageNumber  The number of the list page to return, starting from 0 for the first page.
421 	 * @return the ids of all files contained inside the given package.
422 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
423 	 *                                 is not authenticated or doesn't have the right to access the service.
424 	 */
425 	@WebMethod
426 	@WebResult(name = "fileIds")
427 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
428 	NamedFileIdentifierListPage getFilesContainedInPackageById(
429 			@WebParam(name = "packageFileId") FileIdentifier packageFile,
430 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
431 
432 	/**
433 	 * Returns the ids of all files contained inside the given package.
434 	 *
435 	 * @param packageName The name of the package to look for its children.
436 	 * @param pageNumber  The number of the list page to return, starting from 0 for the first page.
437 	 * @return the ids of all files contained inside the given package.
438 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
439 	 *                                 is not authenticated or doesn't have the right to access the service.
440 	 */
441 	@WebMethod
442 	@WebResult(name = "fileIds")
443 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
444 	NamedFileIdentifierListPage getFilesContainedInPackageByName(
445 			@WebParam(name = "packageName") String packageName,
446 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
447 
448 	/**
449 	 * Returns the names of all packages contained inside the given package.
450 	 *
451 	 * @param packageFile The id of the package file to look for its children.
452 	 * @param pageNumber  The number of the list page to return, starting from 0 for the first page.
453 	 * @return the names of all packages contained inside the given package.
454 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
455 	 *                                 is not authenticated or doesn't have the right to access the service.
456 	 */
457 	@WebMethod
458 	@WebResult(name = "packages")
459 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
460 	NameListPage getPackagesContainedInPackageById(
461 			@WebParam(name = "packageFileId") FileIdentifier packageFile,
462 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
463 
464 	/**
465 	 * Returns the names of all packages contained inside the given package.
466 	 *
467 	 * @param packageName The name of the package to look for its children.
468 	 * @param pageNumber  The number of the list page to return, starting from 0 for the first page.
469 	 * @return the names of all packages contained inside the given package.
470 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
471 	 *                                 is not authenticated or doesn't have the right to access the service.
472 	 */
473 	@WebMethod
474 	@WebResult(name = "packages")
475 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES})
476 	NameListPage getPackagesContainedInPackageByName(
477 			@WebParam(name = "packageName") String packageName,
478 			@WebParam(name = "pageNumber") int pageNumber) throws AuthenticationException;
479 
480 	/**
481 	 * Returns the package information of the given package.
482 	 *
483 	 * @param file The id of the package file to look for.
484 	 * @return the package information of the given package or 'null' if
485 	 *         no package exists under the specified arguments.
486 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
487 	 *                                 is not authenticated or doesn't have the right to access the service.
488 	 */
489 	@WebMethod
490 	@WebResult(name = "packageInfo")
491 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
492 	PackageInformation getPackageInformationById(
493 			@WebParam(name = "packageFileId") FileIdentifier file) throws AuthenticationException;
494 
495 	/**
496 	 * Returns the package information list of the given packages.
497 	 *
498 	 * @param files The ids of the package files to look for.
499 	 * @return the package information list of the given package or 'null' if
500 	 *         no packages exists under the specified arguments.
501 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
502 	 *                                 is not authenticated or doesn't have the right to access the service.
503 	 */
504 	@WebMethod
505 	@WebResult(name = "packageInfo")
506 	@ResponseWrapper( // Adding a custom response wrapper to support 'null' values inside the returned collection.
507 			className = "com.trendmicro.grid.acl.l0.wrappers.GetPackageInformationListByIdResponse")
508 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
509 	Collection<PackageInformation> getPackageInformationListById(
510 			@WebParam(name = "packageFileId") BatchCollection<FileIdentifier> files) throws AuthenticationException;
511 
512 	/**
513 	 * Returns the package information of the given package.
514 	 *
515 	 * @param packageName The name of the package to look for.
516 	 * @return the package information of the given package or 'null' if
517 	 *         no package exists under the specified arguments.
518 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
519 	 *                                 is not authenticated or doesn't have the right to access the service.
520 	 */
521 	@WebMethod
522 	@WebResult(name = "packageInfo")
523 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
524 	PackageInformation getPackageInformationByName(
525 			@WebParam(name = "packageName") String packageName) throws AuthenticationException;
526 
527 	/**
528 	 * Returns the package information list of the given packages.
529 	 *
530 	 * @param packageNames The names of the packages to look for.
531 	 * @return the package information list of the given package or 'null' if
532 	 *         no packages exists under the specified arguments.
533 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
534 	 *                                 is not authenticated or doesn't have the right to access the service.
535 	 */
536 	@WebMethod
537 	@WebResult(name = "packageInfo")
538 	@ResponseWrapper( // Adding a custom response wrapper to support 'null' values inside the returned collection.
539 			className = "com.trendmicro.grid.acl.l0.wrappers.GetPackageInformationListByNameResponse")
540 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
541 	Collection<PackageInformation> getPackageInformationListByName(
542 			@WebParam(name = "packageName") BatchCollection<String> packageNames) throws AuthenticationException;
543 
544 	/**
545 	 * Returns the file ID of the file that is associated with the given package.
546 	 *
547 	 * @param packageNames The names of the packages to look for.
548 	 * @return the the file ID of the file that is associated with the given package.
549 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
550 	 *                                 is not authenticated or doesn't have the right to access the service.
551 	 */
552 	@WebMethod
553 	@WebResult(name = "packageFileId")
554 	@ResponseWrapper( // Adding a custom response wrapper to support 'null' values inside the returned collection.
555 			className = "com.trendmicro.grid.acl.l0.wrappers.GetPackageFileIdentifiersByNameResponse")
556 	@RequiredRoles(ROLE_RUN_PACKAGE_QUERIES)
557 	Collection<FileIdentifier> getPackageFileIdentifiersByName(
558 			@WebParam(name = "packageName") BatchCollection<String> packageNames) throws AuthenticationException;
559 
560 	/**
561 	 * Returns the vendor information for the given vendor name.
562 	 *
563 	 * @param name the name of the vendor to return.
564 	 * @return the vendor information for the given vendor name.
565 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
566 	 *                                 is not authenticated or doesn't have the right to access the service.
567 	 */
568 	@WebMethod
569 	@WebResult(name = "vendor")
570 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
571 	Vendor getVendor(@WebParam(name = "name") String name) throws AuthenticationException;
572 
573 	/**
574 	 * Returns the package family on the given basename.
575 	 *
576 	 * @param basename the name of the package family.
577 	 * @return the package family on the given basename.
578 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
579 	 *                                 is not authenticated or doesn't have the right to access the service.
580 	 */
581 	@WebMethod
582 	@WebResult(name = "packageFamily")
583 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
584 	PackageFamily getPackageFamily(
585 			@WebParam(name = "basename") String basename) throws AuthenticationException;
586 
587 	/**
588 	 * Returns the package details on the given package file id.
589 	 *
590 	 * @param file The SHA1 hash of the package file.
591 	 * @return the package details on the given package file id.
592 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
593 	 *                                 is not authenticated or doesn't have the right to access the service.
594 	 */
595 	@WebMethod
596 	@WebResult(name = "packageDetails")
597 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
598 	PackageDetails getPackageDetailsById(
599 			@WebParam(name = "packageFileId") FileIdentifier file) throws AuthenticationException;
600 
601 	/**
602 	 * Returns the package details on the given package file ids.
603 	 *
604 	 * @param files The SHA1 hashes of the package files.
605 	 * @return the package details on the given package file ids.
606 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
607 	 *                                 is not authenticated or doesn't have the right to access the service.
608 	 */
609 	@WebMethod
610 	@WebResult(name = "packageDetails")
611 	@ResponseWrapper( // Adding a custom response wrapper to support 'null' values inside the returned collection.
612 			className = "com.trendmicro.grid.acl.l0.wrappers.GetPackageDetailsListByIdResponse")
613 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
614 	Collection<PackageDetails> getPackageDetailsListById(
615 			@WebParam(name = "packageFileId") BatchCollection<FileIdentifier> files) throws AuthenticationException;
616 
617 	/**
618 	 * Returns the package details on the given package name.
619 	 *
620 	 * @param packageName The name the package.
621 	 * @return the package details on the given package name.
622 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
623 	 *                                 is not authenticated or doesn't have the right to access the service.
624 	 */
625 	@WebMethod
626 	@WebResult(name = "packageDetails")
627 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
628 	PackageDetails getPackageDetailsByName(
629 			@WebParam(name = "packageName") String packageName) throws AuthenticationException;
630 
631 	/**
632 	 * Returns the package details on the given package names.
633 	 *
634 	 * @param packageNames The names the packages to lookup.
635 	 * @return the package details on the given package names.
636 	 * @throws AuthenticationException In case of this service requires authentication and the current user session
637 	 *                                 is not authenticated or doesn't have the right to access the service.
638 	 */
639 	@WebMethod
640 	@WebResult(name = "packageDetails")
641 	@ResponseWrapper( // Adding a custom response wrapper to support 'null' values inside the returned collection.
642 			className = "com.trendmicro.grid.acl.l0.wrappers.GetPackageDetailsListByNameResponse")
643 	@RequiredRoles({ROLE_RUN_PACKAGE_QUERIES, ROLE_ACCESS_DETAILS})
644 	Collection<PackageDetails> getPackageDetailsListByName(
645 			@WebParam(name = "packageName") BatchCollection<String> packageNames) throws AuthenticationException;
646 }