|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.adapter.spi.AbstractManagedConnectionFactory
A ManagedConnectionFactory
creates physical connections to
the underlying EIS for the application server. A physical connection is
encapsulated by a ManagedConnection
instance. This class
encapsulates functionality that is generic across all types of adapters.
It provides the following features:
ResourceBundle
using the base message bundle
property.
Field Summary | |
protected char[] |
m_achPassword
Standard connection parameters; treated as optional |
protected PropertyChangeSupport |
m_changes
|
protected String |
m_strAdapterDescription
Basic adapter metadata; these come from a resource bundle |
protected String |
m_strAdapterName
Basic adapter metadata; these come from a resource bundle |
protected String |
m_strAdapterVendorName
Basic adapter metadata; these come from a resource bundle |
protected String |
m_strAdapterVersion
Basic adapter metadata; these come from a resource bundle |
protected String |
m_strAdditionalLogContext
This value associates "this" with an application component in the runtime environment. |
protected String |
m_strConnectionURL
Standard connection parameters; treated as optional |
protected String |
m_strCountryCode
Associates a country code for determining the locale for logging |
protected String |
m_strLanguageCode
Associates a language code for determining the locale for logging |
protected String |
m_strLogConfigFile
This value provides the name of the log configuration file |
protected String |
m_strLogLevel
Log level - warning by default |
protected String |
m_strMessageBundleBase
Base name for message bundle |
protected String |
m_strPortNumber
Standard connection parameters; treated as optional |
protected String |
m_strRootLogContext
Allows for the categorization of log messages for this adapter. |
protected String |
m_strServerName
Standard connection parameters; treated as optional |
protected String |
m_strUserName
Standard connection parameters; treated as optional |
protected VetoableChangeSupport |
m_vetos
|
Constructor Summary | |
AbstractManagedConnectionFactory()
Constructs a managed connection factory instance. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener l)
To support JavaBeans constrained properties |
void |
addVetoableChangeListener(VetoableChangeListener l)
To support JavaBeans constrained properties |
protected void |
appendField(StringBuffer sb,
String strPropertyName,
Object objValue)
|
protected void |
assertValidLicense()
Verifies the existence of a valid license for this adapter; if there is no valid license available, this method throws an exception to prevent the instantiation of a ManagedConnectionFactory object. |
protected void |
assertValidState()
Verifies that "this" is in a valid state that allows "this" to perform its factory responsibilities successfully. |
protected ValidationResult |
checkLicense()
Returns true if the adapter can locate a valid license in the runtime environment. |
protected boolean |
checkState()
Returns true if all the members of this class are set correctly. |
protected boolean |
compareCharArrays(char[] achMyProperty,
char[] achOtherProperty)
Compares two property arrays for equality. |
protected boolean |
comparePropertyValues(Object myProperty,
Object otherProperty)
Compares two properties for equality. |
Object |
createConnectionFactory()
This method is invoked in the non-managed case. |
Object |
createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
Creates an EIS-specific connection factory. |
protected abstract Object |
createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager,
String strAdapterName,
String strAdapterDescription,
String strAdapterVersion,
String strAdapterVendorName)
Creates a new instance of a connection factory using the supplied parameters. |
boolean |
equals(Object other)
|
String |
getAdapterDescription()
|
String |
getAdapterName()
|
String |
getAdapterVendor()
|
String |
getAdapterVersion()
|
String |
getAdditionalLogContext()
|
String |
getConnectionURL()
Retrieves the ConnectionURL; a "standard" connection property as suggested by the J2EE Connector Architecture |
String |
getCountryCode()
|
String |
getLanguageCode()
|
String |
getLogConfigFile()
|
protected LogContext |
getLogContext()
Retrieves an object that determines the logging configuration for this instance in the logging framework. |
protected ILogger |
getLogger()
Retrieves an object used to log information to. |
String |
getLogLevel()
|
PrintWriter |
getLogWriter()
|
String |
getMessageBundleBase()
|
String |
getPassword()
Retrieves the Password; a "standard" connection property as suggested by the J2EE Connector Architecture |
javax.resource.spi.security.PasswordCredential |
getPasswordCredential(Subject subject,
javax.resource.spi.ConnectionRequestInfo info)
Returns an object that encapsulates a user name and password, gathered from either the JAAS Subject object or the connection request info object. |
protected String |
getPasswordFromRequestInfo(javax.resource.spi.ConnectionRequestInfo info)
Retrieves the password from the supplied connection request info object. |
String |
getPortNumber()
Retrieves the PortNumber; a "standard" connection property as suggested by the J2EE Connector Architecture |
String |
getRootLogContext()
|
String |
getServerName()
Retrieves the ServerName; a "standard" connection property as suggested by the J2EE Connector Architecture. |
String |
getUserName()
Retrieves the UserName; a "standard" connection property as suggested by the J2EE Connector Architecture |
protected String |
getUserNameFromRequestInfo(javax.resource.spi.ConnectionRequestInfo info)
Retrieves the user name from the supplied connection request info object. |
int |
hashCode()
Calculates an integer code for use in lookup from hash tables. |
protected boolean |
hasSameBaseProperties(AbstractManagedConnectionFactory otherMcf)
Compares all the non-connection related properties provided by com.bea.adapter.spi.AbstractManagedConnectionFactory |
protected boolean |
hasSameConnectionProperties(AbstractManagedConnectionFactory otherMcf)
Adapter developers should override this method if they have connection properties other than the standard ones provided by this implementation. |
protected void |
initAdapterMetaData(ResourceBundle resourceBundle)
Retrieves metadata about the resource adapter from a message bundle. |
protected void |
initializeLogResources()
Initializes resources needed by this instance to support localized logging after all base member variables have been initialized correctly by the application server. |
protected boolean |
isValidState()
The application server creates an instance of this class and then calls the setter methods. |
protected void |
logInfo()
Writes information about 'this' instance to the underlying logger as a info message. |
javax.resource.spi.ManagedConnection |
matchManagedConnections(Set connectionSet,
Subject subject,
javax.resource.spi.ConnectionRequestInfo info)
This method gets called by the ConnectionManager to try to find a valid connection in the pool it is managing. |
void |
removePropertyChangeListener(PropertyChangeListener l)
To support JavaBeans constrained properties |
void |
removeVetoableChangeListener(VetoableChangeListener l)
To support JavaBeans constrained properties |
void |
setAdapterDescription(String strAdapterDescription)
Sets the adapter description; this overrides the setting provided by the message bundle for this instance if the adapter_description key is mapped to a value in the message bundle. |
void |
setAdapterName(String strAdapterName)
Sets the adapter name; this overrides the setting provided by the message bundle for this instance if the adapter_name key is mapped to a value in the message bundle. |
void |
setAdapterVendor(String strAdapterVendor)
Sets the adapter vendor; this overrides the setting provided by the message bundle for this instance if the adapter_vendor key is mapped to a value in the message bundle. |
void |
setAdapterVersion(String strAdapterVersion)
Sets the adapter version; this overrides the setting provided by the message bundle for this instance if the adapter_version key is mapped to a value in the message bundle. |
void |
setAdditionalLogContext(String strAdditionalLogContext)
Sets additional context information for identifying logging configuration. |
void |
setConnectionURL(String strConnectionURL)
Sets the ConnectionURL for connecting to the underlying EIS. |
void |
setCountryCode(String strCountryCode)
Sets the country code for enabling I18N log and exception messages from instances of this class. |
void |
setLanguageCode(String strLanguageCode)
Sets the language code for enabling I18N log and exception messages from instances of this class. |
void |
setLogConfigFile(String strLogConfigFile)
Sets the name for the log configuration file used by this instance. |
void |
setLogLevel(String strLogLevel)
Sets the log priority level for 'this' instance. |
void |
setLogWriter(PrintWriter out)
|
void |
setMessageBundleBase(String strMessageBundleBase)
Sets the base name for the message bundle used by this instance. |
void |
setPassword(String strPassword)
Sets the Password for connecting to the underlying EIS. |
void |
setPortNumber(String strPortNumber)
Sets the PortNumber for connecting to the underlying EIS. |
void |
setRootLogContext(String strRootLogContext)
Sets the root log context for this factory. |
void |
setServerName(String strServerName)
Sets the ServerName for connecting to the underlying EIS. |
void |
setUserName(String strUserName)
Sets the UserName for connecting to the underlying EIS. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory |
createManagedConnection |
Field Detail |
protected VetoableChangeSupport m_vetos
protected PropertyChangeSupport m_changes
protected String m_strRootLogContext
protected String m_strAdditionalLogContext
protected String m_strLogConfigFile
protected String m_strLogLevel
protected String m_strMessageBundleBase
protected String m_strLanguageCode
protected String m_strCountryCode
protected String m_strAdapterName
protected String m_strAdapterDescription
protected String m_strAdapterVersion
protected String m_strAdapterVendorName
protected String m_strUserName
protected char[] m_achPassword
protected String m_strServerName
protected String m_strPortNumber
protected String m_strConnectionURL
Constructor Detail |
public AbstractManagedConnectionFactory() throws javax.resource.ResourceException
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to initialize the managed connection factory instanceMethod Detail |
protected void assertValidLicense() throws javax.resource.ResourceException
ManagedConnectionFactory
object. Adapter
developers should override the checkLicense
method to perform
the adapter specific license check.
javax.resource.spi.ResourceAdapterInternalException
- - license verification failed for
this adapter.
javax.resource.ResourceException
checkLicense method
protected void assertValidState() throws javax.resource.ResourceException
javax.resource.ResourceException
- if an error occurs while determining if this
object is in a valid state; which may result from initializing the log
resources needed by this instance.protected boolean isValidState() throws javax.resource.ResourceException
javax.resource.spi.ConnectionFactory
instances
or javax.resource.spi.ManagedConnection
instances.
javax.resource.ResourceException
protected boolean checkState()
protected void initializeLogResources() throws javax.resource.ResourceException
javax.resource.ResourceException
- if this method fails to initialize the logging
framework or message bundle for this instance.protected ILogger getLogger() throws IllegalStateException
IllegalStateException
- if the log context is nullprotected LogContext getLogContext() throws IllegalStateException
IllegalStateException
- if the log context is null, i.e.
this object has not been initialized correctly.public void setLogLevel(String strLogLevel) throws javax.resource.ResourceException
javax.resource.ResourceException
public String getLogLevel()
public void setRootLogContext(String strRootLogContext) throws javax.resource.ResourceException
strRootLogContext
- - the root context from which all log messages
generated will be associated. This helps identify log messages according
to resource adapter type. Typically, this is related to the adapter/EIS
type, etc.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the root log context; the argument cannot be null or
"".public String getRootLogContext()
public void setAdditionalLogContext(String strAdditionalLogContext) throws javax.resource.ResourceException
strAdditionalLogContext
- - a value that provides additional context
information for this instance.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the additional context; the argument cannot be null or
"".public String getAdditionalLogContext()
public void setUserName(String strUserName) throws javax.resource.ResourceException
strUserName
- - a valid UserName for the underlying EIS.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the UserName; the argument cannot be null or empty "".public String getUserName()
public void setPassword(String strPassword) throws javax.resource.ResourceException
strPassword
- - a valid Password for the underlying EIS.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the Password; the argument cannot be null or empty "".public String getPassword()
public void setServerName(String strServerName) throws javax.resource.ResourceException
strServerName
- - a valid ServerName for the underlying EIS.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the ServerName; the argument cannot be null or empty "".public String getServerName()
public void setPortNumber(String strPortNumber) throws javax.resource.ResourceException
strPortNumber
- - a valid PortNumber for the underlying EIS.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the PortNumber; the argument cannot be null or empty "".public String getPortNumber()
public void setConnectionURL(String strConnectionURL) throws javax.resource.ResourceException
strConnectionURL
- - a valid ConnectionURL for the underlying EIS.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the ConnectionURL; the argument cannot be null or empty "".public String getConnectionURL()
public void setLanguageCode(String strLanguageCode) throws javax.resource.ResourceException
strLanguageCode
- - lowercase two-letter ISO-639 code.
javax.resource.ResourceException
- - if the parameter is null, empty, or is not
a valid lowercase two-letter ISO-639 code.public String getLanguageCode()
public void setCountryCode(String strCountryCode) throws javax.resource.ResourceException
strCountryCode
- - uppercase two-letter ISO-3166 code
javax.resource.ResourceException
- - if the parameter is null, empty, or is not
a valid uppercase two-letter ISO-3166 code.public String getCountryCode()
public void setMessageBundleBase(String strMessageBundleBase) throws javax.resource.ResourceException
strMessageBundleBase
- - a valid message bundle base name.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the MessageBundleBase; the argument cannot be null or empty "".public String getMessageBundleBase()
public void setLogConfigFile(String strLogConfigFile) throws javax.resource.ResourceException
strLogConfigFile
- - a valid message bundle base name.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to set the LogConfigFile; the argument cannot be null or empty "".public String getLogConfigFile()
protected void logInfo()
protected void initAdapterMetaData(ResourceBundle resourceBundle)
resourceBundle
- - provides internationalized and localized versions
of adapter metadata.protected String getUserNameFromRequestInfo(javax.resource.spi.ConnectionRequestInfo info)
java.util.Map
with the user name mapped to key "userName".
Adapter developers can override this method to process a connection
request info object that doesn't meet this criteria.
protected String getPasswordFromRequestInfo(javax.resource.spi.ConnectionRequestInfo info)
java.util.Map
with the password mapped to key "password".
Adapter developers can override this method to process a connection
request info object that doesn't meet this criteria.
public javax.resource.spi.security.PasswordCredential getPasswordCredential(Subject subject, javax.resource.spi.ConnectionRequestInfo info) throws javax.resource.ResourceException
javax.resource.ResourceException
protected ValidationResult checkLicense()
ValidationResult
object may or may not
have additional information associated with it. The additional information
is used to generate a "better" exception on a failed validation attempt.public Object createConnectionFactory() throws javax.resource.ResourceException
createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
- - an exceptional condition occured while
attempting to create a connection factory.public Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager) throws javax.resource.ResourceException
createConnectionFactory
in interface javax.resource.spi.ManagedConnectionFactory
connectionManager
- - the connection manager is the link into the
management services offered by an application server. This method
logs and throws a ResourceException
if the
ConnectionManager
parameter is null.
javax.resource.ResourceException
- - an exceptional condition occured while
attempting to create a connection factory.protected abstract Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager, String strAdapterName, String strAdapterDescription, String strAdapterVersion, String strAdapterVendorName) throws javax.resource.ResourceException
connectionManager
- - the connection manager for the factory; the
factory delegates to this object to link into quality of services provided
by the application server.strAdapterName
- - the name of the adapter; In CCI, a connection
factory is responsible for supplying metadata about a resource adapter.strAdapterDescription
- - a short description of the adapter's
purpose in life.strAdapterVersion
- - the current version of the running adapter.strAdapterVendorName
- - the producer of the adapter.
javax.resource.ResourceException
ConnectionFactoryImpl
,
LocalTransaction
public boolean equals(Object other)
equals
in interface javax.resource.spi.ManagedConnectionFactory
public int hashCode()
hashCode
in interface javax.resource.spi.ManagedConnectionFactory
protected boolean hasSameBaseProperties(AbstractManagedConnectionFactory otherMcf)
com.bea.adapter.spi.AbstractManagedConnectionFactory
protected boolean hasSameConnectionProperties(AbstractManagedConnectionFactory otherMcf)
protected boolean compareCharArrays(char[] achMyProperty, char[] achOtherProperty)
protected boolean comparePropertyValues(Object myProperty, Object otherProperty)
public void setLogWriter(PrintWriter out) throws javax.resource.ResourceException
setLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
public PrintWriter getLogWriter() throws javax.resource.ResourceException
getLogWriter
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
public String toString()
protected void appendField(StringBuffer sb, String strPropertyName, Object objValue)
public final String getAdapterName()
public final void setAdapterName(String strAdapterName) throws javax.resource.ResourceException
javax.resource.ResourceException
public final String getAdapterDescription()
public final void setAdapterDescription(String strAdapterDescription) throws javax.resource.ResourceException
javax.resource.ResourceException
public final String getAdapterVersion()
public final void setAdapterVersion(String strAdapterVersion) throws javax.resource.ResourceException
javax.resource.ResourceException
public final String getAdapterVendor()
public final void setAdapterVendor(String strAdapterVendor) throws javax.resource.ResourceException
javax.resource.ResourceException
public javax.resource.spi.ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, javax.resource.spi.ConnectionRequestInfo info) throws javax.resource.ResourceException
connectionSet
, for each object in the
set (until a match is found) it determines if it is an AbstractManagedConnection.
If it is, then this is compared to the ManagedConnectionFactory for the
AbstractManagedConnection from the set. If the factories are equal, then
the compareCredentials method is invoked on the AbstractManagedConnection
If this method returns true, then the instance is returned.
matchManagedConnections
in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException
public void addVetoableChangeListener(VetoableChangeListener l)
public void removeVetoableChangeListener(VetoableChangeListener l)
public void addPropertyChangeListener(PropertyChangeListener l)
public void removePropertyChangeListener(PropertyChangeListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |