com.ibm.serviceregistry
Interface ServiceRegistry


public interface ServiceRegistry

The ServiceRegistry allows you to create, update, delete, query, and retrieve objects from the Service Registry.

The ServiceRegistry interface is available via a Stateless Session Bean. It is recommended that you set up an EJB reference to the Session Bean in the J2EE container in which you are running your code.
The reference name should be ejb/ServiceRegistrySession
See the Information Center for the JNDI name to use.
To get the ejb home use the following code

try {
// look up remote home
ServiceRegistrySessionHome ejbHome = (ServiceRegistrySessionHome) PortableRemoteObject
.narrow(context.lookup("ejb/ServiceRegistrySession"), ServiceRegistrySessionHome.class);
} catch (ClassCastException e) {
// do nothing
} catch (NamingException e) {
// do nothing
}

Currently you should make sure the following jars are in the client classpath
sdo-int.jar This has to be as high up the classpath as possible to be in front of any SDO 1 interfaces.
ServiceRegistryClient.jar
The appropriate jar files from a J2EE runtime


Field Summary
static java.lang.String copyrightStatement
           
 
Method Summary
 java.lang.String create(OriginalObject originalObject)
          Save an OriginalObject to the Service Registry.
 java.lang.String createSCAModule(byte[] content)
          Create an SCAModule by passing the byte[], representing the SCAModule.
 void delete(java.util.List bsrURIs)
          Delete a list of objects from the repository given a List of bsrUris.
 void delete(java.lang.String bsrURI)
          Delete an object from ServiceRegistry using the bsrURI
 java.util.List executeNamedQuery(java.lang.String name)
          Execute a named stored query
 java.util.List executeNamedQuery(java.lang.String name, java.lang.Object[] params)
          Execute a named stored query with parameters
 java.util.List executeQuery(QueryObject query)
          Execute a GraphQuery or PropertyQuery
 java.util.List loadZipFile(byte[] zipFile)
          Load the contents of a zip file into the Service Registry.
 BaseObject retrieve(java.lang.String bsrURI)
          Retrieve a BaseObject using the bsrURI.
 BaseObject retrieve(java.lang.String bsrURI, int depth)
          Retrieve a BaseObject using the object id and a depth value of 0, 1 or -1.
 BaseObject retrieve(java.lang.String bsrURI, Options options)
          Retrieve a BaseObject using the object id and a set of options.
 void update(BaseObject object)
          Update a BaseObject.
 void update(java.util.List objects)
          Update a list of BaseObjects This is done under a transaction, so if a failure occurs, the changes will be rolled back - The list of objects to update
 

Field Detail

copyrightStatement

static final java.lang.String copyrightStatement
See Also:
Constant Field Values
Method Detail

create

java.lang.String create(OriginalObject originalObject)
                        throws ServiceRegistryException
Save an OriginalObject to the Service Registry. An OriginalObject can be a Document, GenericObject or QueryObject

Parameters:
originalObject - - The OriginalObject to be saved.
Returns:
The bsrURI of the saved object
Throws:
ServiceRegistryException - (More specific later)

loadZipFile

java.util.List loadZipFile(byte[] zipFile)
                           throws ServiceRegistryException
Load the contents of a zip file into the Service Registry. If any of the documents in the zip file import other documents, the imported documents must exist either in the zip file or in the Service Registry.

Parameters:
zipFile - - A byte array representation of a zip file
Returns:
A list of BaseObjects representing the top-level documents in the zip file
Throws:
ServiceRegistryException

retrieve

BaseObject retrieve(java.lang.String bsrURI)
                    throws ServiceRegistryException
Retrieve a BaseObject using the bsrURI. The resultant object will be fully populated. This can be cast to the correct object type if known.

Parameters:
bsrURI - - A bsrURI of a Service Registry Object
Returns:
BaseObject Representing the stored data.
Throws:
ServiceRegistryException

retrieve

BaseObject retrieve(java.lang.String bsrURI,
                    int depth)
                    throws ServiceRegistryException
Retrieve a BaseObject using the object id and a depth value of 0, 1 or -1. A depth value of 0 will return a single object with just the properties and classifications present, if there are any relations on the object the relationships will not be present. A depth value of 1 will in addition return any relationships and their targets. The target objects themselves will have been retrieved to a depth 0. A depth of -1 will retrieve the full object graph. A depth of a value other than 0, 1, or -1 will be treated as -1.

Parameters:
bsrURI - - A bsrURI of a ServiceRegistryObject
depth - - The depth of DataGraph in the returned object
Returns:
BaseObject Representing the stored data.
Throws:
ServiceRegistryException

retrieve

BaseObject retrieve(java.lang.String bsrURI,
                    Options options)
                    throws ServiceRegistryException
Retrieve a BaseObject using the object id and a set of options. Options include the retireval depth and whether or not to return the byte[] containing the content (if the returned object is a Document type).

Parameters:
bsrURI - - A bsrURI of a ServiceRegistryObject
options - - An Options object
Returns:
BaseObject Representing the stored data.
Throws:
ServiceRegistryException

update

void update(BaseObject object)
            throws ServiceRegistryException
Update a BaseObject. If you intend to update a BaseObject you should always retrieve the whole DataGraph using retrieve without a depth value.

Parameters:
object - - The BaseObject to update
Throws:
ServiceRegistryException

update

void update(java.util.List objects)
            throws ServiceRegistryException
Update a list of BaseObjects This is done under a transaction, so if a failure occurs, the changes will be rolled back - The list of objects to update

Parameters:
objects - A List of BaseObjects
Throws:
ServiceRegistryException

delete

void delete(java.lang.String bsrURI)
            throws ServiceRegistryException
Delete an object from ServiceRegistry using the bsrURI

Parameters:
bsrURI - - The bsrURI of the object to be deleted.
Throws:
ServiceRegistryException

delete

void delete(java.util.List bsrURIs)
            throws ServiceRegistryException
Delete a list of objects from the repository given a List of bsrUris. This is done under a transaction, so if a failure occurs, the changes will be rolled back. Note. That is some situations this will fail, as the order that objects are deleted is sometimes important. This is a current limitation of the system.

Parameters:
bsrURIs - The list of bsrURIs
Throws:
ServiceRegistryException

executeNamedQuery

java.util.List executeNamedQuery(java.lang.String name)
                                 throws ServiceRegistryException
Execute a named stored query

Parameters:
name - The name of the query
Returns:
The results of the query. If no results are found an empty list will be returned. The results are a list of BaseObject derivatives
Throws:
ServiceRegistryException

executeNamedQuery

java.util.List executeNamedQuery(java.lang.String name,
                                 java.lang.Object[] params)
                                 throws ServiceRegistryException
Execute a named stored query with parameters

Parameters:
name - The name of the query
params - The correctly ordered parameters. These should be String parameters
Returns:
The results of the query. If no results are found an empty list will be returned. The results are a list of BaseObject derivatives
Throws:
ServiceRegistryException

executeQuery

java.util.List executeQuery(QueryObject query)
                            throws ServiceRegistryException
Execute a GraphQuery or PropertyQuery

Parameters:
query - The query to run
Returns:
The List of objects returned as a result of the query. list will be returned.
Throws:
ServiceRegistryException

createSCAModule

java.lang.String createSCAModule(byte[] content)
                                 throws ServiceRegistryException
Create an SCAModule by passing the byte[], representing the SCAModule. The name of the SCAModule will be the same as the name of the Module in the file

Parameters:
content -
Returns:
The bsrURI
Throws:
ServiceRegistryException


© Copyright IBM Corporation 2006, 2009. All Rights Reserved.