tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1500948 - in /tomcat/trunk/java/org/apache: catalina/deploy/ catalina/mbeans/ tomcat/util/descriptor/web/
Date Mon, 08 Jul 2013 21:02:53 GMT
Author: markt
Date: Mon Jul  8 21:02:52 2013
New Revision: 1500948

URL: http://svn.apache.org/r1500948
Log:
Switch to NamingResources interface in objects that represent JNDI
entries in web.xml

Added:
    tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/NamingResources.java
Modified:
    tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java
    tomcat/trunk/java/org/apache/catalina/deploy/ResourceBase.java
    tomcat/trunk/java/org/apache/catalina/mbeans/ContextEnvironmentMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
    tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java

Modified: tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java?rev=1500948&r1=1500947&r2=1500948&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/NamingResourcesImpl.java Mon Jul  8 21:02:52
2013
@@ -42,6 +42,7 @@ import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.naming.ContextBindings;
 import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.descriptor.web.NamingResources;
 import org.apache.tomcat.util.res.StringManager;
 
 
@@ -53,7 +54,8 @@ import org.apache.tomcat.util.res.String
  * @version $Id$
  */
 
-public class NamingResourcesImpl extends LifecycleMBeanBase implements Serializable {
+public class NamingResourcesImpl extends LifecycleMBeanBase
+        implements Serializable, NamingResources {
 
     private static final long serialVersionUID = 1L;
 
@@ -164,6 +166,7 @@ public class NamingResourcesImpl extends
     /**
      * Get the container with which the naming resources are associated.
      */
+    @Override
     public Object getContainer() {
         return container;
     }
@@ -220,6 +223,7 @@ public class NamingResourcesImpl extends
      *
      * @param environment New environment entry
      */
+    @Override
     public void addEnvironment(ContextEnvironment environment) {
 
         if (entries.contains(environment.getName())) {
@@ -353,6 +357,7 @@ public class NamingResourcesImpl extends
      *
      * @param resource New resource reference
      */
+    @Override
     public void addResource(ContextResource resource) {
 
         if (entries.contains(resource.getName())) {
@@ -416,6 +421,7 @@ public class NamingResourcesImpl extends
      *
      * @param resourceLink New resource link
      */
+    @Override
     public void addResourceLink(ContextResourceLink resourceLink) {
 
         if (entries.contains(resourceLink.getName())) {
@@ -726,6 +732,7 @@ public class NamingResourcesImpl extends
      *
      * @param name Name of the environment entry to remove
      */
+    @Override
     public void removeEnvironment(String name) {
 
         entries.remove(name);
@@ -810,6 +817,7 @@ public class NamingResourcesImpl extends
      *
      * @param name Name of the resource reference to remove
      */
+    @Override
     public void removeResource(String name) {
 
         entries.remove(name);
@@ -861,6 +869,7 @@ public class NamingResourcesImpl extends
      *
      * @param name Name of the resource link to remove
      */
+    @Override
     public void removeResourceLink(String name) {
 
         entries.remove(name);

Modified: tomcat/trunk/java/org/apache/catalina/deploy/ResourceBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/ResourceBase.java?rev=1500948&r1=1500947&r2=1500948&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/ResourceBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/ResourceBase.java Mon Jul  8 21:02:52 2013
@@ -22,6 +22,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.tomcat.util.descriptor.web.NamingResources;
+
 
 /**
  * Representation of an Context element
@@ -199,13 +201,13 @@ public class ResourceBase implements Ser
     /**
      * The NamingResources with which we are associated (if any).
      */
-    protected NamingResourcesImpl resources = null;
+    protected NamingResources resources = null;
 
-    public NamingResourcesImpl getNamingResources() {
+    public NamingResources getNamingResources() {
         return (this.resources);
     }
 
-    void setNamingResources(NamingResourcesImpl resources) {
+    void setNamingResources(NamingResources resources) {
         this.resources = resources;
     }
 }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextEnvironmentMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextEnvironmentMBean.java?rev=1500948&r1=1500947&r2=1500948&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextEnvironmentMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextEnvironmentMBean.java Mon Jul  8 21:02:52
2013
@@ -14,10 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.mbeans;
 
-
 import javax.management.Attribute;
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
@@ -27,7 +25,7 @@ import javax.management.RuntimeOperation
 import javax.management.modelmbean.InvalidTargetObjectTypeException;
 
 import org.apache.catalina.deploy.ContextEnvironment;
-import org.apache.catalina.deploy.NamingResourcesImpl;
+import org.apache.tomcat.util.descriptor.web.NamingResources;
 import org.apache.tomcat.util.modeler.BaseModelMBean;
 
 
@@ -99,7 +97,7 @@ public class ContextEnvironmentMBean ext
 
         // cannot use side-effects.  It's removed and added back each time
         // there is a modification in a resource.
-        NamingResourcesImpl nr = ce.getNamingResources();
+        NamingResources nr = ce.getNamingResources();
         nr.removeEnvironment(ce.getName());
         nr.addEnvironment(ce);
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java?rev=1500948&r1=1500947&r2=1500948&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java Mon Jul  8
21:02:52 2013
@@ -14,10 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.mbeans;
 
-
 import javax.management.Attribute;
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
@@ -27,7 +25,7 @@ import javax.management.RuntimeOperation
 import javax.management.modelmbean.InvalidTargetObjectTypeException;
 
 import org.apache.catalina.deploy.ContextResourceLink;
-import org.apache.catalina.deploy.NamingResourcesImpl;
+import org.apache.tomcat.util.descriptor.web.NamingResources;
 import org.apache.tomcat.util.modeler.BaseModelMBean;
 
 
@@ -174,7 +172,7 @@ public class ContextResourceLinkMBean ex
 
         // cannot use side-effects.  It's removed and added back each time
         // there is a modification in a resource.
-        NamingResourcesImpl nr = crl.getNamingResources();
+        NamingResources nr = crl.getNamingResources();
         nr.removeResourceLink(crl.getName());
         nr.addResourceLink(crl);
     }

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java?rev=1500948&r1=1500947&r2=1500948&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java Mon Jul  8 21:02:52
2013
@@ -14,10 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.mbeans;
 
-
 import javax.management.Attribute;
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
@@ -27,7 +25,7 @@ import javax.management.RuntimeOperation
 import javax.management.modelmbean.InvalidTargetObjectTypeException;
 
 import org.apache.catalina.deploy.ContextResource;
-import org.apache.catalina.deploy.NamingResourcesImpl;
+import org.apache.tomcat.util.descriptor.web.NamingResources;
 import org.apache.tomcat.util.modeler.BaseModelMBean;
 
 
@@ -179,9 +177,8 @@ public class ContextResourceMBean extend
 
         // cannot use side-effects.  It's removed and added back each time
         // there is a modification in a resource.
-        NamingResourcesImpl nr = cr.getNamingResources();
+        NamingResources nr = cr.getNamingResources();
         nr.removeResource(cr.getName());
         nr.addResource(cr);
     }
-
 }

Added: tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/NamingResources.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/NamingResources.java?rev=1500948&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/NamingResources.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/NamingResources.java Mon Jul 
8 21:02:52 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.util.descriptor.web;
+
+import org.apache.catalina.deploy.ContextEnvironment;
+import org.apache.catalina.deploy.ContextResource;
+import org.apache.catalina.deploy.ContextResourceLink;
+
+
+/**
+ * Defines an interface for the object that is added to the representation of a
+ * JNDI resource in web.xml to enable it to also be the implementation of that
+ * JNDI resource. Only Catalina implements this interface but because the
+ * web.xml representation is shared this interface has to be visible to Catalina
+ * and Jasper.
+ */
+public interface NamingResources {
+
+    void addEnvironment(ContextEnvironment ce);
+    void removeEnvironment(String name);
+
+    void addResource(ContextResource cr);
+    void removeResource(String name);
+
+    void addResourceLink(ContextResourceLink crl);
+    void removeResourceLink(String name);
+
+    Object getContainer();
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message