uk.org.ogsadai.activity.io
Class SimplePipeManager

java.lang.Object
  extended by uk.org.ogsadai.activity.io.SimplePipeManager
All Implemented Interfaces:
PipeManager

public class SimplePipeManager
extends java.lang.Object
implements PipeManager

A simple pipe manager.

Author:
The OGSA-DAI Project Team.

Constructor Summary
SimplePipeManager(ResourceID requestID)
          Constructs the pipe manager.
 
Method Summary
 void addPipeListener(PipeListener listener)
          Registers a pipe listener to receive any pipe events that are generated.
 void addPipeWaitListener(PipeWaitListener listener)
          Registers a pipe wait listener to receive any pipe events that are generated.
 BlockReader createBlockReader(Literal literal, KeyValueProperties attributes)
          Creates a new literal block reader with properties specified by the given attribute values.
 Pipe createPipe(java.lang.String pipeName, KeyValueProperties attributes)
          Creates a pipe with the specified name and attributes.
 Pipe getPipe(java.lang.String pipeName)
          Gets a pipe with the specified name.
 java.util.Collection getPipeListeners()
          Gets an immutable collection of registered pipe listeners.
 java.util.Collection<PipeWaitListener> getPipeWaitListeners()
          Gets collection of listeners.
 void removePipeListener(PipeListener listener)
          De-registers a child pipe listener.
 void removePipeWaitListener(PipeWaitListener listener)
          De-registers a child pipe wait listener.
 void waitForPipe(java.lang.String pipeName)
          Waits (blocks) until the specified pipe has been created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePipeManager

public SimplePipeManager(ResourceID requestID)
Constructs the pipe manager.

Parameters:
requestID - ID of the request for which pipes will be created
Method Detail

createPipe

public Pipe createPipe(java.lang.String pipeName,
                       KeyValueProperties attributes)
Creates a pipe with the specified name and attributes. Attributes can be used to specify the desired pipe implementation, buffer size, etc. It is up to the implementation of this interface which attributes it supports what they mean.

Specified by:
createPipe in interface PipeManager
Parameters:
pipeName - name of pipe.
attributes - attributes associated with the pipe.
Returns:
the pipe.

createBlockReader

public BlockReader createBlockReader(Literal literal,
                                     KeyValueProperties attributes)
Creates a new literal block reader with properties specified by the given attribute values. A literal block reader is a block reader that will output the given literal values.

Specified by:
createBlockReader in interface PipeManager
Parameters:
literal - literal values the block reader must output.
attributes - attributes containing information about the type of pipe to create.
Returns:
a new block reader.

waitForPipe

public void waitForPipe(java.lang.String pipeName)
                 throws java.lang.InterruptedException
Waits (blocks) until the specified pipe has been created.

Specified by:
waitForPipe in interface PipeManager
Parameters:
pipeName - name of pipe to wait for.
Throws:
java.lang.InterruptedException - if the thread is interrupted.

getPipe

public Pipe getPipe(java.lang.String pipeName)
Gets a pipe with the specified name.

Specified by:
getPipe in interface PipeManager
Parameters:
pipeName - name of pipe
Returns:
the pipe. If the pipe has not yet been created a proxy for the pipe will be returned. Any subsequent attempts to use this proxy before the actual pipe has been created will block.

addPipeListener

public void addPipeListener(PipeListener listener)
Registers a pipe listener to receive any pipe events that are generated.

Specified by:
addPipeListener in interface PipeManager
Parameters:
listener - pipe listener to register

removePipeListener

public void removePipeListener(PipeListener listener)
De-registers a child pipe listener. If the specified listener is not currently registered, then no action takes place.

Specified by:
removePipeListener in interface PipeManager
Parameters:
listener - pipe listener to de-register

getPipeListeners

public java.util.Collection getPipeListeners()
Gets an immutable collection of registered pipe listeners.

Specified by:
getPipeListeners in interface PipeManager
Returns:
an immutable collection of PipeListener objects

getPipeWaitListeners

public java.util.Collection<PipeWaitListener> getPipeWaitListeners()
Gets collection of listeners.

Returns:
collection.

addPipeWaitListener

public void addPipeWaitListener(PipeWaitListener listener)
Registers a pipe wait listener to receive any pipe events that are generated.

Specified by:
addPipeWaitListener in interface PipeManager
Parameters:
listener - pipe wait listener to register

removePipeWaitListener

public void removePipeWaitListener(PipeWaitListener listener)
De-registers a child pipe wait listener. If the specified listener is not currently registered, then no action takes place.

Specified by:
removePipeWaitListener in interface PipeManager
Parameters:
listener - pipe listener to de-register