Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * IronJacamar, a Java EE Connector Architecture implementation
   * Copyright 2008-2009, Red Hat Inc, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.jca.core.connectionmanager;
 
 
 
The connection manager factory.

Author(s):
Jesper Pedersen
 
 {
   
Constructor
 
    public ConnectionManagerFactory()
    {
    }

   
Create a connection manager

Parameters:
tsl The transaction support level
pool The pool for the connection manager
subjectFactory The subject factory
securityDomain The security domain
useCcm Should the CCM be used
ccm The cached connection manager
sharable Enable sharable connections
enlistment Enable enlistment connections
flushStrategy The flush strategy
allocationRetry The allocation retry value
allocationRetryWaitMillis The allocation retry millis value
Returns:
The connection manager instance
 
                                                        final Pool pool,
                                                        final SubjectFactory subjectFactory,
                                                        final String securityDomain,
                                                        final boolean useCcm,
                                                        final CachedConnectionManager ccm,
                                                        final boolean sharable,
                                                        final boolean enlistment,
                                                        final FlushStrategy flushStrategy,
                                                        final Integer allocationRetry,
                                                        final Long allocationRetryWaitMillis)
    {
       if (tsl == null)
          throw new IllegalArgumentException("TransactionSupportLevel is null");
 
       if (pool == null)
          throw new IllegalArgumentException("Pool is null");
 
       if (flushStrategy == null)
          throw new IllegalArgumentException("FlushStrategy is null");
 
       NoTxConnectionManagerImpl cm = null;
 
       switch (tsl)
       {
          case :
             cm = new NoTxConnectionManagerImpl();
             break;
 
          case :
             throw new IllegalArgumentException("Transactional connection manager not supported");
 
          case :
             throw new IllegalArgumentException("Transactional connection manager not supported");
 
         default:
            throw new IllegalArgumentException("Unknown transaction support level " + tsl);
      }
      setProperties(cmpool,
                    subjectFactorysecurityDomain
                    useCcmccm,
                    sharable,
                    enlistment,
                    flushStrategy,
                    allocationRetryallocationRetryWaitMillis
                    null);
      setNoTxProperties(cm);
      return cm;
   }

   
Create a transactional connection manager

Parameters:
tsl The transaction support level
pool The pool for the connection manager
subjectFactory The subject factory
securityDomain The security domain
useCcm Should the CCM be used
ccm The cached connection manager
sharable Enable sharable connections
enlistment Enable enlistment connections
flushStrategy The flush strategy
allocationRetry The allocation retry value
allocationRetryWaitMillis The allocation retry millis value
txIntegration The transaction manager integration
interleaving Enable interleaving
xaResourceTimeout The transaction timeout for XAResource
isSameRMOverride Should isSameRM be overridden
wrapXAResource Should XAResource be wrapped
padXid Should Xids be padded
Returns:
The connection manager instance
                                                  final Pool pool,
                                                  final SubjectFactory subjectFactory,
                                                  final String securityDomain,
                                                  final boolean useCcm,
                                                  final CachedConnectionManager ccm,
                                                  final boolean sharable,
                                                  final boolean enlistment,
                                                  final FlushStrategy flushStrategy,
                                                  final Integer allocationRetry,
                                                  final Long allocationRetryWaitMillis,
                                                  final TransactionIntegration txIntegration,
                                                  final Boolean interleaving,
                                                  final Integer xaResourceTimeout,
                                                  final Boolean isSameRMOverride,
                                                  final Boolean wrapXAResource,
                                                  final Boolean padXid)
   {
      if (tsl == null)
         throw new IllegalArgumentException("TransactionSupportLevel is null");
      if (pool == null)
         throw new IllegalArgumentException("Pool is null");
      if (txIntegration == null)
         throw new IllegalArgumentException("TransactionIntegration is null");
      if (flushStrategy == null)
         throw new IllegalArgumentException("FlushStrategy is null");
      TxConnectionManagerImpl cm = null;
      switch (tsl)
      {
         case :
            throw new IllegalArgumentException("Non transactional connection manager not supported");
         case :
            cm = new TxConnectionManagerImpl(txIntegrationtrue);
            break;
         case :
            cm = new TxConnectionManagerImpl(txIntegrationfalse);
            break;
         default:
            throw new IllegalArgumentException("Unknown transaction support level " + tsl);
      }
      setProperties(cmpool
                    subjectFactorysecurityDomain
                    useCcmccm,
                    sharable,
                    enlistment,
                    flushStrategy,
                    allocationRetryallocationRetryWaitMillis,
                    txIntegration.getTransactionManager());
      setTxProperties(cminterleavingxaResourceTimeoutisSameRMOverridewrapXAResourcepadXid);
      return cm;
   }

   
Common properties

Parameters:
cm The connection manager
pool The pool
subjectFactory The subject factory
securityDomain The security domain
useCcm Should the CCM be used
ccm The cached connection manager
sharable Enable sharable connections
enlistment Enable enlistment connections
flushStrategy The flush strategy
allocationRetry The allocation retry value
allocationRetryWaitMillis The allocation retry millis value
tm The transaction manager
                              Pool pool,
                              SubjectFactory subjectFactory,
                              String securityDomain,
                              boolean useCcm,
                              CachedConnectionManager ccm,
                              boolean sharable,
                              boolean enlistment,
                              FlushStrategy flushStrategy,
                              Integer allocationRetry,
                              Long allocationRetryWaitMillis,
                              TransactionManager tm)
   {
      pool.setConnectionListenerFactory(cm);
      cm.setPool(pool);
      cm.setSubjectFactory(subjectFactory);
      cm.setSecurityDomain(securityDomain);
      cm.setFlushStrategy(flushStrategy);
      if (allocationRetry != null)
         cm.setAllocationRetry(allocationRetry.intValue());
      if (allocationRetryWaitMillis != null)
         cm.setAllocationRetryWaitMillis(allocationRetryWaitMillis.longValue());
      if (useCcm)
         cm.setCachedConnectionManager(ccm);
      cm.setSharable(sharable);
      cm.setEnlistment(enlistment);
   }

   
NoTxConnectionManager properties

Parameters:
cm The connection manager
   {
   }

   
TxConnectionManager properties

Parameters:
cm The connection manager
interleaving Enable interleaving
xaResourceTimeout The transaction timeout for XAResource
isSameRMOverride Should isSameRM be overridden
wrapXAResource Should XAResource be wrapped
padXid Should Xids be padded
                                Boolean interleaving,
                                Integer xaResourceTimeout,
                                Boolean isSameRMOverride,
                                Boolean wrapXAResource,
                                Boolean padXid)
   {
      if (interleaving != null)
         cm.setInterleaving(interleaving.booleanValue());
      if (xaResourceTimeout != null)
         cm.setXAResourceTimeout(xaResourceTimeout.intValue());
      cm.setIsSameRMOverride(isSameRMOverride);
      if (wrapXAResource != null)
         cm.setWrapXAResource(wrapXAResource.booleanValue());
      if (padXid != null)
         cm.setPadXid(padXid.booleanValue());
   }
New to GrepCode? Check out our FAQ X