org.gcube.indexmanagement.common
Class IndexLookupWSResource

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>
          extended by org.gcube.common.core.state.GCUBEWSResource
              extended by org.gcube.indexmanagement.common.IndexWSResource
                  extended by org.gcube.indexmanagement.common.IndexLookupWSResource
All Implemented Interfaces:
org.gcube.common.core.utils.handlers.GCUBEServiceClient, org.globus.wsrf.PersistenceCallback, org.globus.wsrf.Resource, org.globus.wsrf.ResourceLifetime, org.globus.wsrf.ResourceProperties, org.globus.wsrf.TopicListAccessor

public abstract class IndexLookupWSResource
extends IndexWSResource

Author:
Spyros Boutsis, NKUA

Nested Class Summary
 class IndexLookupWSResource.ConsumerNotification
          Class that handles the consuming of received notifications
 
Nested classes/interfaces inherited from class org.gcube.indexmanagement.common.IndexWSResource
IndexWSResource.DestructionMode
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEStatefulResource
org.gcube.common.core.state.GCUBEStatefulResource.LOCK, org.gcube.common.core.state.GCUBEStatefulResource.TaskContext
 
Field Summary
protected  org.globus.wsrf.Topic indexChangeTopic
          The index update notification topic
static String RP_CONNECTION_ID
          The list of standard resource properties defined by every lookup index resource
static String RP_DOCCOUNT
           
static String RP_SUPPORTED_RELATIONS
           
protected  QName sharedStateChangeTopicName
          The state change notification topic QName
 
Fields inherited from class org.gcube.indexmanagement.common.IndexWSResource
bInitializing, destructionMode, initLock, namespace, propNames, RP_COLLECTION_ID, RP_CREATED, RP_FIELDS, RP_INDEX_ID, RP_INDEX_TYPE_NAME, RP_MODIFIED, topicRegistrar
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
uuidGen
 
Constructor Summary
IndexLookupWSResource()
           
 
Method Summary
 void addConnectionID(Integer connectionID)
          Adds a connection ID.
 void changeDocumentCount(int change)
          Modifies the DocumentCount Resource Property
 int getConnectionID()
          Getter method for the ConnectionID Resource Property
 int getDocumentCount()
          Getter method for the DocumentCount Resource Property
 String getIndexDataDirectory()
          Returns the local directory where index data is stored
 String getManagementResourceNamespace()
          Returns the namespace of the management resource associated with this lookup resource
 String[] getSupportedRelations()
          Getter method for the SupportedRelations list Resource Property
 void initialise(String namespace, String managementServiceNamespace, String indexID, String indexTypeName, String[] collectionID, String dataDir, String[] supportedRelations)
          Initializes the index management resource.
protected  void onLoad(ObjectInputStream ois, boolean firstLoad)
          Invoked when a resource is being created from a serialized, previously saved state.
abstract  void onLookupNotificationReceived(Element message)
          Invoked whenever a message is received for this consumer.
 void onResourceRemoval()
          Performs clean-up operations before the resource is removed from the home
protected  void onStore(ObjectOutputStream oos)
          Invoked when the state of the resource must be saved (resource serialization)
 void sendIndexChangeNotification(Object message)
          Sends a state change notification message
 void setConnectionID(int connectionID)
          Setter method for the ConnectionID Resource Property.
 void setDocumentCount(int documentCount)
          Setter method for the DocumentCount Resource Property
 void setSupportedRelations(String[] relations)
          Setter method for the SupportedRelations list Resource Property
 
Methods inherited from class org.gcube.indexmanagement.common.IndexWSResource
addCollectionID, addField, createProperty, createProperty, createTopic, createTopic, filterFieldInfo, getCollectionID, getCreated, getDestructionMode, getFields, getIndexID, getIndexTypeName, getModified, getNamespace, getPropertyNames, initialise, isInitializing, isTopicRegistered, publish, setCollectionID, setCreated, setDestructionMode, setFields, setIndexID, setIndexTypeName, setIsInitializing, setModified, store, waitUntilInitialized
 
Methods inherited from class org.gcube.common.core.state.GCUBEWSResource
getCurrentTime, getEPR, getPorttypeContext, getProperty, getPublisher, getResourcePropertySet, getServiceContext, getTerminationTime, getTopicList, getTopicNames, initialise, initialise, initialiseContainers, inScope, load, setPortTypeContext, setTerminationTime, unpublish
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, onRemove, setID, setPersistenceDelegate, stopTask
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
getPortTypeMap, setPortTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RP_CONNECTION_ID

public static final String RP_CONNECTION_ID
The list of standard resource properties defined by every lookup index resource

See Also:
Constant Field Values

RP_DOCCOUNT

public static final String RP_DOCCOUNT
See Also:
Constant Field Values

RP_SUPPORTED_RELATIONS

public static final String RP_SUPPORTED_RELATIONS
See Also:
Constant Field Values

sharedStateChangeTopicName

protected QName sharedStateChangeTopicName
The state change notification topic QName


indexChangeTopic

protected org.globus.wsrf.Topic indexChangeTopic
The index update notification topic

Constructor Detail

IndexLookupWSResource

public IndexLookupWSResource()
Method Detail

initialise

public void initialise(String namespace,
                       String managementServiceNamespace,
                       String indexID,
                       String indexTypeName,
                       String[] collectionID,
                       String dataDir,
                       String[] supportedRelations)
                throws Exception
Initializes the index management resource.

Parameters:
namespace - the namespace of the service that this resource belongs to
managementServiceNamespace - the namespace of the corresponding index management service
indexID - the indexID of this resource
indexTypeName - the index type name of this resource
collectionID - the list of collection IDs of this resource
dataDir - the local directory where index data is stored
Throws:
Exception - an error occured

onLoad

protected void onLoad(ObjectInputStream ois,
                      boolean firstLoad)
               throws Exception
Invoked when a resource is being created from a serialized, previously saved state.

Overrides:
onLoad in class IndexWSResource
Parameters:
ois - the input stream through which the state can be read
indicates - if the resource is being loaded for the first time (hard load) or not (soft load)
Throws:
Exception - an error occured during resource deserialization

onStore

protected void onStore(ObjectOutputStream oos)
                throws Exception
Invoked when the state of the resource must be saved (resource serialization)

Overrides:
onStore in class IndexWSResource
Parameters:
oos - the output stream to write the resource state to
Throws:
Exception - an error occured during resource serialization

sendIndexChangeNotification

public void sendIndexChangeNotification(Object message)
Sends a state change notification message

Parameters:
message - the notification message to send

getConnectionID

public int getConnectionID()
Getter method for the ConnectionID Resource Property

Returns:
int the requested connection number

setConnectionID

public void setConnectionID(int connectionID)
Setter method for the ConnectionID Resource Property.

Parameters:
connectionID - - the id of the connection

addConnectionID

public void addConnectionID(Integer connectionID)
Adds a connection ID.

Parameters:
connectionID -

setDocumentCount

public void setDocumentCount(int documentCount)
Setter method for the DocumentCount Resource Property

Parameters:
documentCount - int the new document count

getDocumentCount

public int getDocumentCount()
Getter method for the DocumentCount Resource Property

Returns:
- the document count int.

getSupportedRelations

public String[] getSupportedRelations()
Getter method for the SupportedRelations list Resource Property

Returns:
String[] the requested SupportedRelations

setSupportedRelations

public void setSupportedRelations(String[] relations)
                           throws Exception
Setter method for the SupportedRelations list Resource Property

Parameters:
String[] - the new SupportedRelations
Throws:
Exception

changeDocumentCount

public void changeDocumentCount(int change)
Modifies the DocumentCount Resource Property


getIndexDataDirectory

public String getIndexDataDirectory()
Returns the local directory where index data is stored

Returns:
the local index data directory

getManagementResourceNamespace

public String getManagementResourceNamespace()
Returns the namespace of the management resource associated with this lookup resource

Returns:
the namespace

onResourceRemoval

public void onResourceRemoval()
Description copied from class: IndexWSResource
Performs clean-up operations before the resource is removed from the home

Overrides:
onResourceRemoval in class IndexWSResource

onLookupNotificationReceived

public abstract void onLookupNotificationReceived(Element message)
Invoked whenever a message is received for this consumer.

Parameters:
message - the received message


Copyright © 2012. All Rights Reserved.