cuba.wired
Class WiredContainer

java.lang.Object
  extended by cuba.wired.WiredContainer

public class WiredContainer
extends java.lang.Object

A component and resource container for the CUBA wired model A WiredContainer is usually not created explicitly be a client but implicitly through a WiredClientContext.

Author:
Jan Lessner

Field Summary
static java.lang.String EMPTY_CALLER
           
 
Constructor Summary
WiredContainer()
          Creates a default WiredContainer without particular properties.
WiredContainer(java.util.Properties props)
          Creates a default WiredContainer.
WiredContainer(java.lang.String deploymentDescriptor, java.util.Properties props)
          Creates a new WiredContainer using PrimitiveWiredInstanceFactory as the default lifecycle manager and PrimitiveDataSourceProvider as the default SQL source manager.
WiredContainer(WiredInstanceFactoryI lifecycleManager, WiredDataSourceProviderI dataSourceProvider, ComponentMap componentMap, ResourceFactoryMap resourceFactoryMap, java.util.Map users)
          Constructor for test purposes
WiredContainer(WiredInstanceFactoryI instanceFactory, WiredDataSourceProviderI dataSourceProvider, java.lang.String deploymentDescriptor, java.util.Properties props)
          Creates a new WiredContainer
 
Method Summary
 CubaEntityManager allocateEntityManager(ResourceFactoryI factory)
           
 javax.sql.DataSource getDataSource(java.lang.String globalName)
          Get a DataSource by its global lookup name.
 javax.transaction.TransactionManager getTransactionManager()
           
 void shutdown()
          Shutdown this container in order to release all its allocated resources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CALLER

public static final java.lang.String EMPTY_CALLER
See Also:
Constant Field Values
Constructor Detail

WiredContainer

public WiredContainer(WiredInstanceFactoryI lifecycleManager,
                      WiredDataSourceProviderI dataSourceProvider,
                      ComponentMap componentMap,
                      ResourceFactoryMap resourceFactoryMap,
                      java.util.Map users)
               throws InitException
Constructor for test purposes

Throws:
InitException

WiredContainer

public WiredContainer(WiredInstanceFactoryI instanceFactory,
                      WiredDataSourceProviderI dataSourceProvider,
                      java.lang.String deploymentDescriptor,
                      java.util.Properties props)
               throws InitException
Creates a new WiredContainer

Parameters:
instanceFactory - The WiredInstanceFactoryI to be used by the container for control of component instance management. A primitive implementation of this interface is provided by the class PrimitiveWiredInstanceFactory.
dataSourceProvider - The WiredDataSourceProviderI to be used by the container for control of SQLSource instances as the only type of resources supported so far. A primitive implementation of this interface is provided by the class PrimitiveDataSourceProvider.
deploymentDescriptor - Filename of the application's wired descriptor. If this parameter is null, the descriptor is retrieved from the CLASSPATH using the predefinied name META-INF/wired-application.xml.
Throws:
InitException - if the initialization fails

WiredContainer

public WiredContainer(java.lang.String deploymentDescriptor,
                      java.util.Properties props)
               throws InitException
Creates a new WiredContainer using PrimitiveWiredInstanceFactory as the default lifecycle manager and PrimitiveDataSourceProvider as the default SQL source manager.

Parameters:
deploymentDescriptor - Filename of the application's wired descriptor. If this parameter is null, the descriptor is retrieved from the CLASSPATH using the predefinied name META-INF/wired-application.xml.
props - Creation configuration properties
Throws:
InitException - if the initialization failed

WiredContainer

public WiredContainer(java.util.Properties props)
               throws InitException
Creates a default WiredContainer. The configuration is read from an application deployment descriptor wired-application.xml which is retrieved from the system class path.

Parameters:
props - Creation configuration properties
Throws:
InitException - if the initialization failed

WiredContainer

public WiredContainer()
               throws InitException
Creates a default WiredContainer without particular properties. The configuration is read from an application deployment descriptor wired-application.xml which is retrieved from the system class path.

Throws:
InitException - if the initialization failed
Method Detail

shutdown

public void shutdown()
Shutdown this container in order to release all its allocated resources


getDataSource

public javax.sql.DataSource getDataSource(java.lang.String globalName)
                                   throws ConstructionException,
                                          ReferenceException
Get a DataSource by its global lookup name. This corresponds to a global JNDI lookup in a J2EE application.

Parameters:
globalName - the global lookup name of the requested resource
Returns:
The requested DataSource
Throws:
ReferenceException - if the specified symbolic name is not valid in the container's global name space
ConstructionException - if the container failed to provide the requested resource.

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()

allocateEntityManager

public CubaEntityManager allocateEntityManager(ResourceFactoryI factory)
                                        throws ConstructionException
Throws:
ConstructionException