org.gcube.contentmanagement.contentmanager.plugin.delegates
Class Collection

java.lang.Object
  extended by org.gcube.contentmanagement.contentmanager.plugin.delegates.Delegate
      extended by org.gcube.contentmanagement.contentmanager.plugin.delegates.Collection
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DefaultCollection

public abstract class Collection
extends Delegate
implements java.io.Serializable

Extends Delegate as the base class for extensions of CollectionResource.

Author:
Fabio Simeoni (University of Strathclyde)
See Also:
Serialized Form

Nested Class Summary
static class Collection.ChangeTopic
          A GCUBETopic for changes of state to dynamic collection properties.
 
Constructor Summary
Collection(java.lang.String id)
          Constructs an instance for a collection.
 
Method Summary
 long getCardinality()
          Returns the cardinality of the collection.
 java.util.Calendar getCreationTime()
          Returns the creation time of the collection.
 java.lang.String getDescription()
          Returns the free-form description of the collection.
 java.lang.String getID()
          Returns the collection identifier.
 java.util.Calendar getLastUpdate()
          Returns the time in which the collection was last updated.
 java.lang.String getName()
          Returns the name of the collection.
 ReadDelegate getReader()
          Return the collection reader.
 WriteDelegate getWriter()
          Return the collection writer.
abstract  void initialise()
          Invoked by the service to initialise the collection.
 boolean isUser()
          Indicates whether the collection is a user collection.
 void notifyDeletion()
          Reports the deletion of the collection.
 void onLoad(boolean firstLoad)
          Invoked right after collection has been reloaded form persistent storage.
 void setCardinality(long c)
          Sets the cardinality of the collection.
 java.util.Calendar setCreationTime(java.util.Calendar c)
          Sets the creation time of the collection.
 void setDescription(java.lang.String d)
          Sets the free-form description of the collection.
 void setLastUpdate(java.util.Calendar t)
          Sets the time in which the collection was last updated.
 void setName(java.lang.String name)
          Sets the name of the collection.
 void setReader(ReadDelegate r)
          Sets the reader.
 void setUser(boolean isUser)
          Sets the collection as a user collection or as a system collection.
 void setWriter(WriteDelegate w)
          Sets the writer.
 void store()
          Signals that the delegate has changed.
 void subscribe( consumer)
           
 
Methods inherited from class org.gcube.contentmanagement.contentmanager.plugin.delegates.Delegate
getScopeManager, getSecurityManager, setResource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collection

public Collection(java.lang.String id)
           throws java.lang.IllegalArgumentException
Constructs an instance for a collection.

Parameters:
id - the collection identifier.
Throws:
java.lang.IllegalArgumentException
Method Detail

subscribe

public void subscribe( consumer)

initialise

public abstract void initialise()
                         throws java.lang.Exception
Invoked by the service to initialise the collection.

Subclasses are expected to trigger staging processes during the execution of this method.

Throws:
java.lang.Exception - if the collection could not be initialised.

isUser

public boolean isUser()
Indicates whether the collection is a user collection.

Returns:
true if it is, false otherwise.

getCreationTime

public java.util.Calendar getCreationTime()
Returns the creation time of the collection.

Returns:
the time.

setCreationTime

public java.util.Calendar setCreationTime(java.util.Calendar c)
Sets the creation time of the collection.

Parameters:
the - time.

getDescription

public java.lang.String getDescription()
Returns the free-form description of the collection.

Returns:
the description.

setDescription

public void setDescription(java.lang.String d)
Sets the free-form description of the collection.

Parameters:
the - description.

setUser

public void setUser(boolean isUser)
Sets the collection as a user collection or as a system collection.

Parameters:
isUser - true if is a user collection, false otherwise.

getName

public java.lang.String getName()
Returns the name of the collection.

Returns:
the name.

setName

public void setName(java.lang.String name)
Sets the name of the collection.

Parameters:
name - the name.

setReader

public void setReader(ReadDelegate r)
Sets the reader.

Parameters:
r - the reader.

setWriter

public void setWriter(WriteDelegate w)
Sets the writer.

Parameters:
r - the writer.

getReader

public ReadDelegate getReader()
Return the collection reader.

Returns:
the reader.

getWriter

public WriteDelegate getWriter()
Return the collection writer.

Returns:
the writer.

getID

public java.lang.String getID()
Returns the collection identifier.

Returns:
the identifier.

setCardinality

public void setCardinality(long c)
Sets the cardinality of the collection.

Parameters:
c - the cardinality.

getCardinality

public long getCardinality()
Returns the cardinality of the collection.

Returns:
the cardinality.

setLastUpdate

public void setLastUpdate(java.util.Calendar t)
Sets the time in which the collection was last updated.

Parameters:
t - the time.

getLastUpdate

public java.util.Calendar getLastUpdate()
Returns the time in which the collection was last updated.

Returns:
the time.

notifyDeletion

public void notifyDeletion()
Reports the deletion of the collection.


store

public void store()
Signals that the delegate has changed.


onLoad

public final void onLoad(boolean firstLoad)
                  throws java.lang.Exception
Invoked right after collection has been reloaded form persistent storage.

Throws:
java.lang.Exception - if the collection fails to be loaded.