|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ninecode.email.connector.EmailManagedConnection
Managed connection for the Connector architecture.
Field Summary | |
protected ArrayList |
mConnections
The list of Connections handed out. |
protected EmailConfigurationData |
mData
The configuration data associated with this managed connection. |
protected ArrayList |
mListeners
The ConnectionListeners list. |
protected PrintWriter |
mPrintWriter
The logging output stream. |
protected Session |
mSession
The email session. |
protected EmailSource |
mSource
The source corresponding to the 'store' configuration data. |
protected Transport |
mTransport
The javax.mail Transport object for this connection. |
Constructor Summary | |
EmailManagedConnection()
Creates a new instance of EmailManagedConnection. |
Method Summary | |
void |
addConnectionEventListener(ConnectionEventListener listener)
Adds a connection event listener to the ManagedConnection instance. |
void |
associateConnection(Object connection)
Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance. |
void |
begin()
Begins a local transaction on an EIS instance. |
void |
cleanup()
Application server calls this method to force any cleanup on the ManagedConnection instance. |
protected void |
closeConnection(EmailConnection connection)
Close a connection created by this managed connection. |
void |
commit()
Commits the current local transaction and release all locks held by the underlying EIS instance. |
protected Transport |
connectTransport()
Connect to the transport. |
void |
destroy()
Destroys the physical connection to the underlying resource manager. |
protected void |
disconnectTransport()
Disconnect the Transport. |
protected EmailConfigurationData |
getConfigurationData()
Getter for property configurationData. |
protected boolean |
getConnected()
Report the connected state of this managed connection. |
Object |
getConnection(Subject subject,
ConnectionRequestInfo info)
Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance. |
LocalTransaction |
getLocalTransaction()
Returns an javax.resource.spi.LocalTransaction instance. |
PrintWriter |
getLogWriter()
Gets the log writer for this ManagedConnection instance. |
protected Message[] |
getMessages()
Get any messages. |
ManagedConnectionMetaData |
getMetaData()
Gets the metadata information for this connection's underlying EIS resource manager instance. |
protected Session |
getSession()
Get the session associated with this connection. |
protected EmailSource |
getSource()
Get the source associated with the 'store' connection data. |
protected Transport |
getTransport()
Get the transport associated with this connection. |
XAResource |
getXAResource()
Returns an javax.transaction.xa.XAresource instance. |
protected void |
notifyListeners(ConnectionEvent event,
String call)
Send an event to all listeners. |
void |
removeConnectionEventListener(ConnectionEventListener listener)
Removes an already registered connection event listener from the ManagedConnection instance. |
void |
rollback()
Rollbacks the current resource manager local transaction. |
protected void |
setConfigurationData(EmailConfigurationData data)
Setter for property configurationData. |
protected void |
setConnected(boolean connect)
Connect or disconnect the email session. |
void |
setLogWriter(PrintWriter writer)
Sets the log writer for this ManagedConnection instance. |
protected void |
setSession(Session session)
Set the session associated with this connection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Session mSession
protected EmailConfigurationData mData
protected Transport mTransport
protected EmailSource mSource
protected PrintWriter mPrintWriter
protected ArrayList mListeners
protected ArrayList mConnections
Constructor Detail |
public EmailManagedConnection()
Method Detail |
protected Session getSession()
protected void setSession(Session session)
session
- The new session object.protected EmailConfigurationData getConfigurationData()
protected void setConfigurationData(EmailConfigurationData data)
data
- New value of property configurationData.protected Transport getTransport()
protected EmailSource getSource() throws ResourceException
ResourceException
- If the source cannot be obtained.protected Message[] getMessages() throws ResourceException, MessagingException
ResourceException
- If the source cannot be obtained.
MessagingException
- If there is a problem retrieving messages.protected Transport connectTransport() throws ResourceException
ResourceException
- If a problem occurs, examples are:
getTransportProtocol()
protected void disconnectTransport() throws ResourceException
ResourceException
- If the close fails.protected void setConnected(boolean connect) throws ResourceException
connect
- If true
and this managed connection is not
already connected it performs a connect operation by getting a new
email session and connecting to the Transport.
If false
and this managed connection is
connected it disconnects by closing the Transport and nulling
out the session.
ResourceException
protected boolean getConnected()
true
if this managed connection is already connected,
false
otherwise.protected void closeConnection(EmailConnection connection) throws ResourceException
connection
- The connection to close.
ResourceException
- If there is a problem closing.protected void notifyListeners(ConnectionEvent event, String call) throws ResourceException
event
- The event to send.call
- The ConnectionEventListener
method to call.
ResourceException
- If the reflection invocation fails for some
reason.public void addConnectionEventListener(ConnectionEventListener listener)
addConnectionEventListener
in interface ManagedConnection
listener
- A new ConnectionEventListener to be registered.public void removeConnectionEventListener(ConnectionEventListener listener)
removeConnectionEventListener
in interface ManagedConnection
listener
- Already registered connection event listener to be removed.public void associateConnection(Object connection) throws ResourceException
associateConnection
in interface ManagedConnection
connection
- Application-level connection handle.
ResourceException
- Failed to associate the connection handle with this ManagedConnection instance.
IllegalStateException
- Illegal state for invoking this method.
ResourceAdapterInternalException
- Resource adapter internal error condition.public void cleanup() throws ResourceException
cleanup
in interface ManagedConnection
ResourceException
- Generic exception if operation fails.
ResourceAdapterInternalException
- Resource adapter internal error condition.
IllegalStateException
- Illegal state for calling connection cleanup.
Example - if a localtransaction is in progress that doesn't allow connection cleanuppublic void destroy() throws ResourceException
destroy
in interface ManagedConnection
ResourceException
- Generic exception if operation failed.
IllegalStateException
- Illegal state for destroying connection.public Object getConnection(Subject subject, ConnectionRequestInfo info) throws ResourceException
getConnection
in interface ManagedConnection
subject
- Security context as JAAS subject.info
- ConnectionRequestInfo instance.
ResourceException
- Generic exception if operation fails.
ResourceAdapterInternalException
- Resource adapter internal error condition.
SecurityException
- Security related error condition.
CommException
- Failed communication with EIS instance.
EISSystemException
- Internal error condition in EIS instance
- used if EIS instance is involved in setting state of ManagedConnection.public LocalTransaction getLocalTransaction() throws ResourceException
getLocalTransaction
in interface ManagedConnection
ResourceException
- Generic exception if operation fails.
NotSupportedException
- If the operation is not supported.
ResourceAdapterInternalException
- Resource adapter internal error condition.public PrintWriter getLogWriter() throws ResourceException
getLogWriter
in interface ManagedConnection
ResourceException
- Generic exception if operation fails.public ManagedConnectionMetaData getMetaData() throws ResourceException
getMetaData
in interface ManagedConnection
ResourceException
- Generic exception if operation fails.
NotSupportedException
- If the operation is not supported.public XAResource getXAResource() throws ResourceException
getXAResource
in interface ManagedConnection
ResourceException
- Generic exception if operation fails.
NotSupportedException
- If the operation is not supported.
ResourceAdapterInternalException
- Resource adapter internal error condition.public void setLogWriter(PrintWriter writer) throws ResourceException
setLogWriter
in interface ManagedConnection
writer
- - Character Output stream to be associated.
ResourceException
- Generic exception if operation fails.
ResourceAdapterInternalException
- Resource adapter related error condition.public void commit() throws ResourceException
commit
in interface LocalTransaction
ResourceException
- Failed to commit a local transaction.
Examples of error cases are:
public void begin() throws ResourceException
begin
in interface LocalTransaction
ResourceException
- Failed to begin a local transaction.
Examples of error cases are:
public void rollback() throws ResourceException
rollback
in interface LocalTransaction
ResourceException
- Failed to rollback a local transaction.
Examples of error cases are:
|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |