Email Answering System
Version 1.0

com.ninecode.email.connector
Class EmailConnectionFactory

java.lang.Object
  |
  +--com.ninecode.email.connector.EmailConnectionFactory
All Implemented Interfaces:
ConnectionFactory, Referenceable, Referenceable, Serializable

public class EmailConnectionFactory
extends Object
implements ConnectionFactory

Front end email connection factory for the Connector architecture. ConnectionFactory provides an interface for getting connection to an EIS instance. An implementation of ConnectionFactory interface is provided by a resource adapter. Application code looks up a ConnectionFactory instance from JNDI namespace and uses it to get EIS connections. An implementation class for ConnectionFactory is required to implement java.io.Serializable and javax.resource.Referenceable interfaces to support JNDI registration.

Author:
Derrick Oswald
See Also:
Serialized Form

Field Summary
protected  EmailConfigurationData mConfigurationData
          Configuration data.
protected  EmailConnectionData mConnectionData
          Connection data.
protected  ConnectionManager mConnectionManager
          The connection manager to use when creating connections.
protected  Reference mReference
          Reference to this ConnectionFactory.
 
Constructor Summary
EmailConnectionFactory()
          Create a new instance of an EmailConnectionFactory.
 
Method Summary
 boolean equals(Object other)
          Returns true if the other object is equal to this one.
 EmailConfigurationData getConfigurationData()
          Getter for property configurationData.
 Connection getConnection()
          Gets a connection to an EIS instance.
 Connection getConnection(ConnectionSpec spec)
          Gets a connection to an EIS instance.
 EmailConnectionData getConnectionData()
          Getter for property connectionData.
 ConnectionManager getConnectionManager()
          Getter for property connectionManager.
 ManagedConnectionFactory getManagedConnectionFactory()
          Getter for property managedConnectionFactory.
 ResourceAdapterMetaData getMetaData()
          Gets metadata for the Resource Adapter.
 RecordFactory getRecordFactory()
          Gets a RecordFactory instance.
 Reference getReference()
          Retrieves the Reference of this object.
 int hashCode()
          Returns a hash code for this object.
 void setConfigurationData(EmailConfigurationData data)
          Setter for property configurationData.
 void setConnectionData(EmailConnectionData data)
          Setter for property connectionData.
 void setConnectionManager(ConnectionManager manager)
          Setter for property connectionManager.
 void setManagedConnectionFactory(ManagedConnectionFactory factory)
          Setter for property managedConnectionFactory.
 void setReference(Reference reference)
          Sets the Reference instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mConnectionManager

protected ConnectionManager mConnectionManager
The connection manager to use when creating connections. This is serialized with this factory. This may not be our connection manager (it may be provided by the AS).


mReference

protected Reference mReference
Reference to this ConnectionFactory.


mConfigurationData

protected EmailConfigurationData mConfigurationData
Configuration data.


mConnectionData

protected EmailConnectionData mConnectionData
Connection data.

Constructor Detail

EmailConnectionFactory

public EmailConnectionFactory()
Create a new instance of an EmailConnectionFactory.

Method Detail

equals

public boolean equals(Object other)
Returns true if the other object is equal to this one. Ignores the mReference and mManagedConnectionFactory fields, since these are derived from the others.

Overrides:
equals in class Object
Returns:
true if the other object is equal to this one.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class Object
Returns:
The hash code for this object.

getManagedConnectionFactory

public ManagedConnectionFactory getManagedConnectionFactory()
Getter for property managedConnectionFactory.

Returns:
The ManagedConnectionFactory associated with this ConnectionFactory.

setManagedConnectionFactory

public void setManagedConnectionFactory(ManagedConnectionFactory factory)
Setter for property managedConnectionFactory. Note that the provided conection factory is not saved, only it's configuration parameters. The factory is rehydrated when needed.

Parameters:
factory - The ManagedConnectionFactory to associate with this ConnectionFactory.

getConnectionManager

public ConnectionManager getConnectionManager()
Getter for property connectionManager.

Returns:
The ConnectionManager associated with this ConnectionFactory.

setConnectionManager

public void setConnectionManager(ConnectionManager manager)
Setter for property connectionManager.

Parameters:
manager - The ConnectionManager to associate with this ConnectionFactory.

getConfigurationData

public EmailConfigurationData getConfigurationData()
Getter for property configurationData.

Returns:
Value of property configurationData.

setConfigurationData

public void setConfigurationData(EmailConfigurationData data)
Setter for property configurationData.

Parameters:
data - New value of property configurationData.

getConnectionData

public EmailConnectionData getConnectionData()
Getter for property connectionData.

Returns:
Value of property connectionData.

setConnectionData

public void setConnectionData(EmailConnectionData data)
Setter for property connectionData.

Parameters:
data - New value of property connectionData.

getConnection

public Connection getConnection()
                         throws ResourceException
Gets a connection to an EIS instance. This getConnection variant should be used when a component wants the container to manage EIS sign-on. This case is termed container-managed sign-on. The component does not pass any security information.

Specified by:
getConnection in interface ConnectionFactory
Returns:
Connection instance.
Throws:
ResourceException - Failed to get a connection to the EIS instance. Examples of error cases are: Invalid configuration of ManagedConnectionFactory -- example: invalid server name Application server-internal error -- example: connection pool related error Communication error EIS-specific error -- example: EIS not active Resource adapter-internal error Security related error -- example: invalid user Failure to allocate system resources

getConnection

public Connection getConnection(ConnectionSpec spec)
                         throws ResourceException
Gets a connection to an EIS instance. A component should use the getConnection variant with javax.resource.cci.ConnectionSpec parameter, if it needs to pass any resource adapter specific security information and connection parameters. In the component-managed sign-on case, an application component passes security information (example: username, password) through the ConnectionSpec instance. It is important to note that the properties passed through the getConnection method should be client-specific (example: username, password, language) and not related to the configuration of a target EIS instance (example: port number, server name). The ManagedConnectionFactory instance is configured with complete set of properties required for the creation of a connection to an EIS instance.

Specified by:
getConnection in interface ConnectionFactory
Parameters:
spec - Connection parameters and security information specified as ConnectionSpec instance.
Returns:
Connection instance.
Throws:
ResourceException - Failed to get a connection to the EIS instance. Examples of error cases are: Invalid specification of input parameters Invalid configuration of ManagedConnectionFactory -- example: invalid server name Application server-internal error -- example: connection pool related error Communication error EIS-specific error -- example: EIS not active Resource adapter-internal error Security related error -- example: invalid user Failure to allocate system resources

getMetaData

public ResourceAdapterMetaData getMetaData()
                                    throws ResourceException
Gets metadata for the Resource Adapter. Note that the metadata information is about the ResourceAdapter and not the EIS instance. An invocation of this method does not require that an active connection to an EIS instance should have been established.

Specified by:
getMetaData in interface ConnectionFactory
Throws:
ResourceException - Failed to get metadata information about the resource adapter.

getRecordFactory

public RecordFactory getRecordFactory()
                               throws ResourceException
Gets a RecordFactory instance. The RecordFactory is used for the creation of generic Record instances.

Specified by:
getRecordFactory in interface ConnectionFactory
Returns:
RecordFactory instance.
Throws:
ResourceException - Failed to create a RecordFactory.
NotSupportedException - Operation not supported.

setReference

public void setReference(Reference reference)
Sets the Reference instance. This method is called by the deployment code to set the Reference that can be later returned by the getReference method (as defined in the javax.naming.Referenceable interface).

Specified by:
setReference in interface Referenceable
Parameters:
reference - - A Reference instance.

getReference

public Reference getReference()
                       throws NamingException
Retrieves the Reference of this object.

Specified by:
getReference in interface Referenceable
Returns:
The non-null Reference of this object.
Throws:
NamingException - If a naming exception was encountered while retrieving the reference.

Email Answering System
Version 1.0

Copyright © 2003 Derrick Oswald. All rights reserved.