Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql.ra
Class ManagedConnectionFactoryImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.ra.ManagedConnectionFactoryImpl
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, RepositoryManagement

public class ManagedConnectionFactoryImpl
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, RepositoryManagement

The managed connection factory receives requests from the application server to create new ManagedConnection (the physical connection).

It also is a factory for ConnectionFactorys.

Author:
Florent Guillaume
See Also:
Serialized Form

Constructor Summary
ManagedConnectionFactoryImpl()
           
ManagedConnectionFactoryImpl(RepositoryDescriptor repositoryDescriptor)
           
 
Method Summary
 void activateServer()
          Activates the VCS server used for remote connections.
 int clearCaches()
          Clears all the caches.
 java.lang.Object createConnectionFactory()
           
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
           
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
           
 void deactivateServer()
          Deactivates the VCS server used for remote connections.
 int getActiveSessionsCount()
          Gets the number of active sessions.
 java.util.Collection<MapperClientInfo> getClientInfos()
          Get info about current VCS server clients
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getName()
          Gets the repository name.
 java.lang.String getProperty()
           
 javax.resource.spi.ResourceAdapter getResourceAdapter()
           
 java.lang.String getServerURL()
          Which is the remote location ?
 java.lang.String getXaDataSource()
           
 boolean isServerActivated()
          Is the server available remotely ?
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Returns a matched connection from the candidate set of connections.
static java.util.Map<java.lang.String,java.lang.String> parseProperties(java.lang.String expr)
          Parses a string of the form: key1=val1;key2=val2;...
 void processClusterInvalidationsNext()
          Makes sure that the next transaction will process cluster invalidations.
 void setLogWriter(java.io.PrintWriter out)
           
 void setName(java.lang.String name)
           
 void setProperty(java.lang.String property)
          Properties are specified in the format key=val1[;key2=val2;...]
 void setResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter)
          Called by the application server exactly once to associate this ManagedConnectionFactory with a ResourceAdapter.
 void setXaDataSource(java.lang.String xaDataSourceName)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
equals, hashCode
 

Constructor Detail

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl()

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl(RepositoryDescriptor repositoryDescriptor)
Method Detail

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()
Description copied from interface: RepositoryManagement
Gets the repository name.

Specified by:
getName in interface RepositoryManagement

setXaDataSource

public void setXaDataSource(java.lang.String xaDataSourceName)

getXaDataSource

public java.lang.String getXaDataSource()

setProperty

public void setProperty(java.lang.String property)
Properties are specified in the format key=val1[;key2=val2;...]

If a value has to contain a semicolon, it can be escaped by doubling it.

Parameters:
property -
See Also:
parseProperties(String)

getProperty

public java.lang.String getProperty()

setResourceAdapter

public void setResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter)
                        throws javax.resource.ResourceException
Called by the application server exactly once to associate this ManagedConnectionFactory with a ResourceAdapter. The ResourceAdapter may then be used to look up configuration.

Specified by:
setResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation
Throws:
javax.resource.ResourceException

getResourceAdapter

public javax.resource.spi.ResourceAdapter getResourceAdapter()
Specified by:
getResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager connectionManager)
                                         throws javax.resource.ResourceException
Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
                                                             throws javax.resource.ResourceException
Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cri)
                                                             throws javax.resource.ResourceException
Returns a matched connection from the candidate set of connections.

Called by the application server when it's looking for an appropriate connection to server from a pool.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getActiveSessionsCount

public int getActiveSessionsCount()
Description copied from interface: RepositoryManagement
Gets the number of active sessions.

Specified by:
getActiveSessionsCount in interface RepositoryManagement

clearCaches

public int clearCaches()
Description copied from interface: RepositoryManagement
Clears all the caches.

Specified by:
clearCaches in interface RepositoryManagement
Returns:
an indicative count of objects removed

processClusterInvalidationsNext

public void processClusterInvalidationsNext()
Description copied from interface: RepositoryManagement
Makes sure that the next transaction will process cluster invalidations.

Specified by:
processClusterInvalidationsNext in interface RepositoryManagement

shutdown

public void shutdown()

parseProperties

public static java.util.Map<java.lang.String,java.lang.String> parseProperties(java.lang.String expr)
Parses a string of the form: key1=val1;key2=val2;... and collects the key/value pairs.

A ';' character may end the expression. If a value has to contain a ';', it can be escaped by doubling it.

Examples of valid expressions: key1=val1, key1=val1;, key1=val1;key2=val2, key1=a=b;;c=d;key2=val2.

Syntax errors are reported using the logger and will stop the parsing but already collected properties will be available. The ';' or '=' characters cannot be escaped in keys.

Parameters:
expr - the expression to parse
Returns:
a key/value map

activateServer

public void activateServer()
Description copied from interface: RepositoryManagement
Activates the VCS server used for remote connections.

Specified by:
activateServer in interface RepositoryManagement

deactivateServer

public void deactivateServer()
Description copied from interface: RepositoryManagement
Deactivates the VCS server used for remote connections.

Specified by:
deactivateServer in interface RepositoryManagement

getClientInfos

public java.util.Collection<MapperClientInfo> getClientInfos()
Description copied from interface: RepositoryManagement
Get info about current VCS server clients

Specified by:
getClientInfos in interface RepositoryManagement

isServerActivated

public boolean isServerActivated()
Description copied from interface: RepositoryManagement
Is the server available remotely ?

Specified by:
isServerActivated in interface RepositoryManagement

getServerURL

public java.lang.String getServerURL()
Description copied from interface: RepositoryManagement
Which is the remote location ? TODO this info would be better served by a provisioning service. The remote location is dependent to the context of access.

Specified by:
getServerURL in interface RepositoryManagement

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.