cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java
remm2002/12/10 09:56:57 Modified:catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java Log: - Fix creation of resource links. - Fix bug 15239. Revision ChangesPath 1.11 +6 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java Index: NamingResourcesMBean.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- NamingResourcesMBean.java 24 Jun 2002 21:11:42 - 1.10 +++ NamingResourcesMBean.java 10 Dec 2002 17:56:57 - 1.11 @@ -272,8 +272,8 @@ * @param resourceLinkName New resource link reference name * @param type New resource link reference type */ -public String addResourceLink(String global, String resourceLinkName, -String type) throws MalformedObjectNameException { +public String addResourceLink(String resourceLinkName, String type, + String global) throws MalformedObjectNameException { NamingResources nresources = (NamingResources) this.resource; if (nresources == null) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java
craigmcc02/05/06 12:55:06 Modified:catalina/src/share/org/apache/catalina/core NamingContextListener.java catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java Log: Make NamingContextListener a little bit smarter so that it handles dynamically added/removed global naming resources, as well as those configured at startup time. Revision ChangesPath 1.12 +154 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/NamingContextListener.java Index: NamingContextListener.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/NamingContextListener.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- NamingContextListener.java16 Apr 2002 00:43:04 - 1.11 +++ NamingContextListener.java6 May 2002 19:55:05 - 1.12 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/NamingContextListener.java,v 1.11 2002/04/16 00:43:04 remm Exp $ - * $Revision: 1.11 $ - * $Date: 2002/04/16 00:43:04 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/NamingContextListener.java,v 1.12 2002/05/06 19:55:05 craigmcc Exp $ + * $Revision: 1.12 $ + * $Date: 2002/05/06 19:55:05 $ * * * @@ -65,6 +65,8 @@ package org.apache.catalina.core; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -116,11 +118,11 @@ * with each context and server. * * @author Remy Maucherat - * @version $Revision: 1.11 $ $Date: 2002/04/16 00:43:04 $ + * @version $Revision: 1.12 $ $Date: 2002/05/06 19:55:05 $ */ public class NamingContextListener -implements LifecycleListener, ContainerListener { +implements LifecycleListener, ContainerListener, PropertyChangeListener { // --- Constructors @@ -264,6 +266,7 @@ namingResources = ((Context) container).getNamingResources(); } else if (container instanceof Server) { namingResources = ((Server) container).getGlobalNamingResources(); +namingResources.addPropertyChangeListener(this); } else { return; } @@ -337,6 +340,7 @@ } if (container instanceof Server) { +namingResources.removePropertyChangeListener(this); ContextBindings.unbindClassLoader (container, container, this.getClass().getClassLoader()); @@ -507,7 +511,152 @@ } +// - PropertyChangeListener Methods + + +/** + * Process property change events. Currently, only listens to such events + * on the codeNamingResources/code instance for the global naming + * resources. + * + * @param event The property change event that has occurred + */ +public void propertyChange(PropertyChangeEvent event) { + +Object source = event.getSource(); +if (source == namingResources) { +processGlobalResourcesChange(event.getPropertyName(), + event.getOldValue(), + event.getNewValue()); +} + +} + + // Private Methods + + +/** + * Process a property change on the global naming resources, by making the + * corresponding addition or removal to the associated JNDI context. + * + * @param name Property name of the change to be processed + * @param oldValue The old value (or codenull/code if adding) + * @param newValue The new value (or codenull/code if removing) + */ +private void processGlobalResourcesChange(String name, + Object oldValue, + Object newValue) { + +// NOTE - It seems that the Context for global JNDI resources +// is left in read-write mode, so we do not have to change it here + +if (name.equals(ejb)) { +if (oldValue != null) { +ContextEjb ejb = (ContextEjb) oldValue; +if (ejb.getName() != null) { +removeEjb(ejb.getName()); +} +} +if (newValue != null) { +ContextEjb ejb = (ContextEjb) newValue;
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java
manveen 02/05/04 08:48:54 Modified:catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java Log: Minor type on addEnvironment operation on the NamingResource mBean. Also, this operation should take value as a parameter while creating a new env entry. Revision ChangesPath 1.2 +7 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java Index: NamingResourcesMBean.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NamingResourcesMBean.java 3 May 2002 23:42:48 - 1.1 +++ NamingResourcesMBean.java 4 May 2002 15:48:54 - 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v 1.1 2002/05/03 23:42:48 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2002/05/03 23:42:48 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v 1.2 2002/05/04 15:48:54 manveen Exp $ + * $Revision: 1.2 $ + * $Date: 2002/05/04 15:48:54 $ * * * @@ -83,7 +83,7 @@ * codeorg.apache.catalina.deploy.NamingResources/code component./p * * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2002/05/03 23:42:48 $ + * @version $Revision: 1.2 $ $Date: 2002/05/04 15:48:54 $ */ public class NamingResourcesMBean extends BaseModelMBean { @@ -181,7 +181,7 @@ * * @param envName New environment entry name */ -public void addEnvironment(String envName, String type) { +public void addEnvironment(String envName, String type, String value) { NamingResources nresources = (NamingResources) this.resource; if (nresources == null) { @@ -194,7 +194,8 @@ } env = new ContextEnvironment(); env.setName(envName); -env.setName(type); +env.setType(type); +env.setValue(value); nresources.addEnvironment(env); // FIXME add to the javax.naming.directory.DirContext } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java
manveen 02/05/04 09:10:34 Modified:catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java Log: Env name and type are sufficient to form the key for the env entry. Revision ChangesPath 1.3 +5 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java Index: NamingResourcesMBean.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NamingResourcesMBean.java 4 May 2002 15:48:54 - 1.2 +++ NamingResourcesMBean.java 4 May 2002 16:10:34 - 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v 1.2 2002/05/04 15:48:54 manveen Exp $ - * $Revision: 1.2 $ - * $Date: 2002/05/04 15:48:54 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v 1.3 2002/05/04 16:10:34 manveen Exp $ + * $Revision: 1.3 $ + * $Date: 2002/05/04 16:10:34 $ * * * @@ -83,7 +83,7 @@ * codeorg.apache.catalina.deploy.NamingResources/code component./p * * @author Amy Roh - * @version $Revision: 1.2 $ $Date: 2002/05/04 15:48:54 $ + * @version $Revision: 1.3 $ $Date: 2002/05/04 16:10:34 $ */ public class NamingResourcesMBean extends BaseModelMBean { @@ -181,7 +181,7 @@ * * @param envName New environment entry name */ -public void addEnvironment(String envName, String type, String value) { +public void addEnvironment(String envName, String type) { NamingResources nresources = (NamingResources) this.resource; if (nresources == null) { @@ -195,7 +195,6 @@ env = new ContextEnvironment(); env.setName(envName); env.setType(type); -env.setValue(value); nresources.addEnvironment(env); // FIXME add to the javax.naming.directory.DirContext } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java ContextResourceMBean.java
amyroh 02/05/03 16:42:48 Added: catalina/src/share/org/apache/catalina/mbeans NamingResourcesMBean.java ContextResourceMBean.java Log: Add MBeans for NamingResources and ContextResource to support Global JNDI Resources in admin tool. Revision ChangesPath 1.1 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java Index: NamingResourcesMBean.java === /* * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/NamingResourcesMBean.java,v 1.1 2002/05/03 23:42:48 amyroh Exp $ * $Revision: 1.1 $ * $Date: 2002/05/03 23:42:48 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 2002 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.catalina.mbeans; import java.util.ArrayList; import javax.management.MalformedObjectNameException; import javax.management.MBeanException; import javax.management.ObjectName; import javax.management.RuntimeOperationsException; import org.apache.catalina.deploy.ContextEnvironment; import org.apache.catalina.deploy.ContextResource; import org.apache.catalina.deploy.NamingResources; import org.apache.catalina.deploy.ResourceParams; import org.apache.commons.modeler.BaseModelMBean; import org.apache.commons.modeler.ManagedBean; import org.apache.commons.modeler.Registry; /** * pA strongModelMBean/strong implementation for the * codeorg.apache.catalina.deploy.NamingResources/code component./p * * @author Amy Roh * @version $Revision: 1.1 $ $Date: 2002/05/03 23:42:48 $ */ public class NamingResourcesMBean extends BaseModelMBean { // --- Constructors /** * Construct a codeModelMBean/code with default * codeModelMBeanInfo/code information. * * @exception MBeanException if the initializer of an object * throws an exception * @exception RuntimeOperationsException if an IllegalArgumentException * occurs */ public NamingResourcesMBean() throws MBeanException,