Allow the factory attribute on the ResourceLink element.
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 21 Apr 2009 17:03:12 +0000 (17:03 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 21 Apr 2009 17:03:12 +0000 (17:03 +0000)
Make sure that ResourceBase properties are transferred to the ResourceLinkRef

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@767223 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/NamingContextListener.java
java/org/apache/catalina/deploy/ContextResourceLink.java

index d6c3ad4..57e5a90 100644 (file)
@@ -1063,7 +1063,16 @@ public class NamingContextListener
 
         // Create a reference to the resource.
         Reference ref = new ResourceLinkRef
-            (resourceLink.getType(), resourceLink.getGlobal());
+            (resourceLink.getType(), resourceLink.getGlobal(), resourceLink.getFactory(), null);
+        Iterator i = resourceLink.listProperties();
+        while (i.hasNext()) {
+            String key = i.next().toString();
+            Object val = resourceLink.getProperty(key);
+            if (val!=null) {
+                StringRefAddr refAddr = new StringRefAddr(key, val.toString());
+                ref.add(refAddr);
+            }
+        }
         javax.naming.Context ctx = 
             "UserTransaction".equals(resourceLink.getName()) 
             ? compCtx : envCtx;
index 939fcf8..379ca79 100644 (file)
@@ -40,6 +40,10 @@ public class ContextResourceLink extends ResourceBase implements Serializable {
      * The global name of this resource.
      */
     private String global = null;
+    /**
+     * The factory to be used for creating the object
+     */
+    private String factory = null;
 
     public String getGlobal() {
         return (this.global);
@@ -49,7 +53,13 @@ public class ContextResourceLink extends ResourceBase implements Serializable {
         this.global = global;
     }
 
+    public String getFactory() {
+        return factory;
+    }
 
+    public void setFactory(String factory) {
+        this.factory = factory;
+    }
     // --------------------------------------------------------- Public Methods