From: fhanik Date: Tue, 21 Apr 2009 17:03:12 +0000 (+0000) Subject: Allow the factory attribute on the ResourceLink element. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5f9b38d2c15ed0595f176883c3ce1fb11cd7c1e1;p=tomcat7.0 Allow the factory attribute on the ResourceLink element. 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 --- diff --git a/java/org/apache/catalina/core/NamingContextListener.java b/java/org/apache/catalina/core/NamingContextListener.java index d6c3ad4f9..57e5a9046 100644 --- a/java/org/apache/catalina/core/NamingContextListener.java +++ b/java/org/apache/catalina/core/NamingContextListener.java @@ -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; diff --git a/java/org/apache/catalina/deploy/ContextResourceLink.java b/java/org/apache/catalina/deploy/ContextResourceLink.java index 939fcf846..379ca792d 100644 --- a/java/org/apache/catalina/deploy/ContextResourceLink.java +++ b/java/org/apache/catalina/deploy/ContextResourceLink.java @@ -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