autohit.common.channels
Class SimpleInjector

java.lang.Object
  extended byautohit.common.channels.SimpleInjector
All Implemented Interfaces:
Injector

public class SimpleInjector
extends java.lang.Object
implements Injector

A very simple injector. Post anything and everything. You can set a default sender ID with setDefaultSenderID. If it is set as anything but null, when an atom without a sender id is posted, the sender id will be changed to this default.

Version:
1.0 Version History EPG - Rewrite - 27Apr03
EPG - Add default post - 24Jul03
EPG - Set default sender ID - 23Sep03
Author:
Erich P. Gatejen

Field Summary
 java.lang.String defaultSenderID
          Default sender ID.
 
Constructor Summary
SimpleInjector()
          Default contructor
 
Method Summary
 Atom defaultAtom()
          Instantiate a default atom for this kind of injector.
 Receipt defaultPost(int numeric, java.lang.Object o)
          Post a a default item.
 Receipt post(Atom a)
          Post an item
 void setChannel(Channel c)
          Set channel callback
 void setDefaultSenderID(java.lang.String id)
          Post an item
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSenderID

public java.lang.String defaultSenderID
Default sender ID. It starts as null. You must set it.

Constructor Detail

SimpleInjector

public SimpleInjector()
Default contructor

Method Detail

setDefaultSenderID

public void setDefaultSenderID(java.lang.String id)
Post an item

Parameters:
id - The new default sender ID. If set to null, it will not try and set the sender ID.

post

public Receipt post(Atom a)
             throws ChannelException
Post an item

Specified by:
post in interface Injector
Parameters:
a - An atom to post
Returns:
a receipt
Throws:
ChannelException

setChannel

public void setChannel(Channel c)
                throws ChannelException
Set channel callback

Specified by:
setChannel in interface Injector
Returns:
a receipt
Throws:
ChannelException

defaultPost

public Receipt defaultPost(int numeric,
                           java.lang.Object o)
                    throws ChannelException
Post a a default item. Use this if you aren't sure what kind of Atom this channal normally services.

Specified by:
defaultPost in interface Injector
Parameters:
numeric - value
o - object to post (often a string)
Returns:
a receipt
Throws:
ChannelException

defaultAtom

public Atom defaultAtom()
Instantiate a default atom for this kind of injector. It will be completely bare.

Specified by:
defaultAtom in interface Injector
Returns:
default atom


Test.