|
Version: 1.1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biomoby.client.CentralImpl
org.biomoby.client.CentralDigestImpl
org.biomoby.client.CentralDigestCachedSimpleImpl
public class 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 removeFromCache(java.lang.String)).
This class can be used also without caching - just instantiate it with 'cacheDir' set to null in the constructor.
| 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 |
| Constructor Summary | |
|---|---|
CentralDigestCachedSimpleImpl(String cacheDir)
Create an instance that will access a default Moby registry and will cache results in the 'cacheDir' directory. |
|
CentralDigestCachedSimpleImpl(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 | |
|---|---|
long |
getCacheAge()
Return age of the current (whole) cache in millis from the beginning of the Epoch; or -1 if cache is empty, or the age is unknown. |
String |
getCacheDir()
Return a directory name representing the current cache. |
Properties |
getCacheInfo(String id)
Return as many properties describing the given part of a cache as possible. |
String |
getCacheInfoFormatted(String id)
Similar as CentralCached.getCacheInfo(java.lang.String) but formatted into a single
string. |
boolean |
getCacheMode()
It always (again, if it functions as a cache which is when 'cacheDir' is given) reports that caching is disabled (even though for the cumulative results is actually always enabled - but that is obvious from the name of this class, isn't it?). |
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. |
boolean |
isUsingCache()
Indicate whether the implementtaion really is using a local cache. |
void |
removeFromCache(String id)
Removes object groups from the cache. |
void |
setCacheMode(boolean shouldCache)
It always (if it functions as a cache which is when 'cacheDir' was given) disables caching in the parent (so no memory caching happens there). |
void |
updateCache(String id)
Update the indicated part of the cache. |
| Methods inherited from class org.biomoby.client.CentralDigestImpl |
|---|
addNotificationListener, addNotificationListeners, callback, fireEvent, fireEvent, getFullServiceTypes, getNotificationListeners, removeNotificationListener, removeNotificationListeners |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 |
|---|
public CentralDigestCachedSimpleImpl(String cacheDir)
throws MobyException
MobyException
public CentralDigestCachedSimpleImpl(String endpoint,
String namespace,
String cacheDir)
throws MobyException
MobyException| Method Detail |
|---|
public String getCacheDir()
public boolean isUsingCache()
isUsingCache in interface CentralCachedpublic void removeFromCache(String id)
removeFromCache in interface SimpleCacheremoveFromCache in interface CentralCachedremoveFromCache in class CentralImplid - should be either null, or one of the following:
CentralCached.CACHE_PART_DATATYPES, CentralCached.CACHE_PART_SERVICES,
CentralCached.CACHE_PART_SERVICETYPES, and CentralCached.CACHE_PART_NAMESPACES.
public void updateCache(String id)
throws MobyException
Updates means to fetch a new list of entities, compare it with existing entities in the cache, fetch the missing ones and remove the redundant ones.
updateCache in interface CentralCachedid - should be either null, or one of the following:
CentralCached.CACHE_PART_DATATYPES, CentralCached.CACHE_PART_SERVICES,
CentralCached.CACHE_PART_SERVICETYPES, and CentralCached.CACHE_PART_NAMESPACES.
MobyException
public Map getDataTypeNames()
throws MobyException
CentralImpl
<objectNames>
<Object name="objectName" lsid="...">
<Description><![CDATA[free text description here]]></Description>
</Object>
...
...
</objectNames>
getDataTypeNames in interface CentralgetDataTypeNames in class CentralImplMobyException - if communication with the Moby Registry fails
public MobyDataType[] getDataTypes()
throws MobyException
CentralDigestCentral.getDataType(java.lang.String) for all
registered data type names.
getDataTypes in interface CentralgetDataTypes in interface CentralDigestgetDataTypes in class CentralDigestImplMobyException - if communication with the Moby Registry fails
public Map getServiceNamesByAuthority()
throws MobyException
CentralImpl<serviceNames> <serviceName name="serviceName" lsid="..." authURI='authority.info.here'/> ... ... </serviceNames>
getServiceNamesByAuthority in interface CentralgetServiceNamesByAuthority in class CentralImplMobyException - if communication with the Moby Registry fails
public MobyService[] getServices()
throws MobyException
CentralDigestfindService by name for all
known service names.
getServices in interface CentralDigestgetServices in class CentralDigestImplMobyException - if communication with the Moby Registry fails
public MobyNamespace[] getFullNamespaces()
throws MobyException
CentralImpl
<Namespaces>
<Namespace name="namespace" lsid="...">
<Description><![CDATA[free text description here]]></Description>
<contactEmail>...</contactEmail>
<authURI>...</authURI>
</Namespace>
...
...
</Namespaces>
getFullNamespaces in interface CentralgetFullNamespaces in class CentralDigestImplMobyException - if communication with the Moby Registry failspublic void setCacheMode(boolean shouldCache)
setCacheMode in interface CentralsetCacheMode in class CentralDigestImplshouldCache - whether retrieveXXX call results should be
cached in case they are called again (i.e. don't request
MobyCentral every time)public boolean getCacheMode()
getCacheMode in interface CentralgetCacheMode in class CentralImplpublic long getCacheAge()
getCacheAge in interface CentralCachedpublic Properties getCacheInfo(String id)
getCacheInfo in interface CentralCachedid - is a part of cache to be described, or null if the
whole cache should be described (this may return different kind
of properties than for individual cache parts)
public String getCacheInfoFormatted(String id)
CentralCachedCentralCached.getCacheInfo(java.lang.String) but formatted into a single
string.
getCacheInfoFormatted in interface CentralCachedid - is a part of cache to be described, or null if the whole
cache should be described (this may return different kind
of properties than for individual cache parts)
|
Version: 1.1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||