gov.nasa.pds.registry.service
Class RegistryService

java.lang.Object
  extended by gov.nasa.pds.registry.service.RegistryService

@Service(value="registryService")
public class RegistryService
extends Object

This class contains all the logic for publishing, versioning, updating, and deleting registry objects. The registry aims to support the registry portion of the CCSDS regrep specification at the same time it leverages the much of the ebXML information model.

Author:
pramirez

Constructor Summary
RegistryService()
           
 
Method Summary
 void changeRegistryObjectStatus(String user, String guid, ObjectAction action, Class<? extends RegistryObject> objectClass)
          Changes the status of registry object with the given guid and of the given type
 void changeStatus(String user, String lid, String versionId, ObjectAction action)
          Changes the Product status with the given identifying information.
 void deleteRegistryObject(String user, String guid, Class<? extends RegistryObject> objectClass)
          Deletes a RegistryObject from the registry which share the logical identifier and version.
 void deleteRegistryObject(String user, String lid, String versionId, Class<? extends RegistryObject> objectClass)
          Deletes a RegistryObject from the registry which share the logical identifier and version.
 Association getAssocation(String guid)
          Retrieves the Association from the registry with the given guid
 RegistryResponse getAssociations(AssociationQuery query, Integer start, Integer rows)
          Retrieves a set of associations that match the given query.
 RegistryResponse getAssociations(String lid, String versionId, Integer start, Integer rows)
          Retrieves all associations for a given registry object.
 RegistryResponse getAuditableEvents(String affectedObject)
          Retrieves the list of (@link AuditableEvent}'s for the affected object
 List<ClassificationNode> getClassificationNodes(String scheme)
          Retrieves all ClassificationNode for a given ClassificationScheme
 Product getEarliestProduct(String lid)
          Retrieves the earliest version of the Product with the given logical identifier
 IdentifierGenerator getIdentifierGenerator()
           
 Product getLatestProduct(String lid)
          Retrieves the latest version of the Product with the given logical identifier
 MetadataStore getMetadataStore()
          Get access to the back end store for the registry service.
 Product getNextProduct(String lid, String versionId)
          Retrieves the next version of the Product
 Product getPreviousProduct(String lid, String versionId)
          Retrieves the previous version of the Product
 Product getProduct(String guid)
          Retrieves a Product from the registry
 Product getProduct(String lid, String versionId)
          Retrieves a Product from the registry with the given identifying information.
 RegistryResponse getProducts(Integer start, Integer rows)
          This method allows one to page through the Product's in the registry.
 RegistryResponse getProducts(ProductQuery query)
          Retrieves the first set of products that match the query
 RegistryResponse getProducts(ProductQuery query, Integer start, Integer rows)
          Retrieves a set of products that match the given query.
 List<Product> getProductVersions(String lid)
          Retrieves all versions of a Product
 RegistryObject getRegistryObject(String guid, Class<? extends RegistryObject> objectClass)
          Retrieves a registry object of the requested type
 StatusInfo getStatus()
          Gives back some basic summary information about the registry.
 Versioner getVersioner()
           
 String publishRegistryObject(String user, RegistryObject registryObject)
          Publishes a registry object to the registry.
 void setIdentifierGenerator(IdentifierGenerator idGenerator)
          Sets the class used to generate unique ids for registry objects
 void setMetadataStore(MetadataStore metadataStore)
          Set where to store all the metadata for registry objects.
 void setVersioner(Versioner versioner)
          Sets the class used to generate and sort versions for registry objects.
 void updateRegistryObject(String user, RegistryObject registryObject)
          This method allows one to update all the metadata associated with a registry object.
 String versionProduct(String user, String lid, Product product, boolean major)
          Versions a Product in the registry and publishes the contents of the provided product.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryService

public RegistryService()
Method Detail

setMetadataStore

public void setMetadataStore(MetadataStore metadataStore)
Set where to store all the metadata for registry objects. Typically this has a database back end.

Parameters:
metadataStore - for registry object metadata

getMetadataStore

public MetadataStore getMetadataStore()
Get access to the back end store for the registry service. Mostly used for internal purposes.

Returns:
metadata store for registry objects

setVersioner

public void setVersioner(Versioner versioner)
Sets the class used to generate and sort versions for registry objects.

Parameters:
versioner - to use when generating a new version of a registry object.

getVersioner

public Versioner getVersioner()
Returns:
versioner used to generate version for registry objects

setIdentifierGenerator

public void setIdentifierGenerator(IdentifierGenerator idGenerator)
Sets the class used to generate unique ids for registry objects

Parameters:
idGenerator - to use to generate a guid for registry objects when there is not one supplied by clients.

getIdentifierGenerator

public IdentifierGenerator getIdentifierGenerator()
Returns:
id generator used to generate guids for registry objects

getProducts

public RegistryResponse getProducts(Integer start,
                                    Integer rows)
This method allows one to page through the Product's in the registry.

Parameters:
start - the index at which to start the result list from
rows - how many results to return
Returns:
a list of products

getProducts

public RegistryResponse getProducts(ProductQuery query)
Retrieves the first set of products that match the query

Parameters:
query - holds a set of filters to match against products
Returns:
a list of products

getProducts

public RegistryResponse getProducts(ProductQuery query,
                                    Integer start,
                                    Integer rows)
Retrieves a set of products that match the given query. Allows one to page through results.

Parameters:
query - holds a set of filters to match against Product's
start - the index at which to start the result list from. This index starts at one and if anything less than one is provided it will default to one.
rows - how many results to return
Returns:
a list of products

getStatus

public StatusInfo getStatus()
Gives back some basic summary information about the registry. This summary information includes the amount of managed objects.

Returns:
registry status

versionProduct

public String versionProduct(String user,
                             String lid,
                             Product product,
                             boolean major)
                      throws RegistryServiceException
Versions a Product in the registry and publishes the contents of the provided product.

Parameters:
user - that has taken the action. Typically this should point to a unique username.
lid - logical identifier of the parent registry object
product - the contents for this version of the product
major - flag to indicate whether this is a minor or major version
Returns:
the guid of the versioned product
Throws:
RegistryServiceException

getLatestProduct

public Product getLatestProduct(String lid)
Retrieves the latest version of the Product with the given logical identifier

Parameters:
lid - of product to look up
Returns:
latest version of product

getEarliestProduct

public Product getEarliestProduct(String lid)
Retrieves the earliest version of the Product with the given logical identifier

Parameters:
lid - of product to look up
Returns:
earliest version of product

getNextProduct

public Product getNextProduct(String lid,
                              String versionId)
Retrieves the next version of the Product

Parameters:
lid - of the current product
versionId - of the current product. This is the user provided version.
Returns:
the next version of the product otherwise null if there is no more versions

getPreviousProduct

public Product getPreviousProduct(String lid,
                                  String versionId)
Retrieves the previous version of the Product

Parameters:
lid - of the current product
versionId - of the current product. This is the user provided version.
Returns:
the previous version of the product otherwise null if there is no versions before the current one

getProductVersions

public List<Product> getProductVersions(String lid)
Retrieves all versions of a Product

Parameters:
lid - of the product of interest
Returns:
all versions of the product that share the given lid

getProduct

public Product getProduct(String lid,
                          String versionId)
Retrieves a Product from the registry with the given identifying information.

Parameters:
lid - of the product of interest.
versionId - of the product of interest. This is the user provided version.
Returns:
a product

getClassificationNodes

public List<ClassificationNode> getClassificationNodes(String scheme)
Retrieves all ClassificationNode for a given ClassificationScheme

Parameters:
scheme - guid for which to get the classification nodes for
Returns:
all classification nodes for the scheme's guid

changeStatus

public void changeStatus(String user,
                         String lid,
                         String versionId,
                         ObjectAction action)
Changes the Product status with the given identifying information.

Parameters:
user - that is requesting the change
lid - logical identifier of the product
versionId - of the product. This is the user supplied version
action - which to take (i.e. approve, deprecate, etc.)

changeRegistryObjectStatus

public void changeRegistryObjectStatus(String user,
                                       String guid,
                                       ObjectAction action,
                                       Class<? extends RegistryObject> objectClass)
Changes the status of registry object with the given guid and of the given type

Parameters:
user - that is requesting the change
guid - of the product to uniquely identify it
action - which to take (i.e. approve, deprecate, etc.)
objectClass - identifies the type of registry object

updateRegistryObject

public void updateRegistryObject(String user,
                                 RegistryObject registryObject)
This method allows one to update all the metadata associated with a registry object.

Parameters:
user - that is requesting the update
registryObject - to update too. The update is made to the object with the same guid

getAssociations

public RegistryResponse getAssociations(AssociationQuery query,
                                        Integer start,
                                        Integer rows)
Retrieves a set of associations that match the given query. Allows one to page through results.

Parameters:
query - holds a set of filters to match against Association's
start - the index at which to start the result list from. This index starts at one and if anything less than one is provided it will default to one.
rows - how many results to return
Returns:
a list of associations

getAuditableEvents

public RegistryResponse getAuditableEvents(String affectedObject)
Retrieves the list of (@link AuditableEvent}'s for the affected object

Parameters:
affectedObject - guid for the registry object of interest
Returns:
list of events associated with the guid

getAssociations

public RegistryResponse getAssociations(String lid,
                                        String versionId,
                                        Integer start,
                                        Integer rows)
Retrieves all associations for a given registry object. The registry object can be the source or target in the association

Parameters:
lid - of the object of interest
versionId - of the object of interest. This is the user provided version.
start - the index at which to start the result list from. This index starts at one and if anything less than one is provided it will default to one.
rows - how many results to return
Returns:
a list of associations

publishRegistryObject

public String publishRegistryObject(String user,
                                    RegistryObject registryObject)
                             throws RegistryServiceException
Publishes a registry object to the registry.

Parameters:
user - that is requesting the object to be published
registryObject - to publish
Returns:
guid of the published object
Throws:
RegistryServiceException

deleteRegistryObject

public void deleteRegistryObject(String user,
                                 String lid,
                                 String versionId,
                                 Class<? extends RegistryObject> objectClass)
Deletes a RegistryObject from the registry which share the logical identifier and version.

Parameters:
user - that requested the delete
lid - logical identifier of registry object
versionId - user defined version for the registry object
objectClass - type of registry object

deleteRegistryObject

public void deleteRegistryObject(String user,
                                 String guid,
                                 Class<? extends RegistryObject> objectClass)
Deletes a RegistryObject from the registry which share the logical identifier and version.

Parameters:
user - that requested the delete
guid - globally unique identifier of the registry object
objectClass - type of registry object

getAssocation

public Association getAssocation(String guid)
Retrieves the Association from the registry with the given guid

Parameters:
guid - globally unique identifier of the registry object
Returns:
the identified association

getProduct

public Product getProduct(String guid)
Retrieves a Product from the registry

Parameters:
guid - globally unique identifier of the registry object
Returns:
matching product

getRegistryObject

public RegistryObject getRegistryObject(String guid,
                                        Class<? extends RegistryObject> objectClass)
Retrieves a registry object of the requested type

Parameters:
guid - globally unique identifier of the object
objectClass - type of the registry object
Returns:
matching registry object


Copyright © 2005-2010 Planetary Data System. All Rights Reserved.