com.infoengine.connector
Class IeManagedConnectionFactory

java.lang.Object
  extended bycom.infoengine.connector.IeManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, Serializable

public class IeManagedConnectionFactory
extends Object
implements javax.resource.spi.ManagedConnectionFactory

this object typically interacts with an application server for creating ConnectionFactories and ManagedConnections and to match ManagedConnections for connection requests with pooled ManagedConnections.

See Also:
Serialized Form

Field Summary
protected  PropertyChangeSupport changes
           
private  IeConnectionRequestInfo cxInfo
           
private  Log log
           
private  PrintWriter logWriter
           
protected  VetoableChangeSupport vetos
           
 
Constructor Summary
IeManagedConnectionFactory()
           
 
Method Summary
 Object createConnectionFactory()
          create a default ConnectionFactory for us in a "non managed" environment.
 Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
          create a ConnectionFactory with a specific ConnectionManager.
 javax.resource.spi.ManagedConnection createManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          create a new managed connection
 boolean equals(Object other)
          compare this ManagedConnectionFactory to another for equality
 String getConnectionImplementation()
          get the connection implementation this ManagedConnectionFactory uses when creating ConnectionFactories
 String getConnectionProperties()
          get the connection implementation this ManagedConnectionFactory uses when creating ConnectionFactories
 String getLogLevel()
          get the log level
 PrintWriter getLogWriter()
          get the PrintWriter instance this ManagedConnectionFactory is using
 int hashCode()
          generate this objects hashCode.
 void loadConnectionProperties(InputStream is)
          load connection properties from an input stream
 javax.resource.spi.ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          given a set of ManagedConnections return one that matches the subject and connection request info criteria.
 void setConnectionImplementation(String impl)
          set the connection implementation this ManagedConnectionFactory is to use when producing ConnectionFactories.
 void setConnectionProperties(String props)
          set the connection implementation this ManagedConnectionFactory is to use when producing ConnectionFactories.
 void setConnectionProperty(String name, String value)
          set a single connection property
 void setLogLevel(String level)
          set the log level.
 void setLogWriter(PrintWriter out)
          set the PrintWriter this ManagedConnectionFactory should use to log info
(package private)  void setRequestInfo(IeConnectionRequestInfo info)
          for use in non-managed scenario to propogate default connection request info back...
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changes

protected PropertyChangeSupport changes

vetos

protected VetoableChangeSupport vetos

cxInfo

private IeConnectionRequestInfo cxInfo

logWriter

private PrintWriter logWriter

log

private Log log
Constructor Detail

IeManagedConnectionFactory

public IeManagedConnectionFactory()
Method Detail

createConnectionFactory

public Object createConnectionFactory()
                               throws javax.resource.ResourceException
create a default ConnectionFactory for us in a "non managed" environment.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Returns:
Object (IeConnectionFactory)
Throws:
javax.resource.ResourceException

createConnectionFactory

public Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
                               throws javax.resource.ResourceException
create a ConnectionFactory with a specific ConnectionManager. used in a "managed" environment. the ConnectionManager here is implemented by the application server vendor.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cxManager - a connection manager
Returns:
Object (IeConnectionFactory)
Throws:
javax.resource.ResourceException - if something bad happens

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                             throws javax.resource.ResourceException
create a new managed connection

Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
subject - security credentials supplied in a "container managed sign on" scenario.
cxRequestInfo - connection request info supplied by appication
Returns:
ManagedConnection
Throws:
javax.resource.ResourceException - if something bad happens

equals

public boolean equals(Object other)
compare this ManagedConnectionFactory to another for equality

Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory
Returns:
other object to compare to

getLogWriter

public PrintWriter getLogWriter()
                         throws javax.resource.ResourceException
get the PrintWriter instance this ManagedConnectionFactory is using

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Returns:
PrintWriter
Throws:
javax.resource.ResourceException - (not really)

hashCode

public int hashCode()
generate this objects hashCode. based on connection request info.

Specified by:
hashCode in interface javax.resource.spi.ManagedConnectionFactory
Returns:
int

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(Set connectionSet,
                                                                    Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                                                             throws javax.resource.ResourceException
given a set of ManagedConnections return one that matches the subject and connection request info criteria. This method is called by a ConnectionManager to find a free connection to fulfill a connection request. Objects in connectionSet must be instances of IeManagedConnection.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
connectionSet - set of ManagedConnections
subject - security credentials in connection request
cxRequestInfo - connection request info in connection request
Returns:
ManagedConnection or null if no suitable connection found
Throws:
javax.resource.ResourceException - (not really)

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws javax.resource.ResourceException
set the PrintWriter this ManagedConnectionFactory should use to log info

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
out - the PrintWriter
Throws:
javax.resource.ResourceException - (not really)

setRequestInfo

void setRequestInfo(IeConnectionRequestInfo info)
for use in non-managed scenario to propogate default connection request info back...

Parameters:
info -

setConnectionImplementation

public void setConnectionImplementation(String impl)
                                 throws PropertyVetoException
set the connection implementation this ManagedConnectionFactory is to use when producing ConnectionFactories. The app server may call this method to populate this deploy time property.

Parameters:
impl - the connection implementation
Throws:
PropertyVetoException - if someone doesn't like the new value

getConnectionImplementation

public String getConnectionImplementation()
get the connection implementation this ManagedConnectionFactory uses when creating ConnectionFactories

Returns:
String

loadConnectionProperties

public void loadConnectionProperties(InputStream is)
                              throws IOException
load connection properties from an input stream

Parameters:
is - the property input stream
Throws:
IOException

setConnectionProperty

public void setConnectionProperty(String name,
                                  String value)
set a single connection property

Parameters:
name - the property name
value - the property value

setConnectionProperties

public void setConnectionProperties(String props)
                             throws PropertyVetoException
set the connection implementation this ManagedConnectionFactory is to use when producing ConnectionFactories. The app server may call this method to populate this deploy time property.

Throws:
PropertyVetoException - if someone doesn't like the new value

getConnectionProperties

public String getConnectionProperties()
get the connection implementation this ManagedConnectionFactory uses when creating ConnectionFactories

Returns:
String

setLogLevel

public void setLogLevel(String level)
                 throws PropertyVetoException
set the log level. the app server calls this method to set the deploy time property.

Parameters:
level - string representation of an integer
Throws:
PropertyVetoException - if someone doesn't like the new value

getLogLevel

public String getLogLevel()
get the log level

Returns:
String