gov.nasa.pds.registry.service
Class RegistryServiceImpl

java.lang.Object
  extended by gov.nasa.pds.registry.service.RegistryServiceImpl
All Implemented Interfaces:
RegistryService

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

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
RegistryServiceImpl()
           
 
Method Summary
 void changeObjectStatus(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 changeObjectStatus(String user, String lid, String versionId, ObjectAction action, Class<? extends RegistryObject> objectClass)
          Changes the RegistryObject status with the given identifying information.
 String configure(String user, RegistryPackage registryPackage, List<? extends RegistryObject> registryObjects)
          Configures the registry with a list of registry objects as input.
 void deleteObject(String user, String guid, Class<? extends RegistryObject> objectClass)
          Deletes a RegistryObject from the registry which share the logical identifier and version.
 void deleteObject(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 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
 RegistryObject getEarliestObject(String lid, Class<? extends RegistryObject> objectClass)
          Retrieves the earliest version of the RegsitryObject with the given logical identifier
 ExtrinsicObject getExtrinsic(String guid)
          Retrieves a ExtrinsicObject from the registry
 RegistryResponse getExtrinsics(ExtrinsicQuery query)
          Retrieves the first set of extrinsics that match the query
 RegistryResponse getExtrinsics(ExtrinsicQuery query, Integer start, Integer rows)
          Retrieves a set of extinsics that match the given query.
 RegistryResponse getExtrinsics(Integer start, Integer rows)
          This method allows one to page through the ExtrinsicObject's in the registry.
 IdentifierGenerator getIdentifierGenerator()
           
 RegistryObject getLatestObject(String lid, Class<? extends RegistryObject> objectClass)
          Retrieves the latest version of the RegistryObject with the given logical identifier
 MetadataStore getMetadataStore()
          Get access to the back end store for the registry service.
 RegistryObject getNextObject(String lid, String versionId, Class<? extends RegistryObject> objectClass)
          Retrieves the next version of the RegsitryObject
 RegistryObject getObject(String guid, Class<? extends RegistryObject> objectClass)
          Retrieves a registry object of the requested type
 RegistryObject getObject(String lid, String versionId, Class<? extends RegistryObject> objectClass)
          Retrieves a RegistryObject from the registry with the given identifying information.
 RegistryResponse getObjects(ObjectQuery query, Integer start, Integer rows, Class<? extends RegistryObject> objectClass)
          Generic query for a given class of registry objects.
 List<RegistryObject> getObjectVersions(String lid, Class<? extends RegistryObject> objectClass)
          Retrieves all versions of a RegistryObject
 RegistryObject getPreviousObject(String lid, String versionId, Class<? extends RegistryObject> objectClass)
          Retrieves the previous version of the RegistryObject
 Report getReport()
          Gives back some basic summary information about the registry.
 Versioner getVersioner()
           
 String publishObject(String user, RegistryObject registryObject)
          Publishes a registry object to the registry.
 String publishObject(String user, RegistryObject registryObject, String packageId)
          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 updateObject(String user, RegistryObject registryObject)
          This method allows one to update all the metadata associated with a registry object.
 String versionObject(String user, String lid, RegistryObject object, boolean major)
          Versions a RegistryObject in the registry and publishes the contents of the provided extrinsic object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryServiceImpl

public RegistryServiceImpl()
Method Detail

setMetadataStore

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

Specified by:
setMetadataStore in interface RegistryService
Parameters:
metadataStore - for registry object metadata

getMetadataStore

public MetadataStore getMetadataStore()
Description copied from interface: RegistryService
Get access to the back end store for the registry service. Mostly used for internal purposes.

Specified by:
getMetadataStore in interface RegistryService
Returns:
metadata store for registry objects

setVersioner

public void setVersioner(Versioner versioner)
Description copied from interface: RegistryService
Sets the class used to generate and sort versions for registry objects.

Specified by:
setVersioner in interface RegistryService
Parameters:
versioner - to use when generating a new version of a registry object.

getVersioner

public Versioner getVersioner()
Specified by:
getVersioner in interface RegistryService
Returns:
versioner used to generate version for registry objects

setIdentifierGenerator

public void setIdentifierGenerator(IdentifierGenerator idGenerator)
Description copied from interface: RegistryService
Sets the class used to generate unique ids for registry objects

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

getIdentifierGenerator

public IdentifierGenerator getIdentifierGenerator()
Specified by:
getIdentifierGenerator in interface RegistryService
Returns:
id generator used to generate guids for registry objects

getExtrinsics

public RegistryResponse getExtrinsics(Integer start,
                                      Integer rows)
Description copied from interface: RegistryService
This method allows one to page through the ExtrinsicObject's in the registry.

Specified by:
getExtrinsics in interface RegistryService
Parameters:
start - the index at which to start the result list from
rows - how many results to return
Returns:
a list of extrinsics

getExtrinsics

public RegistryResponse getExtrinsics(ExtrinsicQuery query)
Description copied from interface: RegistryService
Retrieves the first set of extrinsics that match the query

Specified by:
getExtrinsics in interface RegistryService
Parameters:
query - holds a set of filters to match against extrinsics
Returns:
a list of extrinsics

getExtrinsics

public RegistryResponse getExtrinsics(ExtrinsicQuery query,
                                      Integer start,
                                      Integer rows)
Description copied from interface: RegistryService
Retrieves a set of extinsics that match the given query. Allows one to page through results.

Specified by:
getExtrinsics in interface RegistryService
Parameters:
query - holds a set of filters to match against ExtrinsicObject'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 extrinsics

getReport

public Report getReport()
Description copied from interface: RegistryService
Gives back some basic summary information about the registry. This summary information includes the amount of managed objects.

Specified by:
getReport in interface RegistryService
Returns:
registry status

versionObject

public String versionObject(String user,
                            String lid,
                            RegistryObject object,
                            boolean major)
                     throws RegistryServiceException
Description copied from interface: RegistryService
Versions a RegistryObject in the registry and publishes the contents of the provided extrinsic object.

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

getLatestObject

public RegistryObject getLatestObject(String lid,
                                      Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves the latest version of the RegistryObject with the given logical identifier

Specified by:
getLatestObject in interface RegistryService
Parameters:
lid - of extrinsic to look up
Returns:
latest version of extrinsic

getEarliestObject

public RegistryObject getEarliestObject(String lid,
                                        Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves the earliest version of the RegsitryObject with the given logical identifier

Specified by:
getEarliestObject in interface RegistryService
Parameters:
lid - of registry object to look up
objectClass - the type of object to look up
Returns:
earliest version of registry object

getNextObject

public RegistryObject getNextObject(String lid,
                                    String versionId,
                                    Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves the next version of the RegsitryObject

Specified by:
getNextObject in interface RegistryService
Parameters:
lid - of the current registry object
versionId - of the current registry object. This is the user provided version.
objectClass - the type of object to look up
Returns:
the next version of the registry object otherwise null if there is no more versions

getPreviousObject

public RegistryObject getPreviousObject(String lid,
                                        String versionId,
                                        Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves the previous version of the RegistryObject

Specified by:
getPreviousObject in interface RegistryService
Parameters:
lid - of the current registry object
versionId - of the current registry version. This is the user provided version.
objectClass - the type of object to look up
Returns:
the previous version of the registry object otherwise null if there is no versions before the current one

getObjectVersions

public List<RegistryObject> getObjectVersions(String lid,
                                              Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves all versions of a RegistryObject

Specified by:
getObjectVersions in interface RegistryService
Parameters:
lid - of the registry object of interest
objectClass - the type of object to look up
Returns:
all versions of the registry object that share the given lid

getObject

public RegistryObject getObject(String lid,
                                String versionId,
                                Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves a RegistryObject from the registry with the given identifying information.

Specified by:
getObject in interface RegistryService
Parameters:
lid - of the registry object of interest.
versionId - of the registry object of interest. This is the user provided version.
objectClass - the type of object to look up
Returns:
a registry object

getClassificationNodes

public List<ClassificationNode> getClassificationNodes(String scheme)
Description copied from interface: RegistryService
Retrieves all ClassificationNode for a given ClassificationScheme

Specified by:
getClassificationNodes in interface RegistryService
Parameters:
scheme - guid for which to get the classification nodes for
Returns:
all classification nodes for the scheme's guid

changeObjectStatus

public void changeObjectStatus(String user,
                               String lid,
                               String versionId,
                               ObjectAction action,
                               Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Changes the RegistryObject status with the given identifying information.

Specified by:
changeObjectStatus in interface RegistryService
Parameters:
user - that is requesting the change
lid - logical identifier of the extrinsic
versionId - of the registry object. This is the user supplied version
action - which to take (i.e. approve, deprecate, etc.)
objectClass - identifies the type of registry object

changeObjectStatus

public void changeObjectStatus(String user,
                               String guid,
                               ObjectAction action,
                               Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Changes the status of registry object with the given guid and of the given type

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

updateObject

public void updateObject(String user,
                         RegistryObject registryObject)
Description copied from interface: RegistryService
This method allows one to update all the metadata associated with a registry object.

Specified by:
updateObject in interface RegistryService
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)
Description copied from interface: RegistryService
Retrieves a set of associations that match the given query. Allows one to page through results.

Specified by:
getAssociations in interface RegistryService
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

getObjects

public RegistryResponse getObjects(ObjectQuery query,
                                   Integer start,
                                   Integer rows,
                                   Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Generic query for a given class of registry objects. This query only contains attributes that are applicable across all registry objects.

Specified by:
getObjects in interface RegistryService
Parameters:
query - based on a set of filters
start - index within the results to start at. This index is one based
rows - number of results to get
objectClass - the type of registry object to look for
Returns:
list of RegistryObject with the given class

getAuditableEvents

public RegistryResponse getAuditableEvents(String affectedObject)
Description copied from interface: RegistryService
Retrieves the list of (@link AuditableEvent}'s for the affected object

Specified by:
getAuditableEvents in interface RegistryService
Parameters:
affectedObject - guid for the registry object of interest
Returns:
list of events associated with the guid

publishObject

public String publishObject(String user,
                            RegistryObject registryObject,
                            String packageId)
                     throws RegistryServiceException
Description copied from interface: RegistryService
Publishes a registry object to the registry.

Specified by:
publishObject in interface RegistryService
Parameters:
user - that is requesting the object to be published
registryObject - to publish
packageId - to associate this publish event with
Returns:
guid of the published object
Throws:
RegistryServiceException

publishObject

public String publishObject(String user,
                            RegistryObject registryObject)
                     throws RegistryServiceException
Description copied from interface: RegistryService
Publishes a registry object to the registry.

Specified by:
publishObject in interface RegistryService
Parameters:
user - that is requesting the object to be published
registryObject - to publish
Returns:
guid of the published object
Throws:
RegistryServiceException

deleteObject

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

Specified by:
deleteObject in interface RegistryService
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

deleteObject

public void deleteObject(String user,
                         String guid,
                         Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Deletes a RegistryObject from the registry which share the logical identifier and version.

Specified by:
deleteObject in interface RegistryService
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)
Description copied from interface: RegistryService
Retrieves the Association from the registry with the given guid

Specified by:
getAssocation in interface RegistryService
Parameters:
guid - globally unique identifier of the registry object
Returns:
the identified association

getExtrinsic

public ExtrinsicObject getExtrinsic(String guid)
Description copied from interface: RegistryService
Retrieves a ExtrinsicObject from the registry

Specified by:
getExtrinsic in interface RegistryService
Parameters:
guid - globally unique identifier of the extrinsic object
Returns:
matching extrinsic object

getObject

public RegistryObject getObject(String guid,
                                Class<? extends RegistryObject> objectClass)
Description copied from interface: RegistryService
Retrieves a registry object of the requested type

Specified by:
getObject in interface RegistryService
Parameters:
guid - globally unique identifier of the object
objectClass - type of the registry object
Returns:
matching registry object

configure

public String configure(String user,
                        RegistryPackage registryPackage,
                        List<? extends RegistryObject> registryObjects)
                 throws RegistryServiceException
Description copied from interface: RegistryService
Configures the registry with a list of registry objects as input. This should be limited to publishing a set of Classification Schemes and Nodes that drive registry function. This would include but not limited to object types and association types.

Specified by:
configure in interface RegistryService
Parameters:
user - that has taken the action. Typically this should point to a unique username.
registryPackage - to associate objects to
registryObjects - classification schemes and nodes that are apart of this config
Returns:
identifier for the package with which the configuration is associated
Throws:
RegistryServiceException


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