[Jboss-cvs] JBossAS SVN: r55211 - in branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system: . filterfactory metadata
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 4 13:06:17 EDT 2006
Author: scott.stark at jboss.org
Date: 2006-08-04 13:06:05 -0400 (Fri, 04 Aug 2006)
New Revision: 55211
Added:
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceValueMetaData.java
Removed:
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java
branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceValueMetaData.java
Log:
Move jmx related code to the system-jmx module
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory (from rev 55207, branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.filterfactory;
-
-import javax.management.AttributeChangeNotificationFilter;
-import javax.management.NotificationFilter;
-
-import org.jboss.system.NotificationFilterFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Factory for AttributeChangeNotificationFilter filters.
- *
- * The produced filter filters-in AttributeChangeNotifications
- * for zero or more attributes, so you need to explicitly enable
- * the attribute names you are interested in.
- *
- * The passed filterConfig xml element fragment should look like:
- *
- * <filter factory="AttributeChangeNotificationFilterFactory">
- * <enable attribute-name="State"/>
- * ...
- * </filter>
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public class AttributeChangeNotificationFilterFactory
- implements NotificationFilterFactory
-{
- // Constants -----------------------------------------------------
-
- /** the xml element and attribute supported by this factory */
- public static final String ENABLE_ELEMENT = "enable";
- public static final String ENABLE_ATTRNAME_ATTRIBUTE = "attribute-name";
-
- /**
- * Default public CTOR (necessary)
- */
- public AttributeChangeNotificationFilterFactory()
- {
- // empty
- }
-
- /**
- * The actual filter factory implementation
- */
- public NotificationFilter createNotificationFilter(Element filterConfig)
- throws Exception
- {
- // start off with a filter that does not allow any named attribute
- AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
-
- // filterConfig should point to the <filter factory="..."> element,
- // we are interested in its 'enable' children to configure the filter
- NodeList filterChildren = filterConfig.getChildNodes();
-
- for (int i = 0; i < filterChildren.getLength(); i++)
- {
- Node filterChildNode = filterChildren.item(i);
-
- // check if this is an 'enable' element, ignore everything else
- if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
- {
- // look for 'attribute-name' attribute
- if (((Element)filterChildNode).hasAttribute(ENABLE_ATTRNAME_ATTRIBUTE))
- {
- String attributeName = ((Element)filterChildNode).getAttribute(ENABLE_ATTRNAME_ATTRIBUTE);
- // enable this type in the filter
- filter.enableAttribute(attributeName);
- }
- else
- {
- throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
- + ENABLE_ATTRNAME_ATTRIBUTE + "' attribute");
- }
- }
- }
- // we are done
- return filter;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/AttributeChangeNotificationFilterFactory.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,256 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.filterfactory;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.management.Notification;
-import javax.management.NotificationFilter;
-
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.mx.util.JBossNotificationFilterSupport;
-import org.jboss.system.NotificationFilterFactory;
-import org.jboss.util.collection.CollectionsFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Factory for {@link DeploymentInfoNotificationFilter} filters.
- * (check the inner class).
- *
- * The produced filter is really meant for Notifications
- * emitted by SubDeployers. The types of interest are:
- *
- * org.jboss.deployment.SubDeployer.init
- * org.jboss.deployment.SubDeployer.create
- * org.jboss.deployment.SubDeployer.start
- * org.jboss.deployment.SubDeployer.stop
- * org.jboss.deployment.SubDeployer.destroy
- *
- * The above subdeployer notifications carry a DeploymentInfo
- * instance in their UserData. We can further filter based on
- * DeploymentInfo.shortName, but is important to explicitly
- * enable both the notification types and the desired shortNames.
- *
- * In practice, you'll be able to receive notifications when a
- * particular deployment unit (e.g. my-app.ear) gets processed
- * (e.g. started, stopped, etc.) by a subdeployer.
- *
- * The passed filterConfig xml element fragment should look like:
- *
- * <filter factory="DeploymentInfoNotificationFilterFactory">
- * <enable type="org.jboss.deployment.SubDeployer.start"/>
- * <enable type="org.jboss.deployment.SubDeployer.stop"/>
- * ...
- * <enable short-name="my-app.ear"/>
- * <enable short-name="my-service.xml"/>
- * ...
- * </filter>
- *
- * Note: org.jboss.deployment.SubDeployer yields all five
- * SubDeployer notifications.
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
- * @since 4.0.3
-**/
-public class DeploymentInfoNotificationFilterFactory
- implements NotificationFilterFactory
-{
- // Constants -----------------------------------------------------
-
- /** the xml element and attribute supported by this factory */
- public static final String ENABLE_ELEMENT = "enable";
- public static final String ENABLE_TYPE_ATTRIBUTE = "type";
- public static final String ENABLE_SHORTNAME_ATTRIBUTE = "short-name";
-
- /**
- * Default public CTOR (necessary)
- */
- public DeploymentInfoNotificationFilterFactory()
- {
- // empty
- }
-
- /**
- * The actual filter factory implementation
- */
- public NotificationFilter createNotificationFilter(Element filterConfig)
- throws Exception
- {
- // start off with a filter that does not allow any type
- DeploymentInfoNotificationFilter filter = new DeploymentInfoNotificationFilter();
-
- // filterConfig should point to the <filter factory="..."> element,
- // we are interested in its 'enable' children to configure the filter
- NodeList filterChildren = filterConfig.getChildNodes();
-
- for (int i = 0; i < filterChildren.getLength(); i++)
- {
- Node filterChildNode = filterChildren.item(i);
-
- // check if this is an 'enable' element, ignore everything else
- if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
- {
- // look for 'type' attribute
- if (((Element)filterChildNode).hasAttribute(ENABLE_TYPE_ATTRIBUTE))
- {
- String type = ((Element)filterChildNode).getAttribute(ENABLE_TYPE_ATTRIBUTE);
- // enable this type in the filter
- filter.enableType(type);
- }
- else if (((Element)filterChildNode).hasAttribute(ENABLE_SHORTNAME_ATTRIBUTE))
- {
- String shortName = ((Element)filterChildNode).getAttribute(ENABLE_SHORTNAME_ATTRIBUTE);
- // enable this shortName in the filter
- filter.enableShortName(shortName);
- }
- else
- {
- throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
- + ENABLE_TYPE_ATTRIBUTE + "' or a '" + ENABLE_SHORTNAME_ATTRIBUTE + "' attribute");
- }
- }
- }
- // we are done
- return filter;
- }
-
- /**
- * A NotificationFilter that can filter Notifications that
- * carry a DeploymentInfo payload in the UserData field.
- *
- * The Notification is filtered first on its type,
- * then on its DeploymentInfo.shortName.
- *
- * Uses copy-on-write semantics for fast unsynchronized access.
- */
- public static class DeploymentInfoNotificationFilter extends JBossNotificationFilterSupport
- {
- private static final long serialVersionUID = -5067618040005609685L;
-
- /** The short names that will pass the filter */
- private Set enabledShortNames;
-
- // Constructors -----------------------------------------------
-
- /**
- * Default CTOR.
- *
- * Create a filter that filters out all notification types/sortnames.
- */
- public DeploymentInfoNotificationFilter()
- {
- super();
- enabledShortNames = CollectionsFactory.createCopyOnWriteSet();
- }
-
- /**
- * Disable all shortNames. Rejects all notifications.
- */
- public void disableAllShortNames()
- {
- enabledShortNames.clear();
- }
-
- /**
- * Disable a shortName.
- *
- * @param name the shortName to disable.
- */
- public void disableShortName(String name)
- {
- enabledShortNames.remove(name);
- }
-
- /**
- * Enable a shortName.
- *
- * @param name the shortName to enable.
- * @exception IllegalArgumentException for a null name.
- */
- public void enableShortName(String name) throws IllegalArgumentException
- {
- if (name == null)
- {
- throw new IllegalArgumentException("null shortName");
- }
- enabledShortNames.add(name);
- }
-
- /**
- * Get all the enabled short names.<p>
- *
- * Returns a vector of enabled short names.<br>
- * An empty vector means all short names disabled.
- *
- * @return the vector of enabled short names.
- */
- public Vector getEnabledShortNames()
- {
- return new Vector(enabledShortNames);
- }
-
- /**
- * @return human readable string.
- */
- public String toString()
- {
- StringBuffer sb = new StringBuffer(100);
-
- sb.append(getClass().getName()).append(':');
- sb.append(" enabledTypes=").append(getEnabledTypes());
- sb.append(" enabledShortNames=").append(getEnabledShortNames());
-
- return sb.toString();
- }
-
- // NotificationFilter implementation ---------------------------
-
- /**
- * Test to see whether this notification is enabled
- *
- * @param notification the notification to filter
- * @return true when the notification should be sent, false otherwise
- * @exception IllegalArgumentException for null notification.
- */
- public boolean isNotificationEnabled(Notification notification)
- {
- // check if the notification type is not enabled in the super class
- if (super.isNotificationEnabled(notification) == false)
- {
- return false;
- }
-
- // Check the shortName in the payload. We assume that proper
- // filtering on notification type, ensures that the
- // notification actually carries a DeploymentInfo.
- DeploymentInfo di = (DeploymentInfo)notification.getUserData();
- String shortName = di.shortName;
-
- // Return true if the shortName is enabled, false otherwise
- return enabledShortNames.contains(shortName);
- }
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/DeploymentInfoNotificationFilterFactory.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,125 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.filterfactory;
-
-import javax.management.NotificationFilter;
-import javax.management.ObjectName;
-import javax.management.relation.MBeanServerNotificationFilter;
-
-import org.jboss.system.NotificationFilterFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Factory for MBeanServerNotificationFilter filters.
- *
- * The produced filter is really meant for MBeanServerNotifications
- * emitted by the "JMImplementation:type=MBeanServerDelegate" MBean.
- *
- * filters-in zero or more Notification types, and zero or more
- * ObjectNames (contained in the MBeanServerNotification), so
- * you need to explicitly enable both the types and the ObjectNames.
- *
- * In a nutshell, you'll be able to receive registration and/or unregistration
- * notifications for selected ObjectNames (i.e. MBean instances)!
- *
- * The passed filterConfig xml element fragment should look like:
- *
- * <filter factory="MBeanServerNotificationFilterFactory">
- * <enable type="JMX.mbean"/>
- * ...
- * <enable object-name="mydomain:type=mymbean"/>
- * <enable object-name="mydomain:type=myothermbean"/>
- * ...
- * </filter>
- *
- * Note: JMX.mbean yields both notifications:
- * JMX.mbean.registered
- * JMX.mbean.unregistered
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public class MBeanServerNotificationFilterFactory
- implements NotificationFilterFactory
-{
- // Constants -----------------------------------------------------
-
- /** the xml element and attribute supported by this factory */
- public static final String ENABLE_ELEMENT = "enable";
- public static final String ENABLE_TYPE_ATTRIBUTE = "type";
- public static final String ENABLE_OBJECTNAME_ATTRIBUTE = "object-name";
-
- /**
- * Default public CTOR (necessary)
- */
- public MBeanServerNotificationFilterFactory()
- {
- // empty
- }
-
- /**
- * The actual filter factory implementation
- */
- public NotificationFilter createNotificationFilter(Element filterConfig)
- throws Exception
- {
- // start off with a filter that does not allow any type/objectname
- MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
-
- // filterConfig should point to the <filter factory="..."> element,
- // we are interested in its 'enable' children to configure the filter
- NodeList filterChildren = filterConfig.getChildNodes();
-
- for (int i = 0; i < filterChildren.getLength(); i++)
- {
- Node filterChildNode = filterChildren.item(i);
-
- // check if this is an 'enable' element, ignore everything else
- if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
- {
- // look for 'type' attribute
- if (((Element)filterChildNode).hasAttribute(ENABLE_TYPE_ATTRIBUTE))
- {
- String type = ((Element)filterChildNode).getAttribute(ENABLE_TYPE_ATTRIBUTE);
- // enable this type in the filter
- filter.enableType(type);
- }
- else if (((Element)filterChildNode).hasAttribute(ENABLE_OBJECTNAME_ATTRIBUTE))
- {
- String objectName = ((Element)filterChildNode).getAttribute(ENABLE_OBJECTNAME_ATTRIBUTE);
- // enable this objectName in the filter
- // may throw MalformedObjectNameException
- filter.enableObjectName(new ObjectName(objectName));
- }
- else
- {
- throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
- + ENABLE_TYPE_ATTRIBUTE + "' or a '" + ENABLE_OBJECTNAME_ATTRIBUTE + "' attribute");
- }
- }
- }
- // we are done
- return filter;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/MBeanServerNotificationFilterFactory.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.filterfactory;
-
-import javax.management.NotificationFilter;
-import javax.management.NotificationFilterSupport;
-
-import org.jboss.system.NotificationFilterFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Factory for NotificationFilterSupport filters.
- *
- * The produced filter filters-in zero or more Notification types,
- * so you need to explicitly enable the types you want.
- *
- * The passed filterConfig xml element fragment should look like:
- *
- * <filter factory="NotificationFilterSupportFactory">
- * <enable type="some.notification.type"/>
- * <enable type="another.notification.type"/>
- * ...
- * </filter>
- *
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @version $Revision$
-**/
-public class NotificationFilterSupportFactory
- implements NotificationFilterFactory
-{
- // Constants -----------------------------------------------------
-
- /** the xml element and attribute supported by this factory */
- public static final String ENABLE_ELEMENT = "enable";
- public static final String ENABLE_TYPE_ATTRIBUTE = "type";
-
- /**
- * Default public CTOR (necessary)
- */
- public NotificationFilterSupportFactory()
- {
- // empty
- }
-
- /**
- * The actual filter factory implementation
- */
- public NotificationFilter createNotificationFilter(Element filterConfig)
- throws Exception
- {
- // start off with a filter that does not allow any type
- NotificationFilterSupport filter = new NotificationFilterSupport();
-
- // filterConfig should point to the <filter factory="..."> element,
- // we are interested in its 'enable' children to configure the filter
- NodeList filterChildren = filterConfig.getChildNodes();
-
- for (int i = 0; i < filterChildren.getLength(); i++)
- {
- Node filterChildNode = filterChildren.item(i);
-
- // check if this is an 'enable' element, ignore everything else
- if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
- {
- // look for 'type' attribute
- if (((Element)filterChildNode).hasAttribute(ENABLE_TYPE_ATTRIBUTE))
- {
- String type = ((Element)filterChildNode).getAttribute(ENABLE_TYPE_ATTRIBUTE);
- // enable this type in the filter
- filter.enableType(type);
- }
- else
- {
- throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
- + ENABLE_TYPE_ATTRIBUTE + "' attribute");
- }
- }
- }
- // we are done
- return filter;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/filterfactory/NotificationFilterSupportFactory.java)
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata (from rev 55207, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,155 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.util.UnreachableStatementException;
-
-/**
- * ServiceAttributeMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceAttributeMetaData
-{
- /** The attribute name */
- private String name;
-
- /** Whether to trim the value */
- private boolean trim;
-
- /** Whether to do property replacement */
- private boolean replace;
-
- /** The value */
- private ServiceValueMetaData value;
-
- /**
- * Get the name.
- *
- * @return the name.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the name.
- *
- * @param name the name.
- */
- public void setName(String name)
- {
- if (name == null)
- throw new IllegalArgumentException("Null name");
- this.name = name;
- }
-
- /**
- * Get the replace.
- *
- * @return the replace.
- */
- public boolean isReplace()
- {
- return replace;
- }
-
- /**
- * Set the replace.
- *
- * @param replace the replace.
- */
- public void setReplace(boolean replace)
- {
- this.replace = replace;
- }
-
- /**
- * Get the trim.
- *
- * @return the trim.
- */
- public boolean isTrim()
- {
- return trim;
- }
-
- /**
- * Set the trim.
- *
- * @param trim the trim.
- */
- public void setTrim(boolean trim)
- {
- this.trim = trim;
- }
-
- /**
- * Get the value.
- *
- * @return the value.
- */
- public ServiceValueMetaData getValue()
- {
- return value;
- }
-
- /**
- * Set the value.
- *
- * @param value the value.
- */
- public void setValue(ServiceValueMetaData value)
- {
- if (value == null)
- throw new IllegalArgumentException("Null value");
- this.value = value;
- }
-
- /**
- * Get the value
- *
- * @param server the mbean server
- * @param attributeInfo the attribute info
- * @param cl the classloader
- * @return the value
- * @throws Exception for any error
- */
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl) throws Exception
- {
- try
- {
- return value.getValue(server, attributeInfo, cl, isTrim(), isReplace());
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Error configuring attribute " + name, t);
- throw new UnreachableStatementException();
- }
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceAttributeMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,155 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-import java.lang.reflect.Constructor;
-
-import org.jboss.system.ConfigurationException;
-import org.jboss.util.Classes;
-import org.jboss.util.StringPropertyReplacer;
-
-/**
- * ServiceConstructorMetaData.
- *
- * This class is based on the old ConstructorInfo from ServiceCreator
- *
- * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceConstructorMetaData
-{
- /** An empty parameters */
- public static final Object[] EMPTY_PARAMETERS = {};
-
- /** An empty parameters list. */
- public static final String[] EMPTY_PARAMS = {};
-
- /** An signature list. */
- public static final String[] EMPTY_SIGNATURE = {};
-
- /** The constructor signature. */
- private String[] signature = EMPTY_SIGNATURE;
-
- /** The constructor parameters. */
- private String[] params = EMPTY_PARAMS;
-
- /**
- * Get the params.
- *
- * @return the params.
- */
- public String[] getParams()
- {
- return params;
- }
-
- /**
- * Set the params.
- *
- * @param params the params.
- */
- public void setParams(String[] params)
- {
- if (params == null)
- throw new IllegalArgumentException("Null params");
- this.params = params;
- }
-
- /**
- * Get the signature.
- *
- * @return the signature.
- */
- public String[] getSignature()
- {
- return signature;
- }
-
- /**
- * Set the signature.
- *
- * @param signature the signature.
- */
- public void setSignature(String[] signature)
- {
- if (signature == null)
- throw new IllegalArgumentException("Null signature");
- this.signature = signature;
- }
-
- /**
- * Get the parameters
- *
- * @param cl the class loader
- * @return the parameters
- * @throws Exception for any error
- */
- public Object[] getParameters(ClassLoader cl) throws Exception
- {
- if (params.length == 0)
- return EMPTY_PARAMETERS;
-
- Object[] result = new Object[params.length];
- for (int i = 0; i < result.length; ++i)
- {
- String value = StringPropertyReplacer.replaceProperties(params[i]);
- Object realValue = value;
-
- if (signature[i] != null)
- {
- // See if it is a primitive type first
- Class typeClass = Classes.getPrimitiveTypeForName(signature[i]);
- if (typeClass == null)
- typeClass = cl.loadClass(signature[i]);
-
- // Convert the string to the real value
- PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
- if (editor == null)
- {
- try
- {
- // See if there is a ctor(String) for the type
- Class[] sig = {String.class};
- Constructor ctor = typeClass.getConstructor(sig);
- Object[] args = {value};
- realValue = ctor.newInstance(args);
- }
- catch (Exception e)
- {
- throw new ConfigurationException("No property editor for type: " + typeClass);
- }
- }
- else
- {
- editor.setAsText(value);
- realValue = editor.getValue();
- }
- }
- result[i] = realValue;
- }
- return result;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceConstructorMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.util.List;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-/**
- * ServiceDependencyListValueMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceDependencyListValueMetaData implements ServiceValueMetaData
-{
- /** The object names */
- private List<ObjectName> objectNames;
-
- /**
- * Create a new ServiceDependencyListValueMetaData.
- */
- public ServiceDependencyListValueMetaData()
- {
- }
-
- /**
- * Create a new ServiceDependencyListValueMetaData.
- *
- * @param objectNames the object names
- */
- public ServiceDependencyListValueMetaData(List<ObjectName> objectNames)
- {
- setObjectNames(objectNames);
- }
-
- /**
- * Get the objectNames.
- *
- * @return the objectNames.
- */
- public List<ObjectName> getObjectNames()
- {
- return objectNames;
- }
-
- /**
- * Set the objectNames.
- *
- * @param objectNames the objectNames.
- */
- public void setObjectNames(List<ObjectName> objectNames)
- {
- if (objectNames == null)
- throw new IllegalArgumentException("Null objectNames");
- this.objectNames = objectNames;
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- return objectNames;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyListValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,58 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import javax.management.ObjectName;
-
-/**
- * ServiceDependencyMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceDependencyMetaData
-{
- /** The dependency */
- private ObjectName iDependOn;
-
- /**
- * Get the iDependOn.
- *
- * @return the iDependOn.
- */
- public ObjectName getIDependOn()
- {
- return iDependOn;
- }
-
- /**
- * Set the iDependOn.
- *
- * @param dependOn the iDependOn.
- */
- public void setIDependOn(ObjectName iDependOn)
- {
- if (iDependOn == null)
- throw new IllegalArgumentException("Null iDependOn");
- this.iDependOn = iDependOn;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,135 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.mx.util.MBeanProxyExt;
-
-/**
- * ServiceDependencyValueMetaData.
- *
- * This class is based on the old ServiceConfigurator
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceDependencyValueMetaData implements ServiceValueMetaData
-{
- /** The object name */
- private ObjectName objectName;
-
- /** The proxy type */
- private String proxyType;
-
- /**
- * Create a new ServiceDependencyValueMetaData.
- */
- public ServiceDependencyValueMetaData()
- {
- }
-
- /**
- * Create a new ServiceDependencyValueMetaData.
- *
- * @param objectName the object name
- */
- public ServiceDependencyValueMetaData(ObjectName objectName)
- {
- setObjectName(objectName);
- }
-
- /**
- * Create a new ServiceDependencyValueMetaData.
- *
- * @param objectName the object name
- * @param proxyType the proxy type
- */
- public ServiceDependencyValueMetaData(ObjectName objectName, String proxyType)
- {
- setObjectName(objectName);
- setProxyType(proxyType);
- }
-
- /**
- * Get the objectName.
- *
- * @return the objectName.
- */
- public ObjectName getObjectName()
- {
- return objectName;
- }
-
- /**
- * Set the objectName.
- *
- * @param objectName the objectName.
- */
- public void setObjectName(ObjectName objectName)
- {
- if (objectName == null)
- throw new IllegalArgumentException("Null objectName");
- this.objectName = objectName;
- }
-
- /**
- * Get the proxyType.
- *
- * @return the proxyType.
- */
- public String getProxyType()
- {
- return proxyType;
- }
-
- /**
- * Set the proxyType.
- *
- * @param proxyType the proxyType.
- */
- public void setProxyType(String proxyType)
- {
- this.proxyType = proxyType;
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- if (proxyType != null)
- {
- if (proxyType.equals("attribute"))
- proxyType = attributeInfo.getType();
-
- Class proxyClass = cl.loadClass(proxyType);
- return MBeanProxyExt.create(proxyClass, objectName, server, true);
- }
-
- return objectName;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceDependencyValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,114 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.StringPropertyReplacer;
-import org.w3c.dom.Element;
-
-/**
- * ServiceElementValueMetaData.
- *
- * This class is based on the old ServiceConfigurator
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceElementValueMetaData implements ServiceValueMetaData
-{
- /** The log */
- private static final Logger log = Logger.getLogger(ServiceElementValueMetaData.class);
-
- /** The element */
- private Element element;
-
- /**
- * Create a new ServiceElementValueMetaData.
- */
- public ServiceElementValueMetaData()
- {
- }
-
- /**
- * Create a new ServiceElementValueMetaData.
- *
- * @param element the element
- */
- public ServiceElementValueMetaData(Element element)
- {
- setElement(element);
- }
-
- /**
- * Get the element.
- *
- * @return the element.
- */
- public Element getElement()
- {
- return element;
- }
-
- /**
- * Set the element.
- *
- * @param element the element.
- */
- public void setElement(Element element)
- {
- if (element == null)
- throw new IllegalArgumentException("Null element");
- this.element = element;
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- // Replace any ${x} references in the element text
- if (replace)
- {
- PropertyEditor editor = PropertyEditorManager.findEditor(Element.class);
- if (editor == null)
- log.warn("Cannot perform property replace on Element");
- else
- {
- editor.setValue(element);
- String text = editor.getAsText();
- text = StringPropertyReplacer.replaceProperties(text);
- editor.setAsText(text);
- return editor.getValue();
- }
- }
-
- return element;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceElementValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,125 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * ServiceJBXBValueMetaData.
- *
- * This class is based on the old ServiceConfigurator
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceJBXBValueMetaData extends ServiceElementValueMetaData
-{
- /**
- * Create a new ServiceJBXBValueMetaData.
- */
- public ServiceJBXBValueMetaData()
- {
- super();
- }
-
- /**
- * Create a new ServiceJBXBValueMetaData.
- *
- * @param element the element
- */
- public ServiceJBXBValueMetaData(Element element)
- {
- super(element);
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- // Get the attribute element content in a parsable form
- StringBuffer buffer = getElementContent(getElement());
-
- // Parse the attribute element content
- DefaultSchemaResolver resolver = new DefaultSchemaResolver();
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- StringReader reader = new StringReader(buffer.toString());
- Object bean = unmarshaller.unmarshal(reader, resolver);
- return bean;
- }
-
- /**
- * A utility method that transforms the contents of the argument element into
- * a StringBuffer representation that can be reparsed.
- *
- * [FIXME] This is not a general DOMUtils method because of its funny contract. It does not
- * support multiple child elements neither can it deal with text content.
- *
- * @param element - the parent dom element whose contents are to be extracted as an xml document string.
- * @return the xml document string.
- */
- private static StringBuffer getElementContent(Element element) throws IOException, TransformerException
- {
- NodeList children = element.getChildNodes();
- Element content = null;
- for (int n = 0; n < children.getLength(); n++)
- {
- Node node = children.item(n);
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- content = (Element)node;
- break;
- }
- }
- if (content == null)
- return null;
-
- // Get a parsable representation of this elements content
- DOMSource source = new DOMSource(content);
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Transformer transformer = tFactory.newTransformer();
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- transformer.transform(source, result);
- sw.close();
- return sw.getBuffer();
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceJBXBValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,98 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.util.Properties;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-
-import org.jboss.util.propertyeditor.PropertyEditors;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * ServiceJavaBeanValueMetaData.
- *
- * This class is based on the old ServiceConfigurator
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceJavaBeanValueMetaData extends ServiceElementValueMetaData
-{
- /**
- * Create a new ServiceJavaBeanValueMetaData.
- */
- public ServiceJavaBeanValueMetaData()
- {
- super();
- }
-
- /**
- * Create a new ServiceJavaBeanValueMetaData.
- *
- * @param element the element
- */
- public ServiceJavaBeanValueMetaData(Element element)
- {
- super(element);
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- // Extract the property elements
- Element element = getElement();
- String attributeClassName = element.getAttribute("attributeClass");
- if( attributeClassName == null || attributeClassName.length() == 0 )
- attributeClassName = attributeInfo.getType();
- Class attributeClass = cl.loadClass(attributeClassName);
- // Create the bean instance
- Object bean = attributeClass.newInstance();
- // Get the JavaBean properties
- NodeList properties = element.getElementsByTagName("property");
- Properties beanProps = new Properties();
- for(int n = 0; n < properties.getLength(); n ++)
- {
- // Skip over non-element nodes
- Node node = properties.item(n);
- if (node.getNodeType() != Node.ELEMENT_NODE)
- {
- continue;
- }
- Element property = (Element) node;
- String name = property.getAttribute("name");
- String value = ServiceMetaDataParser.getElementTextContent(property, trim, replace);
- beanProps.setProperty(name, value);
- }
-
- // Apply the properties to the bean
- PropertyEditors.mapJavaBeanProperties(bean, beanProps);
- return bean;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceJavaBeanValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,281 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.w3c.dom.Element;
-
-/**
- * ServiceMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceMetaData
-{
- /** The default XMBean class, when one is not specified */
- public static final String XMBEAN_CODE = "org.jboss.mx.modelmbean.XMBean";
-
- /** The ObjectName */
- private ObjectName objectName;
-
- /** The code */
- private String code;
-
- /** The interface name */
- private String interfaceName;
-
- /** The constructor */
- private ServiceConstructorMetaData constructor;
-
- /** The XMBean dds */
- private String xmbeanDD;
-
- /** The XMBean code */
- private String xmbeanCode = XMBEAN_CODE;
-
- /** The XMBean descriptor */
- private Element xmbeanDescriptor;
-
- /** The attributes */
- private List<ServiceAttributeMetaData> attributes = Collections.emptyList();
-
- /** The dependencies */
- private List<ServiceDependencyMetaData> dependencies = Collections.emptyList();
-
- /** The class loader */
- private ObjectName classLoaderName;
-
- /**
- * Get the objectName.
- *
- * @return the objectName.
- */
- public ObjectName getObjectName()
- {
- return objectName;
- }
-
- /**
- * Set the objectName.
- *
- * @param objectName the objectName.
- */
- public void setObjectName(ObjectName objectName)
- {
- if (objectName == null)
- throw new IllegalArgumentException("Null objectName");
- this.objectName = objectName;
- }
-
- /**
- * Get the code.
- *
- * @return the code.
- */
- public String getCode()
- {
- return code;
- }
-
- /**
- * Set the code.
- *
- * @param code the code.
- */
- public void setCode(String code)
- {
- if (code == null)
- throw new IllegalArgumentException("Null code");
- this.code = code;
- }
-
- /**
- * Get the constructor.
- *
- * @return the constructor.
- */
- public ServiceConstructorMetaData getConstructor()
- {
- return constructor;
- }
-
- /**
- * Set the constructor.
- *
- * @param constructor the constructor.
- */
- public void setConstructor(ServiceConstructorMetaData constructor)
- {
- this.constructor = constructor;
- }
-
- /**
- * Get the interfaceName.
- *
- * @return the interfaceName.
- */
- public String getInterfaceName()
- {
- return interfaceName;
- }
-
- /**
- * Set the interfaceName.
- *
- * @param interfaceName the interfaceName.
- */
- public void setInterfaceName(String interfaceName)
- {
- this.interfaceName = interfaceName;
- }
-
- /**
- * Get the xmbeanCode.
- *
- * @return the xmbeanCode.
- */
- public String getXMBeanCode()
- {
- return xmbeanCode;
- }
-
- /**
- * Set the xmbeanCode.
- *
- * @param xmbeanCode the xmbeanCode.
- */
- public void setXMBeanCode(String xmbeanCode)
- {
- if (xmbeanCode == null)
- throw new IllegalArgumentException("Null xmbeanCode");
- this.xmbeanCode = xmbeanCode;
- }
-
- /**
- * Get the xmbeanDD.
- *
- * @return the xmbeanDD.
- */
- public String getXMBeanDD()
- {
- return xmbeanDD;
- }
-
- /**
- * Set the xmbeanDD.
- *
- * @param xmbeanDD the xmbeanDD.
- */
- public void setXMBeanDD(String xmbeanDD)
- {
- this.xmbeanDD = xmbeanDD;
- }
-
- /**
- * Get the xmbeanDescriptor.
- *
- * @return the xmbeanDescriptor.
- */
- public Element getXMBeanDescriptor()
- {
- return xmbeanDescriptor;
- }
-
- /**
- * Set the xmbeanDescriptor.
- *
- * @param xmbeanDescriptor the xmbeanDescriptor.
- */
- public void setXMBeanDescriptor(Element xmbeanDescriptor)
- {
- this.xmbeanDescriptor = xmbeanDescriptor;
- }
-
- /**
- * Get the attributes.
- *
- * @return the attributes.
- */
- public List<ServiceAttributeMetaData> getAttributes()
- {
- return attributes;
- }
-
- /**
- * Set the attributes.
- *
- * @param attributes the attributes.
- */
- public void setAttributes(List<ServiceAttributeMetaData> attributes)
- {
- if (attributes == null)
- throw new IllegalArgumentException("Null attributes");
- this.attributes = attributes;
- }
-
- /**
- * Get the dependencies.
- *
- * @return the dependencies.
- */
- public List<ServiceDependencyMetaData> getDependencies()
- {
- return dependencies;
- }
-
- /**
- * Set the dependencies.
- *
- * @param dependencies the dependencies.
- */
- public void setDependencies(List<ServiceDependencyMetaData> dependencies)
- {
- if (dependencies == null)
- throw new IllegalArgumentException("Null dependencies");
- this.dependencies = dependencies;
- }
-
- /**
- * Get the classLoaderName.
- *
- * @return the classLoaderName.
- */
- public ObjectName getClassLoaderName()
- {
- return classLoaderName;
- }
-
- /**
- * Set the classLoaderName.
- *
- * @param classLoaderName the classLoaderName.
- */
- public void setClassLoaderName(ObjectName classLoaderName)
- {
- this.classLoaderName = classLoaderName;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,531 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.system.ConfigurationException;
-import org.jboss.util.StringPropertyReplacer;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * ServiceMetaDataParser
- *
- * This class is based on the old ServiceConfigurator/Creator.
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceMetaDataParser
-{
- /** The element config */
- private Element config;
-
- /**
- * Create a new service meta data parser
- *
- * @param config the xml config
- */
- public ServiceMetaDataParser(Element config)
- {
- if (config == null)
- throw new IllegalArgumentException("Null config");
-
- this.config = config;
- }
-
- /**
- * Parse the xml
- *
- * @return the list of service meta data
- * @throws DeploymentException for any error
- */
- public List<ServiceMetaData> parse() throws DeploymentException
- {
- List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
-
- try
- {
- if ("mbean".equals(config.getTagName()))
- internalParse(services, config, true);
- else
- {
- NodeList nl = config.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); ++i)
- {
- if (nl.item(i).getNodeType() == Node.ELEMENT_NODE)
- {
- Element element = (Element) nl.item(i);
- if ("mbean".equals(element.getTagName()))
- {
- Element mbean = (Element) nl.item(i);
- internalParse(services, mbean, true);
- }
- }
- }
- }
- }
- catch (Throwable t)
- {
- DeploymentException.rethrowAsDeploymentException("Unable to parse service configuration", t);
- }
-
- return services;
- }
-
- /**
- * Internal parse
- *
- * @param services the list of service meta data
- * @param mbeanElement the mbean configuration
- * @param replace whether to replace system properties
- * @return the ObjectName of the parsed mbean
- * @throws Exception for any error
- */
- private ObjectName internalParse(List<ServiceMetaData> services, Element mbeanElement, boolean replace) throws Exception
- {
- ServiceMetaData service = new ServiceMetaData();
-
- ObjectName mbeanName = parseObjectName(mbeanElement, replace);
- service.setObjectName(mbeanName);
-
- String code = parseCode(mbeanName, mbeanElement);
- service.setCode(code);
-
- ServiceConstructorMetaData constructor = parseConstructor(mbeanName, mbeanElement, replace);
- service.setConstructor(constructor);
-
- String interfaceName = parseInterface(mbeanName, mbeanElement);
- service.setInterfaceName(interfaceName);
-
- String xmbeandd = parseXMBeanDD(mbeanName, mbeanElement);
- service.setXMBeanDD(xmbeandd);
-
- String xmbeanCode = parseXMBeanCode(mbeanName, mbeanElement);
- service.setXMBeanCode(xmbeanCode);
-
- if (xmbeandd != null && xmbeandd.length() == 0)
- {
- Element xmbeanDescriptor = parseXMBeanDescriptor(mbeanName, mbeanElement);
- service.setXMBeanDescriptor(xmbeanDescriptor);
- }
-
- List<ServiceAttributeMetaData> attributes = new ArrayList<ServiceAttributeMetaData>();
- List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
-
- NodeList attrs = mbeanElement.getChildNodes();
- for (int j = 0; j < attrs.getLength(); j++)
- {
- // skip over non-element nodes
- if (attrs.item(j).getNodeType() != Node.ELEMENT_NODE)
- continue;
-
- Element element = (Element) attrs.item(j);
-
- boolean replaceAttribute = true;
-
- // Set attributes
- if (element.getTagName().equals("attribute"))
- {
- String attributeName = element.getAttribute("name");
- if (attributeName == null)
- throw new DeploymentException("Null attribute name for " + mbeanName);
- boolean trim = true;
- String replaceAttr = element.getAttribute("replace");
- if (replaceAttr.length() > 0)
- replaceAttribute = Boolean.valueOf(replaceAttr).booleanValue();
- String trimAttr = element.getAttribute("trim");
- if (trimAttr.length() > 0)
- trim = Boolean.valueOf(trimAttr).booleanValue();
- String serialDataType = element.getAttribute("serialDataType");
-
- if (element.hasChildNodes())
- {
- // Unmarshall the attribute value based on the serialDataType
- ServiceValueMetaData value = null;
- if (serialDataType.equals("javaBean"))
- {
- value = new ServiceJavaBeanValueMetaData(element);
- }
- else if (serialDataType.equals("jbxb"))
- {
- value = new ServiceJBXBValueMetaData(element);
- }
- else
- {
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- {
- value = new ServiceElementValueMetaData((Element) n);
- break;
- }
- }
- if (value == null)
- value = new ServiceTextValueMetaData(getElementTextContent(element, trim, replace));
- }
-
- ServiceAttributeMetaData attribute = new ServiceAttributeMetaData();
- attribute.setName(attributeName);
- attribute.setReplace(replaceAttribute);
- attribute.setTrim(trim);
- attribute.setValue(value);
- attributes.add(attribute);
- }
- }
- else if (element.getTagName().equals("depends"))
- {
- if (element.hasChildNodes() == false)
- throw new DeploymentException("No ObjectName supplied for depends in " + mbeanName);
-
- String mbeanRefName = element.getAttribute("optional-attribute-name");
- if ("".equals(mbeanRefName))
- mbeanRefName = null;
- else
- mbeanRefName = StringPropertyReplacer.replaceProperties(mbeanRefName);
-
- String proxyType = element.getAttribute("proxy-type");
- if ("".equals(proxyType))
- proxyType = null;
- else
- proxyType = StringPropertyReplacer.replaceProperties(proxyType);
-
- // Get the mbeanRef value
- ObjectName dependsObjectName = processDependency(mbeanName, element, services, replace);
-
- if (mbeanRefName != null)
- {
- if (proxyType != null)
- {
- if (mbeanRefName == null)
- throw new DeploymentException("You cannot use a proxy-type without an optional-attribute-name for " + mbeanName);
- }
- ServiceValueMetaData value = new ServiceDependencyValueMetaData(dependsObjectName, proxyType);
- ServiceAttributeMetaData attribute = new ServiceAttributeMetaData();
- attribute.setName(mbeanRefName);
- attribute.setValue(value);
- attributes.add(attribute);
- }
-
- ServiceDependencyMetaData dependency = new ServiceDependencyMetaData();
- dependency.setIDependOn(dependsObjectName);
- dependencies.add(dependency);
- }
- else if (element.getTagName().equals("depends-list"))
- {
- String dependsListName = element.getAttribute("optional-attribute-name");
- if ("".equals(dependsListName))
- dependsListName = null;
-
- NodeList dependsList = element.getChildNodes();
- ArrayList<ObjectName> dependsListNames = new ArrayList<ObjectName>();
- for (int l = 0; l < dependsList.getLength(); ++l)
- {
- if (dependsList.item(l).getNodeType() != Node.ELEMENT_NODE)
- continue;
-
- Element dependsElement = (Element) dependsList.item(l);
- if (dependsElement.getTagName().equals("depends-list-element"))
- {
- if (dependsElement.hasChildNodes() == false)
- throw new DeploymentException("Empty depends-list-element for " + mbeanName);
-
- // Get the depends value
- ObjectName dependsObjectName = processDependency(mbeanName, dependsElement, services, replace);
- if (dependsListNames.contains(dependsObjectName) == false)
- dependsListNames.add(dependsObjectName);
-
- ServiceDependencyMetaData dependency = new ServiceDependencyMetaData();
- dependency.setIDependOn(dependsObjectName);
- dependencies.add(dependency);
- }
- }
- if (dependsListName != null)
- {
- ServiceValueMetaData value = new ServiceDependencyListValueMetaData(dependsListNames);
- ServiceAttributeMetaData attribute = new ServiceAttributeMetaData();
- attribute.setName(dependsListName);
- attribute.setValue(value);
- attributes.add(attribute);
- }
- }
- }
-
- service.setAttributes(attributes);
- service.setDependencies(dependencies);
-
- services.add(service);
-
- return mbeanName;
- }
-
- /**
- * Parse an object name from the given element attribute 'name'.
- *
- * @param mbeanElement the element to parse name from.
- * @return the ObjectName
- * @throws Exception for any error
- */
- private ObjectName parseObjectName(final Element mbeanElement, boolean replace) throws Exception
- {
- String name = mbeanElement.getAttribute("name");
-
- if (name == null || name.trim().length() == 0)
- throw new DeploymentException("Missing or empty 'name' attribute for mbean.");
-
- if (replace)
- name = StringPropertyReplacer.replaceProperties(name);
-
- return new ObjectName(name);
- }
-
- /**
- * Parse a class name from the given element attribute 'code'.
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @return the class name
- * @throws Exception for any error
- */
- private String parseCode(final ObjectName name, final Element mbeanElement) throws Exception
- {
- String code = mbeanElement.getAttribute("code");
-
- if (code == null || code.trim().length() == 0)
- throw new ConfigurationException("Missing or empty 'code' attribute for mbean " + name);
-
- return code;
- }
-
- /**
- * Parse the constructor element of the given element
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @param replace whether to replace system properties
- * @return the constructor meta data
- * @throws Exception for any error
- */
- private ServiceConstructorMetaData parseConstructor(final ObjectName name, final Element mbeanElement, boolean replace) throws Exception
- {
- ServiceConstructorMetaData result = new ServiceConstructorMetaData();
-
- NodeList list = mbeanElement.getElementsByTagName("constructor");
- if (list.getLength() > 1 && list.item(0).getParentNode() == mbeanElement)
- throw new DeploymentException("only one <constructor> element may be defined for " + name);
-
- if (list.getLength() == 1)
- {
- Element element = (Element) list.item(0);
-
- // get all of the "arg" elements
- list = element.getElementsByTagName("arg");
- int length = list.getLength();
- String[] params = new String[length];
- String[] signature = new String[length];
-
- // decode the values into params & signature
- for (int j=0; j<length; ++j)
- {
- Element arg = (Element)list.item(j);
- String typeName = null;
- Attr attr = arg.getAttributeNode("type");
- if (attr != null)
- typeName = attr.getValue();
- if (typeName == null || typeName.trim().length() == 0)
- throw new ConfigurationException("Missing or empty 'type' attribute in constructor arg for " + name);
- String value = null;
- attr = arg.getAttributeNode("value");
- if (attr != null)
- value = attr.getValue();
- if (value == null)
- throw new ConfigurationException("Missing 'value' attribute in constructor arg for " + name);
- signature[j] = typeName;
- params[j] = value;
- }
-
- result.setParams(params);
- result.setSignature(signature);
- }
-
- return result;
- }
-
- /**
- * Parse the interface name from the given element attribute 'interface'.
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @return the class name
- * @throws Exception for any error
- */
- private String parseInterface(final ObjectName name, final Element mbeanElement) throws Exception
- {
- Attr attr = mbeanElement.getAttributeNode("interface");
- if (attr != null)
- return attr.getValue();
- else
- return null;
- }
-
- /**
- * Parse the xmbean dds from the given element attribute 'xmbean-dd'.
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @return the xmbean dds location
- * @throws Exception for any error
- */
- private String parseXMBeanDD(final ObjectName name, final Element mbeanElement) throws Exception
- {
- Attr attr = mbeanElement.getAttributeNode("xmbean-dd");
- if (attr != null)
- return attr.getValue();
- else
- return null;
- }
-
- /**
- * Parse the xmbean code from the given element attribute 'xmbean-code'.
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @return the xmbean code
- * @throws Exception for any error
- */
- private String parseXMBeanCode(final ObjectName name, final Element mbeanElement) throws Exception
- {
- Attr attr = mbeanElement.getAttributeNode("xmbean-code");
- if (attr != null)
- return attr.getValue();
- else
- return ServiceMetaData.XMBEAN_CODE;
- }
-
- /**
- * Parse the xmbean descriptor.
- *
- * @param name the mbean name
- * @param mbeanElement the element to parse name from.
- * @return the xmbean descriptor
- * @throws Exception for any error
- */
- private Element parseXMBeanDescriptor(final ObjectName name, final Element mbeanElement) throws Exception
- {
- NodeList mbeans = mbeanElement.getElementsByTagName("xmbean");
- if (mbeans.getLength() == 0)
- throw new DeploymentException("No nested mbean element given for xmbean for " + name);
- return (Element) mbeans.item(0);
- }
-
- /**
- * Process a dependency
- *
- * @param mbeanName the surronding mbean
- * @param element the element
- * @param services the list of services
- * @param replace whether to replace properties
- * @return the dependent object name
- * @throws Exception for any error
- */
- private ObjectName processDependency(ObjectName mbeanName, Element element, List<ServiceMetaData> services, boolean replace) throws Exception
- {
- ObjectName dependsObjectName = null;
-
- NodeList nl = element.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node childNode = nl.item(i);
- if (childNode.getNodeType() == Node.ELEMENT_NODE)
- {
- Element child = (Element) childNode;
- if (child.getTagName().equals("mbean"))
- {
- dependsObjectName = internalParse(services, child, replace);
- break;
- }
- else
- throw new DeploymentException("Non mbean child element in depends tag for " + mbeanName);
- }
- }
-
- if (dependsObjectName == null)
- {
- String name = getElementTextContent(element, true, replace);
- try
- {
- dependsObjectName = new ObjectName(name);
- }
- catch (Throwable t)
- {
- throw new DeploymentException("Invalid object name '" + name + "' in depends tag for " + mbeanName, t);
- }
- }
-
- if (dependsObjectName == null)
- throw new DeploymentException("No object name found in depends tag for " + mbeanName);
-
- return dependsObjectName;
- }
-
- /**
- * Get an elements text content
- *
- * @param element the element
- * @return the concatentation of the text nodes
- * @throws Exception for any error
- */
- public static String getElementTextContent(Element element, boolean trim, boolean replace) throws Exception
- {
- NodeList nl = element.getChildNodes();
- String attributeText = "";
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
- if (n instanceof Text)
- {
- attributeText += ((Text) n).getData();
- }
- }
- if (trim)
- attributeText = attributeText.trim();
- if (replace)
- attributeText = StringPropertyReplacer.replaceProperties(attributeText);
- return attributeText;
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceMetaDataParser.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,132 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-
-import org.jboss.deployment.DeploymentException;
-import org.jboss.util.Classes;
-import org.jboss.util.propertyeditor.PropertyEditors;
-
-/**
- * ServiceTextValueMetaData.
- *
- * This class is based on the old ServiceConfigurator
- *
- * @author <a href="mailto:marc at jboss.org">Marc Fleury</a>
- * @author <a href="mailto:hiram at jboss.org">Hiram Chirino</a>
- * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ServiceTextValueMetaData implements ServiceValueMetaData
-{
- static
- {
- try
- {
- PropertyEditors.init();
- }
- catch (Exception ignored)
- {
- }
- }
-
- /** The text */
- private String text;
-
- /**
- * Create a new ServiceTextValueMetaData.
- *
- * @param text the text
- */
- public ServiceTextValueMetaData(String text)
- {
- setText(text);
- }
-
- /**
- * Get the text.
- *
- * @return the text.
- */
- public String getText()
- {
- return text;
- }
-
- /**
- * Set the text.
- *
- * @param text the text.
- */
- public void setText(String text)
- {
- if (text == null)
- throw new IllegalArgumentException("Null text");
- this.text = text;
- }
-
- public Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception
- {
- String typeName = attributeInfo.getType();
-
- // see if it is a primitive type first
- Class typeClass = Classes.getPrimitiveTypeForName(typeName);
- if (typeClass == null)
- {
- // nope try look up
- try
- {
- typeClass = cl.loadClass(typeName);
- }
- catch (ClassNotFoundException e)
- {
- throw new DeploymentException("Class not found for attribute: " + attributeInfo.getName(), e);
- }
- }
-
- PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
- if (editor == null)
- throw new DeploymentException("No property editor for attribute: " + attributeInfo.getName() + "; type=" + typeClass.getName());
-
- // JBAS-1709, temporarily switch the TCL so that property
- // editors have access to the actual deployment ClassLoader.
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(cl);
- try
- {
- editor.setAsText(text);
- return editor.getValue();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(tcl);
- }
- }
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceTextValueMetaData.java)
Deleted: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceValueMetaData.java
===================================================================
--- branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceValueMetaData.java 2006-08-04 16:52:38 UTC (rev 55207)
+++ branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceValueMetaData.java 2006-08-04 17:06:05 UTC (rev 55211)
@@ -1,47 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.system.metadata;
-
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanServer;
-
-/**
- * ServiceValueMetaData.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public interface ServiceValueMetaData
-{
- /**
- * Get the value
- *
- * @param server the mbean server
- * @param attributeInfo the mbean attribute info
- * @param cl the class loader
- * @param trim whether to trim
- * @param replace whether to replace
- * @return the value
- * @throws Exception for any error
- */
- Object getValue(MBeanServer server, MBeanAttributeInfo attributeInfo, ClassLoader cl, boolean trim, boolean replace) throws Exception;
-}
Copied: branches/MC_VDF_WORK/system-jmx/src/main/org/jboss/system/metadata/ServiceValueMetaData.java (from rev 55209, branches/MC_VDF_WORK/system/src/main/org/jboss/system/metadata/ServiceValueMetaData.java)
More information about the jboss-cvs-commits
mailing list