com.ibm.connector2.hod
Class J2HODBaseManagedConnectionFactory

java.lang.Object
  |
  +--com.ibm.connector2.hod.J2HODBaseManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, java.io.Serializable
Direct Known Subclasses:
J2HOD3270ManagedConnectionFactory, J2HOD5250ManagedConnectionFactory, J2HODCICSManagedConnectionFactory, J2HODVTManagedConnectionFactory

public class J2HODBaseManagedConnectionFactory
extends java.lang.Object
implements java.io.Serializable, javax.resource.spi.ManagedConnectionFactory

This is a base class for other ManagedConnectionFactory classes.

Properties

The following table lists the base properties for all 3270, 5250, CICS and VT managed connection factories:

Property Name Type

Default

Access
ConnectionTimeout Integer 60000 get/set
LogonLogoffClassName String "" get/set
Password String "" get/set
PortNumber Integer ECLSession.SESSION_3270_HOST_PORT_DEFAULT get/set
PortNumberBackup1 Integer ECLSession.SESSION_3270_HOST_PORT_DEFAULT get/set
PortNumberBackup2 Integer ECLSession.SESSION_3270_HOST_PORT_DEFAULT get/set
Reauthentication Boolean true get/set
ServerName String "" get/set
ServerNameBackup1 String "" get/set
ServerNameBackup2 String "" get/set
SessionName String "" get/set
Security Boolean false get/set
SecurityProtocol String SESSION_PROTOCOL_TELNET get/set
SSLServerAuthentication Boolean false get/set
TraceLevel Integer RAS_TRACE_ERROR_EXCEPTION get/set
UserName String "" get/set

See Also:
Serialized Form

Field Summary
static int CONNECTION_TIMEOUT_DEFAULT
          Default connection time out value in milliseconds
static int RAS_TRACE_ENTRY_EXIT
          Define for tracelevel - Entry/exit trace
static int RAS_TRACE_ERROR_EXCEPTION
          Define for tracelevel - Error exception trace
static int RAS_TRACE_INTERNAL
          Define for tracelevel - HOD Connector internal trace
static int RAS_TRACE_INTERNAL_NATIVE
          Define for tracelevel - HOD native internal trace
static int RAS_TRACE_OFF
          Define for tracelevel - Trace turned off
 
Constructor Summary
J2HODBaseManagedConnectionFactory()
          J2HODBaseManagedConnectionFactory constructor.
 
Method Summary
 java.lang.Object createConnectionFactory()
          Creates a Connection Factory instance.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
          Creates a Connection Factory instance.
 boolean equals(java.lang.Object obj)
          Check to see if this ManagedConnectionFactory is equal to another ManagedConnectionFactory, based on server names, port numbers and logonLogoffClassName.
 java.lang.Integer getConnectionTimeout()
          Gets the connectionTimeout property (java.lang.Integer) value.
 java.lang.String getLogonLogoffClassName()
          Gets the logonLogoffClassName property (java.lang.String) value.
 java.io.PrintWriter getLogWriter()
          Gets a logWriter.
 java.lang.String getPassword()
          Gets the password property (java.lang.String) value.
 java.lang.Integer getPortNumber()
          Gets the portNumber property (java.lang.Integer) value.
 java.lang.Integer getPortNumberBackup1()
          Gets the portNumberBackup1 property (java.lang.Integer) value.
 java.lang.Integer getPortNumberBackup2()
          Gets the portNumberBackup2 property (java.lang.Integer) value.
 java.lang.Boolean getReauthentication()
          Gets the reauthentication (Boolean) value.
 java.lang.Boolean getSecurity()
          Gets the security property (java.lang.Boolean) value.
 java.lang.String getSecurityProtocol()
          Gets the security protocol property (java.lang.String) value.
 java.lang.String getServerName()
          Gets the serverName property (java.lang.String) value.
 java.lang.String getServerNameBackup1()
          Gets the serverNameBackup1 property (java.lang.String) value.
 java.lang.String getServerNameBackup2()
          Gets the serverNameBackup2 property (java.lang.String) value.
 java.lang.String getSessionName()
          Gets the sessionName property (java.lang.String) value.
 java.lang.Boolean getSSLServerAuthentication()
          Gets the SSLServerAuthentication property (java.lang.Boolean) value.
 java.lang.Integer getTraceLevel()
          Gets the traceLevel property (java.lang.Integer) value.
 java.lang.String getUserName()
          Gets the userName property (java.lang.String) value.
 int hashCode()
          Returns the hash code (serverName + portNumber) for the ManagedConnectionFactory.
 java.lang.Boolean isReauthentication()
          Gets the reauthentication (Boolean) value.
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo)
          This method selects the matching ManagedConnection from the candidate set provided by the caller.
 void setConnectionTimeout(java.lang.Integer connectionTimeout)
          Sets the connectionTimeout property (java.lang.Integer) value.
 void setLogonLogoffClassName(java.lang.String logonLogoffClassName)
          Sets the logonLogoffClassName property (java.lang.String) value.
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer for this ManagedConnectionFactory instance.
 void setPassword(java.lang.String password)
          Sets the password property (java.lang.String) value.
 void setPortNumber(java.lang.Integer portNumber)
          Sets the portNumber property (java.lang.Integer) value.
 void setPortNumberBackup1(java.lang.Integer portNumber)
          Sets the portNumberBackup1 property (java.lang.Integer) value.
 void setPortNumberBackup2(java.lang.Integer portNumber)
          Sets the portNumberBackup2 property (java.lang.Integer) value.
 void setReauthentication(java.lang.Boolean newReauthentication)
          Sets the reauthentication property (java.lang.Boolean) value.
 void setSecurity(java.lang.Boolean secure)
          Sets the Security property (java.lang.Boolean) value.
 void setSecurityProtocol(java.lang.String sProtocol)
          Sets the SecurityProtocol property (java.lang.Boolean) value.
 void setServerName(java.lang.String serverName)
          Sets the serverName property (java.lang.String) value.
 void setServerNameBackup1(java.lang.String serverName)
          Sets the serverNameBackup1 property (java.lang.String) value.
 void setServerNameBackup2(java.lang.String serverName)
          Sets the serverNameBackup2 property (java.lang.String) value.
 void setSessionName(java.lang.String sessionName)
          Sets the sessionName property (java.lang.String) value.
 void setSessionProperties(java.util.Properties p)
          Sets Session (a Display Session) properties.
 void setSSLServerAuthentication(java.lang.Boolean SSLServerAuthentication)
          Sets the SSLServerAuthentication property (java.lang.Boolean) value.
 void setTraceLevel(java.lang.Integer traceLevel)
          Sets the traceLevel property (java.lang.Integer) value.
 void setUserName(java.lang.String userName)
          Sets the userName property (java.lang.String) value.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
createManagedConnection
 

Field Detail

RAS_TRACE_OFF

public static final int RAS_TRACE_OFF
Define for tracelevel - Trace turned off

RAS_TRACE_ERROR_EXCEPTION

public static final int RAS_TRACE_ERROR_EXCEPTION
Define for tracelevel - Error exception trace

RAS_TRACE_ENTRY_EXIT

public static final int RAS_TRACE_ENTRY_EXIT
Define for tracelevel - Entry/exit trace

RAS_TRACE_INTERNAL

public static final int RAS_TRACE_INTERNAL
Define for tracelevel - HOD Connector internal trace

RAS_TRACE_INTERNAL_NATIVE

public static final int RAS_TRACE_INTERNAL_NATIVE
Define for tracelevel - HOD native internal trace

CONNECTION_TIMEOUT_DEFAULT

public static final int CONNECTION_TIMEOUT_DEFAULT
Default connection time out value in milliseconds
Constructor Detail

J2HODBaseManagedConnectionFactory

public J2HODBaseManagedConnectionFactory()
J2HODBaseManagedConnectionFactory constructor.
Method Detail

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with a default ConnectionManager provided by the resource adapter.
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Returns:
Object - J2HODConnectionFactory instance
Throws:
javax.resource.ResourceException - - generic exception

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with the passed ConnectionManager. In the managed scenario, ConnectionManager is provided by the application server.
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cxManager - javax.resource.spi.ConnectionManager - ConnectionManager to be associated with created J2HODConnectionFactory instance
Returns:
J2HODConnectionFactory instance
Throws:
javax.resource.ResourceException - generic exception

getServerName

public java.lang.String getServerName()
Gets the serverName property (java.lang.String) value.
Returns:
String - The serverName property value.
See Also:
setServerName(java.lang.String)

getServerNameBackup1

public java.lang.String getServerNameBackup1()
Gets the serverNameBackup1 property (java.lang.String) value. When connecting to the serverName fails, this backup server will be used for the connection.
Returns:
String - The serverNameBackup1 property value.
See Also:
setServerNameBackup1(java.lang.String)

getServerNameBackup2

public java.lang.String getServerNameBackup2()
Gets the serverNameBackup2 property (java.lang.String) value. When connecting to the serverNameBackup1 fails, this backup server will be used for the connection.
Returns:
String - The serverNameBackup2 property value.
See Also:
setServerNameBackup2(java.lang.String)

getLogonLogoffClassName

public java.lang.String getLogonLogoffClassName()
Gets the logonLogoffClassName property (java.lang.String) value.
Returns:
The logonLogoffClassName property value.
See Also:
setLogonLogoffClassName(java.lang.String)

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Gets a logWriter.
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException -  
See Also:
setLogWriter(java.io.PrintWriter)

getPassword

public java.lang.String getPassword()
Gets the password property (java.lang.String) value.
Returns:
java.lang.String - The password property value
See Also:
setPassword(java.lang.String)

getPortNumber

public java.lang.Integer getPortNumber()
Gets the portNumber property (java.lang.Integer) value.
Returns:
java.lang.Integer - The portNumber property value
See Also:
setPortNumber(java.lang.Integer)

getPortNumberBackup1

public java.lang.Integer getPortNumberBackup1()
Gets the portNumberBackup1 property (java.lang.Integer) value. This port number is associated with serverNameBackup1.
Returns:
java.lang.Integer - The portNumberBackup1 property value
See Also:
setPortNumberBackup1(java.lang.Integer)

getPortNumberBackup2

public java.lang.Integer getPortNumberBackup2()
Gets the portNumberBackup2 property (java.lang.Integer) value. This port number is associated with serverNameBackup2.
Returns:
java.lang.Integer - The portNumberBackup2 property value
See Also:
setPortNumberBackup2(java.lang.Integer)

getSessionName

public java.lang.String getSessionName()
Gets the sessionName property (java.lang.String) value.
Returns:
java.lang.String - The sessionName property value
See Also:
setSessionName(java.lang.String)

getSecurity

public java.lang.Boolean getSecurity()
Gets the security property (java.lang.Boolean) value. True = Enabled, False = Disabled. Only when security property is enabled, SecurityProtocol will be used.
Returns:
java.lang.Boolean - Security enabled or disabled
See Also:
setSecurity(java.lang.Boolean)

getSecurityProtocol

public java.lang.String getSecurityProtocol()
Gets the security protocol property (java.lang.String) value. ECLSession.SESSION_PROTOCOL_TELNET = Telnet, ECLSession.SESSION_PROTOCOL_TLS = TLS, ECLSession.SESSION_PROTOCOL_SSL = SSL.
Returns:
java.lang.String - Security Protocol (TLS or SSL)
See Also:
setSecurityProtocol(java.lang.String)

getSSLServerAuthentication

public java.lang.Boolean getSSLServerAuthentication()
Gets the SSLServerAuthentication property (java.lang.Boolean) value.
Returns:
java.lang.Boolean - The SSLServerAuthentication property value
See Also:
setSSLServerAuthentication(java.lang.Boolean)

getTraceLevel

public java.lang.Integer getTraceLevel()
Gets the traceLevel property (java.lang.Integer) value.
Returns:
java.lang.Integer - The traceLevel property value
See Also:
setTraceLevel(java.lang.Integer)

getUserName

public java.lang.String getUserName()
Gets the userName property (java.lang.String) value.
Returns:
java.lang.String - The userName property value
See Also:
setUserName(java.lang.String)

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo requestInfo)
                                                             throws javax.resource.ResourceException
This method selects the matching ManagedConnection from the candidate set provided by the caller. It is intended as a sample and shows all the possible matching criteria. The general structure of the method is as follows

a) Connector does not support reauthentication i.e. the security info of the existing managed connection and the security info of the request have to match. The request security info can be read either from the Subject or the ConnectionRequestInfo. This value is compared with the security info of the ManagedConnection from the candidate set. If there is no match, method returns null to the caller. If the match is found, the next step is to match remining properties of the ConnectionRequestInfo. The Connector has the knowledge to verify that particluar value of the property can be overwritten so after finding compatible properties the ManagedConnection is returned to the caller. If there is no match or properties are not 'compatible', the method returns null. In case when ConnectionRequestInfo and Subject are null, the security info and properties of the ManagedConnections from the candidate set are compared with the default values of the ManagedConnectionFactory. If there is a match, the ManagedConnection is returned to the caller, otherwise null is returned.

b) Connector supports reauthentication - only properties from the ConnectionRequestInfo have to match. The Connector has the knowledge to verify that particluar value of the property can be overwritten so if it finds compatible properties, it overwrites them and then returns ManagedConnection to the caller. If there is no match or properties are not 'compatible', the method returns null. In case when ConnectionRequestInfo is null, the security info and properties of the ManagedConnections from the candidate set are compared with the default values of the ManagedConnectionFactory. If there is a match, the ManagedConnection is returned to the caller, otherwise null is returned.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
connectionSet - java.util.Set - candidate connection set
subject - javax.security.auth.Subject - caller's security information
requestInfo - ConnectionRequestInfo - additional resource adapter specific connection request information
Returns:
javax.resource.spi.ManagedConnection - J2HODConnectionFactory instance
Throws:
javax.resource.ResourceException - - generic exception
java.lang.IllegalStateException - - illegal state exception

setServerName

public void setServerName(java.lang.String serverName)
Sets the serverName property (java.lang.String) value.
Parameters:
serverName - java.lang.String - The new value for the property
See Also:
getServerName()

setServerNameBackup1

public void setServerNameBackup1(java.lang.String serverName)
Sets the serverNameBackup1 property (java.lang.String) value. When connecting to the serverName fails, this backup server will be used for the connection.
Parameters:
serverName - java.lang.String - The new value for the property
See Also:
getServerNameBackup1()

setServerNameBackup2

public void setServerNameBackup2(java.lang.String serverName)
Sets the serverNameBackup2 property (java.lang.String) value. When connecting to the serverName1 fails, this backup server will be used for the connection.
Parameters:
serverNameBackup2 - java.lang.String - The new value for the property
See Also:
getServerNameBackup2()

setLogonLogoffClassName

public void setLogonLogoffClassName(java.lang.String logonLogoffClassName)
Sets the logonLogoffClassName property (java.lang.String) value.
Parameters:
logonLogoffClassName - java.lang.String - The new value for the property
See Also:
getLogonLogoffClassName()

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Sets the log writer for this ManagedConnectionFactory instance.

The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionfactory instance will be printed.

ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
out - java.io.PrintWriter - an out stream for error logging and tracing
Throws:
javax.resource.ResourceException - - generic exception
See Also:
getLogWriter()

setPassword

public void setPassword(java.lang.String password)
Sets the password property (java.lang.String) value.
Parameters:
password - java.lang.String - The new value for the property
See Also:
getPassword()

setPortNumber

public void setPortNumber(java.lang.Integer portNumber)
Sets the portNumber property (java.lang.Integer) value.
Parameters:
portNumber - java.lang.Integer - The new value for the property
See Also:
getPortNumber()

setPortNumberBackup1

public void setPortNumberBackup1(java.lang.Integer portNumber)
Sets the portNumberBackup1 property (java.lang.Integer) value. This port number is associated with serverNameBackup1.
Parameters:
portNumber - java.lang.Integer - The new value for the property
See Also:
getPortNumberBackup1()

setPortNumberBackup2

public void setPortNumberBackup2(java.lang.Integer portNumber)
Sets the portNumberBackup2 property (java.lang.Integer) value. This port number is associated with serverNameBackup2.
Parameters:
portNumber - java.lang.Integer - The new value for the property
See Also:
getPortNumberBackup2()

setSessionName

public void setSessionName(java.lang.String sessionName)
Sets the sessionName property (java.lang.String) value.
Parameters:
sessionName - java.lang.String - The new value for the property
See Also:
getSessionName()

setSecurity

public void setSecurity(java.lang.Boolean secure)
Sets the Security property (java.lang.Boolean) value. This property is not used in CICS Resource Adapter.
Parameters:
secure - java.lang.Boolean - The new value for the property
See Also:
getSecurity()

setSecurityProtocol

public void setSecurityProtocol(java.lang.String sProtocol)
Sets the SecurityProtocol property (java.lang.Boolean) value. Security property must be set to true in order for this security protocol to be used. Valid values are: ECLSession.SESSION_PROTOCOL_TELNET ("SESSION_PROTOCOL_TELNET"), ECLSession.SESSION_PROTOCOL_TLS ("SESSION_PROTOCOL_TLS"), ECLSession.SESSION_PROTOCOL_SSL ("SESSION_PROTOCOL_SSL") or ECLSession.SESSION_PROTOCOL_SSH ("SESSION_PROTOCOL_SSH"). This property is not used in CICS Resource Adapter.
Parameters:
sProtocol - java.lang.Boolean - The new value for the property
See Also:
getSecurityProtocol()

setSSLServerAuthentication

public void setSSLServerAuthentication(java.lang.Boolean SSLServerAuthentication)
Sets the SSLServerAuthentication property (java.lang.Boolean) value.
Parameters:
SSLServerAuthentication - java.lang.Boolean - The new value for the property
See Also:
getSSLServerAuthentication()

setTraceLevel

public void setTraceLevel(java.lang.Integer traceLevel)
Sets the traceLevel property (java.lang.Integer) value. Valid levels are from 1 to 4.
Parameters:
traceLevel - java.lang.Integer - The new trace level value for the property
See Also:
getTraceLevel()

setUserName

public void setUserName(java.lang.String userName)
Sets the userName property (java.lang.String) value.
Parameters:
userName - java.lang.String - The new user name value for the property
See Also:
getUserName()

equals

public boolean equals(java.lang.Object obj)
Check to see if this ManagedConnectionFactory is equal to another ManagedConnectionFactory, based on server names, port numbers and logonLogoffClassName.
Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object - the Object to compare with
Returns:
boolean - true if these Objects are equal; false otherwise.

getConnectionTimeout

public java.lang.Integer getConnectionTimeout()
Gets the connectionTimeout property (java.lang.Integer) value.
Returns:
java.lang.Integer - The connectionTimeout property value.
See Also:
setConnectionTimeout(java.lang.Integer)

hashCode

public int hashCode()
Returns the hash code (serverName + portNumber) for the ManagedConnectionFactory.
Specified by:
hashCode in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
hashCode in class java.lang.Object
Returns:
int - hash code for the ManagedConnectionFactory

isReauthentication

public java.lang.Boolean isReauthentication()
Gets the reauthentication (Boolean) value.
Returns:
Boolean - The reauthentication value
See Also:
setReauthentication(java.lang.Boolean)

getReauthentication

public java.lang.Boolean getReauthentication()
Gets the reauthentication (Boolean) value.
Returns:
Boolean - The reauthentication value
See Also:
setReauthentication(java.lang.Boolean)

setConnectionTimeout

public void setConnectionTimeout(java.lang.Integer connectionTimeout)
Sets the connectionTimeout property (java.lang.Integer) value.
Parameters:
connectionTimeout - java.lang.Integer - The new connection timeout value for the property
See Also:
getConnectionTimeout()

setReauthentication

public void setReauthentication(java.lang.Boolean newReauthentication)
Sets the reauthentication property (java.lang.Boolean) value.
Parameters:
newReauthentication - Boolean - The new value for the property
See Also:
isReauthentication()

setSessionProperties

public void setSessionProperties(java.util.Properties p)
Sets Session (a Display Session) properties. It is used to over-write properties for a session. It should be called from an application level.
Parameters:
p - java.util.Properties - Session bean properties