com.trendmicro.grid.acl.l0
Class PublicPackageRestService

java.lang.Object
  extended by com.trendmicro.grid.acl.l0.PublicPackageRestService
All Implemented Interfaces:
Level0RestService, RestService, Service

@Service
public class PublicPackageRestService
extends Object
implements Level0RestService

Implements a REST styled interface on top of the SOAP api using JAX-RS

Version:
1.0
Author:
Juergen_Kellerer, 2010-04-30

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.trendmicro.grid.acl.l0.Level0RestService
Level0RestService.RestUtil
 
Constructor Summary
PublicPackageRestService()
           
 
Method Summary
static PackageDetails convertJpaPackageDetails(PackageDetails pd)
           
static PackageInformation convertJpaPackageInformation(PackageInformation pf)
           
 NamedFileIdentifierListPage getFilesContainedInPackageById(String sha1OrMd5Hash, int pageNumber)
          Returns the ids of all files contained inside the given package.
 NamedFileIdentifierListPage getFilesContainedInPackageByName(String packageName, int pageNumber)
          Returns the ids of all files contained inside the given package.
 NameListPage getMatchingPackageNames(int pageNumber, String tagExpression, String tagExpressionVersion)
          Returns all known packages that are matched by the given tag expression.
 PackageDetails getPackageDetailsById(String sha1OrMd5Hash)
          Returns the package details of the given package.
 PackageDetails getPackageDetailsByName(String packageName)
          Returns the package details of the given package.
 String getPackageDisplayName(String packageName)
          Returns the displayname for the given reference name.
 String getPackageFamilyDisplayName(String packageFamilyName)
          Returns the displayname for the given reference name.
 NameListPage getPackageFamilyNames(int pageNumber)
          Returns all known package family names.
 NameListPage getPackageFamilyNamesForVendor(String vendorName, int pageNumber)
          Returns all known package family names for the given vendor.
 PackageInformation getPackageInformationById(String sha1OrMd5Hash)
          Returns the package information of the given package.
 PackageInformation getPackageInformationByName(String packageName)
          Returns the package information of the given package.
 NameListPage getPackageNamesInFamily(String packageFamilyName, int pageNumber)
          Returns all package names that are members of the given package family.
 NameListPage getPackageNamesTaggedWith(int pageNumber, List<String> tags)
          Returns all known files that are tagged with the given list of tags.
 NameListPage getPackagesContainedInPackageById(String sha1OrMd5Hash, int pageNumber)
          Returns the names of all packages contained inside the given package.
 NameListPage getPackagesContainedInPackageByName(String packageName, int pageNumber)
          Returns the names of all packages contained inside the given package.
 NameListPage getReferencingPackageNames(String packageName, int pageNumber)
          Returns the names of all packages that reference the given package directly.
 NameListPage getReferencingPackageNamesById(String sha1OrMd5Hash, int pageNumber)
          Returns the names of all packages that reference the given file directly.
 String getVendorDisplayName(String vendorName)
          Returns the displayname for the given reference name.
 NameListPage getVendorNames(int pageNumber)
          Returns all known vendor names.
 String isPackageTaggedWithById(String sha1OrMd5Hash, List<String> tags)
          Returns true if the given package is tagged with the specified tags.
 String isPackageTaggedWithByName(String packageName, List<String> tags)
          Returns true if the given package is tagged with the specified tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicPackageRestService

public PublicPackageRestService()
Method Detail

convertJpaPackageInformation

public static PackageInformation convertJpaPackageInformation(PackageInformation pf)

convertJpaPackageDetails

public static PackageDetails convertJpaPackageDetails(PackageDetails pd)

getVendorNames

public NameListPage getVendorNames(int pageNumber)
                            throws AuthenticationException
Returns all known vendor names.

Parameters:
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of known vendor names or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getVendorDisplayName

public String getVendorDisplayName(String vendorName)
                            throws AuthenticationException
Returns the displayname for the given reference name.

Parameters:
vendorName - the name of the vendor to return the display name for.
Returns:
a collection of displaynames for the given names, never 'null'.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageFamilyNames

public NameListPage getPackageFamilyNames(int pageNumber)
                                   throws AuthenticationException
Returns all known package family names.

Parameters:
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of known package family names or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageFamilyDisplayName

public String getPackageFamilyDisplayName(String packageFamilyName)
                                   throws AuthenticationException
Returns the displayname for the given reference name.

Parameters:
packageFamilyName - the name of the package family to return the display name for.
Returns:
the displayname for the given name, never 'null'.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageFamilyNamesForVendor

public NameListPage getPackageFamilyNamesForVendor(String vendorName,
                                                   int pageNumber)
                                            throws AuthenticationException
Returns all known package family names for the given vendor.

Parameters:
vendorName - the name of the vendor to query package families from.
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of known package family names or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageNamesInFamily

public NameListPage getPackageNamesInFamily(String packageFamilyName,
                                            int pageNumber)
                                     throws AuthenticationException
Returns all package names that are members of the given package family.

Parameters:
packageFamilyName - the name of the package family to query package names from.
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of package names or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageDisplayName

public String getPackageDisplayName(String packageName)
                             throws AuthenticationException
Returns the displayname for the given reference name.

Parameters:
packageName - the name of the package to return the display name for.
Returns:
the displayname for the given name, never 'null'.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

isPackageTaggedWithById

public String isPackageTaggedWithById(String sha1OrMd5Hash,
                                      List<String> tags)
                               throws AuthenticationException
Returns true if the given package is tagged with the specified tags.

Parameters:
sha1OrMd5Hash - The package file to verify.
tags - The tags to check against.
Returns:
'true' if the tags apply to the package, 'false' if not, 'null' (HTTP 204 No Content) if the package is unknown or the file id references a ordinary file not a package.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

isPackageTaggedWithByName

public String isPackageTaggedWithByName(String packageName,
                                        List<String> tags)
                                 throws AuthenticationException
Returns true if the given package is tagged with the specified tags.

Parameters:
packageName - The package to verify.
tags - The tags to check against.
Returns:
'true' if the tags apply to the package, 'false' if not, 'null' (HTTP 204 No Content) if the package is unknown.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageNamesTaggedWith

public NameListPage getPackageNamesTaggedWith(int pageNumber,
                                              List<String> tags)
                                       throws AuthenticationException
Returns all known files that are tagged with the given list of tags.

Parameters:
tags - The tags to get the files for.
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of package names for the packages tagged with the given tags or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_TAG_MATCHING_QUERIES

getMatchingPackageNames

public NameListPage getMatchingPackageNames(int pageNumber,
                                            String tagExpression,
                                            String tagExpressionVersion)
                                     throws AuthenticationException
Returns all known packages that are matched by the given tag expression.

Parameters:
tagExpression - An expression following the tag query grammar used to identify packages.
tagExpressionVersion - The version of the expression (the most recent version is assumed if ommitted).
pageNumber - The number of the list page to return, starting from 0 for the first chunk.
Returns:
A page of package names for the packages, matching the given expression or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_TAG_MATCHING_QUERIES

getReferencingPackageNamesById

public NameListPage getReferencingPackageNamesById(String sha1OrMd5Hash,
                                                   int pageNumber)
                                            throws AuthenticationException
Returns the names of all packages that reference the given file directly.

A package references a file if the file is a direct child of the package.

Parameters:
sha1OrMd5Hash - The file to return the referencing package names for.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
A page of package names or 'null' if no page exists under the given number.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getReferencingPackageNames

public NameListPage getReferencingPackageNames(String packageName,
                                               int pageNumber)
                                        throws AuthenticationException
Returns the names of all packages that reference the given package directly.

Parameters:
packageName - The package name to return the names of referencing packages.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
A page of package names or 'null' if no page exists under the given name or pageNumber.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getFilesContainedInPackageById

public NamedFileIdentifierListPage getFilesContainedInPackageById(String sha1OrMd5Hash,
                                                                  int pageNumber)
                                                           throws AuthenticationException
Returns the ids of all files contained inside the given package.

Parameters:
sha1OrMd5Hash - The id of the package file to look for its children.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
the ids of all files contained inside the given package.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getFilesContainedInPackageByName

public NamedFileIdentifierListPage getFilesContainedInPackageByName(String packageName,
                                                                    int pageNumber)
                                                             throws AuthenticationException
Returns the ids of all files contained inside the given package.

Parameters:
packageName - The name of the package to look for its children.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
the ids of all files contained inside the given package.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getPackagesContainedInPackageById

public NameListPage getPackagesContainedInPackageById(String sha1OrMd5Hash,
                                                      int pageNumber)
                                               throws AuthenticationException
Returns the names of all packages contained inside the given package.

Parameters:
sha1OrMd5Hash - The id of the package file to look for its children.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
the names of all packages contained inside the given package.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getPackagesContainedInPackageByName

public NameListPage getPackagesContainedInPackageByName(String packageName,
                                                        int pageNumber)
                                                 throws AuthenticationException
Returns the names of all packages contained inside the given package.

Parameters:
packageName - The name of the package to look for its children.
pageNumber - The number of the list page to return, starting from 0 for the first page.
Returns:
the names of all packages contained inside the given package.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES, ROLE_RUN_COMPLEX_QUERIES

getPackageInformationById

public PackageInformation getPackageInformationById(String sha1OrMd5Hash)
                                             throws AuthenticationException
Returns the package information of the given package.

Parameters:
sha1OrMd5Hash - The id of the package file to look for.
Returns:
the package information of the given package or 'null' if no package exists under the specified arguments.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageInformationByName

public PackageInformation getPackageInformationByName(String packageName)
                                               throws AuthenticationException
Returns the package information of the given package.

Parameters:
packageName - The name of the package to look for.
Returns:
the package information of the given package or 'null' if no package exists under the specified arguments.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES

getPackageDetailsById

public PackageDetails getPackageDetailsById(String sha1OrMd5Hash)
                                     throws AuthenticationException
Returns the package details of the given package.

Parameters:
sha1OrMd5Hash - The id of the package file to look for.
Returns:
the package details of the given package or 'null' if no package exists under the specified arguments.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES ROLE_ACCESS_DETAILS

getPackageDetailsByName

public PackageDetails getPackageDetailsByName(String packageName)
                                       throws AuthenticationException
Returns the package details of the given package.

Parameters:
packageName - The name of the package to look for.
Returns:
the package details of the given package or 'null' if no package exists under the specified arguments.
Throws:
AuthenticationException - In case of this service requires authentication and the current user session is not authenticated or doesn't have the right to access the service.
Required roles:
ROLE_RUN_PACKAGE_QUERIES ROLE_ACCESS_DETAILS