You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by hi...@apache.org on 2006/01/26 13:18:17 UTC
svn commit: r372516 [7/12] - in /webservices/muse/trunk/wsdm-jmx: ./ src/
src/examples/ src/examples/requestcounter/
src/examples/requestcounter/config/ src/examples/requestcounter/requests/
src/examples/requestcounter/src/ src/examples/requestcounter/...
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorMBeanResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorMBeanResource.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorMBeanResource.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorMBeanResource.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,293 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.notification.monitor;
+
+import javax.management.MBeanServerConnection;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.management.monitor.MonitorNotification;
+
+import org.apache.commons.id.uuid.UUID;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.muws.jmx.notification.JmxSubscriptionResource;
+import org.apache.ws.muws.jmx.resource.properties.PropertyValue;
+import org.apache.ws.muws.v1_0.capability.IdentityCapability;
+import org.apache.ws.muws.v1_0.events.Situation;
+import org.apache.ws.muws.v1_0.events.impl.XmlBeansManagementEvent;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.v2004_06.impl.XmlBeansResourcePropertyValueChangeEvent;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlAnyURI;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
+
+/**
+ * An abstract class for {@link AttributeChangeMonitorMBeanResource} and {@link JmxMonitorMBeanResource}.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public abstract class MonitorMBeanResource implements NotificationListener
+{
+ private static final Log LOG = LogFactory.getLog(MonitorMBeanResource.class);
+
+ public static final String MONITOR_DOMAIN = "muse";
+
+ private JmxSubscriptionResource m_subscription;
+ private PropertyValue m_observedPropertyValue;
+ private Topic[] m_topics;
+
+ /**
+ * Creates a new {@link MonitorMBeanResource} object.
+ *
+ * @param subscription Subscription resource associated with this {@link MonitorMBeanResource}
+ * @param observedPropertyValue PropertyValue object represents the observed resource property
+ * @param targetTopics Topic objects relating with the observed resource properties
+ */
+ protected MonitorMBeanResource(
+ JmxSubscriptionResource subscription,
+ PropertyValue observedPropertyValue,
+ Topic[] targetTopics)
+ {
+ m_subscription = subscription;
+ m_observedPropertyValue = observedPropertyValue;
+ m_topics = targetTopics;
+ }
+
+ /**
+ * Receives an JMX Notification, makes a WSDM ManagementEvent notification and invokes WSN Notify.
+ */
+ public void handleNotification(Notification notification, Object handback)
+ {
+ try
+ {
+ LOG.debug("Received a JMX notification. " + notification);
+
+ if(checkNotification(notification))
+ {
+ XmlBeansManagementEvent xmlMgmtEvent =
+ new XmlBeansManagementEvent(createSituation(notification));
+ xmlMgmtEvent.setEventId("urn:" + (UUID.randomUUID()).toString());
+
+ Resource producerResource = m_subscription.getProducerResource();
+ ResourcePropertySet propSet = ((PropertiesResource) producerResource).getResourcePropertySet();
+
+ XmlAnyURI resourceIdPropXBean =
+ (XmlAnyURI) propSet.get(IdentityCapability.PROP_NAME_RESOURCE_ID).get(0);
+
+ //TODO construct SourceComponent
+ xmlMgmtEvent.setSourceComponentAddresses(null);
+ xmlMgmtEvent.setSourceResourceId(resourceIdPropXBean.getStringValue());
+
+ ResourceProperty observedProperty = propSet.get(m_observedPropertyValue.getPropertyName());
+
+ Object[] oldValue = null;
+ Object[] newValue = null;
+
+ m_observedPropertyValue.updateResourceProperty(observedProperty);
+
+ newValue = new Object[observedProperty.size()];
+ for(int i = 0; i < observedProperty.size(); i++)
+ {
+ newValue[i] = XmlBeanUtils.copyXmlBean((XmlObject) observedProperty.get(i));
+ }
+
+ //Set RP Value Change into the Management Event
+ XmlBeansResourcePropertyValueChangeEvent event =
+ new XmlBeansResourcePropertyValueChangeEvent(oldValue, newValue);
+ ManagementEventDocument meDoc =
+ (ManagementEventDocument)((XmlObjectWrapper)xmlMgmtEvent).getXmlObject();
+ ManagementEventType mgmtEventElement = meDoc.getManagementEvent();
+ XmlBeanUtils.addChildElement(mgmtEventElement, ((XmlObjectWrapper)event).getXmlObject());
+
+ for(int i = 0; i < m_topics.length; i++)
+ {
+ LOG.debug("Publishing. Topic = " + m_topics[i]);
+ m_topics[i].publish(meDoc);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Exception occurred while handling JMX notification. " + e.getLocalizedMessage());
+
+ if(LOG.isDebugEnabled())
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Returns an MBeanServerConnection object used for this {@link MonitorMBeanResource}.
+ *
+ * @return MBeanServerConnection object
+ */
+ MBeanServerConnection getMBeanServerConnection()
+ {
+ return m_observedPropertyValue.getMBeanServerConnection();
+ }
+
+ /**
+ * Returns an ObjectName of the observed MBean.
+ *
+ * @return ObjectName of the observed MBean
+ */
+ ObjectName getObservedObject()
+ {
+ return m_observedPropertyValue.getObjectName();
+ }
+
+ /**
+ * Returns the observed attribute name.
+ *
+ * @return The observed attribute name
+ */
+ String getObservedAttribute()
+ {
+ return m_observedPropertyValue.getTextNodeAttributeName();
+ }
+
+ /**
+ * Returns the observed attribute type.
+ *
+ * @return The observed attribute type
+ */
+ String getObservedAttributeType()
+ {
+ return m_observedPropertyValue.getTextNodeAttributeType();
+ }
+
+ /**
+ * Returns {@link JmxSubscriptionResource} associated with this {@link MonitorMBeanResource}.
+ *
+ * @return {@link JmxSubscriptionResource} associated with this {@link MonitorMBeanResource}
+ */
+ JmxSubscriptionResource getSubscription()
+ {
+ return m_subscription;
+ }
+
+ private boolean checkNotification(Notification notification)
+ {
+ ObjectName observedObject = getObservedObject(notification);
+ if(observedObject == null)
+ {
+ LOG.warn("Invalid notification. Cause: Observed Object is null.");
+ return false;
+ }
+ if(!observedObject.equals(m_observedPropertyValue.getObjectName()))
+ {
+ LOG.debug("Invalid notification. Cause:Observed Object is invalid.");
+ return false;
+ }
+
+ String observedAttribute = getObservedAttribute(notification);
+ if(observedAttribute == null)
+ {
+ LOG.warn("Invalid notification. Cause:Observed Attribute is null.");
+ return false;
+ }
+
+ if(!observedAttribute.equals(m_observedPropertyValue.getTextNodeAttributeName()))
+ {
+ LOG.debug("Invalid notification. Cause:Observed Attribute is invalid.");
+ return false;
+ }
+
+ String type = notification.getType();
+ if(type == null)
+ {
+ LOG.warn("Invalid notification. Cause:type is null.");
+ return false;
+ }
+ else
+ {
+ if( (type.equals(MonitorNotification.OBSERVED_ATTRIBUTE_ERROR)) ||
+ (type.equals(MonitorNotification.OBSERVED_ATTRIBUTE_TYPE_ERROR)) ||
+ (type.equals(MonitorNotification.OBSERVED_OBJECT_ERROR)) )
+ {
+ LOG.error("Error notification received. message = " + notification.getMessage());
+ return false;
+ }
+ }
+
+ LOG.debug("Valid notification.");
+ return true;
+ }
+
+ /**
+ * Starts monitoring.
+ *
+ * @throws Exception
+ */
+ public abstract void subscribe() throws MonitorSubscriptionFailedException;
+
+ /**
+ * Stops monitoring.
+ *
+ * @throws Exception
+ */
+ public abstract void unsubscribe() throws MonitorSubscriptionFailedException;
+
+ /**
+ * Pause monitoring.
+ * @throws MonitorSubscriptionFailedException
+ *
+ */
+ public abstract void pause() throws MonitorSubscriptionFailedException;
+
+ /**
+ * Resume monitoring.
+ *
+ */
+ public abstract void resume() throws MonitorSubscriptionFailedException;
+
+ /**
+ * Returns ObjectName of the observed object in the specified Notification.
+ *
+ * @param notification
+ * @return ObjectName of the observed object
+ */
+ abstract ObjectName getObservedObject(Notification notification);
+
+ /**
+ * Returns the observed attribute name in the specified Notification.
+ *
+ * @param notification
+ * @return The observed attribute name
+ */
+ abstract String getObservedAttribute(Notification notification);
+
+ /**
+ * Creates a {@link Situation} object from the specified Notification.
+ *
+ * @param notification The received Notification
+ * @return {@link Situation} of the specified Notification
+ * @throws InvalidMonitorNotificationReceivedException
+ */
+ abstract Situation createSituation(Notification notification)
+ throws InvalidMonitorNotificationReceivedException;
+
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorSubscriptionFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorSubscriptionFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorSubscriptionFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/notification/monitor/MonitorSubscriptionFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,37 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.notification.monitor;
+
+/**
+ * An exception to be thrown when {@link JmxMonitorType#subscribe()} fails.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MonitorSubscriptionFailedException extends Exception
+{
+
+ public MonitorSubscriptionFailedException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+
+ public MonitorSubscriptionFailedException(Throwable e)
+ {
+ super(e);
+ }
+
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResource.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResource.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResource.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResource.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,379 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.muws.jmx.resource.properties.MBeanPropertyMap;
+import org.apache.ws.muws.jmx.resource.properties.PropertyValue;
+import org.apache.ws.muws.jmx.util.DataTypeUtils;
+import org.apache.ws.muws.jmx.util.WsdmJmxConstants;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.values.XmlObjectBase;
+
+/**
+ * An abstract base class for the resource which communicates with JMXMBean.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public abstract class AbstractMBeanResource implements PropertiesResource
+{
+ private static final Log LOG = LogFactory.getLog(AbstractMBeanResource.class);
+
+ private ObjectName m_objectName;
+ private MBeanServerConnection m_mbs;
+ private MBeanAttributeInfo[] m_attributeInfo;
+ private HashMap m_propertyValues;
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.ws.resource.Resource#init()
+ */
+ public void init()
+ {
+ try
+ {
+ QName serviceName = getServiceName();
+
+ MBeanResourceConfig resourceConfig = MBeanResourceConfig.getMBeanResourceConfig(serviceName);
+
+ if(resourceConfig == null)
+ {
+ LOG.error("MBeanResourceConfig not found. Service name = " + serviceName);
+ throw new MBeanResourceConfigurationException(
+ "MBeanResourceConfig not found. Service name = " + serviceName);
+ }
+
+ String objectNameStr = resourceConfig.getObjectName((String) getID());
+
+ if(objectNameStr == null)
+ {
+ LOG.error("ObjectName not found. Resource id = " + getID());
+ throw new MBeanResourceConfigurationException("ObjectName not found. Resource id = " + getID());
+ }
+
+ m_objectName = new ObjectName(objectNameStr);
+
+ String jmxServiceUrl = resourceConfig.getJMXServiceURL((String) getID());
+
+ if(jmxServiceUrl == null)
+ {
+ LOG.error("JMXServiceURL not found. Resource id = " + getID());
+ throw new MBeanResourceConfigurationException("JMXServiceURL not found. Resource id = " + getID());
+ }
+
+ createMBeanServerConnection(jmxServiceUrl);
+
+ String mBeanClassName = resourceConfig.getMBeanClassName();
+
+ if(!m_mbs.isRegistered(m_objectName))
+ {
+ m_mbs.createMBean(mBeanClassName, m_objectName);
+
+ LOG.debug("Created a new MBean instance." +
+ " MBean Class = " + mBeanClassName + ", ObjectName = [" + m_objectName + "]");
+ }
+ else
+ {
+ if(!m_mbs.isInstanceOf(m_objectName, mBeanClassName))
+ {
+ throw new MBeanResourceConfigurationException(
+ "The MBean [" + m_objectName + "] is not an instance of " + mBeanClassName);
+ }
+ LOG.debug("Use existing MBean instance. ObjectName = [" + m_objectName + "]");
+ }
+
+ m_attributeInfo = m_mbs.getMBeanInfo(m_objectName).getAttributes();
+
+ MBeanPropertyMap propertyMap = resourceConfig.getMBeanPropertyMap();
+
+ createPropertyValues(propertyMap);
+ }
+ catch(Exception e)
+ {
+ throw new MBeanResourceInitializationFailedException(e);
+ }
+ }
+
+ /**
+ * Returns the type of the specified attribute.
+ *
+ * @param attributeName The attribute name
+ * @return The type of the specified attribute
+ */
+ public String getAttributeType(String attributeName)
+ {
+ String name = null;
+ String type = null;
+ for (int i=0; i < m_attributeInfo.length; i++)
+ {
+ name = m_attributeInfo[i].getName();
+ if(attributeName.equals(name))
+ {
+ type = m_attributeInfo[i].getType();
+ break;
+ }
+ }
+ return type;
+ }
+
+ /**
+ * Returns the MBeanServerConnection instance used for this {@link AbstractMBeanResource}.
+ *
+ * @return MBeanServerConnection instance used for this {@link AbstractMBeanResource}
+ */
+ public MBeanServerConnection getMBeanServerConnection()
+ {
+ return m_mbs;
+ }
+
+ /**
+ * Returns the ObjectName for the MBean associated with this {@link AbstractMBeanResource}.
+ *
+ * @return ObjectName for the MBean associated with this {@link AbstractMBeanResource}
+ */
+ public ObjectName getObjectName()
+ {
+ return m_objectName;
+ }
+
+ /**
+ * Returns {@link PropertyValue} associated with the resource property for the specified QName.
+ *
+ * @param resourcePropertyName The resource property name
+ * @return {@link PropertyValue} or null if the PropertyValue for the specified QName not found
+ */
+ public PropertyValue getPropertyValue(QName resourcePropertyName)
+ {
+ return (PropertyValue) m_propertyValues.get(resourcePropertyName);
+ }
+
+ /**
+ * Returns the MBean attribute values for the specified MBean attribute name.
+ *
+ * @param attrName The MBean attribute name
+ * @return The MBean attribute values
+ * @throws MBeanServerAccessFailedException
+ */
+ public Object[] getAttributeValues(String attrName) throws MBeanServerAccessFailedException
+ {
+ Object value = null;
+ try
+ {
+ value = m_mbs.getAttribute(m_objectName, attrName);
+ }
+ catch(Exception e)
+ {
+ LOG.error("Unable to get MBean attribute values. Cause: " + e.getLocalizedMessage());
+
+ throw new MBeanServerAccessFailedException("Unable to get MBean attribute values", e);
+ }
+
+ LOG.debug("Got attributes from MBean. " +
+ "ObjectName = " + m_objectName +
+ "Attribute name = " + attrName +
+ "value = " + value);
+
+ return DataTypeUtils.toObjectArray(value);
+ }
+
+ /**
+ * Initializes the resource property with the MBean values and set {@link MBeanCallback}
+ * to the resource property.
+ *
+ * @param propertyName The resource property name
+ * @param propElem The XmlObject for the resource property
+ * @throws ResourcePropertyInitializationFailedException
+ */
+ protected void initResourceProperty(QName propertyName, XmlObject propElem)
+ throws ResourcePropertyInitializationFailedException
+ {
+ try
+ {
+ PropertyValue propertyValue = getPropertyValue(propertyName);
+
+ if(propertyValue == null)
+ {
+ LOG.warn(propertyName + " was not initialized. Cause: Not defined in the property map file.");
+ }
+ else
+ {
+ ResourceProperty resourceProperty = getResourcePropertySet().get(propertyName);
+
+ setTemporaryValue(propElem, propertyName);
+
+ resourceProperty.add(propElem);
+
+ MBeanCallback callback = new MBeanCallback(propertyValue);
+ resourceProperty.setCallback(callback);
+
+ callback.refreshProperty(resourceProperty);
+ }
+ }
+ catch(Exception e)
+ {
+ LOG.error("Unable to initialize a resource property with MBean. Cause: " + e.getLocalizedMessage());
+ throw new ResourcePropertyInitializationFailedException(e);
+ }
+ }
+
+ private QName getServiceName()
+ {
+ EndpointReference epr = getEndpointReference();
+ QName serviceName = epr.getServiceName();
+ return serviceName;
+ }
+
+ private void createMBeanServerConnection(String urlStr) throws MBeanServerAccessFailedException
+ {
+ try
+ {
+ JMXServiceURL url = new JMXServiceURL(urlStr);
+ JMXConnector connector = JMXConnectorFactory.connect(url);
+ m_mbs = connector.getMBeanServerConnection();
+
+ LOG.debug("Remote MBeanServer. JMXServiceURL = " + url);
+ }
+ catch(Exception e)
+ {
+ LOG.error("Unable to connect to MBeanServer. JMXServiceURL = " + urlStr + ". " +
+ "Cause:" + e.getLocalizedMessage());
+
+ throw new MBeanServerAccessFailedException(
+ "Unable to connect to MBeanServer. JMXServiceURL = " + urlStr, e);
+ }
+ }
+
+ private void createPropertyValues(MBeanPropertyMap propertyMap)
+ throws MBeanServerAccessFailedException
+ {
+ ArrayList resourcePropertyNameList = propertyMap.getResourcePropertyList();
+
+ m_propertyValues = new HashMap(resourcePropertyNameList.size());
+
+ QName resourcePropertyName = null;
+ HashMap attributePathMap = null;
+ HashMap attributeTypeMap = null;
+ String attributeName = null;
+ String attributeType = null;
+ PropertyValue propertyValue = null;
+
+ for(Iterator propIterator = resourcePropertyNameList.iterator(); propIterator.hasNext();)
+ {
+ resourcePropertyName = (QName) propIterator.next();
+
+ attributePathMap = propertyMap.getAttributeMap(resourcePropertyName);
+ attributeTypeMap = new HashMap();
+
+ for(Iterator attrIterator =
+ propertyMap.getAttributeNameList(resourcePropertyName).iterator();
+ attrIterator.hasNext();)
+ {
+ attributeName = (String) attrIterator.next();
+ attributeType = getAttributeType(attributeName);
+ attributeTypeMap.put(attributeName, attributeType);
+ }
+
+ propertyValue =
+ new PropertyValue(resourcePropertyName, attributePathMap, attributeTypeMap, this);
+
+ m_propertyValues.put(resourcePropertyName, propertyValue);
+
+ LOG.debug("Created a PropertyValue object. Resource Property QName = " + resourcePropertyName);
+ }
+ }
+
+ private void setTemporaryValue(XmlObject rpDoc, QName resourcePropertyName) throws Exception
+ {
+ try
+ {
+ SimpleValue addedElem =
+ (SimpleValue) ((XmlObjectBase) rpDoc).get_store().add_element_user(resourcePropertyName);
+
+ if(!DataTypeUtils.isSchemaTypeSupported(addedElem))
+ {
+ throw new ResourcePropertySchemaTypeNotSupportedException();
+ }
+
+ SchemaType schemaType = addedElem.schemaType();
+
+ Object tempValue ="0";
+
+ XmlAnySimpleType[] enumerations = schemaType.getEnumerationValues();
+ if(enumerations != null)
+ {
+ tempValue = enumerations[0].getStringValue();
+ }
+
+ QName schemaName = null;
+ SchemaType primitiveType = schemaType.getPrimitiveType();
+ if(primitiveType != null)
+ {
+ schemaName = primitiveType.getName();
+ }
+ else
+ {
+ schemaName = schemaType.getName();
+ }
+
+ if( (schemaName.equals(WsdmJmxConstants.XSD_DATETIME))
+ || (schemaName.equals(WsdmJmxConstants.XSD_DATE))
+ || (schemaName.equals(WsdmJmxConstants.XSD_TIME))
+ || (schemaName.equals(WsdmJmxConstants.XSD_GYEAR))
+ || (schemaName.equals(WsdmJmxConstants.XSD_GMONTH))
+ || (schemaName.equals(WsdmJmxConstants.XSD_GDAY))
+ || (schemaName.equals(WsdmJmxConstants.XSD_GYEARMONTH))
+ || (schemaName.equals(WsdmJmxConstants.XSD_GMONTHDAY)) )
+ {
+ tempValue = Calendar.getInstance().getTime();
+ }
+ else if(schemaName.equals(WsdmJmxConstants.XSD_DURATION))
+ {
+ tempValue = new Long(0);
+ }
+
+ tempValue = DataTypeUtils.toXsdString(tempValue, schemaName);
+ addedElem.setStringValue((String) tempValue);
+
+ LOG.debug("Set temporary value. " + rpDoc);
+ }
+ catch(Exception e)
+ {
+ LOG.debug("Unable to set temporary value. Cause:" + e.getLocalizedMessage());
+ throw e;
+ }
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResourceHome.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResourceHome.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResourceHome.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/AbstractMBeanResourceHome.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,256 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.muws.jmx.resource.properties.MBeanPropertyMap;
+import org.apache.ws.muws.jmx.util.WsdmJmxConstants;
+import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+
+/**
+ * A ResourceHome for {@link AbstractMBeanResource}.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public abstract class AbstractMBeanResourceHome extends AbstractResourceHome
+{
+ private static final Log LOG = LogFactory.getLog(AbstractMBeanResourceHome.class);
+
+ protected String MBEAN_CLASS_NAME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" +
+ getServiceName().getLocalPart() + "/mBeanClassName";
+
+ protected String PROPERTY_MAP_FILENAME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" +
+ getServiceName().getLocalPart() + "/propertyMappingFilename";
+
+ protected String RESOURCE_LIST_FILENAME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" +
+ getServiceName().getLocalPart() + "/resourceListFilename";
+
+ protected String VALUE_CHANGE_MONITORING_PERIOD_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" +
+ getServiceName().getLocalPart() + "/mBeanValueChangeMonitoringPeriod";
+
+ private String m_mBeanClassName;
+ private MBeanPropertyMap m_propertyMap;
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.ws.util.jndi.Initializable#init()
+ */
+ public void init() throws Exception
+ {
+ super.init();
+
+ try
+ {
+ m_mBeanClassName = (String) new InitialContext().lookup(MBEAN_CLASS_NAME_LOCATION);
+
+ LOG.debug("mBeanClassName = " + m_mBeanClassName);
+ }
+ catch (NamingException e)
+ {
+ LOG.error("Unable to lookup " + MBEAN_CLASS_NAME_LOCATION);
+ throw e;
+ }
+
+ String propertyMapFilename = null;
+ try
+ {
+ propertyMapFilename = (String) new InitialContext().lookup(PROPERTY_MAP_FILENAME_LOCATION);
+
+ LOG.debug("propertyMappingFilename = " + m_mBeanClassName);
+ }
+ catch (NamingException e)
+ {
+ LOG.error("Unable to lookup " + PROPERTY_MAP_FILENAME_LOCATION);
+ throw e;
+ }
+ m_propertyMap = new MBeanPropertyMap(propertyMapFilename);
+
+ String resourceListFilename = null;
+ try
+ {
+ resourceListFilename =
+ (String) new InitialContext().lookup(RESOURCE_LIST_FILENAME_LOCATION);
+
+ LOG.debug("resourceListFilename = " + resourceListFilename);
+ }
+ catch (NamingException e)
+ {
+ LOG.warn("Unable to lookup " + RESOURCE_LIST_FILENAME_LOCATION);
+ }
+
+ if(resourceListFilename != null)
+ {
+ MBeanResourceConfig resourceConfig = MBeanResourceConfig.getMBeanResourceConfig(getServiceName());
+
+ if(resourceConfig == null)
+ {
+ resourceConfig =
+ MBeanResourceConfig.createMBeanResourceConfig(
+ getServiceName(),
+ m_mBeanClassName,
+ m_propertyMap);
+ }
+
+ MBeanResourceList resourceList = new MBeanResourceList(resourceListFilename);
+ resourceConfig.update(resourceList);
+ }
+
+ Long monitoringPeriod = null;
+ try
+ {
+ monitoringPeriod =
+ (Long) new InitialContext().lookup(VALUE_CHANGE_MONITORING_PERIOD_LOCATION);
+
+ LOG.debug("mBeanValueChangeMonitoringPeriod = " + monitoringPeriod);
+ }
+ catch (NamingException e)
+ {
+ LOG.debug("Unable to lookup " + VALUE_CHANGE_MONITORING_PERIOD_LOCATION);
+ }
+ if(monitoringPeriod != null)
+ {
+ WsdmJmxConstants.setValueChangeMonitoringPeriod(monitoringPeriod);
+ }
+ }
+
+
+ /**
+ * Returns the EndpointReferences of the resources which this {@link AbstractMBeanResourceHome} created.
+ *
+ * @return ArrayList of EndpointReferences or null if no Resources created
+ */
+ public ArrayList getEndpointReferences()
+ {
+ Set set = m_resources.keySet();
+ ArrayList eprList = new ArrayList(set.size());
+
+ Resource resource = null;
+ EndpointReference epr = null;
+ for(Iterator it = set.iterator(); it.hasNext();)
+ {
+ resource = (Resource) it.next();
+ epr = resource.getEndpointReference();
+ if(epr != null)
+ {
+ eprList.add(epr);
+ }
+ }
+ if(eprList.isEmpty())
+ {
+ return null;
+ }
+ return eprList;
+ }
+
+ /**
+ * Updates configuration information for connecting to MBean.
+ *
+ * @param filename The filename of the resource list.
+ * @throws MBeanResourceConfigurationException
+ * @throws FileNotFoundException
+ * @throws MBeanResourceListInitializationFailedException
+ */
+ protected void updateMBeanResourceConfig(String filename)
+ throws MBeanResourceConfigurationException,
+ FileNotFoundException,
+ MBeanResourceListInitializationFailedException
+ {
+ MBeanResourceConfig resourceConfig = MBeanResourceConfig.getMBeanResourceConfig(getServiceName());
+
+ if(resourceConfig == null)
+ {
+ resourceConfig =
+ MBeanResourceConfig.createMBeanResourceConfig(
+ getServiceName(),
+ m_mBeanClassName,
+ m_propertyMap);
+
+ }
+
+ MBeanResourceList resourceList = new MBeanResourceList(filename);
+ resourceConfig.update(resourceList);
+ }
+
+ /**
+ * Updates configuration information for connecting to MBean.
+ *
+ * @param id The resource id
+ * @param objectName The object name of the MBean
+ * @param jmxUrl The JMXServiceURL used for connecting to the MBean
+ * @throws MBeanResourceConfigurationException
+ */
+ protected void updateMBeanResourceConfig(String id, String objectName, String jmxUrl)
+ throws MBeanResourceConfigurationException
+ {
+ MBeanResourceConfig resourceConfig = MBeanResourceConfig.getMBeanResourceConfig(getServiceName());
+
+ if(resourceConfig == null)
+ {
+ resourceConfig =
+ MBeanResourceConfig.createMBeanResourceConfig(
+ getServiceName(),
+ m_mBeanClassName,
+ m_propertyMap);
+ }
+
+ resourceConfig.update(id, objectName, jmxUrl);
+ }
+
+ /**
+ * Creates resources that communicate with MBeans.
+ *
+ * @throws ResourceException
+ */
+ protected void createMBeanResources() throws ResourceException
+ {
+ MBeanResourceConfig resourceConfig = MBeanResourceConfig.getMBeanResourceConfig(getServiceName());
+
+ if(resourceConfig != null)
+ {
+ ArrayList idList = resourceConfig.getResourceIdentifierList();
+
+ String id = null;
+ for(Iterator it = idList.iterator(); it.hasNext();)
+ {
+ id = (String) it.next();
+ add(createInstance(id));
+ }
+ LOG.debug("Created MBeanResource. Resource id = " + id);
+ }
+ else
+ {
+ LOG.warn("No MBeanResourceConfig for " + getServiceName());
+ }
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/InvalidSchemaException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/InvalidSchemaException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/InvalidSchemaException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/InvalidSchemaException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,35 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when the given xml does not match the schema.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class InvalidSchemaException extends Exception
+{
+ public InvalidSchemaException(String namespace)
+ {
+ super("Given xml does not match the schema. " + namespace);
+ }
+
+ public InvalidSchemaException()
+ {
+ super("Given xml does not match the schema.");
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanCallback.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanCallback.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanCallback.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanCallback.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,60 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.muws.jmx.resource.properties.PropertyValue;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+
+/**
+ * A Callback for WSDM-JMX.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanCallback implements ResourcePropertyCallback
+{
+ private static final Log LOG = LogFactory.getLog(MBeanCallback.class);
+
+ private PropertyValue m_propertyValue;
+
+ public MBeanCallback(PropertyValue propertyValue) throws CallbackFailedException
+ {
+ m_propertyValue = propertyValue;
+ }
+
+ public ResourceProperty refreshProperty(ResourceProperty resourceProperty)
+ throws CallbackFailedException
+ {
+ try
+ {
+ m_propertyValue.updateResourceProperty(resourceProperty);
+ }
+ catch (Exception e)
+ {
+ if(LOG.isDebugEnabled())
+ {
+ e.printStackTrace();
+ }
+ throw new CallbackFailedException(e);
+ }
+
+ return resourceProperty;
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfig.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfig.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfig.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfig.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,238 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.muws.jmx.resource.properties.MBeanPropertyMap;
+
+/**
+ * Contains configuration information for connecting to MBean.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanResourceConfig
+{
+ private static final Log LOG = LogFactory.getLog(MBeanResourceConfig.class);
+
+ private static HashMap s_mBeanResourceConfigs = new HashMap();
+
+ private QName m_serviceName;
+ private String m_mBeanClassName;
+ private MBeanPropertyMap m_propertyMap;
+ private HashMap m_objectNameMap = new HashMap();
+ private HashMap m_urlMap = new HashMap();
+
+ private MBeanResourceConfig(
+ QName serviceName,
+ String mBeanClassName,
+ MBeanPropertyMap propertyMap)
+ throws MBeanResourceConfigurationException
+ {
+ if( (serviceName == null) || (mBeanClassName == null) || (propertyMap == null) )
+ {
+ throw new MBeanResourceConfigurationException(
+ new IllegalArgumentException("serviceName, mBeanClassName, propertyMap must not be null."));
+ }
+
+ m_serviceName = serviceName;
+ m_mBeanClassName = mBeanClassName;
+ m_propertyMap = propertyMap;
+ }
+
+ /**
+ * Creates a new {@link MBeanResourceConfig} object.
+ *
+ * @param serviceName The service name
+ * @param mBeanClassName The class name of the MBean to be connected
+ * @param propertyMap {@link MBeanPropertyMap}
+ * @return {@link MBeanResourceConfig} created
+ * @throws MBeanResourceConfigurationException
+ */
+ static MBeanResourceConfig createMBeanResourceConfig(
+ QName serviceName,
+ String mBeanClassName,
+ MBeanPropertyMap propertyMap)
+ throws MBeanResourceConfigurationException
+ {
+ MBeanResourceConfig resourceConfig = null;
+
+ synchronized(s_mBeanResourceConfigs)
+ {
+ if(s_mBeanResourceConfigs.containsKey(serviceName))
+ {
+ LOG.warn("MBeanResourceConfig for " + serviceName + " already exists, so it is updated.");
+
+ MBeanResourceConfig.removeMBeanResourceConfig(serviceName);
+ }
+ resourceConfig =
+ new MBeanResourceConfig(serviceName, mBeanClassName, propertyMap);
+
+ s_mBeanResourceConfigs.put(serviceName, resourceConfig);
+ LOG.debug("Created a new MBeanResourceConfig. Service QName = " + serviceName);
+ }
+
+ return resourceConfig;
+ }
+
+ static void removeMBeanResourceConfig(QName serviceName)
+ {
+ synchronized(s_mBeanResourceConfigs)
+ {
+ if(s_mBeanResourceConfigs.containsKey(serviceName))
+ {
+ s_mBeanResourceConfigs.remove(serviceName);
+
+ LOG.debug("Removed an MBeanResourceConfig. Service QName = " + serviceName);
+ }
+ }
+ }
+
+ /**
+ * Returns the {@link MBeanResourceConfig} object for the specified service name.
+ *
+ * @param serviceName The service name
+ * @return An {@link MBeanResourceConfig} object or null if not found
+ */
+ static MBeanResourceConfig getMBeanResourceConfig(QName serviceName)
+ {
+ MBeanResourceConfig resourceConfig = (MBeanResourceConfig) s_mBeanResourceConfigs.get(serviceName);
+ if(resourceConfig == null)
+ {
+ LOG.debug("MBeanResourceConfig not found. Service QName = " + serviceName);
+ }
+ return resourceConfig;
+ }
+
+ /**
+ * Adds configuration information for connecting to MBean.
+ *
+ * @param resourceList {@link MBeanResourceList} which contains configuration information
+ */
+ void update(MBeanResourceList resourceList)
+ {
+ ArrayList idList = resourceList.getResourceIdentifierList();
+
+ String id = null;
+ String objectName = null;
+ String jmxUrl = null;
+
+ for(Iterator it = idList.iterator(); it.hasNext();)
+ {
+ id = (String) it.next();
+
+ objectName = resourceList.getObjectName(id);
+ jmxUrl = resourceList.getJmxServiceUrl(id);
+
+ update(id, objectName, jmxUrl);
+ }
+ }
+
+ /**
+ * Updates configuration information for connecting to MBean.
+ *
+ * @param id The resource id
+ * @param objectName The object name of the MBean
+ * @param jmxUrl The JMXServiceURL used for connecting to the MBean
+ */
+ synchronized void update(String id, String objectName, String jmxUrl)
+ {
+ if(m_objectNameMap.containsKey(id))
+ {
+ LOG.warn("Resource id already exists. Resource id = " + id + " This entry is updated.");
+ }
+
+ m_objectNameMap.put(id, objectName);
+ m_urlMap.put(id, jmxUrl);
+
+ LOG.debug("Updated. " +
+ "Resource id = [" + id + "], " +
+ "ObjectName = [" + objectName + "], " +
+ "JMXServiceURL = [" + jmxUrl + "]");
+ }
+
+ /**
+ * Returns the service name of this {@link MBeanResourceConfig}.
+ *
+ * @return The service name
+ */
+ QName getServiceName()
+ {
+ return m_serviceName;
+ }
+
+ /**
+ * Returns the MBean class name of this {@link MBeanResourceConfig}.
+ *
+ * @return The MBean class name
+ */
+ String getMBeanClassName()
+ {
+ return m_mBeanClassName;
+ }
+
+ /**
+ * Returns {@link MBeanPropertyMap} object for this {@link MBeanResourceConfig}.
+ *
+ * @return {@link MBeanPropertyMap} object
+ */
+ MBeanPropertyMap getMBeanPropertyMap()
+ {
+ return m_propertyMap;
+ }
+
+ /**
+ * Returns the MBean object name of this {@link MBeanResourceConfig}.
+ *
+ * @param id The resource id of the resource associated with the MBean
+ * @return The object name
+ */
+ String getObjectName(String id)
+ {
+ return (String) m_objectNameMap.get(id);
+ }
+
+ /**
+ * Returns JMXServiceURL for this {@link MBeanResourceConfig}.
+ *
+ * @param id The resource id of the resource associated with the MBean
+ * @return JMXServiceURL
+ */
+ String getJMXServiceURL(String id)
+ {
+ return (String) m_urlMap.get(id);
+ }
+
+ /**
+ * Returns the list of resource identifiers.
+ *
+ * @return the list of resource identifiers
+ */
+ ArrayList getResourceIdentifierList()
+ {
+ ArrayList idList = new ArrayList(m_objectNameMap.keySet());
+ return idList;
+ }
+
+
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfigurationException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfigurationException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfigurationException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceConfigurationException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,39 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An exception to be thrown by {@link MBeanResourceConfig#createMBeanResourceConfig(QName, String, MBeanPropertyMap)}
+ * when the {@link MBeanResourceConfig} for the specified service name already exists.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanResourceConfigurationException extends Exception
+{
+ public MBeanResourceConfigurationException(String message)
+ {
+ super(message);
+ }
+
+ public MBeanResourceConfigurationException(Throwable e)
+ {
+ super(e);
+ }
+
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceInitializationFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceInitializationFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceInitializationFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceInitializationFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,29 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when {@link AbstractMBeanResource#init()} fails.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanResourceInitializationFailedException extends RuntimeException
+{
+ public MBeanResourceInitializationFailedException(Throwable e) {
+ super("An exception occurred in AbstractMBeanResource#init() failed.", e);
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceList.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceList.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceList.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceList.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,169 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.muse.resourceList.ResourceListDocument;
+import org.apache.ws.muse.resourceList.ResourceListType;
+import org.apache.ws.muse.resourceList.ResourceType;
+
+/**
+ * Contains the list of configurations for resources to be initialized.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanResourceList
+{
+ private static final Log LOG = LogFactory.getLog(MBeanResourceList.class);
+
+ private HashMap m_objectNameMap;
+ private HashMap m_urlMap;
+
+ /**
+ * Creates a new {@link MBeanResourceList} object.
+ *
+ * @param filename The name of the resource list file
+ * @throws MBeanResourceListInitializationFailedException
+ * @throws FileNotFoundException
+ */
+ public MBeanResourceList(String filename)
+ throws MBeanResourceListInitializationFailedException,
+ FileNotFoundException
+ {
+ InputStream inputStream =
+ Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+
+ if(inputStream == null)
+ {
+ LOG.error(filename + " is not found.");
+ throw new FileNotFoundException(filename);
+ }
+ LOG.debug("Input filename = " + filename);
+
+ init(inputStream);
+ }
+
+ /**
+ * Creates a new {@link MBeanResourceList} object.
+ *
+ * @param inputStream
+ * @throws MBeanResourceListInitializationFailedException
+ */
+ public MBeanResourceList(InputStream inputStream) throws MBeanResourceListInitializationFailedException
+ {
+ init(inputStream);
+ }
+
+ /**
+ * Creates a new {@link MBeanResourceList} object.
+ *
+ */
+ public MBeanResourceList()
+ {
+ m_objectNameMap = new HashMap();
+ m_urlMap = new HashMap();
+ }
+
+ synchronized public void put(String id, String objectName, String jmxUrl)
+ {
+ if(!m_objectNameMap.containsKey(id))
+ {
+ m_objectNameMap.put(id, objectName);
+ m_urlMap.put(id, jmxUrl);
+
+ LOG.debug("Added " +
+ "Resource id = [" + id + "], " +
+ "ObjectName = [" + objectName + "], " +
+ "JMXServiceURL = [" + jmxUrl + "]");
+ }
+ else
+ {
+ LOG.warn(id + " already exists.");
+ }
+ }
+
+ public ArrayList getResourceIdentifierList() {
+ ArrayList idList = new ArrayList(m_objectNameMap.size());
+ String id = null;
+
+ for(Iterator it = m_objectNameMap.keySet().iterator(); it.hasNext();)
+ {
+ id = (String) it.next();
+ idList.add(id);
+ }
+ return idList;
+ }
+
+ public String getObjectName(String id)
+ {
+ return (String) m_objectNameMap.get(id);
+ }
+
+ /**
+ * Returns JMXServiceURL for the specified resource id.
+ *
+ * @param id
+ * @return The string representation of JMXServiceURL
+ */
+ public String getJmxServiceUrl(String id)
+ {
+ return (String) m_urlMap.get(id);
+ }
+
+ private void init(InputStream inputStream) throws MBeanResourceListInitializationFailedException
+ {
+ try
+ {
+ ResourceListDocument rlDoc = ResourceListDocument.Factory.parse(inputStream);
+ if(!rlDoc.validate())
+ {
+ throw new InvalidSchemaException();
+ }
+
+ ResourceListType rl = rlDoc.getResourceList();
+ ResourceType[] resources = rl.getResourceArray();
+
+ m_objectNameMap = new HashMap(resources.length);
+ m_urlMap = new HashMap(resources.length);
+
+ String id = null;
+ String objectName = null;
+ String jmxUrl = null;
+
+ for(int i=0; i < resources.length; i++)
+ {
+ id = resources[i].getResourceIdentifier();
+ objectName = resources[i].getMBeanObjectName();
+ jmxUrl = resources[i].getJMXServiceURL();
+
+ put(id, objectName, jmxUrl);
+ }
+ }
+ catch(Exception e)
+ {
+ LOG.error("Unable to initialize. Cause: " + e.getLocalizedMessage());
+ throw new MBeanResourceListInitializationFailedException(e);
+ }
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceListInitializationFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceListInitializationFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceListInitializationFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanResourceListInitializationFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,30 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when {@link MBeanResourceList#init(InputStream)} fails.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanResourceListInitializationFailedException extends Exception
+{
+ public MBeanResourceListInitializationFailedException(Throwable e)
+ {
+ super("Unable to initialize.", e);
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanServerAccessFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanServerAccessFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanServerAccessFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/MBeanServerAccessFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,30 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when {@link AbstractMBeanResource} fails to access to MBean.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanServerAccessFailedException extends Exception
+{
+ public MBeanServerAccessFailedException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertyInitializationFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertyInitializationFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertyInitializationFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertyInitializationFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,30 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when {@link AbstractMBeanResource#initResourceProperty(QName, XmlObject)} fails.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class ResourcePropertyInitializationFailedException extends Exception
+{
+ public ResourcePropertyInitializationFailedException(Throwable e)
+ {
+ super(e);
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertySchemaTypeNotSupportedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertySchemaTypeNotSupportedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertySchemaTypeNotSupportedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/ResourcePropertySchemaTypeNotSupportedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,32 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource;
+
+/**
+ * An exception to be thrown when the content type of the resource property is not supported.
+ * The WSDM-JMX library currently supports only SIMPLE_CONTENT and NOT_COMPLEX_TYPE.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class ResourcePropertySchemaTypeNotSupportedException extends Exception
+{
+ public ResourcePropertySchemaTypeNotSupportedException()
+ {
+ super("Content type of the ResourceProperty MUST be SIMPLE_CONTENT or NOT_COMPLEX_TYPE");
+ }
+
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMap.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMap.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMap.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMap.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,208 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource.properties;
+
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.muse.propertyMap.MBeanAttributeType;
+import org.apache.ws.muse.propertyMap.PropertyMappingDocument;
+import org.apache.ws.muse.propertyMap.PropertyMappingType;
+import org.apache.ws.muse.propertyMap.WsdmResourcePropertyType;
+import org.apache.ws.muws.jmx.resource.InvalidSchemaException;
+
+/**
+ * Provides a property map that defines relations between WSDM properties and MBean attributes.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanPropertyMap
+{
+ private static final Log LOG = LogFactory.getLog(MBeanPropertyMap.class);
+
+ private HashMap m_resourceProperties;
+
+ /**
+ * Creates a new {@link MBeanPropertyMap}.
+ *
+ * @param filename The name of the property map file
+ * @throws MBeanPropertyMapInitializationFailedException
+ * @throws FileNotFoundException
+ */
+ public MBeanPropertyMap(String filename)
+ throws MBeanPropertyMapInitializationFailedException,
+ FileNotFoundException
+ {
+ InputStream inputStream =
+ Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+
+ if(inputStream == null)
+ {
+ LOG.error(filename + " is not found.");
+ throw new FileNotFoundException(filename);
+ }
+ LOG.debug("Input filename = " + filename);
+
+ init(inputStream);
+ }
+
+ /**
+ * Creates a new {@link MBeanPropertyMap} object.
+ *
+ * @param inputStream
+ * @throws MBeanPropertyMapInitializationFailedException
+ */
+ public MBeanPropertyMap(InputStream inputStream)
+ throws MBeanPropertyMapInitializationFailedException
+ {
+ init(inputStream);
+ }
+
+
+ /**
+ * Returns resource property names included in this {@link MBeanPropertyMap}.
+ *
+ * @return ArrayList of resource property names.
+ */
+ public ArrayList getResourcePropertyList()
+ {
+ return new ArrayList(m_resourceProperties.keySet());
+ }
+
+ /**
+ * Returns MBean attribute names associated with the specified resource property.
+ *
+ * @param resourcePropertyName The resource property name
+ * @return ArrayList of MBean attribute names or null if not found
+ */
+ public ArrayList getAttributeNameList(QName resourcePropertyName)
+ {
+ HashMap attributes = getAttributeMap(resourcePropertyName);
+
+ ArrayList attributeNameList = null;
+ if(attributes != null)
+ {
+ attributeNameList = new ArrayList(attributes.keySet());
+ }
+
+ return attributeNameList;
+ }
+
+ /**
+ * Returns the location path for the specified attribute in the specified resource property.
+ *
+ * @param attributeName The MBean attribute name
+ * @param resourcePropertyName The resource property name
+ * @return The location path or null if not found
+ */
+ public String getLocationPath(QName resourcePropertyName, String attributeName)
+ {
+ String locationPath = null;
+ HashMap attributes = getAttributeMap(resourcePropertyName);
+ if(attributes != null)
+ {
+ locationPath = (String) attributes.get(attributeName);
+ }
+ return locationPath;
+ }
+
+ /**
+ * Returns a HashMap object which contains MBean attribute names and location paths.
+ *
+ * @param resourcePropertyName The resource property name
+ * @return HashMap object or null if no attributes found
+ */
+ public HashMap getAttributeMap(QName resourcePropertyName)
+ {
+ return (HashMap) m_resourceProperties.get(resourcePropertyName);
+ }
+
+ private void init(InputStream inputStream)
+ throws MBeanPropertyMapInitializationFailedException
+ {
+ try
+ {
+ PropertyMappingDocument pmDoc =
+ PropertyMappingDocument.Factory.parse(inputStream);
+
+ if(!pmDoc.validate())
+ {
+ throw new InvalidSchemaException();
+ }
+
+ PropertyMappingType pm = pmDoc.getPropertyMapping();
+ WsdmResourcePropertyType[] propertyArray = pm.getWsdmResourcePropertyArray();
+
+ m_resourceProperties = new HashMap(propertyArray.length);
+
+ MBeanAttributeType[] attributeArray = null;
+
+ QName propertyName = null;
+ HashMap attributes = null;
+ String attributeName = null;
+ String locationPath = null;
+
+ for(int i = 0; i < propertyArray.length; i++)
+ {
+ propertyName = propertyArray[i].getName();
+ LOG.debug("added [" + i + "]: " + propertyName);
+
+ attributeArray = propertyArray[i].getMBeanAttributeArray();
+ attributes = new HashMap(attributeArray.length);
+
+ for(int j = 0; j < attributeArray.length; j++)
+ {
+ attributeName = attributeArray[j].getName();
+ locationPath = attributeArray[j].getLocationPath();
+ if( (locationPath == null) || (locationPath.equals("")) )
+ {
+ locationPath = ".";
+ }
+ if(!attributes.containsKey(attributeName))
+ {
+ attributes.put(attributeName, locationPath);
+ LOG.debug("added [" + i + "][" + j + "]: " + attributeName + ", " + locationPath);
+ }
+ else
+ {
+ LOG.warn("ignored [" + i + "][" + j + "]: " + attributeName + ", " + locationPath);
+ }
+ }
+ if(!attributes.containsValue("."))
+ {
+ throw new MBeanPropertyMapException(
+ "MBean attribute for the text node not defined. " +
+ "Resource Property QName = " + propertyName);
+ }
+ m_resourceProperties.put(propertyName, attributes);
+ }
+ LOG.debug("MBeanPropertyMap is initialized successfully.");
+ }
+ catch(Exception e)
+ {
+ LOG.error("Unable to initialize MBeanPropertyMap. Cause: " + e.getLocalizedMessage());
+
+ throw new MBeanPropertyMapInitializationFailedException(e);
+ }
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,30 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource.properties;
+
+/**
+ * An exception tobe thrown in {@link MBeanPropertyMap}.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanPropertyMapException extends Exception
+{
+ public MBeanPropertyMapException(String message)
+ {
+ super(message);
+ }
+}
Added: webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapInitializationFailedException.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapInitializationFailedException.java?rev=372516&view=auto
==============================================================================
--- webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapInitializationFailedException.java (added)
+++ webservices/muse/trunk/wsdm-jmx/src/java/org/apache/ws/muws/jmx/resource/properties/MBeanPropertyMapInitializationFailedException.java Thu Jan 26 04:14:27 2006
@@ -0,0 +1,31 @@
+/*=============================================================================*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.jmx.resource.properties;
+
+/**
+ * An exception to be thrown by {@link MBeanPropertyMap#MBeanPropertyMap(String)}
+ * when initialization of {@link MBeanPropertyMap} fails.
+ *
+ * @author Hideharu Kato
+ *
+ */
+public class MBeanPropertyMapInitializationFailedException extends Exception
+{
+ public MBeanPropertyMapInitializationFailedException(Exception e)
+ {
+ super("Unable to initialize MBeanPropertyMap.", e);
+ }
+}