Version: 1.1.1

org.biomoby.client
Class CentralImpl

java.lang.Object
  extended by org.biomoby.client.CentralImpl
All Implemented Interfaces:
SimpleCache, Central
Direct Known Subclasses:
CentralDigestImpl

public class CentralImpl
extends Object
implements Central, SimpleCache

A default implementation of the interface Central allowing access to a Moby registry.

This class is supposed to be used by all other clients that wish to communicate with the Moby Registry, but do not want to know about all XML details that are necessary for talking with the Moby Central directly. This is an example of a client program:

 import org.biomoby.shared.Central;
 import org.biomoby.shared.MobyException;
 import org.biomoby.client.CentralImpl;
 import java.util.Map;
 import java.util.Iterator;

 public class Test {

    public static void main (String[] args)
       throws MobyException {

       Central worker = new CentralImpl();
       Map authorities = worker.getServiceNamesByAuthority();

       for (Iterator it = authorities.entrySet().iterator(); it.hasNext(); ) {
          Map.Entry entry = (Map.Entry)it.next();
          System.out.println (entry.getKey());
          String[] names = (String[])entry.getValue();
          for (int i = 0; i < names.length; i++)
             System.out.println ("\t" + names[i]);
       }
    }
 }

Version:
$Id: CentralImpl.java,v 1.65 2010/04/16 19:59:01 gordonp Exp $
Author:
Martin Senger

Field Summary
static String CENTRAL_IMPL_RESOURCE_NAME
          The META-INF resource file that will be checked to determine what default class should be instantiated in order to create a Central Implementation when getDefaultCentral() is called.
static String DEFAULT_CENTRAL_IMPL_CLASSNAME
          The class to use for getDefaultCentral if all else fails
static String DEFAULT_ENDPOINT
          Default location (endpoint) of a Moby registry.
static String DEFAULT_NAMESPACE
          Default namespace used by the contacted Moby registry.
static ThreadLocal DOCUMENT_BUILDER_FACTORIES
          Thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe).
 
Fields inherited from interface org.biomoby.shared.Central
DATA_TYPES_RESOURCE_NAME, FULL_RESOURCE_NAME, HAS, HASA, iHAS, iHASA, iISA, ISA, NAMESPACES_RESOURCE_NAME, SERVICE_INSTANCES_RESOURCE_NAME, SERVICE_TYPES_RESOURCE_NAME
 
Constructor Summary
CentralImpl()
          Default constructor.
CentralImpl(String endpoint)
          Constructor allowing to specify which Moby Registry to use.
CentralImpl(String endpoint, String namespace)
          Constructor allowing to specify which Moby Registry and what namespace to use.
 
Method Summary
 String call(String methodName, String inputXML)
          Call Moby registry's method with given XML as input and return whatever you get back.
 String createId(String rootName, String semanticType, String syntaxType, long lastModified, Properties props)
          Create a unique ID from the given parameters.
 String escapeXML(String str)
          Convert non-suitable characters in a XML string into their entity references.
 boolean existsInCache(String id)
          Is the object identified by its 'id' already cached?
 MobyService[] extractServices(String xml)
          Extract one or more MobyService objects from the given XML piece.
 MobyService[] findService(MobyService pattern)
          Find services matching whatever is non-empty in the given 'pattern'.
 MobyService[] findService(MobyService pattern, String[] keywords)
          Find service matching both all non-empty fields in the 'pattern' and the 'keywords'.
 MobyService[] findService(MobyService pattern, String[] keywords, boolean includeChildrenServiceTypes, boolean includeParentDataTypes)
          All 'findService' methods end up here.
 MobyService[] findService(String serviceType)
          Find services of the given type and its sub-types.
 MobyService[] findService(String[] keywords)
          Find services by given keywords.
static void formatFault(org.apache.axis.AxisFault e, PrintStream out, String endpoint, QName method)
          Format an exception.
static String formatFault(org.apache.axis.AxisFault e, String endpoint, QName method)
          Format an exception.
 boolean getCacheMode()
          Find if caching is currently enabled.
 Object getContents(String id)
          Return 'data' identified by 'id'.
 MobyDataType getDataType(String dataTypeName)
          Parses and imports the following XML.
 Map getDataTypeNames()
          Parses and imports the following XML.
 Map getDataTypeRelationships(String dataTypeName)
          Parses and imports the following XML.
 String[] getDataTypeRelationships(String dataTypeName, String relationshipType)
          Parses and imports the following XML.
 MobyDataType[] getDataTypes()
           
static CentralImpl getDefaultCentral()
          Using this method to get a Central object will ensure that other parts of the org.biomoby.shared class hierarchy that implicitly check the registry will use the same cache.
static CentralImpl getDefaultCentral(Registry reg)
           
static String getDefaultURI()
           
static String getDefaultURL()
           
 MobyNamespace[] getFullNamespaces()
          Parses and imports the following XML.
 Map getNamespaces()
          Deprecated. Replaced by getFullNamespaces() that gives more information for the same price.

 String[] getProviders()
          Parses and imports the following XML.
 String getRegisterDataTypeXML(MobyDataType dataType)
           
 String getRegisterNamespaceXML(MobyNamespace namespace)
           
 String getRegisterServiceTypeXML(MobyServiceType serviceType)
           
 String getRegisterServiceXML(MobyService service)
           
 String getRegistryEndpoint()
          Return an endpoint (a stringified URL) representing a Moby registry that an instance of this implementation is connected to.
 String getRegistryNamespace()
          Return a namespace (a URI) used by a Moby registry that an instance of this implementation is connected to.
 InputStream getResource(String resourceName)
          First get (from a BioMoby registry) a URL for the given 'resourceName' and then retrieve a document from this URL.
 MobyResourceRef[] getResourceRefs()
          Parses and imports the following XML.
 Map<String,String> getServiceNames()
          Deprecated. Replaced by getServiceNamesByAuthority(). The reason is that this method returns a random result if there are more services with the same name but belonging to different authorities.

 Map getServiceNamesByAuthority()
          Parses and imports the following XML.
 Map getServicesByAuthority()
          Similar to getServiceNamesByAuthority() but the resulting Map contains slightly more.
 String[] getServiceTypeRelationships(String serviceTypeName, boolean expand)
          Parses and imports the following XML.
 Map<String,String> getServiceTypes()
          Parses and imports the following XML.
 String getServiceWSDL(String serviceName)
          Get WSDL defining a service given by its name.
 String getServiceWSDL(String serviceName, String authority)
          Get WSDL defining a service given by its name and its authority.
static Document loadDocument(InputStream input)
          Loads a DOM Document from an InputStream.
 void registerDataType(MobyDataType dataType)
          Register new data type.
 void registerNamespace(MobyNamespace namespace)
          Register new namespace.
 void registerService(MobyService service)
          Register a new service.
 void registerServiceType(MobyServiceType serviceType)
          Register new service type.
 void removeFromCache(String id)
          Remove cached object identified by its 'id' from the cache.
 void setCacheMode(boolean shouldCache)
          By default, caching is enabled to reduce network traffic.
 void setContents(String id, Object data)
          Store/cache 'data' identified by 'id'.
 boolean setDebug(boolean enabled)
          Ask the implementation to create more verbose logs or messages about what is going on.
 void unregisterDataType(MobyDataType dataType)
          B
 void unregisterNamespace(MobyNamespace namespace)
          Unregister given Moby namespace.
 void unregisterService(MobyService service)
          Unregister given Moby service.
 void unregisterServiceType(MobyServiceType serviceType)
          Unregister given Moby service type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENDPOINT

public static final String DEFAULT_ENDPOINT
Default location (endpoint) of a Moby registry.

See Also:
Constant Field Values

DEFAULT_NAMESPACE

public static final String DEFAULT_NAMESPACE
Default namespace used by the contacted Moby registry.

See Also:
Constant Field Values

CENTRAL_IMPL_RESOURCE_NAME

public static final String CENTRAL_IMPL_RESOURCE_NAME
The META-INF resource file that will be checked to determine what default class should be instantiated in order to create a Central Implementation when getDefaultCentral() is called.

See Also:
Constant Field Values

DEFAULT_CENTRAL_IMPL_CLASSNAME

public static final String DEFAULT_CENTRAL_IMPL_CLASSNAME
The class to use for getDefaultCentral if all else fails

See Also:
Constant Field Values

DOCUMENT_BUILDER_FACTORIES

public static ThreadLocal DOCUMENT_BUILDER_FACTORIES
Thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe). Code taken from Apache's JaxpUtils.

Constructor Detail

CentralImpl

public CentralImpl()
            throws MobyException
Default constructor. It connects to a default Moby registry (as defined in DEFAULT_ENDPOINT) using a default namespace (as defined int DEFAULT_NAMESPACE).

Throws:
MobyException

CentralImpl

public CentralImpl(String endpoint)
            throws MobyException
Constructor allowing to specify which Moby Registry to use.

Throws:
MobyException - if 'endpoint' is not a valid URL, or if no DOM parser is available

CentralImpl

public CentralImpl(String endpoint,
                   String namespace)
            throws MobyException
Constructor allowing to specify which Moby Registry and what namespace to use. If any of the parameters is null, its default value is used instead.

Throws:
MobyException - if 'endpoint' is not a valid URL, or if no DOM parser was found
Method Detail

loadDocument

public static Document loadDocument(InputStream input)
                             throws MobyException
Loads a DOM Document from an InputStream. Uses thread-safe mechanism.

Throws:
MobyException

extractServices

public MobyService[] extractServices(String xml)
                              throws MobyException
Extract one or more MobyService objects from the given XML piece. The XML should look like this:
  <Services>
    <Service authURI="authority.URI.here" lsid="..." serviceName="MyService">
      <serviceType>Service_Ontology_Term</serviceType>
      <Category>moby</Category> <!-- or 'cgi' or 'soap' -->
      <contactEmail>your@email.addy.here</contactEmail>
      <signatureURL>http://service.RDF.here</signatureURL>
      <URL>http://service.endpoint.here/scriptname</URL>
      <authoritative>1</authoritative>
      <Input>
           <!-- one or more Simple and/or Complex Primary articles -->
      </Input>
      <Output>
           <!-- one or more Simple and/or Complex Primary articles --> 
      </Output>
      <secondaryArticles>
           <!-- one or more Secondary articles -->
      </secondaryArticles>
      <Description><![CDATA[free text description here]]></Description>
    </Service>
    ...  <!--  one or more Service blocks may be returned -->
    ...
    ...
  </Services>
 

Throws:
MobyException - if the XML document is invalid

createId

public String createId(String rootName,
                       String semanticType,
                       String syntaxType,
                       long lastModified,
                       Properties props)
Description copied from interface: SimpleCache
Create a unique ID from the given parameters. The ID is used to identify a cached object. Depending on the implementation it can be a filename, a database primary key, or something else. Its important characteristic, however, is that given the same set of properties describing the cached object, the same ID is always created.

Specified by:
createId in interface SimpleCache
Parameters:
rootName - is some high level name of the cached object
semanticType - is yet another feature of the cached object
syntaxType - is another property of the cached object (e.i. it may be used as the file name suffix if the cache is implemented as a filesystem)
lastModified - is time in millis indicating when the cached object was created or modified
props - are all remaining properties identifying the cached object
Returns:
a unique ID that can be used in other methods defined in this interface in order to identify the same cached object

existsInCache

public boolean existsInCache(String id)
Description copied from interface: SimpleCache
Is the object identified by its 'id' already cached?

Specified by:
existsInCache in interface SimpleCache
Parameters:
id - a unique ID of the cached (or possibly cached) object
Returns:
true if the object identified by 'id' already exists in this cache

getContents

public Object getContents(String id)
Description copied from interface: SimpleCache
Return 'data' identified by 'id'.

Specified by:
getContents in interface SimpleCache
Parameters:
id - a unique ID of the object being returned
Returns:
data previously stored under 'id'; or null if such data do not exist

setContents

public void setContents(String id,
                        Object data)
Description copied from interface: SimpleCache
Store/cache 'data' identified by 'id'.

Specified by:
setContents in interface SimpleCache
Parameters:
id - a unique ID of the object being stored
data - are being stored

removeFromCache

public void removeFromCache(String id)
Description copied from interface: SimpleCache
Remove cached object identified by its 'id' from the cache.

Specified by:
removeFromCache in interface SimpleCache
Parameters:
id - a unique ID

setCacheMode

public void setCacheMode(boolean shouldCache)
By default, caching is enabled to reduce network traffic. Setting this to false will clear the cache, and not cache any further calls unless it is set to true again.

Specified by:
setCacheMode in interface Central
Parameters:
shouldCache - whether retrieveXXX call results should be cached in case they are called again (i.e. don't request MobyCentral every time)

getCacheMode

public boolean getCacheMode()
Find if caching is currently enabled.

Specified by:
getCacheMode in interface Central
Returns:
true if caching is enabled

getServiceNames

public Map<String,String> getServiceNames()
                                   throws MobyException
Deprecated. Replaced by getServiceNamesByAuthority(). The reason is that this method returns a random result if there are more services with the same name but belonging to different authorities.

Parses and imports the following XML.
 <serviceNames>
   <serviceName name="serviceName" authURI='authority.info.here'/>
   ...
   ...
 </serviceNames>
 

Specified by:
getServiceNames in interface Central
Returns:
a hash table where keys are names of services while values are their authorities
Throws:
MobyException - if communication with the Moby Registry fails

getServiceNamesByAuthority

public Map getServiceNamesByAuthority()
                               throws MobyException
Parses and imports the following XML.
 <serviceNames>
   <serviceName name="serviceName" lsid="..." authURI='authority.info.here'/>
   ...
   ...
 </serviceNames>
 

Specified by:
getServiceNamesByAuthority in interface Central
Returns:
a Map which has authorities as keys, and String arrays with service names as a values.
Throws:
MobyException - if communication with the Moby Registry fails

getServicesByAuthority

public Map getServicesByAuthority()
                           throws MobyException
Similar to getServiceNamesByAuthority() but the resulting Map contains slightly more.

Returns:
a Map which has authorities as keys, and arrays of MobyServices as a values. Each MobyService is filled with its name, authority and LSID.
Throws:
MobyException

getProviders

public String[] getProviders()
                      throws MobyException
Parses and imports the following XML.
  <serviceProviders>
     <serviceProvider name="authority.URI.here"/>
          ...
          ...
  </serviceProviders>
 

Specified by:
getProviders in interface Central
Throws:
MobyException - if communication with the Moby Registry fails

getServiceTypes

public Map<String,String> getServiceTypes()
                                   throws MobyException
Parses and imports the following XML.
  <serviceTypes>
     <serviceType name="serviceName" lsid="...">
            <Description><![CDATA[free text description here]]></Description>
            <contactEmail>...</contactEmail>
            <authURI>...</authURI>
     </serviceType>
          ...
          ...
  </serviceTypes>
 

Specified by:
getServiceTypes in interface Central
Returns:
a hash table where keys are names of service types while values are their descriptions
Throws:
MobyException - if communication with the Moby Registry fails

getFullNamespaces

public MobyNamespace[] getFullNamespaces()
                                  throws MobyException
Parses and imports the following XML.
  <Namespaces>
     <Namespace name="namespace" lsid="...">
            <Description><![CDATA[free text description here]]></Description>
            <contactEmail>...</contactEmail>
            <authURI>...</authURI>
     </Namespace>
          ...
          ...
  </Namespaces>
 

Specified by:
getFullNamespaces in interface Central
Returns:
array of namespaces
Throws:
MobyException - if communication with the Moby Registry fails

getNamespaces

public Map getNamespaces()
                  throws MobyException
Deprecated. Replaced by getFullNamespaces() that gives more information for the same price.

Description copied from interface: Central
Get the list of all registered namespaces.

Specified by:
getNamespaces in interface Central
Returns:
a hash table where keys are names of namespaces while values are their descriptions
Throws:
MobyException - if communication with the Moby Registry fails

getDataTypeNames

public Map getDataTypeNames()
                     throws MobyException
Parses and imports the following XML.
  <objectNames>
     <Object name="objectName" lsid="...">
            <Description><![CDATA[free text description here]]></Description>
     </Object>
          ...
          ...
  </objectNames>
 

Specified by:
getDataTypeNames in interface Central
Returns:
a hash table where keys are names of data types while values are their descriptions
Throws:
MobyException - if communication with the Moby Registry fails

getDataType

public MobyDataType getDataType(String dataTypeName)
                         throws MobyException,
                                NoSuccessException
Parses and imports the following XML. An example:
 <retrieveObjectDefinition>
   <objectType lsid="...">go_term</objectType>
   <Description><![CDATA[A very lightweight object holding a GO term name and its definition]]></Description>
   <authURI>http://www.illuminae.com</authURI>
   <contactEmail>markw@illuminae.com</contactEmail>
   <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:isa'>
      <objectType articleName=''>urn:lsid:biomoby.org:objectclass:object</objectType>
   </Relationship>
   <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:hasa'>
      <objectType articleName='Term'>urn:lsid:biomoby.org:objectclass:string</objectType>
      <objectType articleName='Definition'>urn:lsid:biomoby.org:objectclass:string</objectType>
   </Relationship>
   <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:has'>
      <objectType articleName='Problems'>urn:lsid:biomoby.org:objectclass:string</objectType>
      <objectType articleName='Issues'>urn:lsid:biomoby.org:objectclass:string</objectType>
   </Relationship>
 </retrieveObjectDefinition>
 

Specified by:
getDataType in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if 'dataTypeName' was not found

getDataTypes

public MobyDataType[] getDataTypes()
                            throws MobyException,
                                   NoSuccessException
Specified by:
getDataTypes in interface Central
Throws:
MobyException
NoSuccessException

getServiceWSDL

public String getServiceWSDL(String serviceName)
                      throws MobyException,
                             NoSuccessException
Description copied from interface: Central
Get WSDL defining a service given by its name. The method asks for all services first and then uses the first one matches the given name.

Specified by:
getServiceWSDL in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if such service was not found
See Also:
Central.getServiceWSDL(String,String)

getServiceWSDL

public String getServiceWSDL(String serviceName,
                             String authority)
                      throws MobyException,
                             NoSuccessException
Description copied from interface: Central
Get WSDL defining a service given by its name and its authority.

Specified by:
getServiceWSDL in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if such service was not found

getRegisterDataTypeXML

public String getRegisterDataTypeXML(MobyDataType dataType)

registerDataType

public void registerDataType(MobyDataType dataType)
                      throws MobyException,
                             NoSuccessException,
                             PendingCurationException
Description copied from interface: Central
Register new data type.

If the same data type is already registered, it is overwritten.

Specified by:
registerDataType in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if registration failed
PendingCurationException

unregisterDataType

public void unregisterDataType(MobyDataType dataType)
                        throws MobyException,
                               NoSuccessException,
                               PendingCurationException
B

Specified by:
unregisterDataType in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if unregistration failed
PendingCurationException

getRegisterServiceTypeXML

public String getRegisterServiceTypeXML(MobyServiceType serviceType)

registerServiceType

public void registerServiceType(MobyServiceType serviceType)
                         throws MobyException,
                                NoSuccessException,
                                PendingCurationException
Description copied from interface: Central
Register new service type.

If the same service type is already registered, it is not overwritten but an exception is raised.

Specified by:
registerServiceType in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if registration failed
PendingCurationException

unregisterServiceType

public void unregisterServiceType(MobyServiceType serviceType)
                           throws MobyException,
                                  NoSuccessException,
                                  PendingCurationException
Description copied from interface: Central
Unregister given Moby service type.

Specified by:
unregisterServiceType in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if unregistration failed
PendingCurationException

getRegisterNamespaceXML

public String getRegisterNamespaceXML(MobyNamespace namespace)

registerNamespace

public void registerNamespace(MobyNamespace namespace)
                       throws MobyException,
                              NoSuccessException,
                              PendingCurationException
Description copied from interface: Central
Register new namespace.

If the same namespace is already registered, it is overwritten.

Specified by:
registerNamespace in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if registration failed
PendingCurationException

unregisterNamespace

public void unregisterNamespace(MobyNamespace namespace)
                         throws MobyException,
                                NoSuccessException,
                                PendingCurationException
Description copied from interface: Central
Unregister given Moby namespace.

Specified by:
unregisterNamespace in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if unregistration failed
PendingCurationException

getRegisterServiceXML

public String getRegisterServiceXML(MobyService service)

registerService

public void registerService(MobyService service)
                     throws MobyException,
                            NoSuccessException,
                            PendingCurationException
Description copied from interface: Central
Register a new service.

If the same service type is already registered, it is not overwritten but an exception is raised.

Specified by:
registerService in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if registration failed
PendingCurationException

unregisterService

public void unregisterService(MobyService service)
                       throws MobyException,
                              NoSuccessException,
                              PendingCurationException
Description copied from interface: Central
Unregister given Moby service.

Specified by:
unregisterService in interface Central
Throws:
MobyException - if communication with the Moby Registry fails
NoSuccessException - if unregistration failed
PendingCurationException

findService

public MobyService[] findService(String serviceType)
                          throws MobyException
Description copied from interface: Central
Find services of the given type and its sub-types.

Specified by:
findService in interface Central
Returns:
services of the given type and all sub-typesd, or an empty array if none was found
Throws:
MobyException - if communication with the Moby Registry fails

findService

public MobyService[] findService(String[] keywords)
                          throws MobyException
Description copied from interface: Central
Find services by given keywords. More keywords are treated as logical OR.

Specified by:
findService in interface Central
Returns:
services containing given keywords, or an empty array if none was found
Throws:
MobyException - if communication with the Moby Registry fails

findService

public MobyService[] findService(MobyService pattern)
                          throws MobyException
Description copied from interface: Central
Find services matching whatever is non-empty in the given 'pattern'. If more fields are given the logical AND is applied on them.

Specified by:
findService in interface Central
Throws:
MobyException - if communication with the Moby Registry fails

findService

public MobyService[] findService(MobyService pattern,
                                 String[] keywords)
                          throws MobyException
Description copied from interface: Central
Find service matching both all non-empty fields in the 'pattern' and the 'keywords'.

Specified by:
findService in interface Central
Throws:
MobyException

findService

public MobyService[] findService(MobyService pattern,
                                 String[] keywords,
                                 boolean includeChildrenServiceTypes,
                                 boolean includeParentDataTypes)
                          throws MobyException
All 'findService' methods end up here.

Specified by:
findService in interface Central
includeChildrenServiceTypes - - if true (which is default) then it discovers also services that are child types (more specific) than the service type in 'pattern'
includeParentDataTypes - - if true (which is default) then it finds services that operate not only on the input/output data types defined in 'pattern', but also any ontolological parent types of that data types
Throws:
MobyException

call

public String call(String methodName,
                   String inputXML)
            throws MobyException
Description copied from interface: Central
Call Moby registry's method with given XML as input and return whatever you get back. If 'inputXML' is null or empty, the method is called without any parameters.

Meant for debugging and may be deprecated anytime...

Specified by:
call in interface Central
Throws:
MobyException

setDebug

public boolean setDebug(boolean enabled)
Description copied from interface: Central
Ask the implementation to create more verbose logs or messages about what is going on. The behaviour is completely implementation dependent.

Specified by:
setDebug in interface Central
Parameters:
enabled - true if debug mode should be enabled, false otherwise
Returns:
the previous value of the debug mode

getServiceTypeRelationships

public String[] getServiceTypeRelationships(String serviceTypeName,
                                            boolean expand)
                                     throws MobyException
Parses and imports the following XML.
 <Relationships>
   <Relationship relationshipType='urn:lsid:biomoby.org:servicerelation:isa'>
     <serviceType>urn:lsid:biomoby.org:servicetype:analysis</serviceType>
     <serviceType>urn:lsid:biomoby.org:servicetype:service</serviceType>
   </Relationship>
 </Relationships>
 

Specified by:
getServiceTypeRelationships in interface Central
Parameters:
serviceTypeName - is a service type name whose relationships should be looked at
expand - 'true' causes that all related type names are returned, 'false' means that only first-level neighbour is returned
Returns:
an array of service type names representing all parents (direct or indirect) of the given 'serviceTypeName'
Throws:
MobyException - if communication with the Moby Registry fails

getDataTypeRelationships

public Map getDataTypeRelationships(String dataTypeName)
                             throws MobyException
Parses and imports the following XML.
<Relationships>
  <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:isa'>
    <objectType>urn:lsid:biomoby.org:objectclass:virtualsequence</objectType>
    <objectType>urn:lsid:biomoby.org:objectclass:object</objectType>
  </Relationship>
  <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:hasa'>
    <objectType>urn:lsid:biomoby.org:objectclass:string</objectType>
    <objectType>urn:lsid:biomoby.org:objectclass:integer</objectType>
  </Relationship>
</Relationships>
 
Added at Sun Feb 19 19:32:31 PHT 2006: it recognizes also an attributes 'lsid' and 'articleName' in <objectType> element.

Specified by:
getDataTypeRelationships in interface Central
Parameters:
dataTypeName - is an ontology term specifying whose relationships should be looked at
Returns:
a Map of ontology terms defining all relationships of the given 'dataTypeName'. The keys (of type String) are from the set Central.ISA, Central.HASA, and Central.HAS. The values (of type String) are data type names.
Throws:
MobyException - if communication with the Moby Registry fails

getDataTypeRelationships

public String[] getDataTypeRelationships(String dataTypeName,
                                         String relationshipType)
                                  throws MobyException
Parses and imports the following XML.
<Relationships>
  <Relationship relationshipType='urn:lsid:biomoby.org:objectrelation:isa'>
    <objectType>urn:lsid:biomoby.org:objectclass:virtualsequence</objectType>
    <objectType>urn:lsid:biomoby.org:objectclass:object</objectType>
  </Relationship>
</Relationships>
 

Specified by:
getDataTypeRelationships in interface Central
Parameters:
dataTypeName - is an ontology term specifying whose relationships should be looked at
relationshipType - is one from the set Central.ISA, Central.HASA, and Central.HAS.
Returns:
an array of names specifying all related types (of the given type and for the given data type)
Throws:
MobyException - if communication with the Moby Registry fails

getRegistryEndpoint

public String getRegistryEndpoint()
Description copied from interface: Central
Return an endpoint (a stringified URL) representing a Moby registry that an instance of this implementation is connected to.

Specified by:
getRegistryEndpoint in interface Central

getRegistryNamespace

public String getRegistryNamespace()
Description copied from interface: Central
Return a namespace (a URI) used by a Moby registry that an instance of this implementation is connected to.

Specified by:
getRegistryNamespace in interface Central

getResourceRefs

public MobyResourceRef[] getResourceRefs()
                                  throws MobyException
Parses and imports the following XML.
 <resourceURLs>
   <Resource name="Service"         url="..." />
   <Resource name="Object"          url="..." />
   <Resource name="Namespace"       url="..." />
   <Resource name="ServiceInstance" url="..." />
   <Resource name="Full"            url="..." />
 </resourceURLs>
 

Specified by:
getResourceRefs in interface Central
Returns:
an array of references to RDF documents; some elements of this array may refer to the same resources but stored/available in a different content type (this mostly means that some of them may be compressed to get them faster)
Throws:
MobyException - if communication with the Moby Registry fails

getResource

public InputStream getResource(String resourceName)
                        throws MobyException
Description copied from interface: Central
First get (from a BioMoby registry) a URL for the given 'resourceName' and then retrieve a document from this URL. If the resource is available in a compressed format, return it uncompressed.

The document is in RDF and represents some (or all) entities registered in the BioMoby registry.

Specified by:
getResource in interface Central
Parameters:
resourceName - is an ontology name (must be one of these: Central.SERVICE_TYPES_RESOURCE_NAME, Central.DATA_TYPES_RESOURCE_NAME, Central.NAMESPACES_RESOURCE_NAME, Central.SERVICE_INSTANCES_RESOURCE_NAME, Central.FULL_RESOURCE_NAME)
Returns:
an input stream that contains an RDF document
Throws:
MobyException - if communication with the Moby Registry fails, or if communication with the resource URL fails

getDefaultCentral

public static CentralImpl getDefaultCentral()
                                     throws MobyException
Using this method to get a Central object will ensure that other parts of the org.biomoby.shared class hierarchy that implicitly check the registry will use the same cache. Otherwise, methods such as MobyNamespace.getNamespace() must be passed a Central object parameter as well. The actual CentralImpl subclass returned is based on info from META-INF/org.biomoby.shared.CentralDefaultImpl or failing that the class specified in DEFAULT_CENTRAL_IMPL_CLASSNAME

Returns:
a CentralImpl using the default Central URI, and currently a class implementing a caching mechanism
Throws:
MobyException

getDefaultCentral

public static CentralImpl getDefaultCentral(Registry reg)
                                     throws MobyException
Throws:
MobyException

getDefaultURL

public static String getDefaultURL()
Returns:
a String representing the Default mobycentral endpoint. If the system property 'moby.check.default' exists and is set to true, then the URL http://biomoby.org/mobycentral is queried and the default central endpoint is returned, otherwise DEFAULT_ENDPOINT is returned.

getDefaultURI

public static String getDefaultURI()
Returns:
a String representing the default mobycentral uri. If the system property 'moby.check.default' exists and is set to true, then the URL http://biomoby.org/mobycentral is queried and the default central namespace is returned, otherwise DEFAULT_NAMESPACE is returned.

escapeXML

public String escapeXML(String str)
Convert non-suitable characters in a XML string into their entity references.

Adapted from jDom.

Parameters:
str - input to be converted
Returns:
If there were any non-suitable characters, return a new string with those characters escaped, otherwise return the unmodified input string

formatFault

public static String formatFault(org.apache.axis.AxisFault e,
                                 String endpoint,
                                 QName method)
Format an exception.


formatFault

public static void formatFault(org.apache.axis.AxisFault e,
                               PrintStream out,
                               String endpoint,
                               QName method)
Format an exception.


Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010