Author: costin Date: Fri May 19 19:08:49 2006 New Revision: 407937 URL: http://svn.apache.org/viewvc?rev=407937&view=rev Log: More cleanup of unused stuff.
Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/AttributeInfo.java Fri May 19 19:08:49 2006 @@ -28,58 +28,22 @@ * descriptor.</p> * * @author Craig R. McClanahan - * @version $Revision: 155428 $ $Date: 2005-02-26 14:12:25 +0100 (sam., 26 févr. 2005) $ */ - public class AttributeInfo extends FeatureInfo implements Serializable { static final long serialVersionUID = -2511626862303972143L; // ----------------------------------------------------- Instance Variables - - - /** - * The <code>ModelMBeanAttributeInfo</code> object that corresponds - * to this <code>AttributeInfo</code> instance. - */ - protected transient MBeanAttributeInfo info = null; protected String displayName = null; + + // Information about the method to use protected String getMethod = null; protected String setMethod = null; - -// protected transient Method getMethodObj = null; -// protected transient Method setMethodObj = null; - protected boolean readable = true; protected boolean writeable = true; - protected boolean is = false; - protected String type = null; - - protected String persist; - protected String defaultStringValue; + // ------------------------------------------------------------- Properties - - /** - * Override the <code>description</code> property setter. - * - * @param description The new description - */ - public void setDescription(String description) { - super.setDescription(description); - this.info = null; - } - - /** - * Override the <code>name</code> property setter. - * - * @param name The new name - */ - public void setName(String name) { - super.setName(name); - this.info = null; - } - /** * The display name of this attribute. */ @@ -102,7 +66,6 @@ public void setGetMethod(String getMethod) { this.getMethod = getMethod; - this.info = null; } /** @@ -114,7 +77,6 @@ public void setIs(boolean is) { this.is = is; - this.info = null; } @@ -127,7 +89,6 @@ public void setReadable(boolean readable) { this.readable = readable; - this.info = null; } @@ -142,23 +103,8 @@ public void setSetMethod(String setMethod) { this.setMethod = setMethod; - this.info = null; - } - - - /** - * The fully qualified Java class name of this attribute. - */ - public String getType() { - return (this.type); } - public void setType(String type) { - this.type = type; - this.info = null; - } - - /** * Is this attribute writeable by management applications? */ @@ -168,35 +114,8 @@ public void setWriteable(boolean writeable) { this.writeable = writeable; - this.info = null; - } - - /** Persistence policy. - * All persistent attributes should have this attribute set. - * Valid values: - * ??? - */ - public String getPersist() { - return persist; - } - - public void setPersist(String persist) { - this.persist = persist; - } - - /** Default value. If set, it can provide info to the user and - * it can be used by persistence mechanism to generate a more compact - * representation ( a value may not be saved if it's default ) - */ - public String getDefault() { - return defaultStringValue; - } - - public void setDefault(String defaultStringValue) { - this.defaultStringValue = defaultStringValue; } - // --------------------------------------------------------- Public Methods @@ -204,44 +123,14 @@ * Create and return a <code>ModelMBeanAttributeInfo</code> object that * corresponds to the attribute described by this instance. */ - public MBeanAttributeInfo createAttributeInfo() { + MBeanAttributeInfo createAttributeInfo() { // Return our cached information (if any) - if (info != null) - return (info); - // Create and return a new information object - info = new MBeanAttributeInfo - (getName(), getType(), getDescription(), - isReadable(), isWriteable(), false); - return (info); - - } - - - /** - * Return a string representation of this attribute descriptor. - */ - public String toString() { - - StringBuffer sb = new StringBuffer("AttributeInfo["); - sb.append("name="); - sb.append(name); - sb.append(", description="); - sb.append(description); - if (!readable) { - sb.append(", readable="); - sb.append(readable); + if (info == null) { + info = new MBeanAttributeInfo(getName(), getType(), getDescription(), + isReadable(), isWriteable(), false); } - sb.append(", type="); - sb.append(type); - if (!writeable) { - sb.append(", writeable="); - sb.append(writeable); - } - sb.append("]"); - return (sb.toString()); - + return (MBeanAttributeInfo)info; } - // -------------------------------------------------------- Private Methods Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/BaseModelMBean.java Fri May 19 19:08:49 2006 @@ -113,80 +113,12 @@ * @exception RuntimeOperationsException if an IllegalArgumentException * occurs */ - public BaseModelMBean() throws MBeanException, RuntimeOperationsException { - + protected BaseModelMBean() throws MBeanException, RuntimeOperationsException { super(); - if( log.isDebugEnabled()) log.debug("default constructor"); - //BaseModelMBeans should be created only from ManagedBean, which sets the model explicitely. - //No need to create another object - //setModelMBeanInfo(createDefaultModelMBeanInfo()); } - - /** - * Construct a <code>ModelMBean</code> associated with the specified - * <code>ModelMBeanInfo</code> information. - * - * @param info ModelMBeanInfo for this MBean - * - * @exception MBeanException if the initializer of an object - * throws an exception - * @exception RuntimeOperationsException if an IllegalArgumentException - * occurs - */ -// public BaseModelMBean(ModelMBeanInfo info) -// throws MBeanException, RuntimeOperationsException { -// // XXX should be deprecated - just call setInfo -// super(); -// setModelMBeanInfo(info); -// if( log.isDebugEnabled()) log.debug("ModelMBeanInfo constructor"); -// } - - /** Construct a ModelMBean of a specified type. - * The type can be a class name or the key used in one of the descriptors. - * - * If no descriptor is available, we'll first try to locate one in - * the same package with the class, then use introspection. - * - * The mbean resource will be created. - * - * @param type Class name or the type key used in the descriptor. - * @throws MBeanException - * @throws RuntimeOperationsException - */ - // not used -// public BaseModelMBean( String type ) -// throws MBeanException, RuntimeOperationsException -// { -// try { -// // This constructor is used from <mlet>, it should create -// // the resource -// setModeledType(type); -// } catch( Throwable ex ) { -// log.error( "Error creating mbean ", ex); -// } -// } - - // not used -// public BaseModelMBean( String type, ModelerSource source ) -// throws MBeanException, RuntimeOperationsException -// { -// try { -// setModeledType(type); -// } catch( Throwable ex ) { -// log.error( "Error creating mbean ", ex); -// } -// this.source=source; -// } - // ----------------------------------------------------- Instance Variables - - // Information from MBeanRegistration - /** Registry we are associated with - */ -// protected Registry registry=null; - protected ObjectName oname=null; /** @@ -198,7 +130,6 @@ * Notification broadcaster for general notifications. */ protected BaseNotificationBroadcaster generalBroadcaster = null; - /** Metadata for the mbean instance. */ @@ -209,24 +140,11 @@ */ protected Object resource = null; - /** Source object used to read this mbean. Can be used to - * persist the mbean - */ - //protected ModelerSource source=null; - - /** Attribute values. XXX That can be stored in the value Field - */ - //protected HashMap attributes=new HashMap(); - // --------------------------------------------------- DynamicMBean Methods // TODO: move to ManagedBean static final Object[] NO_ARGS_PARAM=new Object[0]; static final Class[] NO_ARGS_PARAM_SIG=new Class[0]; - /** - * The <code>ModelMBeanInfo</code> object that controls our activity. - */ - protected MBeanInfo info = null; protected String resourceType = null; // key: operation val: invoke method @@ -328,9 +246,7 @@ * Return the <code>MBeanInfo</code> object for this MBean. */ public MBeanInfo getMBeanInfo() { - // XXX Why do we have to clone ? - if( info== null ) return null; - return ((MBeanInfo) info.clone()); + return managedBean.getMBeanInfo(); } @@ -649,40 +565,6 @@ } - /** - * Initialize the <code>ModelMBeanInfo</code> associated with this - * <code>ModelMBean</code>. After the information and associated - * descriptors have been customized, the <code>ModelMBean</code> should - * be registered with the associated <code>MBeanServer</code>. - * - * Currently the model can be set after registration. This behavior is - * deprecated and won't be supported in future versions. - * - * @param info The ModelMBeanInfo object to be used by this ModelMBean - * - * @exception MBeanException If an exception occurs recording this - * ModelMBeanInfo information - * @exception RuntimeOperations if the specified parameter is - * <code>null</code> or invalid - */ - public void setMBeanInfo(MBeanInfo info) - throws MBeanException, RuntimeOperationsException { - - if (info == null) - throw new RuntimeOperationsException - (new IllegalArgumentException("ModelMBeanInfo is null"), - "ModelMBeanInfo is null"); - -// if (!isModelMBeanInfoValid(info)) -// throw new RuntimeOperationsException -// (new IllegalArgumentException("ModelMBeanInfo is invalid"), -// "ModelMBeanInfo is invalid"); - - this.info = (MBeanInfo) info.clone(); - - } - - // ------------------------------ ModelMBeanNotificationBroadcaster Methods @@ -934,7 +816,7 @@ public MBeanNotificationInfo[] getNotificationInfo() { // Acquire the set of application notifications - MBeanNotificationInfo current[] = info.getNotifications(); + MBeanNotificationInfo current[] = getMBeanInfo().getNotifications(); if (current == null) current = new MBeanNotificationInfo[0]; MBeanNotificationInfo response[] = Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/ConstructorInfo.java Fri May 19 19:08:49 2006 @@ -21,7 +21,6 @@ import java.io.Serializable; import javax.management.MBeanConstructorInfo; -import javax.management.MBeanParameterInfo; /** @@ -29,133 +28,28 @@ * descriptor.</p> * * @author Craig R. McClanahan - * @version $Revision: 155428 $ $Date: 2005-02-26 14:12:25 +0100 (sam., 26 févr. 2005) $ */ - -public class ConstructorInfo extends FeatureInfo implements Serializable { +public class ConstructorInfo extends OperationInfo implements Serializable { static final long serialVersionUID = -5735336213417238238L; - - // ----------------------------------------------------- Instance Variables - - - /** - * The <code>ModelMBeanConstructorInfo</code> object that corresponds - * to this <code>ConstructorInfo</code> instance. - */ - transient MBeanConstructorInfo info = null; - protected String displayName = null; - protected ParameterInfo parameters[] = new ParameterInfo[0]; - - // ------------------------------------------------------------- Properties public ConstructorInfo() { - System.err.println("CONSTRUCTOR XXXX"); - } - - /** - * Override the <code>description</code> property setter. - * - * @param description The new description - */ - public void setDescription(String description) { - super.setDescription(description); - this.info = null; - } - - - /** - * Override the <code>name</code> property setter. - * - * @param name The new name - */ - public void setName(String name) { - super.setName(name); - this.info = null; - System.err.println("Constructor: name"); - } - - - /** - * The display name of this attribute. - */ - public String getDisplayName() { - return (this.displayName); - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - - /** - * The set of parameters for this constructor. - */ - public ParameterInfo[] getSignature() { - return (this.parameters); } - // --------------------------------------------------------- Public Methods /** - * Add a new parameter to the set of parameters for this constructor. - * - * @param parameter The new parameter descriptor - */ - public void addParameter(ParameterInfo parameter) { - - synchronized (parameters) { - ParameterInfo results[] = new ParameterInfo[parameters.length + 1]; - System.arraycopy(parameters, 0, results, 0, parameters.length); - results[parameters.length] = parameter; - parameters = results; - this.info = null; - } - - } - - - /** * Create and return a <code>ModelMBeanConstructorInfo</code> object that * corresponds to the attribute described by this instance. */ public MBeanConstructorInfo createConstructorInfo() { - // Return our cached information (if any) - if (info != null) - return (info); - - // Create and return a new information object - ParameterInfo params[] = getSignature(); - MBeanParameterInfo parameters[] = - new MBeanParameterInfo[params.length]; - for (int i = 0; i < params.length; i++) - parameters[i] = params[i].createParameterInfo(); - info = new MBeanConstructorInfo - (getName(), getDescription(), parameters); - return (info); - - } - - - /** - * Return a string representation of this constructor descriptor. - */ - public String toString() { - - StringBuffer sb = new StringBuffer("ConstructorInfo["); - sb.append("name="); - sb.append(name); - sb.append(", description="); - sb.append(description); - sb.append(", parameters="); - sb.append(parameters.length); - sb.append("]"); - return (sb.toString()); - + if (info == null) { + info = new MBeanConstructorInfo(getName(), getDescription(), + getMBeanParameterInfo()); + } + return (MBeanConstructorInfo)info; } - } Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/FeatureInfo.java Fri May 19 19:08:49 2006 @@ -19,8 +19,8 @@ import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; + +import javax.management.MBeanFeatureInfo; /** @@ -35,13 +35,17 @@ public class FeatureInfo implements Serializable { static final long serialVersionUID = -911529176124712296L; + protected String description = null; - //protected List fields = new ArrayList(); protected String name = null; + protected MBeanFeatureInfo info = null; + + // all have type except Constructor + protected String type = null; + // ------------------------------------------------------------- Properties - /** * The human-readable description of this feature. */ @@ -55,14 +59,6 @@ /** - * The field information for this feature. - */ -// public List getFields() { -// return (fields); -// } - - - /** * The name of this feature, which must be unique among features in the * same collection. */ @@ -74,39 +70,16 @@ this.name = name; } - - // --------------------------------------------------------- Public Methods - - /** - * <p>Add a new field to the fields associated with the - * Descriptor that will be created from this metadata.</p> - * - * @param field The field to be added + * The fully qualified Java class name of this element. */ -// public void addField(FieldInfo field) { -// fields.add(field); -// } - - - // ------------------------------------------------------ Protected Methods - + public String getType() { + return (this.type); + } - /** - * <p>Add the name/value fields that have been stored into the - * specified <code>Descriptor</code> instance.</p> - * - * @param descriptor The <code>Descriptor</code> to add fields to - */ -// protected void addFields(Descriptor descriptor) { -// -// Iterator items = getFields().iterator(); -// while (items.hasNext()) { -// FieldInfo item = (FieldInfo) items.next(); -// descriptor.setField(item.getName(), item.getValue()); -// } -// -// } + public void setType(String type) { + this.type = type; + } } Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/ManagedBean.java Fri May 19 19:08:49 2006 @@ -340,7 +340,6 @@ MBeanException, RuntimeOperationsException { BaseModelMBean mbean = null; - MBeanInfo minfo = createMBeanInfo(); // Load the ModelMBean implementation class if(getClassName().equals(BASE_MBEAN)) { @@ -382,19 +381,6 @@ mbean.setManagedBean(this); - // Create a new ModelMBean instance - try { - mbean.setMBeanInfo(minfo); - } catch (MBeanException e) { - throw e; - } catch (RuntimeOperationsException e) { - throw e; - } catch (Exception e) { - throw new MBeanException - (e, "Cannot instantiate ModelMBean of class " + - getClassName()); - } - // Set the managed resource (if any) try { if (instance != null) @@ -411,7 +397,7 @@ * Create and return a <code>ModelMBeanInfo</code> object that * describes this entire managed bean. */ - MBeanInfo createMBeanInfo() { + MBeanInfo getMBeanInfo() { // Return our cached information (if any) if (info != null) Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/OperationInfo.java Fri May 19 19:08:49 2006 @@ -29,9 +29,7 @@ * descriptor.</p> * * @author Craig R. McClanahan - * @version $Revision: 155428 $ $Date: 2005-02-26 14:12:25 +0100 (sam., 26 févr. 2005) $ */ - public class OperationInfo extends FeatureInfo implements Serializable { static final long serialVersionUID = 4418342922072614875L; // ----------------------------------------------------------- Constructors @@ -45,77 +43,16 @@ super(); } - - - /** - * Special constructor for setting up getter and setter operations. - * - * @param name Name of this operation - * @param getter Is this a getter (as opposed to a setter)? - * @param type Data type of the return value (if this is a getter) - * or the parameter (if this is a setter) - * - */ - public OperationInfo(String name, boolean getter, String type) { - - super(); - setName(name); - if (getter) { - setDescription("Attribute getter method"); - setImpact("INFO"); - setReturnType(type); - setRole("getter"); - } else { - setDescription("Attribute setter method"); - setImpact("ACTION"); - setReturnType("void"); - setRole("setter"); - addParameter(new ParameterInfo("value", type, - "New attribute value")); - } - - } - - + // ----------------------------------------------------- Instance Variables - - /** - * The <code>ModelMBeanOperationInfo</code> object that corresponds - * to this <code>OperationInfo</code> instance. - */ - transient MBeanOperationInfo info = null; protected String impact = "UNKNOWN"; protected String role = "operation"; - protected String returnType = "void"; // FIXME - Validate protected ParameterInfo parameters[] = new ParameterInfo[0]; // ------------------------------------------------------------- Properties - - /** - * Override the <code>description</code> property setter. - * - * @param description The new description - */ - public void setDescription(String description) { - super.setDescription(description); - this.info = null; - } - - - /** - * Override the <code>name</code> property setter. - * - * @param name The new name - */ - public void setName(String name) { - super.setName(name); - this.info = null; - } - - /** * The "impact" of this operation, which should be a (case-insensitive) * string value "ACTION", "ACTION_INFO", "INFO", or "UNKNOWN". @@ -150,11 +87,14 @@ * operation. */ public String getReturnType() { - return (this.returnType); + if(type == null) { + type = "void"; + } + return type; } public void setReturnType(String returnType) { - this.returnType = returnType; + this.type = returnType; } /** @@ -189,52 +129,32 @@ * Create and return a <code>ModelMBeanOperationInfo</code> object that * corresponds to the attribute described by this instance. */ - public MBeanOperationInfo createOperationInfo() { + MBeanOperationInfo createOperationInfo() { // Return our cached information (if any) - if (info != null) - return (info); + if (info == null) { + // Create and return a new information object + int impact = MBeanOperationInfo.UNKNOWN; + if ("ACTION".equals(getImpact())) + impact = MBeanOperationInfo.ACTION; + else if ("ACTION_INFO".equals(getImpact())) + impact = MBeanOperationInfo.ACTION_INFO; + else if ("INFO".equals(getImpact())) + impact = MBeanOperationInfo.INFO; + + info = new MBeanOperationInfo(getName(), getDescription(), + getMBeanParameterInfo(), + getReturnType(), impact); + } + return (MBeanOperationInfo)info; + } - // Create and return a new information object + protected MBeanParameterInfo[] getMBeanParameterInfo() { ParameterInfo params[] = getSignature(); MBeanParameterInfo parameters[] = new MBeanParameterInfo[params.length]; for (int i = 0; i < params.length; i++) parameters[i] = params[i].createParameterInfo(); - int impact = MBeanOperationInfo.UNKNOWN; - if ("ACTION".equals(getImpact())) - impact = MBeanOperationInfo.ACTION; - else if ("ACTION_INFO".equals(getImpact())) - impact = MBeanOperationInfo.ACTION_INFO; - else if ("INFO".equals(getImpact())) - impact = MBeanOperationInfo.INFO; - - info = new MBeanOperationInfo - (getName(), getDescription(), parameters, - getReturnType(), impact); - return (info); - - } - - - /** - * Return a string representation of this operation descriptor. - */ - public String toString() { - - StringBuffer sb = new StringBuffer("OperationInfo["); - sb.append("name="); - sb.append(name); - sb.append(", description="); - sb.append(description); - sb.append(", returnType="); - sb.append(returnType); - sb.append(", parameters="); - sb.append(parameters.length); - sb.append("]"); - return (sb.toString()); - + return parameters; } - - } Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/ParameterInfo.java Fri May 19 19:08:49 2006 @@ -40,80 +40,9 @@ * Standard zero-arguments constructor. */ public ParameterInfo() { - - super(); - - } - - - /** - * Special constructor for setting up parameters programatically. - * - * @param name Name of this parameter - * @param type Java class of this parameter - * @param description Description of this parameter - */ - public ParameterInfo(String name, String type, String description) { - super(); - setName(name); - setType(type); - setDescription(description); - - } - - - // ----------------------------------------------------- Instance Variables - - - /** - * The <code>MBeanParameterInfo</code> object that corresponds - * to this <code>ParameterInfo</code> instance. - */ - transient MBeanParameterInfo info = null; - protected String type = null; - - // ------------------------------------------------------------- Properties - - - /** - * Override the <code>description</code> property setter. - * - * @param description The new description - */ - public void setDescription(String description) { - super.setDescription(description); - this.info = null; - } - - - /** - * Override the <code>name</code> property setter. - * - * @param name The new name - */ - public void setName(String name) { - super.setName(name); - this.info = null; } - - /** - * The fully qualified Java class name of this parameter. - */ - public String getType() { - return (this.type); - } - - public void setType(String type) { - this.type = type; - this.info = null; - } - - - // --------------------------------------------------------- Public Methods - - /** * Create and return a <code>MBeanParameterInfo</code> object that * corresponds to the parameter described by this instance. @@ -121,31 +50,10 @@ public MBeanParameterInfo createParameterInfo() { // Return our cached information (if any) - if (info != null) - return (info); - - // Create and return a new information object - info = new MBeanParameterInfo - (getName(), getType(), getDescription()); - return (info); - - } - - - /** - * Return a string representation of this parameter descriptor. - */ - public String toString() { - - StringBuffer sb = new StringBuffer("ParameterInfo["); - sb.append("name="); - sb.append(name); - sb.append(", description="); - sb.append(description); - sb.append(", type="); - sb.append(type); - sb.append("]"); - return (sb.toString()); - + if (info == null) { + info = new MBeanParameterInfo + (getName(), getType(), getDescription()); + } + return (MBeanParameterInfo)info; } } Modified: tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java?rev=407937&r1=407936&r2=407937&view=diff ============================================================================== --- tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java (original) +++ tomcat/sandbox/java/org/apache/tomcat/util/modeler/Registry.java Fri May 19 19:08:49 2006 @@ -23,7 +23,6 @@ import java.io.InputStream; import java.net.URL; import java.util.ArrayList; -import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; @@ -72,10 +71,6 @@ * @author Costin Manolache */ public class Registry implements RegistryMBean, MBeanRegistration { - /** Experimental support for manifest-based discovery. - */ - public static String MODELER_MANIFEST="/META-INF/mbeans-descriptors.xml"; - /** * The Log instance to which we will write our log messages. */ @@ -83,7 +78,7 @@ // Support for the factory methods - /** Will be used to isolate different apps and enhance security + /** Will be used to isolate different apps and enhance security. */ private static HashMap perLoaderRegistries=null; @@ -114,10 +109,10 @@ // map to avoid duplicated searching or loading descriptors private HashMap searchedPaths=new HashMap(); - private Object key; private Object guard; // Id - small ints to use array access. No reset on stop() + // Used for notifications private Hashtable idDomains=new Hashtable(); private Hashtable ids=new Hashtable(); @@ -159,7 +154,7 @@ localRegistry=(Registry)perLoaderRegistries.get(key); if( localRegistry == null ) { localRegistry=new Registry(); - localRegistry.key=key; +// localRegistry.key=key; localRegistry.guard=guard; perLoaderRegistries.put( key, localRegistry ); return localRegistry; @@ -183,7 +178,8 @@ return (registry); } - /** Allow containers to isolate apps. Can be called only once. + /** + * Allow containers to isolate apps. Can be called only once. * It is highly recommended you call this method if using Registry in * a container environment. The default is false for backward compatibility * @@ -198,21 +194,8 @@ // -------------------- Generic methods -------------------- - /** Set a guard object that will prevent access to this registry - * by unauthorized components - * - * @param guard - * - * @since 1.1 - */ - public void setGuard( Object guard ) { - if( this.guard!=null ) { - return; // already set, only once - } - this.guard=guard; - } - /** Lifecycle method - clean up the registry metadata. + * Called from resetMetadata(). * * @since 1.1 */ @@ -248,9 +231,6 @@ * descriptors file. In the case of File and URL, if the extension is ".ser" * a serialized version will be loaded. * - * Also ( experimental for now ) a ClassLoader - in which case META-INF/ will - * be used. - * * This method should be used to explicitely load metadata - but this is not * required in most cases. The registerComponent() method will find metadata * in the same pacakge. @@ -258,13 +238,7 @@ * @param source */ public void loadMetadata(Object source ) throws Exception { - if( source instanceof ClassLoader ) { - loadMetaInfDescriptors((ClassLoader)source); - return; - } else { - loadDescriptors( null, source, null ); - } - + loadDescriptors( null, source, null ); } /** Register a bean by creating a modeler mbean and adding it to the @@ -899,25 +873,6 @@ } } - /** Discover all META-INF/modeler.xml files in classpath and register - * the components - * - * @since EXPERIMENTAL - */ - private void loadMetaInfDescriptors(ClassLoader cl) { - try { - Enumeration en=cl.getResources(MODELER_MANIFEST); - while( en.hasMoreElements() ) { - URL url=(URL)en.nextElement(); - InputStream is=url.openStream(); - if( log.isDebugEnabled()) log.debug("Loading " + url); - loadDescriptors("MbeansDescriptorsDigesterSource", is, null ); - } - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - /** Lookup the component descriptor in the package and * in the parent packages. * @@ -1061,12 +1016,6 @@ } } - public List loadMBeans( Object source ) - throws Exception - { - return loadMBeans( source, null ); - } - /** * Load the registry from a cached .ser file. This is typically 2-3 times --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]