Version: 1.1.1

org.biomoby.client
Class CentralDigestCachedImpl

java.lang.Object
  extended by org.biomoby.client.CentralImpl
      extended by org.biomoby.client.CentralDigestImpl
          extended by org.biomoby.client.CentralDigestCachedSimpleImpl
              extended by org.biomoby.client.CentralDigestCachedImpl
All Implemented Interfaces:
SimpleCache, Central, CentralAll, CentralCached, CentralDigest, Notifier
Direct Known Subclasses:
CentralCachedCallsImpl

public class CentralDigestCachedImpl
extends CentralDigestCachedSimpleImpl

An implementation of CentralAll, allowing to cache locally results of the cumulative methods so it does not need to access Moby registry all the time. The other methods of the Central interface do not use the results of the cached cumulative results (their implementation is just passed to the parent class).

The caching is done in the file system, not in memory, so the results are permanent (until someone removes the caching directory, or calls CentralDigestCachedSimpleImpl.removeFromCache(java.lang.String)).

This class can be used also without caching - just instantiate it with 'cacheDir' set to null in the constructor.

Version:
$Id: CentralDigestCachedImpl.java,v 1.33 2008/07/16 20:25:24 gordonp Exp $
Author:
Martin Senger

Field Summary
 
Fields inherited from class org.biomoby.client.CentralImpl
CENTRAL_IMPL_RESOURCE_NAME, DEFAULT_CENTRAL_IMPL_CLASSNAME, DEFAULT_ENDPOINT, DEFAULT_NAMESPACE, DOCUMENT_BUILDER_FACTORIES
 
Fields inherited from interface org.biomoby.shared.CentralCached
CACHE_PART_DATATYPES, CACHE_PART_NAMESPACES, CACHE_PART_SERVICES, CACHE_PART_SERVICETYPES, CACHE_PROP_COUNT, CACHE_PROP_LOCATION, CACHE_PROP_NAME, CACHE_PROP_OLDEST, CACHE_PROP_REGISTRY_URL, CACHE_PROP_SIZE, CACHE_PROP_YOUNGEST, LIST_FILE, RDF_FILE
 
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
 
Fields inherited from interface org.biomoby.shared.event.Notifier
AUTHORITIES_CANCELLED, AUTHORITIES_COUNT, AUTHORITIES_END, AUTHORITIES_RESET, AUTHORITIES_START, AUTHORITIES_UPDATED, AUTHORITY_LOADED, AUTHORITY_LOADING, DATA_TYPE_LOADED, DATA_TYPE_LOADING, DATA_TYPES_CANCELLED, DATA_TYPES_COUNT, DATA_TYPES_END, DATA_TYPES_RESET, DATA_TYPES_START, DATA_TYPES_UPDATED, NAMESPACE_LOADED, NAMESPACE_LOADING, NAMESPACES_CANCELLED, NAMESPACES_COUNT, NAMESPACES_END, NAMESPACES_RESET, NAMESPACES_START, NAMESPACES_UPDATED, SERVICE_TYPE_LOADED, SERVICE_TYPE_LOADING, SERVICE_TYPES_CANCELLED, SERVICE_TYPES_COUNT, SERVICE_TYPES_END, SERVICE_TYPES_RESET, SERVICE_TYPES_START, SERVICE_TYPES_UPDATED, SIGNAL_CANCEL_DATA_TYPES, SIGNAL_CANCEL_NAMESPACES, SIGNAL_CANCEL_SERVICE_TYPES, SIGNAL_CANCEL_SERVICES
 
Constructor Summary
CentralDigestCachedImpl()
          The same as calling CentralDigestCachedImpl(null)
CentralDigestCachedImpl(String cacheDir)
          Create an instance that will access a default Moby registry and will cache results in the 'cacheDir' directory.
CentralDigestCachedImpl(String endpoint, String namespace)
          Create an instance that will access a specific Moby registry and will cache results in the default cache directory.
CentralDigestCachedImpl(String endpoint, String namespace, String cacheDir)
          Create an instance that will access a Moby registry defined by its 'endpoint' and 'namespace', and will cache results in the 'cacheDir' directory.
 
Method Summary
 Map getDataTypeNames()
          Parses and imports the following XML.
 MobyDataType[] getDataTypes()
          Get definition of all known data types.
 MobyNamespace[] getFullNamespaces()
          Parses and imports the following XML.
 Map getServiceNamesByAuthority()
          Parses and imports the following XML.
 MobyService[] getServices()
          Get definition of all registered service instances.
 
Methods inherited from class org.biomoby.client.CentralDigestCachedSimpleImpl
getCacheAge, getCacheDir, getCacheInfo, getCacheInfoFormatted, getCacheMode, isUsingCache, removeFromCache, setCacheMode, updateCache
 
Methods inherited from class org.biomoby.client.CentralDigestImpl
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getFullServiceTypes, getNotificationListeners, removeNotificationListener, removeNotificationListeners
 
Methods inherited from class org.biomoby.client.CentralImpl
call, createId, escapeXML, existsInCache, extractServices, findService, findService, findService, findService, findService, formatFault, formatFault, getContents, getDataType, getDataTypeRelationships, getDataTypeRelationships, getDefaultCentral, getDefaultCentral, getDefaultURI, getDefaultURL, getNamespaces, getProviders, getRegisterDataTypeXML, getRegisterNamespaceXML, getRegisterServiceTypeXML, getRegisterServiceXML, getRegistryEndpoint, getRegistryNamespace, getResource, getResourceRefs, getServiceNames, getServicesByAuthority, getServiceTypeRelationships, getServiceTypes, getServiceWSDL, getServiceWSDL, loadDocument, registerDataType, registerNamespace, registerService, registerServiceType, setContents, setDebug, unregisterDataType, unregisterNamespace, unregisterService, unregisterServiceType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.Central
call, findService, findService, findService, findService, findService, getDataType, getDataTypeRelationships, getDataTypeRelationships, getNamespaces, getProviders, getRegistryEndpoint, getRegistryNamespace, getResource, getResourceRefs, getServiceNames, getServiceTypeRelationships, getServiceTypes, getServiceWSDL, getServiceWSDL, registerDataType, registerNamespace, registerService, registerServiceType, setDebug, unregisterDataType, unregisterNamespace, unregisterService, unregisterServiceType
 
Methods inherited from interface org.biomoby.shared.CentralDigest
getFullServiceTypes
 
Methods inherited from interface org.biomoby.shared.event.Notifier
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getNotificationListeners, removeNotificationListener, removeNotificationListeners
 

Constructor Detail

CentralDigestCachedImpl

public CentralDigestCachedImpl()
                        throws MobyException
The same as calling CentralDigestCachedImpl(null)

Throws:
MobyException

CentralDigestCachedImpl

public CentralDigestCachedImpl(String cacheDir)
                        throws MobyException
Create an instance that will access a default Moby registry and will cache results in the 'cacheDir' directory.

Throws:
MobyException

CentralDigestCachedImpl

public CentralDigestCachedImpl(String endpoint,
                               String namespace)
                        throws MobyException
Create an instance that will access a specific Moby registry and will cache results in the default cache directory.

Throws:
MobyException

CentralDigestCachedImpl

public CentralDigestCachedImpl(String endpoint,
                               String namespace,
                               String cacheDir)
                        throws MobyException
Create an instance that will access a Moby registry defined by its 'endpoint' and 'namespace', and will cache results in the 'cacheDir' directory. Note that the same 'cacheDir' can be safely used for more Moby registries.

Throws:
MobyException
Method Detail

getDataTypeNames

public Map getDataTypeNames()
                     throws MobyException
Description copied from class: CentralImpl
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
Overrides:
getDataTypeNames in class CentralDigestCachedSimpleImpl
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

getDataTypes

public MobyDataType[] getDataTypes()
                            throws MobyException
Description copied from interface: CentralDigest
Get definition of all known data types. It is a cumulation of many individual calls to Central.getDataType(java.lang.String) for all registered data type names.

Specified by:
getDataTypes in interface Central
Specified by:
getDataTypes in interface CentralDigest
Overrides:
getDataTypes in class CentralDigestCachedSimpleImpl
Throws:
MobyException - if communication with the Moby Registry fails

getServiceNamesByAuthority

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

Specified by:
getServiceNamesByAuthority in interface Central
Overrides:
getServiceNamesByAuthority in class CentralDigestCachedSimpleImpl
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

getServices

public MobyService[] getServices()
                          throws MobyException
Description copied from interface: CentralDigest
Get definition of all registered service instances. It is a cumulation of many individual calls to findService by name for all known service names.

Specified by:
getServices in interface CentralDigest
Overrides:
getServices in class CentralDigestCachedSimpleImpl
Throws:
MobyException - if communication with the Moby Registry fails

getFullNamespaces

public MobyNamespace[] getFullNamespaces()
                                  throws MobyException
Description copied from class: CentralImpl
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
Overrides:
getFullNamespaces in class CentralDigestCachedSimpleImpl
Returns:
array of namespaces
Throws:
MobyException - if communication with the Moby Registry fails

Version: 1.1.1

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