KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > resource > cci > ConnectionFactory

javax.resource.cci
Interface ConnectionFactory

All Superinterfaces:
Referenceable, Referenceable, Serializable
See Also:
Top Examples, Source Code, Connection

public Connection getConnection()
                         throws ResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[348]Create ConnectionFactory with the given ManagedConnectionFactory
By Balendran M on 2003/08/14 02:45:08  Rate
/** The ManagedConnectionFactory that created this ConnectionFactory */ 
     private ManagedConnectionFactory mcf = null; 
  
  
     /** The ConnectionManager associated with this ConnectionFactory */ 
     private ConnectionManager cm = null; 
  
  
     /** 
      * Create ConnectionFactory with the given ManagedConectionFactory and 
      * ConnectionManager instance. 
      * 
      * @param mcf ManagedConnectionFactory instance 
      * @param cm ConnectionManager instance 
      */
 
     public ConnectionFactoryImpl ( ManagedConnectionFactory mcf, 
                                  ConnectionManager cm )   {  
         this.mcf = mcf; 
         if  ( cm == null )   {  
             this.cm = new DefaultConnectionManager (  ) ; 
          }  else  {  
             this.cm = cm; 
          }  
      }  
  
  
     /** 
      * Create ConnectionFactory with the given ManagedConnectionFactory. 
      * 
      * @param mcf ManagedConnectionFactory instance 
      */
 
     public ConnectionFactoryImpl ( ManagedConnectionFactory mcf )   {  
         this.mcf = mcf; 
         this.cm = new DefaultConnectionManager (  ) ; 
      }  
  
  
     /** 
      * Returns the connection instance. 
      * 
      * @return Connection instance 
      * 
      */
 
     public Connection getConnection (  )  throws ResourceException  {  
         return  ( Connection )  cm.allocateConnection ( mcf, null ) ; 
      } 


public Connection getConnection(ConnectionSpec properties)
                         throws ResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[349]Create connection to the given LDAP server
By Balendran M on 2003/08/14 02:47:21  Rate
/** The ManagedConnectionFactory that created this ConnectionFactory */ 
     private ManagedConnectionFactory mcf = null; 
  
  
     /** The ConnectionManager associated with this ConnectionFactory */ 
     private ConnectionManager cm = null; 
  
  
     /** 
      * Create ConnectionFactory with the given ManagedConectionFactory and 
      * ConnectionManager instance. 
      * 
      * @param mcf ManagedConnectionFactory instance 
      * @param cm ConnectionManager instance 
      */
 
     public ConnectionFactoryImpl ( ManagedConnectionFactory mcf, 
                                  ConnectionManager cm )   {  
         this.mcf = mcf; 
         if  ( cm == null )   {  
             this.cm = new DefaultConnectionManager (  ) ; 
          }  else  {  
             this.cm = cm; 
          }  
      }  
  
  
     /** 
      * Create ConnectionFactory with the given ManagedConnectionFactory. 
      * 
      * @param mcf ManagedConnectionFactory instance 
      */
 
     public ConnectionFactoryImpl ( ManagedConnectionFactory mcf )   {  
         this.mcf = mcf; 
         this.cm = new DefaultConnectionManager (  ) ; 
      }  
  
  
     /** 
      * Returns the connection instance. 
      * 
      * @param properties connection request-specific properties 
      * passed as ConnectionSpec instance 
      * 
      * @return Connection instance 
      * 
      * @throws ResourceException if a connection cannot be 
      * created to the given LDAP server on the given port. 
      */
 
     public Connection getConnection ( ConnectionSpec properties )  
         throws ResourceException  {  
         ConnectionSpecImpl props =  ( ConnectionSpecImpl )  properties; 
         String ctxName = props.getContextName (  ) ; 
         String userName = props.getUserName (  ) ; 
         String password = props.getPassword (  ) ; 
         ConnectionRequestInfo info = 
             new ConnectionRequestInfoImpl ( ctxName,userName,password ) ; 
         return  ( Connection )  cm.allocateConnection ( mcf, info ) ; 
      } 


public ResourceAdapterMetaData getMetaData()
                                    throws ResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[350]Returns the metadata of the Resource Adapter
By Elanchezhiyan T on 2003/09/04 01:36:13  Rate
/** 
      * Returns the metadata of the Resource Adapter. 
      * 
      * @return ResourceAdapterMetaData instance 
      * 
      * @throws ResourceException if ResourceAdapterMetaData object is not returned 
      */
 
     public ResourceAdapterMetaData getMetaData (  )  throws ResourceException  {  
         return CalummaMetaData.getMetaData (  ) ; 
      } 


public RecordFactory getRecordFactory()
                               throws ResourceException
See Also:
NotSupportedException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags