org.globus.mds.aggregator.impl
Interface AggregatorSource

All Known Implementing Classes:
PollingAggregatorSource, SubscriptionAggregatorSource

public interface AggregatorSource

The AggregatorSource interface handles session management for establishing data aggregation relationships between services using source-sink paradigms. The exact data generation and consumption methods are abstracted in order to provide an extensible framework. For example, the underlying session may represented by an asynchronous notification channel (e.g. subscription), a synchronous polling mechanism (e.g. repeated queries) or some other mechanism, such as a command buffer or FIFO, etc.


Method Summary
 java.lang.String addAggregation(java.lang.Object parameters, AggregatorServiceGroupEntryResource entry)
          Establishes an implementation-specific data aggregation session.
 AggregatorSink getAggregatorSink()
          Gets the AggregatorSink instance where data from the underlying AggregatorSource will be routed, or NULL if not set.
 AggregatorServiceGroupEntryResource getSessionContext(java.lang.String sessionKey)
          Retrieve AggregatorServiceGroupEntryResource entry context.
 java.lang.String getSessionKey(AggregatorServiceGroupEntryResource entry)
          Get a sessionKey from a given entry context.
 void initialize(java.lang.Object parameters)
          Called to initialize any necessary state.
 boolean isValidSession(java.lang.String sessionKey)
          Determines if a specified sessionKey is valid (active).
 void removeAggregation(java.lang.String sessionKey)
          Terminates the data aggregation represented by sessionKey.
 void setAggregatorSink(AggregatorSink sink, java.lang.Object sinkParameters)
          Sets the AggregatorSink instance where data from the Aggregator Source will be routed.
 void terminate()
          Called to free resources used by the source.
 

Method Detail

initialize

public void initialize(java.lang.Object parameters)
                throws AggregatorSinkTypeNotSupportedException,
                       AggregatorException,
                       java.lang.Exception
Called to initialize any necessary state. This method should also attempt to initialize the specified sink and should always throw an exception if the sink is not set. The underlying implementation should throw an AggregatorSinkTypeNotSupportedException if it is not compatible with the supplied AggregationSink. The implementation may use the optional parameters Object to read implementation specific data from or just ignore the processing of it altogether.

Throws:
AggregatorSinkTypeNotSupportedException
AggregatorException
java.lang.Exception

terminate

public void terminate()
Called to free resources used by the source.


getAggregatorSink

public AggregatorSink getAggregatorSink()
Gets the AggregatorSink instance where data from the underlying AggregatorSource will be routed, or NULL if not set.


setAggregatorSink

public void setAggregatorSink(AggregatorSink sink,
                              java.lang.Object sinkParameters)
Sets the AggregatorSink instance where data from the Aggregator Source will be routed.


addAggregation

public java.lang.String addAggregation(java.lang.Object parameters,
                                       AggregatorServiceGroupEntryResource entry)
                                throws AggregatorParamTypeNotSupportedException,
                                       AggregatorException,
                                       java.lang.Exception
Establishes an implementation-specific data aggregation session. The method of data collection and consumption is defined by the implementation; the contract of the interface is that any data generated should be capable of being consumed by a class implementing the AggregationSink interface, which will in turn be bound an AggregationSource.

Parameters:
parameters - Implementation-specific parameters of the data to be collected.
entry - The AggregatorServiceGroupEntryResource instance to associate with this aggregation session. This instance will be passed unmodified to any connected AggregationSink.
Returns:
A session key, which is a String which must be guaranteed by the underlying AggregatorSource implementation to be a unique token with respect to all other invocations of the addAggregation method with the same parameters and entry instance on the same AggregationSource instance. A null return value is not permitted, though the empty string "" is.
An exception MUST be thrown if the aggregation could not be created by the implementation.
Throws:
AggregatorParamTypeNotSupportedException
AggregatorException
java.lang.Exception

removeAggregation

public void removeAggregation(java.lang.String sessionKey)
                       throws AggregatorException,
                              java.lang.Exception
Terminates the data aggregation represented by sessionKey.

Parameters:
sessionKey - The session key of the aggregation to terminate.
Throws:
AggregatorException
java.lang.Exception

getSessionContext

public AggregatorServiceGroupEntryResource getSessionContext(java.lang.String sessionKey)
Retrieve AggregatorServiceGroupEntryResource entry context.

Parameters:
sessionKey - The session key of the aggregation.
Returns:
A valid object, or NULL. The type of object returned is dependent on the underlying implementation.

getSessionKey

public java.lang.String getSessionKey(AggregatorServiceGroupEntryResource entry)
                               throws AggregatorException
Get a sessionKey from a given entry context.

Returns:
A string representing the sessionKey for the given entry.
Throws:
AggregatorException

isValidSession

public boolean isValidSession(java.lang.String sessionKey)
                       throws AggregatorException
Determines if a specified sessionKey is valid (active).

Returns:
A boolean value indicating whether the specified sessionKey is valid.
Throws:
AggregatorException