org.gcube.indexmanagement.common
Class IndexWSResource

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
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
Direct Known Subclasses:
IndexLookupWSResource, IndexManagementWSResource, IndexUpdaterWSResource

public abstract class IndexWSResource
extends org.gcube.common.core.state.GCUBEWSResource

Author:
Spyros Boutsis, NKUA

Nested Class Summary
static class IndexWSResource.DestructionMode
          The two possible modes of index resource destruction: FULL_DESTRUCTION: Remove the resource and perform full clean-up of any objects created by it (e.g.
 
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  boolean bInitializing
          Is the resource in the initialization state or not?
protected  IndexWSResource.DestructionMode destructionMode
          The resource's destruction mode
protected  Object initLock
          The corresponding lock Object
protected  String namespace
          The service's namespace
protected  List<String> propNames
          The list of property names for this resource
static String RP_COLLECTION_ID
           
static String RP_CREATED
           
static String RP_FIELDS
           
static String RP_INDEX_ID
          The list of standard resource properties defined by every index resource
static String RP_INDEX_TYPE_NAME
           
static String RP_MODIFIED
           
protected  org.gcube.indexmanagement.common.IndexWSResource.TopicRegistrar topicRegistrar
          The object that handles the registration of notification topics
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
uuidGen
 
Constructor Summary
protected IndexWSResource()
          Constructs a new IndexWSResource object.
 
Method Summary
 void addCollectionID(String collectionID)
          Adds a collection id to the collectionID resource property
 void addField(String field)
          Adds a field to the Fields resource property
 org.globus.wsrf.ResourceProperty createProperty(String propName)
          Adds a new ResourceProperty to the resource, given a property name.
 org.globus.wsrf.ResourceProperty createProperty(String propName, String nameSpace)
          Adds a new ResourceProperty to the resource, given a property name and a namespace.
 org.globus.wsrf.impl.SimpleTopic createTopic(String topicName)
          Adds a new topic to the resource, given a topic name.
 org.globus.wsrf.impl.SimpleTopic createTopic(String topicName, String nameSpace)
          Adds a new topic to the resource, given a topic name and a namespace.
protected  void filterFieldInfo(ArrayList<String> presentableFields, ArrayList<String> searchableFields)
           
 String[] getCollectionID()
          Getter method for the CollectionID list Resource Property
 Calendar getCreated()
          Getter method for the Created Resource Property
 IndexWSResource.DestructionMode getDestructionMode()
          Returns the resource's destruction mode
 String[] getFields()
          Getter method for the Fields list Resource Property
 String getIndexID()
          Getter method for the IndexID Resource Property
 String getIndexTypeName()
          Getter method for the IndexTypeName Resource Property
 Calendar getModified()
          Getter method for the Modified Resource Property
 String getNamespace()
          Returns the namespace of the service this resource belongs to
protected  String[] getPropertyNames()
           
 void initialise(String namespace, String indexID, String indexTypeName, String[] collectionID)
          Initializes a IndexWSResource object.
 boolean isInitializing()
          Returns the current initialization state of the resource
 boolean isTopicRegistered(org.globus.wsrf.impl.SimpleTopic topic)
          Checks if the registration of the given topic has been completed.
protected  void onLoad(ObjectInputStream ois, boolean firstLoad)
          Invoked when a resource is being created from a serialized, previously saved state.
 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 publish(org.gcube.common.core.scope.GCUBEScope... scopes)
           
 void setCollectionID(String[] collectionIDs)
          Setter method for the CollectionID list Resource Property
 void setCreated(Calendar created)
          Setter method for the Created Resource Property
 void setDestructionMode(IndexWSResource.DestructionMode mode)
          Sets the resource's destruction mode
 void setFields(String[] fields)
          Setter method for the Fields list Resource Property
 void setIndexID(String indexID)
          Setter method for the IndexID Resource Property
 void setIndexTypeName(String indexTypeName)
          Setter method for the IndexTypeName Resource Property
 void setIsInitializing(boolean isInitializing)
          Specifies the current state of the resource (initializing or not)
 void setModified(Calendar modified)
          Setter method for the Modified Resource Property
 void store()
           
protected  void waitUntilInitialized()
          Blocks thread execution until WS resource is initialized
 
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_INDEX_ID

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

See Also:
Constant Field Values

RP_INDEX_TYPE_NAME

public static final String RP_INDEX_TYPE_NAME
See Also:
Constant Field Values

RP_COLLECTION_ID

public static final String RP_COLLECTION_ID
See Also:
Constant Field Values

RP_FIELDS

public static final String RP_FIELDS
See Also:
Constant Field Values

RP_MODIFIED

public static final String RP_MODIFIED
See Also:
Constant Field Values

RP_CREATED

public static final String RP_CREATED
See Also:
Constant Field Values

propNames

protected List<String> propNames
The list of property names for this resource


namespace

protected String namespace
The service's namespace


bInitializing

protected boolean bInitializing
Is the resource in the initialization state or not?


initLock

protected Object initLock
The corresponding lock Object


topicRegistrar

protected org.gcube.indexmanagement.common.IndexWSResource.TopicRegistrar topicRegistrar
The object that handles the registration of notification topics


destructionMode

protected IndexWSResource.DestructionMode destructionMode
The resource's destruction mode

Constructor Detail

IndexWSResource

protected IndexWSResource()
Constructs a new IndexWSResource object.

Method Detail

initialise

public void initialise(String namespace,
                       String indexID,
                       String indexTypeName,
                       String[] collectionID)
                throws Exception
Initializes a IndexWSResource object.

Throws:
Exception

onLoad

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

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)

Parameters:
oos - the output stream to write the resource state to
Throws:
Exception - an error occured during resource serialization

store

public void store()
Specified by:
store in interface org.globus.wsrf.PersistenceCallback
Overrides:
store in class org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>

createProperty

public org.globus.wsrf.ResourceProperty createProperty(String propName)
                                                throws Exception
Adds a new ResourceProperty to the resource, given a property name.

Parameters:
propName - the name of the new resource property
Returns:
the generated ResourceProperty object
Throws:
Exception

createProperty

public org.globus.wsrf.ResourceProperty createProperty(String propName,
                                                       String nameSpace)
                                                throws Exception
Adds a new ResourceProperty to the resource, given a property name and a namespace.

Parameters:
propName - the name of the new resource property
nameSpace - the namespace of the new resource property
Returns:
the generated ResourceProperty object
Throws:
Exception

createTopic

public org.globus.wsrf.impl.SimpleTopic createTopic(String topicName,
                                                    String nameSpace)
                                             throws Exception
Adds a new topic to the resource, given a topic name and a namespace.

Parameters:
topicName - the name of the new topic
nameSpace - the namespace of the new topic
Returns:
the generated ResourcePropertyTopic object
Throws:
Exception

createTopic

public org.globus.wsrf.impl.SimpleTopic createTopic(String topicName)
                                             throws Exception
Adds a new topic to the resource, given a topic name.

Parameters:
topicName - the name of the new topic
Returns:
the generated ResourcePropertyTopic object
Throws:
Exception

getPropertyNames

protected String[] getPropertyNames()
Overrides:
getPropertyNames in class org.gcube.common.core.state.GCUBEWSResource

getNamespace

public String getNamespace()
Returns the namespace of the service this resource belongs to

Returns:
the namespace

getIndexID

public String getIndexID()
Getter method for the IndexID Resource Property

Returns:
String the requested indexID

setIndexID

public void setIndexID(String indexID)
Setter method for the IndexID Resource Property

Parameters:
indexID - String the new IndexId

getCollectionID

public String[] getCollectionID()
Getter method for the CollectionID list Resource Property

Returns:
String[] the requested CollectionIDs

getFields

public String[] getFields()
Getter method for the Fields list Resource Property

Returns:
String[] the requested Fields

setCollectionID

public void setCollectionID(String[] collectionIDs)
                     throws Exception
Setter method for the CollectionID list Resource Property

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

setFields

public void setFields(String[] fields)
               throws Exception
Setter method for the Fields list Resource Property

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

addCollectionID

public void addCollectionID(String collectionID)
Adds a collection id to the collectionID resource property

Parameters:
collectionID - String -the ID to be added

addField

public void addField(String field)
Adds a field to the Fields resource property

Parameters:
field - String -the field to be added in the following format: [collectionID]:[language]:["s"|"p"]:[fieldName]

getIndexTypeName

public String getIndexTypeName()
Getter method for the IndexTypeName Resource Property

Returns:
String the requested IndexTypeName

setIndexTypeName

public void setIndexTypeName(String indexTypeName)
                      throws Exception
Setter method for the IndexTypeName Resource Property

Parameters:
indexTypeName - String the new IndexTypeName
Throws:
Exception

getCreated

public Calendar getCreated()
Getter method for the Created Resource Property

Returns:
Calendar the requested time of creation for this index replication

setCreated

public void setCreated(Calendar created)
Setter method for the Created Resource Property

Parameters:
created - Calendar representation of the time the resource was created.

getModified

public Calendar getModified()
Getter method for the Modified Resource Property

Returns:
Calendar the requested lastModified indicator

setModified

public void setModified(Calendar modified)
Setter method for the Modified Resource Property

Parameters:
modified - Calendar representation of the time the resource was modified

isInitializing

public boolean isInitializing()
Returns the current initialization state of the resource

Returns:
true if the resoure is currently initializing, false otherwise

setIsInitializing

public void setIsInitializing(boolean isInitializing)
Specifies the current state of the resource (initializing or not)

Parameters:
isInitializing - the initialization state to set

waitUntilInitialized

protected void waitUntilInitialized()
Blocks thread execution until WS resource is initialized


filterFieldInfo

protected void filterFieldInfo(ArrayList<String> presentableFields,
                               ArrayList<String> searchableFields)

getDestructionMode

public IndexWSResource.DestructionMode getDestructionMode()
Returns the resource's destruction mode

Returns:
the resource's destruction mode

setDestructionMode

public void setDestructionMode(IndexWSResource.DestructionMode mode)
Sets the resource's destruction mode

Parameters:
mode - the destruction mode to be set

onResourceRemoval

public void onResourceRemoval()
Performs clean-up operations before the resource is removed from the home


publish

public void publish(org.gcube.common.core.scope.GCUBEScope... scopes)
             throws org.globus.wsrf.ResourceException
Overrides:
publish in class org.gcube.common.core.state.GCUBEWSResource
Throws:
org.globus.wsrf.ResourceException

isTopicRegistered

public boolean isTopicRegistered(org.globus.wsrf.impl.SimpleTopic topic)
                          throws Exception
Checks if the registration of the given topic has been completed.

Parameters:
topic - the topic whose registration to check
Returns:
true if the registration has been completed, else false
Throws:
Exception


Copyright © 2013. All Rights Reserved.