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 changeStatusOfPackageMembers(String user, String packageId, ObjectAction action)
          Changes the status of all registry objects that are members of the package.
 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)
           
 void deletePackageMembers(String user, String packageId)
          Removes all registry objects that are associated with the package.
 Association getAssocation(String guid)
          Retrieves the Association from the registry with the given guid
 PagedResponse<Association> getAssociations(RegistryQuery<AssociationFilter> query, Integer start, Integer rows)
          Retrieves a set of associations that match the given query.
 PagedResponse<AuditableEvent> getAuditableEvents(RegistryQuery<EventFilter> query, Integer start, Integer rows)
          Retrieves the list of (@link AuditableEvent}'s matching the query
 PagedResponse<AuditableEvent> 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
 PagedResponse<ExtrinsicObject> getExtrinsics(Integer start, Integer rows)
          This method allows one to page through the ExtrinsicObject's in the registry.
 PagedResponse<ExtrinsicObject> getExtrinsics(RegistryQuery<ExtrinsicFilter> query)
          Retrieves the first set of extrinsics that match the query
 PagedResponse<ExtrinsicObject> getExtrinsics(RegistryQuery<ExtrinsicFilter> query, Integer start, Integer rows)
          Retrieves a set of extinsics that match the given query.
 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 guid, Class<? extends RegistryObject> objectClass)
          Retrieves the next version of the RegsitryObject
 RegistryObject getNextObject(String lid, String versionName, Class<? extends RegistryObject> objectClass)
           
 RegistryObject getObject(String guid, Class<? extends RegistryObject> objectClass)
          Retrieves a registry object of the requested type
 RegistryObject getObject(String lid, String versionName, Class<? extends RegistryObject> objectClass)
           
 PagedResponse<Association> getObjects(RegistryQuery<ObjectFilter> 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 guid, Class<? extends RegistryObject> objectClass)
          Retrieves the previous version of the RegistryObject
 RegistryObject getPreviousObject(String lid, String versionName, Class<? extends RegistryObject> objectClass)
           
 ReplicationReport getReplicationReport()
          Get the inform about the current replication event.
 Report getReport()
          Gives back some basic summary information about the registry.
 Versioner getVersioner()
           
 Boolean hasReplicationInProgress()
          A check to see if replication is currently under way by the registry.
 void performReplication(String user, String registryUrl, Date lastModified)
          Replicates contents from a remote registry connected to using the provided URL.
 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, RegistryObject registryObject, boolean major)
          Versions a RegistryObject in the registry and publishes the contents of the provided extrinsic object.
 String versionObject(String user, RegistryObject registryObject, boolean major, String packageId)
          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 PagedResponse<ExtrinsicObject> 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 PagedResponse<ExtrinsicObject> getExtrinsics(RegistryQuery<ExtrinsicFilter> 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 PagedResponse<ExtrinsicObject> getExtrinsics(RegistryQuery<ExtrinsicFilter> 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,
                            RegistryObject registryObject,
                            boolean major)
                     throws RegistryServiceException
Description copied from interface: RegistryService
Versions a RegistryObject in the registry and publishes the contents of the provided extrinsic object. A registry object with the the same lid must be already published otherwise there will be nothing to version off of.

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

versionObject

public String versionObject(String user,
                            RegistryObject registryObject,
                            boolean major,
                            String packageId)
                     throws RegistryServiceException
Description copied from interface: RegistryService
Versions a RegistryObject in the registry and publishes the contents of the provided extrinsic object. A registry object with the the same lid must be already published otherwise there will be nothing to version off of.

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

getLatestObject

public RegistryObject getLatestObject(String lid,
                                      Class<? extends RegistryObject> objectClass)
                               throws RegistryServiceException
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
Throws:
RegistryServiceException

getEarliestObject

public RegistryObject getEarliestObject(String lid,
                                        Class<? extends RegistryObject> objectClass)
                                 throws RegistryServiceException
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
Throws:
RegistryServiceException

getNextObject

public RegistryObject getNextObject(String lid,
                                    String versionName,
                                    Class<? extends RegistryObject> objectClass)
                             throws RegistryServiceException
Throws:
RegistryServiceException

getPreviousObject

public RegistryObject getPreviousObject(String lid,
                                        String versionName,
                                        Class<? extends RegistryObject> objectClass)
                                 throws RegistryServiceException
Throws:
RegistryServiceException

getObjectVersions

public List<RegistryObject> getObjectVersions(String lid,
                                              Class<? extends RegistryObject> objectClass)
                                       throws RegistryServiceException
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
Throws:
RegistryServiceException

getObject

public RegistryObject getObject(String lid,
                                String versionName,
                                Class<? extends RegistryObject> objectClass)
Specified by:
getObject in interface RegistryService
Parameters:
lid - logical identifier which correlates to a group of related registry objects
versionName - that specifially identifies an object withing the group
objectClass - type of registry object that is being looked for
Returns:
matching 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 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)
                  throws RegistryServiceException
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
Throws:
RegistryServiceException

getAssociations

public PagedResponse<Association> getAssociations(RegistryQuery<AssociationFilter> 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 PagedResponse<Association> getObjects(RegistryQuery<ObjectFilter> 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 PagedResponse<AuditableEvent> 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)

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)
                          throws RegistryServiceException
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
Throws:
RegistryServiceException

getExtrinsic

public ExtrinsicObject getExtrinsic(String guid)
                             throws RegistryServiceException
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
Throws:
RegistryServiceException

getObject

public RegistryObject getObject(String guid,
                                Class<? extends RegistryObject> objectClass)
                         throws RegistryServiceException
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
Throws:
RegistryServiceException

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

getNextObject

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

Specified by:
getNextObject in interface RegistryService
Parameters:
guid - of the registry object to uniquely identify it
objectClass - the type of object to look up
Returns:
the next version of the registry object otherwise null if there is no more versions
Throws:
RegistryServiceException

getPreviousObject

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

Specified by:
getPreviousObject in interface RegistryService
Parameters:
guid - of the registry object to uniquely identify it
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
Throws:
RegistryServiceException

changeStatusOfPackageMembers

public void changeStatusOfPackageMembers(String user,
                                         String packageId,
                                         ObjectAction action)
Description copied from interface: RegistryService
Changes the status of all registry objects that are members of the package. This will not change the status on the package itself.

Specified by:
changeStatusOfPackageMembers in interface RegistryService
Parameters:
user - that has taken the action. Typically this should point to a unique username.
packageId - unique guid of the package to update members status from
action - which to take (i.e. approve, deprecate, etc.)

deletePackageMembers

public void deletePackageMembers(String user,
                                 String packageId)
                          throws RegistryServiceException
Description copied from interface: RegistryService
Removes all registry objects that are associated with the package. This call will not delete the package itself.

Specified by:
deletePackageMembers in interface RegistryService
Parameters:
user - that has taken the action. Typically this should point to a unique username.
packageId - unique guid of the package to delete members from
Throws:
RegistryServiceException

getReplicationReport

public ReplicationReport getReplicationReport()
Description copied from interface: RegistryService
Get the inform about the current replication event.

Specified by:
getReplicationReport in interface RegistryService
Returns:
report statistics about the replication event that was last completed or in process

hasReplicationInProgress

public Boolean hasReplicationInProgress()
Description copied from interface: RegistryService
A check to see if replication is currently under way by the registry.

Specified by:
hasReplicationInProgress in interface RegistryService
Returns:
flag to indicate in progress (true) or completed/none pending (false)

performReplication

public void performReplication(String user,
                               String registryUrl,
                               Date lastModified)
                        throws RegistryServiceException
Description copied from interface: RegistryService
Replicates contents from a remote registry connected to using the provided URL. Items that have been delete, updated, or added will be replicated in the local registry. Only one replication event can happen at a given time.

Specified by:
performReplication in interface RegistryService
Parameters:
user - that has taken the action. Typically this should point to a unique username.
registryUrl - to pull registry object from to replicate locally
lastModified - time to constrain which registry objects are relevant to replicate. This time is inclusive. If set to null all will be pulled.
Throws:
RegistryServiceException - if another replication is already taking place

getAuditableEvents

public PagedResponse<AuditableEvent> getAuditableEvents(RegistryQuery<EventFilter> query,
                                                        Integer start,
                                                        Integer rows)
Description copied from interface: RegistryService
Retrieves the list of (@link AuditableEvent}'s matching the query

Specified by:
getAuditableEvents in interface RegistryService
Parameters:
query - to filter out events
start - index within the results to start at. This index is one based
rows - number of results to get
Returns:
list of events


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