Nuxeo ECM Projects 5.4.3-SNAPSHOT

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:
Serializable, ManagedConnectionFactory, ResourceAdapterAssociation, RepositoryManagement

public class ManagedConnectionFactoryImpl
extends Object
implements ManagedConnectionFactory, 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.
 Object createConnectionFactory()
           
 Object createConnectionFactory(ConnectionManager connectionManager)
           
 ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo)
           
 void deactivateServer()
          Deactivates the VCS server used for remote connections.
 int getActiveSessionsCount()
          Gets the number of active sessions.
 BinaryGarbageCollector getBinaryGarbageCollector()
          Gets the binary GC for this repository.
 Collection<MapperClientInfo> getClientInfos()
          Get info about current VCS server clients
 PrintWriter getLogWriter()
           
 String getName()
          Gets the repository name.
 String getProperty()
           
 ResourceAdapter getResourceAdapter()
           
 String getServerURL()
          Which is the remote location ? TODO this info would be better served by a provisioning service.
 String getXaDataSource()
           
 boolean isServerActivated()
          Is the server available remotely ?
 void markReferencedBinaries(BinaryGarbageCollector gc)
          Marks the binaries actually in use with the GC so that they won't be deleted.
 ManagedConnection matchManagedConnections(Set set, Subject subject, ConnectionRequestInfo cri)
          Returns a matched connection from the candidate set of connections.
static Map<String,String> parseProperties(String expr)
          Parses a string of the form: key1=val1;key2=val2;... and collects the key/value pairs.
 void processClusterInvalidationsNext()
          Makes sure that the next transaction will process cluster invalidations.
 void setLogWriter(PrintWriter out)
           
 void setName(String name)
           
 void setProperty(String property)
          Properties are specified in the format key=val1[;key2=val2;...]
 void setResourceAdapter(ResourceAdapter resourceAdapter)
          Called by the application server exactly once to associate this ManagedConnectionFactory with a ResourceAdapter.
 void setXaDataSource(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(String name)

getName

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

Specified by:
getName in interface RepositoryManagement

setXaDataSource

public void setXaDataSource(String xaDataSourceName)

getXaDataSource

public String getXaDataSource()

setProperty

public void setProperty(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 String getProperty()

setResourceAdapter

public void setResourceAdapter(ResourceAdapter resourceAdapter)
                        throws 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 ResourceAdapterAssociation
Throws:
ResourceException

getResourceAdapter

public ResourceAdapter getResourceAdapter()
Specified by:
getResourceAdapter in interface ResourceAdapterAssociation

setLogWriter

public void setLogWriter(PrintWriter out)
Specified by:
setLogWriter in interface ManagedConnectionFactory

getLogWriter

public PrintWriter getLogWriter()
Specified by:
getLogWriter in interface ManagedConnectionFactory

createConnectionFactory

public Object createConnectionFactory()
                               throws ResourceException
Specified by:
createConnectionFactory in interface ManagedConnectionFactory
Throws:
ResourceException

createConnectionFactory

public Object createConnectionFactory(ConnectionManager connectionManager)
                               throws ResourceException
Specified by:
createConnectionFactory in interface ManagedConnectionFactory
Throws:
ResourceException

createManagedConnection

public ManagedConnection createManagedConnection(Subject subject,
                                                 ConnectionRequestInfo connectionRequestInfo)
                                          throws ResourceException
Specified by:
createManagedConnection in interface ManagedConnectionFactory
Throws:
ResourceException

matchManagedConnections

public ManagedConnection matchManagedConnections(Set set,
                                                 Subject subject,
                                                 ConnectionRequestInfo cri)
                                          throws 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 ManagedConnectionFactory
Throws:
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

getBinaryGarbageCollector

public BinaryGarbageCollector getBinaryGarbageCollector()
Description copied from interface: RepositoryManagement
Gets the binary GC for this repository.

Specified by:
getBinaryGarbageCollector in interface RepositoryManagement
Returns:
the binary garbage collector

markReferencedBinaries

public void markReferencedBinaries(BinaryGarbageCollector gc)
Description copied from interface: RepositoryManagement
Marks the binaries actually in use with the GC so that they won't be deleted.

The passed GC may or may not be the one returned by RepositoryManagement.getBinaryGarbageCollector() in case it's been determined that another repository's GC is pointing to the same binary data.

Specified by:
markReferencedBinaries in interface RepositoryManagement
Parameters:
gc - the binary garbage collector to use for this repository's binaries

shutdown

public void shutdown()

parseProperties

public static Map<String,String> parseProperties(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 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 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 ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.