remm        00/11/03 22:46:10

  Modified:    catalina build.xml
               catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Added:       catalina/src/share/org/apache/naming EjbRef.java
                        ResourceEnvRef.java ResourceRef.java
                        TransactionRef.java
               catalina/src/share/org/apache/naming/factory Constants.java
                        EjbFactory.java ResourceEnvFactory.java
                        ResourceFactory.java TransactionFactory.java
                        TyrexDataSourceFactory.java
                        TyrexTransactionFactory.java
  Removed:     catalina/src/share/org/apache/naming EjbRefAddr.java
                        ResourceEnvRefAddr.java ResourceRefAddr.java
               catalina/src/share/org/apache/naming/factory
                        LocalStrings.properties
  Log:
  - Removed the address references, and replaced them with references
    (EjbRefAddr -> EjbRef, ResourceEnvRefAddr -> ResourceEnvRef,
    ResourceRefAddr -> ResourceRef). It makes the code simpler and easier to
    understand.
  - Modified StandardContext to reflect this and create the right objects.
  - Add a Tyrex resource factory. Instructions on how to use it to follow
    shortly, as soon as all the issues are ironed out. Although the DataSource
    is successfully instantiated, some more configuration is needed.
  - The object factories are packaged in a separate JAR file
    (lib/namingfactory.jar), to avoid classloading related problems.
  - Object factory selector, which should be more efficient than the built in
    JNDI mechanism. There will be one for each type (resource, ejb,
    resource-env). The first one is the ResourceFactory, which checks the
    requested type and the parameters given to select the appropritate factory.
    As there's only one factory right now, it can only select that one.
  - Add the selector factories for EJB and resource env (without any actual
    factories)
  - Add transaction reference object.
  - Add a transaction factory selector.
  - Add a wrapper to get a UserTransaction object from Tyrex.
  - The StandardContext will now bind a reference to a user transaction in
    java:comp/UserTransaction as recommended by the J2EE spec.
  
  Revision  Changes    Path
  1.20      +19 -1     jakarta-tomcat-4.0/catalina/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- build.xml 2000/11/02 06:14:07     1.19
  +++ build.xml 2000/11/04 06:46:07     1.20
  @@ -26,6 +26,12 @@
       <mkdir dir="${catalina.build}/conf"/>
       <mkdir dir="${catalina.build}/lib"/>
       <mkdir dir="${catalina.build}/server"/>
  +
  +    <!-- =================== Conditional Compilation Falgs ================ -->
  +    <available property="tyrex.present"
  +     classname="tyrex.jdbc.ServerDataSource" />
  +    <available property="jta.present"
  +     classname="javax.transaction.UserTransaction" />
     </target>
   
   
  @@ -72,7 +78,14 @@
       <javac   srcdir="src/share" destdir="${catalina.build}/classes"
                
classpath="${parser.jar}:${jaxp.jar}:${regexp.jar}:${servlet.jar}:${jcert.jar}:${jnet.jar}:${jsse.jar}:${jmxri.jar}"
                deprecation="off" debug="on" optimize="off" target="1.2"
  -             excludes="**/CVS/**"/>
  +             excludes="**/CVS/**">
  +      <exclude name="**/factory/TyrexDataSourceFactory.java" 
  +       unless="tyrex.present" />
  +      <exclude name="**/factory/TyrexTransactionFactory.java" 
  +       unless="tyrex.present" />
  +      <exclude name="**/factory/TransactionFactory.java" 
  +       unless="jta.present" />
  +    </javac>
   
       <!-- Copy static resource files -->
       <copydir  src="src/share"    dest="${catalina.build}/classes">
  @@ -87,6 +100,11 @@
       <jar   jarfile="${catalina.build}/bin/naming.jar"
              basedir="${catalina.build}/classes"
              includes="**/org/apache/naming/**" 
  +           excludes="**/org/apache/naming/factory/**"
  +           />
  +    <jar   jarfile="${catalina.build}/lib/namingfactory.jar"
  +           basedir="${catalina.build}/classes"
  +           includes="**/org/apache/naming/factory/**"
              />
   
     </target>
  
  
  
  1.28      +19 -14    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- StandardContext.java      2000/11/03 06:46:54     1.27
  +++ StandardContext.java      2000/11/04 06:46:07     1.28
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.27 2000/11/03 06:46:54 remm Exp $
  - * $Revision: 1.27 $
  - * $Date: 2000/11/03 06:46:54 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.28 2000/11/04 06:46:07 remm Exp $
  + * $Revision: 1.28 $
  + * $Date: 2000/11/04 06:46:07 $
    *
    * ====================================================================
    *
  @@ -90,9 +90,10 @@
   import org.apache.naming.NamingContext;
   import org.apache.naming.ContextBindings;
   import org.apache.naming.ContextAccessController;
  -import org.apache.naming.EjbRefAddr;
  -import org.apache.naming.ResourceRefAddr;
  -import org.apache.naming.ResourceEnvRefAddr;
  +import org.apache.naming.EjbRef;
  +import org.apache.naming.ResourceRef;
  +import org.apache.naming.ResourceEnvRef;
  +import org.apache.naming.TransactionRef;
   import org.apache.catalina.Container;
   import org.apache.catalina.ContainerListener;
   import org.apache.catalina.Context;
  @@ -130,7 +131,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.27 $ $Date: 2000/11/03 06:46:54 $
  + * @version $Revision: 1.28 $ $Date: 2000/11/04 06:46:07 $
    */
   
   public final class StandardContext
  @@ -3015,10 +3016,9 @@
           while (ejbsList.hasNext()) {
               ContextEjb ejb = (ContextEjb) ejbsList.next();
               // Create a reference to the EJB.
  -            EjbRefAddr ejbRefAddr = new EjbRefAddr
  +            Reference ref = new EjbRef
                   (ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink(),
                    ejb.getRunAs());
  -            Reference ref = new Reference(ejb.getType(), ejbRefAddr);
               // Adding the additional parameters, if any
               addAdditionalParameters(envCtx, ref, ejb.getName());
               try {
  @@ -3036,10 +3036,9 @@
           while (resourcesList.hasNext()) {
               ContextResource resource = (ContextResource) resourcesList.next();
               // Create a reference to the resource.
  -            ResourceRefAddr resourceRefAddr = new ResourceRefAddr
  +            Reference ref = new ResourceRef
                   (resource.getType(), resource.getDescription(),
                    resource.getScope(), resource.getAuth());
  -            Reference ref = new Reference(resource.getType(), resourceRefAddr);
               // Adding the additional parameters, if any
               addAdditionalParameters(envCtx, ref, resource.getName());
               try {
  @@ -3058,9 +3057,7 @@
               String key = (String) resourceEnvsKeyList.next();
               String type = (String) resourceEnvRefs.get(key);
               // Create a reference to the resource env.
  -            Reference ref = new Reference(type);
  -            ref.add(new StringRefAddr("name", key));
  -            ref.add(new StringRefAddr("type", type));
  +            Reference ref = new ResourceEnvRef(type);
               // Adding the additional parameters, if any
               addAdditionalParameters(envCtx, ref, key);
               try {
  @@ -3070,6 +3067,14 @@
                   log(sm.getString("standardContext.bindFailed", e));
               }
   
  +        }
  +
  +        // Binding a User Transaction reference
  +        try {
  +            Reference ref = new TransactionRef();
  +            compCtx.bind("UserTransaction", ref);
  +        } catch (NamingException e) {
  +            log(sm.getString("standardContext.bindFailed", e));
           }
   
           // Setting the context in read only mode
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/EjbRef.java
  
  Index: EjbRef.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/EjbRef.java,v 1.1 
2000/11/04 06:46:08 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:08 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming;
  
  import java.util.Hashtable;
  import javax.naming.Reference;
  import javax.naming.Context;
  import javax.naming.StringRefAddr;
  
  /**
   * Represents a reference address to an EJB.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:08 $
   */
  
  public class EjbRef
      extends Reference {
  
  
      // -------------------------------------------------------------- Constants
  
  
      /**
       * Default factory for this reference.
       */
      public static final String DEFAULT_FACTORY = 
          org.apache.naming.factory.Constants.DEFAULT_EJB_FACTORY;
  
  
      /**
       * EJB type address type.
       */
      public static final String TYPE = "type";
  
  
      /**
       * Remote interface classname address type.
       */
      public static final String REMOTE = "remote";
  
  
      /**
       * Link address type.
       */
      public static final String LINK = "link";
  
  
      /**
       * RunAs address type.
       */
      public static final String RUNAS = "runas";
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * EJB Reference.
       * 
       * @param ejbType EJB type
       * @param home Home interface classname
       * @param remote Remote interface classname
       * @param link EJB link
       * @param runAs Run As
       */
      public EjbRef(String ejbType, String home, String remote, String link,
                    String runAs) {
          this(ejbType, home, remote, link, runAs, null, null);
      }
  
  
      /**
       * EJB Reference.
       * 
       * @param ejbType EJB type
       * @param home Home interface classname
       * @param remote Remote interface classname
       * @param link EJB link
       * @param runAs Run As
       */
      public EjbRef(String ejbType, String home, String remote, String link,
                    String runAs, String factory, String factoryLocation) {
          super(home, factory, factoryLocation);
          StringRefAddr refAddr = null;
          if (ejbType != null) {
              refAddr = new StringRefAddr(TYPE, ejbType);
              add(refAddr);
          }
          if (remote != null) {
              refAddr = new StringRefAddr(REMOTE, remote);
              add(refAddr);
          }
          if (link != null) {
              refAddr = new StringRefAddr(LINK, link);
              add(refAddr);
          }
          if (runAs != null) {
              refAddr = new StringRefAddr(RUNAS, runAs);
              add(refAddr);
          }
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // -------------------------------------------------------- RefAddr Methods
  
  
      // ------------------------------------------------------ Reference Methods
  
  
      /**
       * Retrieves the class name of the factory of the object to which this 
       * reference refers.
       */
      public String getFactoryClassName() {
          String factory = super.getFactoryClassName();
          if (factory != null) {
              return factory;
          } else {
              factory = System.getProperty(Context.OBJECT_FACTORIES);
              if (factory != null) {
                  return null;
              } else {
                  return DEFAULT_FACTORY;
              }
          }
      }
  
  
      // ------------------------------------------------------------- Properties
  
  
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ResourceEnvRef.java
  
  Index: ResourceEnvRef.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ResourceEnvRef.java,v
 1.1 2000/11/04 06:46:08 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:08 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming;
  
  import java.util.Hashtable;
  import javax.naming.Reference;
  import javax.naming.Context;
  import javax.naming.StringRefAddr;
  
  /**
   * Represents a reference address to a resource environment.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:08 $
   */
  
  public class ResourceEnvRef
      extends Reference {
  
  
      // -------------------------------------------------------------- Constants
  
  
      /**
       * Default factory for this reference.
       */
      public static final String DEFAULT_FACTORY = 
          org.apache.naming.factory.Constants.DEFAULT_RESOURCE_ENV_FACTORY;
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Resource env reference.
       * 
       * @param type Type
       */
      public ResourceEnvRef(String resourceType) {
          super(resourceType);
      }
  
  
      /**
       * Resource env reference.
       * 
       * @param type Type
       */
      public ResourceEnvRef(String resourceType, String factory,
                            String factoryLocation) {
          super(resourceType, factory, factoryLocation);
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // ------------------------------------------------------ Reference Methods
  
  
      /**
       * Retrieves the class name of the factory of the object to which this 
       * reference refers.
       */
      public String getFactoryClassName() {
          String factory = super.getFactoryClassName();
          if (factory != null) {
              return factory;
          } else {
              factory = System.getProperty(Context.OBJECT_FACTORIES);
              if (factory != null) {
                  return null;
              } else {
                  return DEFAULT_FACTORY;
              }
          }
      }
  
  
      // ------------------------------------------------------------- Properties
  
  
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ResourceRef.java
  
  Index: ResourceRef.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/ResourceRef.java,v 
1.1 2000/11/04 06:46:08 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:08 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming;
  
  import java.util.Hashtable;
  import javax.naming.Reference;
  import javax.naming.Context;
  import javax.naming.StringRefAddr;
  
  /**
   * Represents a reference address to a resource.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:08 $
   */
  
  public class ResourceRef
      extends Reference {
  
  
      // -------------------------------------------------------------- Constants
  
  
      /**
       * Default factory for this reference.
       */
      public static final String DEFAULT_FACTORY = 
          org.apache.naming.factory.Constants.DEFAULT_RESOURCE_FACTORY;
  
  
      /**
       * Description address type.
       */
      public static final String DESCRIPTION = "description";
  
  
      /**
       * Scope address type.
       */
      public static final String SCOPE = "scope";
  
  
      /**
       * Auth address type.
       */
      public static final String AUTH = "auth";
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Resource Reference.
       * 
       * @param resourceClass Resource class
       * @param scope Resource scope
       * @param auth Resource authetication
       */
      public ResourceRef(String resourceClass, String description, 
                         String scope, String auth) {
          this(resourceClass, description, scope, auth, null, null);
      }
  
  
      /**
       * Resource Reference.
       * 
       * @param resourceClass Resource class
       * @param scope Resource scope
       * @param auth Resource authetication
       */
      public ResourceRef(String resourceClass, String description, 
                         String scope, String auth, String factory,
                         String factoryLocation) {
          super(resourceClass, factory, factoryLocation);
          StringRefAddr refAddr = null;
          if (description != null) {
              refAddr = new StringRefAddr(DESCRIPTION, description);
              add(refAddr);
          }
          if (scope != null) {
              refAddr = new StringRefAddr(SCOPE, scope);
              add(refAddr);
          }
          if (auth != null) {
              refAddr = new StringRefAddr(AUTH, auth);
              add(refAddr);
          }
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // ------------------------------------------------------ Reference Methods
  
  
      /**
       * Retrieves the class name of the factory of the object to which this 
       * reference refers.
       */
      public String getFactoryClassName() {
          String factory = super.getFactoryClassName();
          if (factory != null) {
              return factory;
          } else {
              factory = System.getProperty(Context.OBJECT_FACTORIES);
              if (factory != null) {
                  return null;
              } else {
                  return DEFAULT_FACTORY;
              }
          }
      }
  
  
      // ------------------------------------------------------------- Properties
  
  
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/TransactionRef.java
  
  Index: TransactionRef.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/TransactionRef.java,v
 1.1 2000/11/04 06:46:08 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:08 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming;
  
  import java.util.Hashtable;
  import javax.naming.Reference;
  import javax.naming.Context;
  import javax.naming.StringRefAddr;
  
  /**
   * Represents a reference address to a transaction.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:08 $
   */
  
  public class TransactionRef
      extends Reference {
  
  
      // -------------------------------------------------------------- Constants
  
  
      /**
       * Default factory for this reference.
       */
      public static final String DEFAULT_FACTORY = 
          org.apache.naming.factory.Constants.DEFAULT_TRANSACTION_FACTORY;
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Resource Reference.
       * 
       * @param resourceClass Resource class
       * @param scope Resource scope
       * @param auth Resource authetication
       */
      public TransactionRef() {
          this(null, null);
      }
  
  
      /**
       * Resource Reference.
       * 
       * @param resourceClass Resource class
       * @param scope Resource scope
       * @param auth Resource authetication
       */
      public TransactionRef(String factory, String factoryLocation) {
          super("javax.transaction.UserTransaction", factory, factoryLocation);
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // ------------------------------------------------------ Reference Methods
  
  
      /**
       * Retrieves the class name of the factory of the object to which this 
       * reference refers.
       */
      public String getFactoryClassName() {
          String factory = super.getFactoryClassName();
          if (factory != null) {
              return factory;
          } else {
              factory = System.getProperty(Context.OBJECT_FACTORIES);
              if (factory != null) {
                  return null;
              } else {
                  return DEFAULT_FACTORY;
              }
          }
      }
  
  
      // ------------------------------------------------------------- Properties
  
  
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/Constants.java
  
  Index: Constants.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/Constants.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  
  /**
   * Static constants for this package.
   */
  
  public final class Constants {
  
      public static final String Package = "org.apache.naming.factory";
  
      public static final String DEFAULT_RESOURCE_FACTORY = 
          Package + ".ResourceFactory";
  
      public static final String DEFAULT_TRANSACTION_FACTORY = 
          Package + ".TransactionFactory";
  
      public static final String DEFAULT_RESOURCE_ENV_FACTORY = 
          Package + ".ResourceEnvFactory";
  
      public static final String DEFAULT_EJB_FACTORY = 
          Package + ".EjbFactory";
  
      public static final String TYREX_DATASOURCE_FACTORY = 
          Package + ".TyrexDataSourceFactory";
  
      public static final String TYREX_TRANSACTION_FACTORY = 
          Package + ".TyrexTransactionFactory";
  
      public static final String OBJECT_FACTORIES = "";
  
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/EjbFactory.java
  
  Index: EjbFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/EjbFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.EjbRef;
  
  /**
   * Object factory for EJBs.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class EjbFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new EJB instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof EjbRef) {
              Reference ref = (Reference) obj;
              // Does nothing yet
          }
  
          return null;
  
      }
  
  
  }
  
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceEnvFactory.java
  
  Index: ResourceEnvFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceEnvFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.ResourceEnvRef;
  
  /**
   * Object factory for Resources env.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class ResourceEnvFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new Resource env instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof ResourceEnvRef) {
              Reference ref = (Reference) obj;
              // Does nothing yet
          }
  
          return null;
  
      }
  
  
  }
  
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java
  
  Index: ResourceFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/ResourceFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.ResourceRef;
  
  /**
   * Object factory for Resources.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class ResourceFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new DataSource instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof ResourceRef) {
              Reference ref = (Reference) obj;
              if (ref.getClassName().equals("javax.sql.DataSource")) {
                  // Checking the different known resource factories
                  if ((ref.get(TyrexDataSourceFactory.DRIVER_CLASS_NAME) != null)
                      && (ref.get(TyrexDataSourceFactory.DRIVER_NAME) != null)) {
                      return (new TyrexDataSourceFactory())
                          .getObjectInstance(obj, name, nameCtx, environment);
                  }
                  throw new NamingException
                      ("Cannot create resource instance : Missing parameters");
              }
          }
  
          return null;
  
      }
  
  
  }
  
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TransactionFactory.java
  
  Index: TransactionFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TransactionFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.TransactionRef;
  
  /**
   * Object factory for User trasactions.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class TransactionFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new User transaction instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof TransactionRef) {
              Reference ref = (Reference) obj;
              return (new TyrexTransactionFactory())
                  .getObjectInstance(obj, name, nameCtx, environment);
          }
  
          return null;
  
      }
  
  
  }
  
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java
  
  Index: TyrexDataSourceFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexDataSourceFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.ResourceRef;
  import tyrex.jdbc.ServerDataSource;
  import tyrex.jdbc.xa.EnabledDataSource;
  
  /**
   * Object factory for Tyrex DataSources.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class TyrexDataSourceFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ServerDataSource address names
      public static final String LOGIN_TIMEOUT = "loginTimeout";
      public static final String DESCRIPTION = "description";
      public static final String DATA_SOURCE = "dataSource";
  
  
      // XADataSourceImpl
      public static final String USER = "user";
      public static final String PASSWORD = "password";
      public static final String DRIVER_NAME = "driverName";
      public static final String DRIVER_CLASS_NAME = "driverClassName";
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new DataSource instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof ResourceRef) {
              Reference ref = (Reference) obj;
              if ((ref.getClassName().equals("javax.sql.DataSource")) ||
                  (ref.getClassName().equals("tyrex.jdbc.ServerDataSource")) || 
                  (ref.getClassName().equals
                   ("tyrex.jdbc.xa.EnabledDataSource"))) {
                  
                  try {
                      
                      // Getting a new EnabledDataSource instance
                      EnabledDataSource ds = new EnabledDataSource();
                      
                      // Retrieving parameters
                      RefAddr currentRefAddr = null;
                      currentRefAddr = ref.get(DESCRIPTION);
                      if (currentRefAddr != null)
                          ds.setDescription
                              (currentRefAddr.getContent().toString());
                      currentRefAddr = ref.get(LOGIN_TIMEOUT);
                      if (currentRefAddr != null) {
                          ds.setLoginTimeout
                              (Integer.parseInt
                               (currentRefAddr.getContent().toString()));
                      }
                      currentRefAddr = ref.get(USER);
                      if (currentRefAddr != null) {
                          ds.setUser(currentRefAddr.getContent().toString());
                      }
                      currentRefAddr = ref.get(PASSWORD);
                      if (currentRefAddr != null) {
                          ds.setPassword(currentRefAddr.getContent().toString());
                      }
                      currentRefAddr = ref.get(DRIVER_NAME);
                      if (currentRefAddr != null) {
                          ds.setDriverName
                              (currentRefAddr.getContent().toString());
                      }
                      currentRefAddr = ref.get(DRIVER_CLASS_NAME);
                      if (currentRefAddr != null) {
                          ds.setDriverClassName
                              (currentRefAddr.getContent().toString());
                      }
                      
                      if (ref.getClassName().equals
                          ("tyrex.jdbc.ServerDataSource")) {
                          
                          ServerDataSource sds = 
                              new ServerDataSource((javax.sql.XADataSource) ds);
                          
                          currentRefAddr = ref.get(DESCRIPTION);
                          if (currentRefAddr != null)
                              sds.setDescription
                                  (currentRefAddr.getContent().toString());
                          
                          return sds;
                          
                      }
                      
                      return ds;
                      
                  } catch (Throwable t) {
                      // TEMP
                      t.printStackTrace();
                      // END TEMP
                      // Another factory could handle this, so just give up
                      return null;
                  }
                  
              } else {
                  return null;
              }
              
          } else {
              return null;
          }
          
      }
  
  
  }
  
  
  
  
  1.1                  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java
  
  Index: TyrexTransactionFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/factory/TyrexTransactionFactory.java,v
 1.1 2000/11/04 06:46:09 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/04 06:46:09 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.naming.factory;
  
  import java.util.Hashtable;
  import javax.naming.Name;
  import javax.naming.Context;
  import javax.naming.NamingException;
  import javax.naming.Reference;
  import javax.naming.RefAddr;
  import javax.naming.spi.ObjectFactory;
  import org.apache.naming.TransactionRef;
  import tyrex.tm.Tyrex;
  
  /**
   * Object factory for Tyrex User transactions.
   * 
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/11/04 06:46:09 $
   */
  
  public class TyrexTransactionFactory
      implements ObjectFactory {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // -------------------------------------------------------------- Constants
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      // --------------------------------------------------------- Public Methods
  
  
      // -------------------------------------------------- ObjectFactory Methods
  
  
      /**
       * Crete a new User transaction instance.
       * 
       * @param obj The reference object describing the DataSource
       */
      public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                      Hashtable environment)
          throws NamingException {
          
          if (obj instanceof TransactionRef) {
              Reference ref = (Reference) obj;
              if (ref.getClassName()
                  .equals("javax.transaction.UserTransaction")) {
                  
                  try {
                      
                      return Tyrex.getUserTransaction();
                      
                  } catch (Throwable t) {
                      // TEMP
                      t.printStackTrace();
                      // END TEMP
                      // Another factory could handle this, so just give up
                      return null;
                  }
                  
              }
              
          }
          
          return null;
          
      }
  
  
  }
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to