User: juhalindfors
Date: 01/12/10 09:24:36
Added: src/main/javax/management/modelmbean DescriptorSupport.java
InvalidTargetObjectTypeException.java
ModelMBean.java ModelMBeanAttributeInfo.java
ModelMBeanConstructorInfo.java ModelMBeanInfo.java
ModelMBeanInfoSupport.java
ModelMBeanNotificationBroadcaster.java
ModelMBeanNotificationInfo.java
ModelMBeanOperationInfo.java XMLParseException.java
Log:
javax.management.modelmbean classes
Revision Changes Path
1.1 jmx/src/main/javax/management/modelmbean/DescriptorSupport.java
Index: DescriptorSupport.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import javax.management.Descriptor;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
/**
* Support class for creating descriptors.
*
* @see javax.management.Descriptor
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*/
public class DescriptorSupport
implements Descriptor
{
// Attributes ----------------------------------------------------
public String currClass;
private Map fields = new HashMap();
// Constructors --------------------------------------------------
public DescriptorSupport()
{
}
public DescriptorSupport(int initNumFields) throws MBeanException,
RuntimeOperationsException
{
}
public DescriptorSupport(DescriptorSupport inDescr)
{
}
public DescriptorSupport(String inStr) throws MBeanException,
RuntimeOperationsException, XMLParseException
{
}
public DescriptorSupport(String[] fieldNames, Object[] fieldValues) throws
RuntimeOperationsException
{
}
public DescriptorSupport(String[] fields)
{
}
// Public --------------------------------------------------------
public Object getFieldValue(String inFieldName)
{
// FIXME: null or empty string
return fields.get(inFieldName);
}
public void setField(String inFieldName, Object fieldValue)
{
fields.put(inFieldName, fieldValue);
}
public String[] getFields()
{
String[] fieldStrings = new String[fields.size()];
Iterator it = fields.keySet().iterator();
for (int i = 0; i < fields.size(); ++i)
{
String key = (String)it.next();
fieldStrings[i] = key + "=" + fields.get(key);
}
return fieldStrings;
}
public String[] getFieldNames()
{
return (String[])fields.keySet().toArray(new String[0]);
}
public Object[] getFieldValues(String[] fieldNames)
{
return fields.values().toArray();
}
public void setFields(String[] fieldNames, Object[] fieldValues) throws
RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public Object clone() throws RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public void removeField(String fieldName)
{
fields.remove(fieldName);
}
public boolean isValid() throws RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public String toXMLString()
{
// FIXME: NYI
throw new Error("NYI");
}
// Object overrides ----------------------------------------------
public String toString()
{
// FIXME: human readable string
return super.toString();
}
}
1.1
jmx/src/main/javax/management/modelmbean/InvalidTargetObjectTypeException.java
Index: InvalidTargetObjectTypeException.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
/**
* Thrown when unrecognizable target object type is set to a Model MBean
* instance
*
* @see javax.management.modelmbean.ModelMBean
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*
*/
public class InvalidTargetObjectTypeException
extends Exception
{
// Attributes ----------------------------------------------------
private Exception e = null;
// Constructors --------------------------------------------------
public InvalidTargetObjectTypeException()
{
super();
}
public InvalidTargetObjectTypeException(String s)
{
super(s);
}
public InvalidTargetObjectTypeException(Exception e, String s)
{
this(s);
this.e = e;
}
// Throwable overrides -------------------------------------------
public String getMessage()
{
return super.getMessage();
}
// Object overrides ----------------------------------------------
public String toString()
{
return super.toString();
}
}
1.1 jmx/src/main/javax/management/modelmbean/ModelMBean.java
Index: ModelMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import javax.management.DynamicMBean;
import javax.management.PersistentMBean;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
import javax.management.InstanceNotFoundException;
/**
* Defines Model MBean.
*
* @see javax.management.DynamicMBean
* @see javax.management.PersistentMBean
* @see javax.management.ModelMBeanNotificationBroadcaster
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*/
public interface ModelMBean
extends DynamicMBean, PersistentMBean, ModelMBeanNotificationBroadcaster
{
public void setModelMBeanInfo(ModelMBeanInfo inModelMBeanInfo)
throws MBeanException, RuntimeOperationsException;
public void setManagedResource(Object mr, String mr_type)
throws MBeanException, RuntimeOperationsException, InstanceNotFoundException,
InvalidTargetObjectTypeException;
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanAttributeInfo.java
Index: ModelMBeanAttributeInfo.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import java.lang.reflect.Method;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
import javax.management.MBeanAttributeInfo;
import javax.management.IntrospectionException;
/**
* Represents a Model MBean's management attribute.
*
* @see javax.management.MBeanAttributeInfo
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*
*/
public class ModelMBeanAttributeInfo
extends MBeanAttributeInfo
implements DescriptorAccess, Cloneable
{
// Attributes ----------------------------------------------------
private Descriptor descriptor = null;
// Constructors --------------------------------------------------
public ModelMBeanAttributeInfo(String name, String description, Method getter,
Method setter)
throws IntrospectionException
{
super(name, description, getter, setter);
}
public ModelMBeanAttributeInfo(String name, String description, Method getter,
Method setter, Descriptor descriptor)
throws IntrospectionException
{
this(name, description, getter, setter);
this.descriptor = descriptor;
}
public ModelMBeanAttributeInfo(String name, String type, String description,
boolean isReadable, boolean isWritable, boolean
isIs)
{
super(name, type, description, isReadable, isWritable, isIs);
}
public ModelMBeanAttributeInfo(String name, String type, String description,
boolean isReadable, boolean isWritable, boolean
isIs, Descriptor descriptor)
{
this(name, type, description, isReadable, isWritable, isIs);
this.descriptor = descriptor;
}
public ModelMBeanAttributeInfo(ModelMBeanAttributeInfo inInfo)
{
super("", "", "", false, false, false);
// FIXME: why do we need a copy constructor if we implement Cloneable? This
ain't C++.
throw new Error("NYI");
}
// Public --------------------------------------------------------
public Descriptor getDescriptor()
{
return (Descriptor)descriptor.clone();
}
public void setDescriptor(Descriptor inDescriptor)
{
this.descriptor = descriptor;
}
// Cloneable implementation --------------------------------------
public Object clone()
{
// FIXME: NYI
throw new Error("NYI");
}
// Object override -----------------------------------------------
public String toString()
{
// FIXME: human readable string
return super.toString();
}
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanConstructorInfo.java
Index: ModelMBeanConstructorInfo.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import java.lang.reflect.Constructor;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
import javax.management.MBeanConstructorInfo;
import javax.management.MBeanParameterInfo;
/**
* Represents constructor.
*
* @see javax.management.ModelMBeanInfo
* @see javax.management.ModelMBeanInfoSupport
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*
*/
public class ModelMBeanConstructorInfo
extends MBeanConstructorInfo
implements DescriptorAccess, Cloneable
{
// Attributes ----------------------------------------------------
private Descriptor descriptor = null;
// Constructors --------------------------------------------------
public ModelMBeanConstructorInfo(String description, Constructor
constructorMethod)
{
super(description, constructorMethod);
// FIXME: create default descriptor
}
public ModelMBeanConstructorInfo(String description, Constructor
constructorMethod,
Descriptor descriptor)
{
this(description, constructorMethod);
setDescriptor(descriptor);
}
public ModelMBeanConstructorInfo(String name, String description,
MBeanParameterInfo[] signature)
{
super(name, description, signature);
// FIXME: create default descriptor
}
public ModelMBeanConstructorInfo(String name, String description,
MBeanParameterInfo[] signature,
Descriptor descriptor)
{
this(name, description, signature);
setDescriptor(descriptor);
}
// Public --------------------------------------------------------
public Descriptor getDescriptor()
{
return (Descriptor)descriptor.clone();
}
public void setDescriptor(Descriptor inDescriptor)
{
// FIXME: if null inDescriptor, create default descriptor
// FIXME: if invalid descriptor (fields name, descriptionType, role required)
throw IllegalArgumentException
this.descriptor = descriptor;
}
// Cloneable implementation --------------------------------------
public Object clone()
{
// FIXME: NYI
throw new Error("NYI");
}
// Object overrides ----------------------------------------------
public String toString()
{
// FIXME: human readable string
return super.toString();
}
}
1.1 jmx/src/main/javax/management/modelmbean/ModelMBeanInfo.java
Index: ModelMBeanInfo.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanConstructorInfo;
import javax.management.Descriptor;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
public interface ModelMBeanInfo
{
public Descriptor[] getDescriptors(String inDescriptorType)
throws MBeanException, RuntimeOperationsException;
public void setDescriptors(Descriptor[] inDescriptors)
throws MBeanException, RuntimeOperationsException;
public Descriptor getDescriptor(String inDescriptorName, String inDescriptorType)
throws MBeanException, RuntimeOperationsException;
public void setDescriptor(Descriptor inDescriptor, String inDescriptorType)
throws MBeanException, RuntimeOperationsException;
public Descriptor getMBeanDescriptor()
throws MBeanException, RuntimeOperationsException;
public void setMBeanDescriptor(Descriptor inDescriptor)
throws MBeanException, RuntimeOperationsException;
public ModelMBeanAttributeInfo getAttribute(String inName)
throws MBeanException, RuntimeOperationsException;
public ModelMBeanOperationInfo getOperation(String inName)
throws MBeanException, RuntimeOperationsException;
public ModelMBeanNotificationInfo getNotification(String inName)
throws MBeanException, RuntimeOperationsException;
public Object clone();
public MBeanAttributeInfo[] getAttributes();
public String getClassName();
public MBeanConstructorInfo[] getConstructors();
public String getDescription();
public MBeanNotificationInfo[] getNotifications();
public MBeanOperationInfo[] getOperations();
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanInfoSupport.java
Index: ModelMBeanInfoSupport.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import javax.management.MBeanInfo;
import javax.management.Descriptor;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanConstructorInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanConstructorInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo;
import javax.management.modelmbean.ModelMBeanNotificationInfo;
import javax.management.modelmbean.ModelMBeanInfo;
/**
* Support class for <tt>ModelMBeanInfo</tt> interface.
*
* @see javax.management.modelmbean.ModelMBeanInfo
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*/
public class ModelMBeanInfoSupport
extends MBeanInfo
implements ModelMBeanInfo, java.io.Serializable
{
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
public ModelMBeanInfoSupport(ModelMBeanInfo mbi)
{
// FIXME: NYI
super("", "", null, null, null, null);
throw new Error("NYI");
}
public ModelMBeanInfoSupport(String className, String description,
ModelMBeanAttributeInfo[] attributes,
ModelMBeanConstructorInfo[] constructors,
ModelMBeanOperationInfo[] operations,
ModelMBeanNotificationInfo[] notifications)
{
super(className, description, attributes, constructors, operations,
notifications);
// FIXME: create default MBean descriptor
}
public ModelMBeanInfoSupport(String className, String description,
ModelMBeanAttributeInfo[] attributes,
ModelMBeanConstructorInfo[] constructors,
ModelMBeanOperationInfo[] operations,
ModelMBeanNotificationInfo[] notifications,
Descriptor mbeandescriptor)
{
this(className, description, attributes, constructors, operations,
notifications);
try
{
setMBeanDescriptor(mbeandescriptor);
}
catch (MBeanException e)
{
throw new IllegalArgumentException(e.toString() /* FIXME: message */ );
}
}
// Public --------------------------------------------------------
public Descriptor[] getDescriptors(String inDescriptorType)
throws MBeanException,RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public void setDescriptors(Descriptor[] inDescriptors)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public Descriptor getDescriptor(String inDescriptorName)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public Descriptor getDescriptor(String inDescriptorName, String inDescriptorType)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public void setDescriptor(Descriptor inDescriptor,
java.lang.String inDescriptorType)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public ModelMBeanAttributeInfo getAttribute(String inName)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public ModelMBeanOperationInfo getOperation(String inName)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public ModelMBeanConstructorInfo getConstructor(String inName)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public ModelMBeanNotificationInfo getNotification(String inName)
throws MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public MBeanAttributeInfo[] getAttributes()
{
// FIXME: NYI
throw new Error("NYI");
}
public MBeanOperationInfo[] getOperations()
{
// FIXME: NYI
throw new Error("NYI");
}
public MBeanConstructorInfo[] getConstructors()
{
// FIXME: NYI
throw new Error("NYI");
}
public MBeanNotificationInfo[] getNotifications()
{
// FIXME: NYI
throw new Error("NYI");
}
public Descriptor getMBeanDescriptor() throws MBeanException,
RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
public void setMBeanDescriptor(Descriptor inMBeanDescriptor) throws
MBeanException, RuntimeOperationsException
{
// FIXME: NYI
throw new Error("NYI");
}
// Y overrides ---------------------------------------------------
public Object clone()
{
// FIXME: NYI
throw new Error("NYI");
}
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanNotificationBroadcaster.java
Index: ModelMBeanNotificationBroadcaster.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import javax.management.Attribute;
import javax.management.AttributeChangeNotification;
import javax.management.NotificationBroadcaster;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.MBeanException;
import javax.management.RuntimeOperationsException;
import javax.management.ListenerNotFoundException;
public interface ModelMBeanNotificationBroadcaster extends NotificationBroadcaster
{
public void sendNotification(Notification ntfyObj) throws MBeanException,
RuntimeOperationsException;
public void sendNotification(String ntfyText) throws MBeanException,
RuntimeOperationsException;
public void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj)
throws MBeanException, RuntimeOperationsException;
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute
inNewVal)
throws MBeanException, RuntimeOperationsException;
public void addAttributeChangeNotificationListener(NotificationListener
inlistener,
String inAttributeName, Object inhandback)
throws MBeanException, RuntimeOperationsException, IllegalArgumentException;
public void removeAttributeChangeNotificationListener(NotificationListener
inlistener, String inAttributeName)
throws MBeanException, RuntimeOperationsException, ListenerNotFoundException;
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanNotificationInfo.java
Index: ModelMBeanNotificationInfo.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import javax.management.MBeanNotificationInfo;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
/**
* Represents a notification in a Model MBean's management interface.
*
* @see javax.management.modelmbean.ModelMBeanInfo
* @see javax.management.modelmbean.ModelMBeanAttributeInfo
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*/
public class ModelMBeanNotificationInfo
extends MBeanNotificationInfo
implements DescriptorAccess, Cloneable
{
// Attributes ----------------------------------------------------
private Descriptor descriptor = null;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public ModelMBeanNotificationInfo(String[] notifTypes, String name, String
description)
{
super(notifTypes, name, description);
// FIXME: create default descriptor
}
public ModelMBeanNotificationInfo(String[] notifTypes, String name, String
description,
Descriptor descriptor)
{
this(notifTypes, name, description);
setDescriptor(descriptor);
}
public ModelMBeanNotificationInfo(ModelMBeanNotificationInfo inInfo)
{
super(null, "", "");
// FIXME: why do we need a copy constructor if we implement Cloneable? This
ain't C++.
throw new Error("NYI");
}
// Public --------------------------------------------------------
public Descriptor getDescriptor()
{
return (Descriptor)descriptor.clone();
}
public void setDescriptor(Descriptor inDescriptor)
{
// FIXME: if null inDescriptor, create default descriptor
// FIXME: check validity of descriptor fields (name & descriptorType are
required fields)
this.descriptor = descriptor;
}
// Cloneable implementation --------------------------------------
public Object clone()
{
// FIXME: NYI
throw new Error("NYI");
}
// Object overrides ----------------------------------------------
public String toString()
{
// FIXME: human readable string
return super.toString();
}
}
1.1
jmx/src/main/javax/management/modelmbean/ModelMBeanOperationInfo.java
Index: ModelMBeanOperationInfo.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
import java.lang.reflect.Method;
import javax.management.MBeanParameterInfo;
import javax.management.MBeanOperationInfo;
import javax.management.DescriptorAccess;
import javax.management.Descriptor;
/**
* Represents Model MBean operation.
*
* @see javax.management.ModelMBeanInfo
* @see javax.management.ModelMBeanInfoSupport
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*/
public class ModelMBeanOperationInfo
extends MBeanOperationInfo
implements DescriptorAccess
{
// Attributes ----------------------------------------------------
private Descriptor descriptor = null;
// Constructors --------------------------------------------------
public ModelMBeanOperationInfo(String description, Method operationMethod)
{
super(description, operationMethod);
// FIXME: build default descriptor
}
public ModelMBeanOperationInfo(String description, Method operationMethod,
Descriptor descriptor)
{
this(description, operationMethod);
setDescriptor(descriptor);
}
public ModelMBeanOperationInfo(String name, String description,
MBeanParameterInfo[] signature,
String type, int impact)
{
super(name, description, signature, type, impact);
// FIXME: build default descriptor
}
public ModelMBeanOperationInfo(String name, String description,
MBeanParameterInfo[] signature,
String type, int impact, Descriptor descriptor)
{
this(name, description, signature, type, impact);
setDescriptor(descriptor);
}
public ModelMBeanOperationInfo(ModelMBeanOperationInfo inInfo)
{
super("", "", null, "", 0);
// FIXME: why do we need a copy constructor if we implement Cloneable? This
ain't C++.
throw new Error("NYI");
}
// Public --------------------------------------------------------
public Descriptor getDescriptor()
{
return (Descriptor)descriptor.clone();
}
public void setDescriptor(Descriptor inDescriptor)
{
// FIXME: if null, create default descriptor
// FIXME: check vailidty, fields name, descriptorType and role are required
this.descriptor = inDescriptor;
}
// Cloneable implementation --------------------------------------
public Object clone()
{
// FIXME: NYI
throw new Error("NYI");
}
// Object overrides ----------------------------------------------
public String toString()
{
// FIXME: human readable string
return super.toString();
}
}
1.1 jmx/src/main/javax/management/modelmbean/XMLParseException.java
Index: XMLParseException.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package javax.management.modelmbean;
/**
* Exceptions related to XML handling.
*
* @see javax.management.modelmbean.DescriptorSupport
*
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>.
* @version $Revision: 1.1 $
*
*/
public class XMLParseException
extends Exception
{
// Attributes ----------------------------------------------------
private Exception e = null;
// Constructors --------------------------------------------------
public XMLParseException()
{
super();
}
public XMLParseException(String s)
{
super(s);
}
public XMLParseException(Exception e, String s)
{
this(s);
this.e = e;
}
// Throwable overrides -------------------------------------------
public java.lang.String getMessage()
{
return super.getMessage();
}
// Object overrides ----------------------------------------------
public String toString()
{
return super.toString();
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development