org.gcube.data.tmf.impl
Class AbstractSource

java.lang.Object
  extended by org.gcube.data.tmf.impl.AbstractSource
All Implemented Interfaces:
Serializable, Source

public abstract class AbstractSource
extends Object
implements Source

A partial implementation of Source.

Author:
Fabio Simeoni
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.gcube.data.tmf.api.Source
TREE_TYPE
 
Constructor Summary
AbstractSource(String id)
          Creates an instance with a given identifier.
 
Method Summary
 Long cardinality()
          Returns the cardinality of the source.
 Calendar creationTime()
          Returns the creation time of the source.
 String description()
          Returns the free-form description of the source.
 Environment environment()
          Returns the local Environment of the plugin.
 boolean equals(Object obj)
           
 int hashCode()
           
 String id()
          Returns the identifier of the source.
 boolean isUser()
          Returns true if the source is a user-level source, false if it is instead system-level source.
 Calendar lastUpdate()
          Returns the time in which the source was last modified.
 SourceLifecycle lifecycle()
          Returns the SourceLifecycle.
 String name()
          Returns the name of the source.
 SourceNotifier notifier()
          Returns the SourceNotifier.
 SourceReader reader()
          Returns the SourceReader.
 void setCardinality(Long cardinality)
          Sets the cardinality of the source, changing automatically the time of last modification of the source.
 Calendar setCreationTime(Calendar time)
          Sets the creation time of the source.
 void setDescription(String description)
          Sets a free-form description for the source.
 void setEnvironment(Environment env)
          Sets the local Environment of the plugin.
 void setLastUpdate(Calendar time)
          Sets the time in which the source was last modified.
 void setLifecycle(SourceLifecycle lifecycle)
          Sets the SourceLifecycle.
 void setName(String name)
          Sets the name of the source.
 void setNotifier(SourceNotifier notifier)
          Returns the SourceNotifier.
 void setReader(SourceReader reader)
          Sets the SourceReader
 void setUser(boolean isUser)
          Marks the source as a user or as a system source.
 void setWriter(SourceWriter writer)
          Sets the SourceWriter
 String toString()
           
 SourceWriter writer()
          Returns the SourceWriter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.gcube.data.tmf.api.Source
properties, types
 

Constructor Detail

AbstractSource

public AbstractSource(String id)
               throws org.gcube.common.clients.exceptions.InvalidRequestException
Creates an instance with a given identifier.

Parameters:
id - the identifier
Throws:
org.gcube.common.clients.exceptions.InvalidRequestException - if the identifier is null
Method Detail

id

public String id()
Returns the identifier of the source.

Specified by:
id in interface Source
Returns:
the identifier

name

public String name()
Returns the name of the source.

Specified by:
name in interface Source
Returns:
the name

setName

public void setName(String name)
Sets the name of the source.

Parameters:
name - the name

description

public String description()
Returns the free-form description of the source.

Specified by:
description in interface Source
Returns:
the description

setDescription

public void setDescription(String description)
Sets a free-form description for the source.

Parameters:
description - the description

creationTime

public Calendar creationTime()
Returns the creation time of the source.

Specified by:
creationTime in interface Source
Returns:
the creation time

setCreationTime

public Calendar setCreationTime(Calendar time)
Sets the creation time of the source.

Parameters:
time - the creation time

setUser

public void setUser(boolean isUser)
Marks the source as a user or as a system source.

Parameters:
isUser - true if the source is a user source, false otherwise

isUser

public boolean isUser()
Returns true if the source is a user-level source, false if it is instead system-level source.

Specified by:
isUser in interface Source
Returns:
true if the source is a user-level source, false otherwise

cardinality

public Long cardinality()
Returns the cardinality of the source.

Specified by:
cardinality in interface Source
Returns:
the cardinality

setCardinality

public void setCardinality(Long cardinality)
Sets the cardinality of the source, changing automatically the time of last modification of the source.

Parameters:
cardinality - the cardinality
See Also:
setLastUpdate(Calendar)

lastUpdate

public Calendar lastUpdate()
Returns the time in which the source was last modified.

Specified by:
lastUpdate in interface Source
Returns:
the last modification time

setLastUpdate

public void setLastUpdate(Calendar time)
Sets the time in which the source was last modified.

An actual change in the value of this property notifies the service of a SourceEvent.CHANGE event.

Parameters:
time - the last modification time

lifecycle

public SourceLifecycle lifecycle()
Returns the SourceLifecycle.

Specified by:
lifecycle in interface Source
Returns:
the lifecycle

setLifecycle

public void setLifecycle(SourceLifecycle lifecycle)
Sets the SourceLifecycle.

Parameters:
lifecycle - the lifecycle

reader

public SourceReader reader()
Returns the SourceReader.

Specified by:
reader in interface Source
Returns:
the reader, or null if the source is write-only

setReader

public void setReader(SourceReader reader)
Sets the SourceReader

Parameters:
reader - the reader

setWriter

public void setWriter(SourceWriter writer)
Sets the SourceWriter

Parameters:
writer - the writer

writer

public SourceWriter writer()
Returns the SourceWriter.

Specified by:
writer in interface Source
Returns:
the writer, or null if the source is read-only

setNotifier

public void setNotifier(SourceNotifier notifier)
Returns the SourceNotifier.

This is invoked by the service prior to source initialisation. The service subscribes to the provider so as to receive notification of events fired from the plugin.

Specified by:
setNotifier in interface Source
Parameters:
notifier - the notifier

notifier

public SourceNotifier notifier()
Returns the SourceNotifier.

Specified by:
notifier in interface Source
Returns:
the notifier

environment

public Environment environment()
Returns the local Environment of the plugin.

Specified by:
environment in interface Source
Returns:
the environment

setEnvironment

public void setEnvironment(Environment env)
Sets the local Environment of the plugin.

It is invoked by the service prior to source initialisation.

Specified by:
setEnvironment in interface Source
Parameters:
env - the environment

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.