org.jcoderz.commons.connector.file
Class FsManagedConnectionImpl

java.lang.Object
  extended by org.jcoderz.commons.connector.file.FsManagedConnectionImpl
All Implemented Interfaces:
ManagedConnection, ConnectionNotificationListener

public class FsManagedConnectionImpl
extends Object
implements ManagedConnection, ConnectionNotificationListener

This Managed Connection is the factory for a File System Connction. The File System Connector is not transactional, so the methods getLocalTransaction() and getXAResource() always throw the NotSupportedException.


Constructor Summary
FsManagedConnectionImpl(ManagedConnectionFactory mcf, UserPassword up, ConnectionRequestInfo cri)
          Constructor.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener cel)
          
 void associateConnection(Object connection)
          
 void cleanup()
          
 void destroy()
          
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 Object getConnection(Subject subject, ConnectionRequestInfo cri)
          
 LocalTransaction getLocalTransaction()
          Always throws the NotSupportedException.
 PrintWriter getLogWriter()
          
 ManagedConnectionMetaData getMetaData()
          
 XAResource getXAResource()
          Always throws the NotSupportedException.
 int hashCode()
          
 void notifyConnectionClosed(Object source)
          Notifies the listener, that the connection handle has been closed.
 void notifyConnectionDissociated(Object source)
          Notifies the listener, that the connection handle has been dissociated from the underlying managed connection.
 void notifyConnectionErrorOccurred(Object source, Exception e)
          Notifies the listener, that an error has been occured.
 void removeConnectionEventListener(ConnectionEventListener cel)
          
 void setLogWriter(PrintWriter pw)
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FsManagedConnectionImpl

public FsManagedConnectionImpl(ManagedConnectionFactory mcf,
                               UserPassword up,
                               ConnectionRequestInfo cri)
Constructor.

Parameters:
mcf - The underlying ManagedConnectionFactory
up - The UserPassword to be used.
cri - Connection Request Info
Method Detail

getConnection

public Object getConnection(Subject subject,
                            ConnectionRequestInfo cri)
                     throws ResourceException

Specified by:
getConnection in interface ManagedConnection
Throws:
ResourceException

destroy

public void destroy()
             throws ResourceException

Specified by:
destroy in interface ManagedConnection
Throws:
ResourceException

cleanup

public void cleanup()
             throws ResourceException

Specified by:
cleanup in interface ManagedConnection
Throws:
ResourceException

associateConnection

public void associateConnection(Object connection)
                         throws ResourceException

Specified by:
associateConnection in interface ManagedConnection
Throws:
ResourceException

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener cel)

Specified by:
addConnectionEventListener in interface ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener cel)

Specified by:
removeConnectionEventListener in interface ManagedConnection

getXAResource

public XAResource getXAResource()
                         throws ResourceException
Always throws the NotSupportedException. The File System Connector does not support any XA Transaction.

Specified by:
getXAResource in interface ManagedConnection
Returns:
never return.
Throws:
ResourceException - Always thrown.
See Also:
ManagedConnection.getXAResource()

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Always throws the NotSupportedException. The File System Connector does not support any Local Transaction.

Specified by:
getLocalTransaction in interface ManagedConnection
Returns:
never return.
Throws:
ResourceException - Always thrown.
See Also:
ManagedConnection.getLocalTransaction()

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException

Specified by:
getMetaData in interface ManagedConnection
Throws:
ResourceException

setLogWriter

public void setLogWriter(PrintWriter pw)
                  throws ResourceException

Specified by:
setLogWriter in interface ManagedConnection
Throws:
ResourceException

getLogWriter

public PrintWriter getLogWriter()
                         throws ResourceException

Specified by:
getLogWriter in interface ManagedConnection
Throws:
ResourceException

notifyConnectionClosed

public void notifyConnectionClosed(Object source)
Notifies the listener, that the connection handle has been closed.

Specified by:
notifyConnectionClosed in interface ConnectionNotificationListener
Parameters:
source - The object that sends this notification.

notifyConnectionErrorOccurred

public void notifyConnectionErrorOccurred(Object source,
                                          Exception e)
Notifies the listener, that an error has been occured.

Specified by:
notifyConnectionErrorOccurred in interface ConnectionNotificationListener
Parameters:
source - The object that sends this notification.
e - The exception caused this notification.

notifyConnectionDissociated

public void notifyConnectionDissociated(Object source)
Notifies the listener, that the connection handle has been dissociated from the underlying managed connection.

Specified by:
notifyConnectionDissociated in interface ConnectionNotificationListener
Parameters:
source - The object that sends this notification.

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to.
Returns:
true if this object is the same as the obj argument; false otherwise.


Copyright 2007 The jCoderZ Project.