|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.servlet.connectionMethods.StandardConnectionMethod
This is a sample implementation of a ConnectionMethod. It is an abstract class because this class does not actually recieve or generate requests. It does do all the channel managment. Implementations of ConnectionMethod should extend this object, unless there is a specific reason not to.
Classes that extend this class will need to implement the
getChannelURL()
and
channelURLIsValid()
functions. They will also need to
ensure that they contain a thread that is started in the constructor
or (prefered) initialize()
, and stopped in
destroy()
.
ConnectionMethod
,
Serialized FormField Summary | |
protected ChannelTable |
channelTable
Stores a set of ChannelTableEntries. |
FilterManager |
filterManager
The FilterManager passed in to the initialize() method. |
ServletManager |
servletManager
The ServletManager passed in to the initialize() method. |
Fields inherited from interface org.enhydra.servlet.connectionMethods.ConnectionMethod |
disabledChannelHtml, errorHtml, noChannelHtml |
Constructor Summary | |
StandardConnectionMethod()
|
Method Summary | |
void |
addChannel(java.lang.String channelID,
java.lang.String URLPrefix,
java.lang.String servletID)
Add a new channel. |
void |
addTransactionFilter(java.lang.String channelID,
java.lang.String filterID)
Add a new Filter to the specified channel. |
void |
deleteChannel(java.lang.String channelID)
Delete a channel. |
void |
destroy()
Shut down the connection method. |
void |
disableChannel(java.lang.String channelID)
Turn off the channel. |
void |
enableChannel(java.lang.String channelID)
Turn on the channel. |
boolean |
equivalent(ConnectionMethod compareObject)
Compares the connection specific attributes for equivalency |
java.lang.String[] |
getChannelIDs()
Returns the identifier names of all the channels currently in the ConnectionMethod. |
ChannelStatus |
getChannelStatus(java.lang.String channelID)
Get the current status of a channel. |
java.lang.String[] |
getTransactionFilterIDs(java.lang.String channelID)
Get a list of all the filter names. |
java.lang.String |
getType()
|
java.lang.String |
getUniqueChannelName()
This returns a channel name that is not currently in use. |
void |
initialize(Config connectionConfig,
java.lang.String id,
ServletManager servletManager,
FilterManager filterManager)
Start up. |
void |
initialize(java.lang.String id,
ServletManager servletManager,
FilterManager filterManager)
Start up. |
void |
removeTransactionFilter(java.lang.String channelID,
java.lang.String filterID)
Remove the given Filter from the specified channel. |
void |
resetRequestCount(java.lang.String channelID)
Reset the specified channel's request count to zero. |
void |
writeToConfig(Config connectionConfig,
java.lang.String base)
Write out self into config fie |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.enhydra.servlet.connectionMethods.ConnectionMethod |
channelURLIsValid, getChannelURL, getPort |
Field Detail |
public ServletManager servletManager
initialize()
method.
If you are extending this class, you should use this ServletManager
to convert the servletID string to Servlets. The servletID strings
are only valid in this ServletManager.
ServletManager
public FilterManager filterManager
initialize()
method.
If you are extending this class, you should use this FilterManager
to convert the filterID string to Filters.
The filterID strings are only valid in this FilterManager.
FilterManager
protected ChannelTable channelTable
Constructor Detail |
public StandardConnectionMethod()
Method Detail |
public void initialize(Config connectionConfig, java.lang.String id, ServletManager servletManager, FilterManager filterManager) throws ConnectionMethodException
This will be called before any other method in this class.
initialize
in interface ConnectionMethod
connectionConfig
- The portion of the config file relevant to
this connection methodid
- The id associated with this connection methodservletManager
- The ServletManager to use to convert servletIDs
into Servlets.filterManager
- The FilterManager to use to convert filterIDs
into Filters.
ConnectionMethodException
- If unable to start up. This
class will not throw this exception, however classes which extend
this class may.Filter
public void initialize(java.lang.String id, ServletManager servletManager, FilterManager filterManager) throws ConnectionMethodException
This will be called before any other method in this class.
initialize
in interface ConnectionMethod
id
- The id associated with this connection methodservletManager
- The ServletManager to use to convert servletIDs
into Servlets.filterManager
- The FilterManager to use to convert filterIDs
into Filters.
ConnectionMethodException
- If unable to start up. This
class will not throw this exception, however classes which extend
this class may.Filter
public void writeToConfig(Config connectionConfig, java.lang.String base) throws ConfigException, KeywordValueException
writeToConfig
in interface ConnectionMethod
base
- The base key string
ConfigException
KeywordValueException
public void addChannel(java.lang.String channelID, java.lang.String URLPrefix, java.lang.String servletID) throws ConnectionMethodException
addChannel
in interface ConnectionMethod
channelID
- The symbolic name to use for this channel.URLPrefix
- If a request's URL starts with this string,
it should be sent to the servlet identified by servletID.
To obtain the servlet, use the ServletManager's get()
method.servletID
- The servlet to send requests to. Use the
ServletManager's get()
method to get the servlet.
Call get()
for each request, do not save a reference
to the servlet.
ConnectionMethodException
- If an error occurs, for example
using an already existing channelID.ServletManager
public ChannelStatus getChannelStatus(java.lang.String channelID)
getChannelStatus
in interface ConnectionMethod
channelID
- Which channel.
ChannelStatus
public void deleteChannel(java.lang.String channelID) throws ConnectionMethodException
deleteChannel
in interface ConnectionMethod
channelID
- Which channel to remove.
ConnectionMethodException
- If an error occurs, for example
if the channelID is not found.public java.lang.String[] getChannelIDs()
getChannelIDs
in interface ConnectionMethod
public void enableChannel(java.lang.String channelID) throws ConnectionMethodException
enableChannel
in interface ConnectionMethod
channelID
- Which channel to enable.
ConnectionMethodException
- If an error occurs, for example
if the channelID is not found.public void disableChannel(java.lang.String channelID) throws ConnectionMethodException
disableChannel
in interface ConnectionMethod
channelID
- Which channel to disable.
ConnectionMethodException
- If an error occurs, for example
if the channelID is not found.public void resetRequestCount(java.lang.String channelID) throws ConnectionMethodException
resetRequestCount
in interface ConnectionMethod
channelID
- Which channel.
ConnectionMethodException
- If an error occurs, for example
if the channelID is not found.public void addTransactionFilter(java.lang.String channelID, java.lang.String filterID) throws ConnectionMethodException
addTransactionFilter
in interface ConnectionMethod
channelID
- Which channel to add a Filter to.filterID
- The TransactionFilter to add.
The filter is fetched from the FilterManager passed in to
initialize()
each time a request comes in.
ConnectionMethodException
- If the channel does not exist, or
the filter name is already in use.Filter
public void removeTransactionFilter(java.lang.String channelID, java.lang.String filterID) throws ConnectionMethodException
removeTransactionFilter
in interface ConnectionMethod
channelID
- Which channel to remove a Filter from.
ConnectionMethodException
- If the channel or the filter
do not exist.Filter
public java.lang.String[] getTransactionFilterIDs(java.lang.String channelID) throws ConnectionMethodException
getTransactionFilterIDs
in interface ConnectionMethod
ConnectionMethodException
- If the channel ID does not exist.public java.lang.String getUniqueChannelName()
getUniqueChannelName
in interface ConnectionMethod
addChannel()
.public void destroy() throws ConnectionMethodException
After this call, none of these methods will be called again.
destroy
in interface ConnectionMethod
ConnectionMethodException
- If an error occurs.public boolean equivalent(ConnectionMethod compareObject)
equivalent
in interface ConnectionMethod
compareObject
- The object to compare this to
ConnectionMethodException
- If an error occurs.public java.lang.String getType()
getType
in interface ConnectionMethod
|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |