cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java

2002-05-16 Thread amyroh

amyroh  02/05/16 13:18:49

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java
  Log:
  Add xml encoding of special characters '', '', ''', '', '' when writing out to
  server.xml.  xml parser exception was thrown when a user enters these
  chracters and save in admin tool before.
  
  Revision  ChangesPath
  1.22  +34 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StandardServerMBean.java  3 May 2002 23:19:37 -   1.21
  +++ StandardServerMBean.java  16 May 2002 20:18:49 -  1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.21 2002/05/03 23:19:37 craigmcc Exp $
  - * $Revision: 1.21 $
  - * $Date: 2002/05/03 23:19:37 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.22 2002/05/16 20:18:49 amyroh Exp $
  + * $Revision: 1.22 $
  + * $Date: 2002/05/16 20:18:49 $
*
* 
*
  @@ -123,7 +123,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.21 $ $Date: 2002/05/03 23:19:37 $
  + * @version $Revision: 1.22 $ $Date: 2002/05/16 20:18:49 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -333,6 +333,34 @@
   //  Private Methods
   
   
  +/** Given a string, this method replaces all occurrences of
  + *  '', '', '', and ''.
  +*/
  +
  +private String convertStr(String input) {
  +
  +StringBuffer filtered = new StringBuffer(input.length());
  +char c;
  +for(int i=0; iinput.length(); i++) {
  +c = input.charAt(i);
  +if (c == '') {
  +filtered.append(lt;);
  +} else if (c == '') {
  +filtered.append(gt;);
  +} else if (c == '\'') {
  +filtered.append(apos;);
  +} else if (c == '') {
  +filtered.append(quot;);
  +} else if (c == '') {
  +filtered.append(amp;);
  +} else {
  +filtered.append(c);
  +}
  +}
  +return(filtered.toString());
  +} 
  +
  +
   /**
* Is this an instance of the default codeLoader/code configuration,
* with all-default properties?
  @@ -509,7 +537,8 @@
   writer.print(' ');
   writer.print(descriptors[i].getName());
   writer.print(=\);
  -writer.print((String) value);
  +String strValue = convertStr((String) value);
  +writer.print(strValue);
   writer.print(\);
   }
   
  
  
  

--
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 StandardServerMBean.java

2002-05-02 Thread amyroh

amyroh  02/05/02 12:32:28

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java
  Log:
  Fix Resource and ResourceParam config save.
  
  Revision  ChangesPath
  1.15  +98 -106   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardServerMBean.java  2 May 2002 17:45:43 -   1.14
  +++ StandardServerMBean.java  2 May 2002 19:32:28 -   1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.14 2002/05/02 17:45:43 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2002/05/02 17:45:43 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.15 2002/05/02 19:32:28 amyroh Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/05/02 19:32:28 $
*
* 
*
  @@ -113,7 +113,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.14 $ $Date: 2002/05/02 17:45:43 $
  + * @version $Revision: 1.15 $ $Date: 2002/05/02 19:32:28 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -595,61 +595,59 @@
   
   // Store nested Resources element
   ContextResource[] resources = context.findResources();
  - for (int i = 0; i  resources.length; i++) {
  +for (int i = 0; i  resources.length; i++) {
   for (int j = 0; j  indent + 2; j++) {
   writer.print(' ');
   }
   writer.print(Resource);
   storeAttributes(writer, false, resources[i]);
   writer.println(/);
  -}   
   
  -// Store nested ResourceParams elements
  -NamingResources namingResources = context.getNamingResources();
  -ResourceParams[] params = namingResources.findResourceParams();
  -for (int i = 0; i  indent + 2; i++) {
  -writer.print(' ');
  -}
  -if (params.length  0) {
  -writer.print(ResourceParams );
  -}
  -for (int i = 0; i  params.length; i++) {
  -storeAttributes(writer, false, params[i]);
  -}
  -writer.println();
  - 
  -for (int i = 0; i  params.length; i++) {
  -Hashtable resourceParams = params[i].getParameters();
  -Enumeration nameEnum = resourceParams.keys();
  -Enumeration valueEnum = resourceParams.elements();
  -while ((nameEnum.hasMoreElements())  (valueEnum.hasMoreElements())) { 
 
  -for (int j = 0; j  indent + 4; j++) {
  -writer.print(' ');
  -}
  -writer.println(parameter);
  -for (int j = 0; j  indent + 6; j++) {
  -writer.print(' ');
  -}   
  -writer.print(name);
  -writer.print(nameEnum.nextElement());
  -writer.println(/name); 
  -for (int j = 0; j  indent + 6; j++) {
  -writer.print(' ');
  -}   
  -writer.print(value); 
  -writer.print(valueEnum.nextElement());
  -writer.println(/value); 
  -for (int j = 0; j  indent + 4; j++) {
  -writer.print(' ');
  -}   
  -writer.println(/parameter);  
  +// Store nested ResourceParams elements
  +NamingResources namingResources = context.getNamingResources();
  +ResourceParams[] params = namingResources.findResourceParams();  
  +for (int j = 0; j  params.length; j++ ) {
  +if (resources[i].getName().equals(params[j].getName())) {
  +for (int k = 0; k  indent + 2; k++) {
  +writer.print(' ');
  +}
  +writer.print(ResourceParams );
  +storeAttributes(writer, false, params[j]);
  +writer.println();
  +Hashtable resourceParams = params[j].getParameters();
  +Enumeration nameEnum = resourceParams.keys();
  +Enumeration valueEnum = resourceParams.elements();
  +while ((nameEnum.hasMoreElements())  
  +(valueEnum.hasMoreElements())) {  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java

2002-05-02 Thread craigmcc

craigmcc02/05/02 16:21:02

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java
  Log:
  Flag the missing saves of resources defined under DefaultContext with a
  FIXME note.
  
  Revision  ChangesPath
  1.19  +12 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StandardServerMBean.java  2 May 2002 23:10:13 -   1.18
  +++ StandardServerMBean.java  2 May 2002 23:21:02 -   1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.18 2002/05/02 23:10:13 craigmcc Exp $
  - * $Revision: 1.18 $
  - * $Date: 2002/05/02 23:10:13 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.19 2002/05/02 23:21:02 craigmcc Exp $
  + * $Revision: 1.19 $
  + * $Date: 2002/05/02 23:21:02 $
*
* 
*
  @@ -120,7 +120,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.18 $ $Date: 2002/05/02 23:10:13 $
  + * @version $Revision: 1.19 $ $Date: 2002/05/02 23:21:02 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -778,6 +778,14 @@
   writer.print(wListeners[i]);
   writer.println(/WrapperListener);
   }
  +
  +// Store nested naming resources elements
  +/* FIXME - DefaultContext does not have a getNamingResources() method
  +NamingResources nresources = dcontext.getNamingResources();
  +if (nresources != null) {
  +storeNamingResources(writer, indent + 2, nresources);
  +}
  +*/
   
   // Store the ending of this element
   for (int i = 0; i  indent; i++) {
  
  
  

--
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 StandardServerMBean.java mbeans-descriptors.xml

2002-04-26 Thread craigmcc

craigmcc02/04/26 10:40:50

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java mbeans-descriptors.xml
  Log:
  Enable saving of most of the simple-to-access configuration elements.
  There are FIXMEs to mark the remaining ones.
  
  Revision  ChangesPath
  1.9   +407 -14   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardServerMBean.java  26 Apr 2002 02:27:33 -  1.8
  +++ StandardServerMBean.java  26 Apr 2002 17:40:50 -  1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.8 2002/04/26 02:27:33 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/04/26 02:27:33 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.9 2002/04/26 17:40:50 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/04/26 17:40:50 $
*
* 
*
  @@ -68,6 +68,7 @@
   import java.io.FileWriter;
   import java.io.IOException;
   import java.io.PrintWriter;
  +import java.util.Iterator;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanAttributeInfo;
   import javax.management.MBeanException;
  @@ -85,7 +86,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.8 $ $Date: 2002/04/26 02:27:33 $
  + * @version $Revision: 1.9 $ $Date: 2002/04/26 17:40:50 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -258,14 +259,17 @@
   if (managedResource.equals(aname)) {
   continue; // KLUDGE - these should be removed
   }
  -if (!ainfo[i].isReadable() || !ainfo[i].isWritable()) {
  -continue; // We cannot configure this attribute
  +if (!ainfo[i].isReadable()) {
  +continue; // We cannot read the current value
  +}
  +if (!className.equals(aname)  !ainfo[i].isWritable()) {
  +continue; // We will not be able to configure this attribute
   }
   
   // Acquire the value of this attribute
   Object value = mserver.getAttribute(oname, aname);
   if (value == null) {
  -value = ;
  +continue; // No need to explicitly record this
   }
   if (!(value instanceof String)) {
   value = value.toString();
  @@ -285,6 +289,358 @@
   
   
   /**
  + * Store the specified Connector properties.
  + *
  + * @param writer PrintWriter to which we are storing
  + * @param indent Number of spaces to indent this element
  + * @param oname ObjectName of the MBean for the object we are storing
  + *
  + * @exception Exception if an exception occurs while storing
  + */
  +private void storeConnector(PrintWriter writer, int indent,
  +ObjectName oname) throws Exception {
  +
  +// Store the beginning of this element
  +for (int i = 0; i  indent; i++) {
  +writer.print(' ');
  +}
  +writer.print(Connector);
  +storeAttributes(writer, oname);
  +writer.println();
  +
  +// Store nested Listener elements
  +; // FIXME
  +
  +// Store nested Factory element
  +; // FIXME
  +
  +// Store the ending of this element
  +for (int i = 0; i  indent; i++) {
  +writer.print(' ');
  +}
  +writer.println(/Connector);
  +
  +}
  +
  +
  +/**
  + * Store the specified Context properties.
  + *
  + * @param writer PrintWriter to which we are storing
  + * @param indent Number of spaces to indent this element
  + * @param oname ObjectName of the MBean for the object we are storing
  + *
  + * @exception Exception if an exception occurs while storing
  + */
  +private void storeContext(PrintWriter writer, int indent,
  +  ObjectName oname) throws Exception {
  +
  +// Store the beginning of this element
  +for (int i = 0; i  indent; i++) {
  +writer.print(' ');
  +}
  +writer.print(Context);
  +storeAttributes(writer, oname);
  +writer.println();
  +
  +// Store nested InstanceListener elements
  +; // FIXME
  +
  +// Store nested Listener elements
  +; // FIXME
  +
  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java mbeans-descriptors.xml

2002-04-26 Thread craigmcc

craigmcc02/04/26 22:09:03

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java mbeans-descriptors.xml
  Log:
  Switch to using the Catalina component tree directly for all persistence
  operations -- since we will need this for components that are not reflected
  as MBeans directly anyway, it's better to be consistent.
  
  This still leaves a few FIXMEs, but for the most part a running Catalina
  configuration is faithfully recorded into a conf/server.xml.new file that
  would (if renamed) reproduce the same configuration after a restart.
  
  Revision  ChangesPath
  1.10  +532 -210  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardServerMBean.java  26 Apr 2002 17:40:50 -  1.9
  +++ StandardServerMBean.java  27 Apr 2002 05:09:03 -  1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.9 2002/04/26 17:40:50 craigmcc Exp $
  - * $Revision: 1.9 $
  - * $Date: 2002/04/26 17:40:50 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.10 2002/04/27 05:09:03 craigmcc Exp $
  + * $Revision: 1.10 $
  + * $Date: 2002/04/27 05:09:03 $
*
* 
*
  @@ -64,6 +64,8 @@
   package org.apache.catalina.mbeans;
   
   
  +import java.beans.IndexedPropertyDescriptor;
  +import java.beans.PropertyDescriptor;
   import java.io.File;
   import java.io.FileWriter;
   import java.io.IOException;
  @@ -76,8 +78,25 @@
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   import javax.management.RuntimeOperationsException;
  +import org.apache.catalina.Connector;
  +import org.apache.catalina.Container;
  +import org.apache.catalina.Context;
  +import org.apache.catalina.Engine;
  +import org.apache.catalina.Host;
  +import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.Loader;
  +import org.apache.catalina.Logger;
  +import org.apache.catalina.Manager;
  +import org.apache.catalina.Pipeline;
  +import org.apache.catalina.Realm;
   import org.apache.catalina.Server;
  -import org.apache.catalina.core.StandardServer;
  +import org.apache.catalina.ServerFactory;
  +import org.apache.catalina.Service;
  +import org.apache.catalina.Store;
  +import org.apache.catalina.Valve;
  +import org.apache.catalina.net.ServerSocketFactory;
  +import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.modeler.BaseModelMBean;
   
   
  @@ -86,17 +105,74 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.9 $ $Date: 2002/04/26 17:40:50 $
  + * @version $Revision: 1.10 $ $Date: 2002/04/27 05:09:03 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
   
  +
  +// --- Static Variables
  +
  +
   /**
* The codeMBeanServer/code for this application.
*/
   private static MBeanServer mserver = MBeanUtils.createServer();
   
   
  +/**
  + * The set of class/property combinations that should strongNOT/strong
  + * be persisted because they are automatically calculated.
  + */
  +private static String exceptions[][] = {
  +{ org.apache.catalina.core.StandardContext, configured },
  +{ org.apache.catalina.core.StandardContext, publicId },
  +{ org.apache.catalina.core.StandardContext, workDir },
  +{ org.apache.catalina.session.StandardManager, distributable },
  +{ org.apache.catalina.session.StandardManager, entropy },
  +};
  +
  +
  +/**
  + * The set of classes that represent persistable properties.
  + */
  +private static Class persistables[] = {
  +String.class,
  +Integer.class, Integer.TYPE,
  +Boolean.class, Boolean.TYPE,
  +Byte.class, Byte.TYPE,
  +Character.class, Character.TYPE,
  +Double.class, Double.TYPE,
  +Float.class, Float.TYPE,
  +Long.class, Long.TYPE,
  +Short.class, Short.TYPE,
  +};
  +
  +
  +/**
  + * The set of class names that should be skipped when persisting state,
  + * because the corresponding listeners, valves, etc. are configured
  + * automatically at startup time.
  + */
  +private static String skippables[] = {
  +org.apache.catalina.authenticator.BasicAuthenticator,
  +

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java mbeans-descriptors.xml

2002-04-25 Thread craigmcc

craigmcc02/04/25 19:27:33

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java mbeans-descriptors.xml
  Log:
  Add the beginnings of the ability to save the current Tomcat configuration
  to conf/server.xml.
  
  Revision  ChangesPath
  1.8   +237 -6
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardServerMBean.java  8 Mar 2002 00:42:14 -   1.7
  +++ StandardServerMBean.java  26 Apr 2002 02:27:33 -  1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.7 2002/03/08 00:42:14 amyroh Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/03/08 00:42:14 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.8 2002/04/26 02:27:33 craigmcc Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/04/26 02:27:33 $
*
* 
*
  @@ -64,14 +64,19 @@
   package org.apache.catalina.mbeans;
   
   
  +import java.io.File;
  +import java.io.FileWriter;
  +import java.io.IOException;
  +import java.io.PrintWriter;
  +import javax.management.InstanceNotFoundException;
  +import javax.management.MBeanAttributeInfo;
   import javax.management.MBeanException;
  +import javax.management.MBeanInfo;
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   import javax.management.RuntimeOperationsException;
   import org.apache.catalina.Server;
  -import org.apache.catalina.Service;
   import org.apache.catalina.core.StandardServer;
  -import org.apache.catalina.core.StandardService;
   import org.apache.commons.modeler.BaseModelMBean;
   
   
  @@ -80,7 +85,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.7 $ $Date: 2002/03/08 00:42:14 $
  + * @version $Revision: 1.8 $ $Date: 2002/04/26 02:27:33 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -114,10 +119,236 @@
   // - Attributes
   
   
  +/**
  + * Set the value of a specific attribute of this MBean.
  + *
  + * @param attribute The identification of the attribute to be set
  + *  and the new value
  + *
  + * @exception AttributeNotFoundException if this attribute is not
  + *  supported by this MBean
  + * @exception MBeanException if the initializer of an object
  + *  throws an exception
  + * @exception ReflectionException if a Java reflection exception
  + *  occurs when invoking the getter
  + */
  +public void setAttribute(javax.management.Attribute attribute)
  +throws javax.management.AttributeNotFoundException,
  +   MBeanException,
  +   javax.management.ReflectionException {
  +
  +// KLUDGE - This is only here to force calling store()
  +// until the admin webapp calls it directly
  +super.setAttribute(attribute);
  +try {
  +store();
  +} catch (InstanceNotFoundException e) {
  +throw new MBeanException(e);
  +}
  +
  +}
   
   
   // - Operations
   
  +
  +/**
  + * Write the configuration information for this entire codeServer/code
  + * out to the server.xml configuration file.
  + *
  + * @exception InstanceNotFoundException if the managed resource object
  + *  cannot be found
  + * @exception MBeanException if the initializer of the object throws
  + *  an exception, or persistence is not supported
  + * @exception RuntimeOperationsException if an exception is reported
  + *  by the persistence mechanism
  + */
  +public synchronized void store() throws InstanceNotFoundException,
  +MBeanException, RuntimeOperationsException {
  +
  +// Calculate file objects for the old and new configuration files.
  +String configFile = conf/server.xml; // FIXME - configurable?
  +File configOld = new File(configFile);
  +if (!configOld.isAbsolute()) {
  +configOld = new File(System.getProperty(catalina.base),
  + configFile);
  +}
  +File configNew = new File(configFile + .new);
  +if (!configNew.isAbsolute()) {
  +configNew = new File(System.getProperty(catalina.base),
  + configFile + .new);
  +  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans StandardServerMBean.java StandardServiceMBean.java mbeans-descriptors.xml

2001-11-12 Thread amyroh

amyroh  01/11/12 18:36:49

  Modified:catalina/src/share/org/apache/catalina/mbeans
StandardServerMBean.java StandardServiceMBean.java
mbeans-descriptors.xml
  Log:
  Updated MBean operations and the descriptor.
  It now only takes necessary properties as parameters and creates mbeans inside the 
operation.
  Admin app will need to set the addional properties if they exist.
  
  Revision  ChangesPath
  1.2   +22 -8 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java
  
  Index: StandardServerMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StandardServerMBean.java  2001/11/09 02:19:07 1.1
  +++ StandardServerMBean.java  2001/11/13 02:36:49 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.1 2001/11/09 02:19:07 amyroh Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/11/09 02:19:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServerMBean.java,v
 1.2 2001/11/13 02:36:49 amyroh Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/11/13 02:36:49 $
*
* 
*
  @@ -66,8 +66,10 @@
   
   import javax.management.MBeanException;
   import javax.management.RuntimeOperationsException;
  +import org.apache.catalina.Container;
   import org.apache.catalina.Server;
   import org.apache.catalina.Service;
  +import org.apache.catalina.core.StandardEngine;
   import org.apache.catalina.core.StandardService;
   import org.apache.commons.modeler.BaseModelMBean;
   
  @@ -77,7 +79,7 @@
* codeorg.apache.catalina.core.StandardServer/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.1 $ $Date: 2001/11/09 02:19:07 $
  + * @version $Revision: 1.2 $ $Date: 2001/11/13 02:36:49 $
*/
   
   public class StandardServerMBean extends BaseModelMBean {
  @@ -111,15 +113,27 @@
   // - Operations
   
   /**
  - * Create a new child Service.
  + * Create a new child Service and Engine.
  + *
  + * @param name The new Service's name
  + *
  + * @exception Exception if an MBean cannot be created or registered
*/
  -public Service createService(String name) {
  +public void createService(String name)
  +throws Exception {
   
   StandardService service = new StandardService();
  +
   service.setName(name);
  -return service;
  +Server server = (Server) this.resource;
  +server.addService(service);
  +MBeanUtils.createMBean(service);
  +
  +StandardEngine engine = new StandardEngine();
  +service.setContainer((Container)engine);
  +MBeanUtils.createMBean(engine);
   
   }
  +
   
  -
   }
  
  
  
  1.3   +15 -18
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java
  
  Index: StandardServiceMBean.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardServiceMBean.java 2001/11/09 02:19:07 1.2
  +++ StandardServiceMBean.java 2001/11/13 02:36:49 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
 1.2 2001/11/09 02:19:07 amyroh Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/11/09 02:19:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v
 1.3 2001/11/13 02:36:49 amyroh Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/11/13 02:36:49 $
*
* 
*
  @@ -78,7 +78,7 @@
* codeorg.apache.catalina.core.StandardService/code component./p
*
* @author Amy Roh
  - * @version $Revision: 1.2 $ $Date: 2001/11/09 02:19:07 $
  + * @version $Revision: 1.3 $ $Date: 2001/11/13 02:36:49 $
*/
   
   public class StandardServiceMBean extends BaseModelMBean {
  @@ -125,25 +125,22 @@
   
   /**
* Create a new Connector.
  + *
  + * @param address The IP address on which to bind
  + * @param port TCP port number to listen on
  + *
  + * @exception Exception if an MBean cannot be created or registered
*/
  -public Connector createConnector(String scheme, int acceptCount, String address,
  -int connectionTimeout,