things.thinger.io.conduits.basic
Class BasicConduit

java.lang.Object
  extended by things.thinger.io.conduits.basic.BasicConduit
All Implemented Interfaces:
Conduit, InjectionInterface

public class BasicConduit
extends java.lang.Object
implements Conduit, InjectionInterface

Basic implementation of a conduit.

NOTES
- Using or deregistering an already deregistered Injector will not cause any errors.

Drains are registered and deregistered. Push drains will call the drain object from a system owned Thread. Pull drains are polled from outside the system Threads

Version:
1.0

Version History

EPG - Adapted from autohit - 29 JUN 05
 
Author:
Erich P. Gatejen

Nested Class Summary
 
Nested classes/interfaces inherited from interface things.thinger.io.conduits.Conduit
Conduit.InjectorType
 
Field Summary
 
Fields inherited from interface things.thinger.io.conduits.Conduit
NOTHING
 
Constructor Summary
BasicConduit()
           
 
Method Summary
 void deRegisterPullDrain(PullDrainContainer theDrain)
          Deregister a PullDrainContainer instance with the Conduit.
 void deRegisterPushDrain(PushDrain theDrain)
          Deregister a PushDrain instance with the Conduit.
 void disposeInjector(Injector theInjector)
          Explicitly dispose of an Injector.
 ConduitID getId()
          Get the id.
 Injector getInjector(Conduit.InjectorType theType)
          This will get an injector to the conduit.
 Injector getInjector(Conduit.InjectorType theType, java.lang.String name)
          This will get an injector to the conduit, named.
 java.util.HashSet<PullDrainContainer> getPullDrains()
          Get the Pull Drains (in their containers).
 java.util.HashSet<PushDrain> getPushDrains()
          Get the Push Drains (in their containers).
 void init(ConduitID yourId)
          Initialize the Conduit.
 void registerPullDrain(PullDrainContainer theDrain)
          Register a PullDrainContainer instance with the Conduit.
 void registerPushDrain(PushDrain theDrain)
          Register a PushDrain instance with the Conduit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicConduit

public BasicConduit()
Method Detail

init

public void init(ConduitID yourId)
          throws SystemException
Initialize the Conduit. This will be called by it's controller. Any subsequent calls may result in a PANIC SystemException. Don't do it!

Specified by:
init in interface Conduit
Parameters:
yourId - The ConduitID.
Throws:
SystemException
See Also:
ConduitID

getId

public ConduitID getId()
Get the id.

Specified by:
getId in interface Conduit
Returns:
The Conduit ID.

getInjector

public Injector getInjector(Conduit.InjectorType theType)
                     throws SystemException
This will get an injector to the conduit.

Specified by:
getInjector in interface Conduit
Parameters:
theType - The type of injector to get. If the underlying implementation does not support that type, it should throw a ThingsException.
Returns:
An injector.
Throws:
SystemException

getInjector

public Injector getInjector(Conduit.InjectorType theType,
                            java.lang.String name)
                     throws SystemException
This will get an injector to the conduit, named.

Specified by:
getInjector in interface Conduit
Parameters:
theType - The type of injector to get. If the underlying implementation does not support that type, it should throw a ThingsException.
name - the name of the Injector
Returns:
An injector.
Throws:
SystemException

disposeInjector

public void disposeInjector(Injector theInjector)
                     throws SystemException
Explicitly dispose of an Injector.

Specified by:
disposeInjector in interface Conduit
Parameters:
theInjector - The Injector object to dispose.
Throws:
SystemException

registerPullDrain

public void registerPullDrain(PullDrainContainer theDrain)
                       throws SystemException
Register a PullDrainContainer instance with the Conduit.

Specified by:
registerPullDrain in interface Conduit
Parameters:
theDrain - The drain to register.
Throws:
SystemException
See Also:
PullDrainContainer

deRegisterPullDrain

public void deRegisterPullDrain(PullDrainContainer theDrain)
                         throws SystemException
Deregister a PullDrainContainer instance with the Conduit. This will not empty any queued items.

Specified by:
deRegisterPullDrain in interface Conduit
Parameters:
theDrain - The drain to deregister.
Throws:
SystemException
See Also:
PullDrainContainer

registerPushDrain

public void registerPushDrain(PushDrain theDrain)
                       throws SystemException
Register a PushDrain instance with the Conduit. It may be immediately subject to pushed items.

Specified by:
registerPushDrain in interface Conduit
Parameters:
theDrain - The drain to register.
Throws:
SystemException
See Also:
PushDrain

deRegisterPushDrain

public void deRegisterPushDrain(PushDrain theDrain)
                         throws SystemException
Deregister a PushDrain instance with the Conduit. If the Conduit is in the middle of a push, it may block this call until done.

Specified by:
deRegisterPushDrain in interface Conduit
Parameters:
theDrain - The drain to deregister.
Throws:
SystemException
See Also:
PushDrain

getPullDrains

public java.util.HashSet<PullDrainContainer> getPullDrains()
                                                    throws SystemException
Get the Pull Drains (in their containers). Access to the Set is not synchronized, as it need not be, but you should be adding any new injectors through this interface. Doing so will give undefined results.

Specified by:
getPullDrains in interface InjectionInterface
Returns:
A HashSet of PullDrainContainers.
Throws:
SystemException
See Also:
PullDrainContainer, HashSet

getPushDrains

public java.util.HashSet<PushDrain> getPushDrains()
                                           throws SystemException
Get the Push Drains (in their containers). Access to the Set is not synchronized, as it need not be, but you should be adding any new injectors through this interface. Doing so will give undefined results.

Specified by:
getPushDrains in interface InjectionInterface
Returns:
A HashSet of PushDrains.
Throws:
SystemException
See Also:
PushDrain, HashSet


Things.