[jboss-cvs] JBossAS SVN: r88975 - in trunk: profileservice/src/main/org/jboss/profileservice and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 15 23:30:17 EDT 2009
Author: scott.stark at jboss.org
Date: 2009-05-15 23:30:17 -0400 (Fri, 15 May 2009)
New Revision: 88975
Added:
trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanManagedObjectFactory.java
trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java
trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyDeploymentInfo.java
trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyManagedDeploymentFactory.java
trunk/profileservice/src/main/org/jboss/profileservice/management/TempManagedComponentImpl.java
trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/
trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java
trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java
trunk/profileservice/src/main/org/jboss/profileservice/spi/
trunk/profileservice/src/main/org/jboss/profileservice/spi/MBeanDeploymentNameBuilder.java
trunk/profileservice/src/main/org/jboss/profileservice/spi/ManagedMBeanDeploymentFactory.java
Removed:
trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java
trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java
Modified:
trunk/component-matrix/pom.xml
trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
trunk/profileservice/src/main/org/jboss/profileservice/management/ManagedOperationProxyFactory.java
trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
trunk/profileservice/src/resources/profileservice-jboss-beans.xml
Log:
JBAS-6911, ManagementView api extensions
JBAS-6927, Update RuntimeComponentDispatcher
JBAS-6676, Support for exposing JMX bean as ManagedObject
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/component-matrix/pom.xml 2009-05-16 03:30:17 UTC (rev 88975)
@@ -73,7 +73,7 @@
<version.org.jboss.ejb3.proxy.clustered.client>1.0.1</version.org.jboss.ejb3.proxy.clustered.client>
<version.org.jboss.ejb3.security.client>1.0.0</version.org.jboss.ejb3.security.client>
<version.org.jboss.ejb3>1.1.5</version.org.jboss.ejb3>
- <version.org.jboss.integration>5.1.0.CR3</version.org.jboss.integration>
+ <version.org.jboss.integration>5.1.0.CR4</version.org.jboss.integration>
<version.org.jboss.jbossxb>2.0.0.GA</version.org.jboss.jbossxb>
<version.org.jboss.jpa>1.0.0</version.org.jboss.jpa>
<version.org.jboss.logbridge>1.0.0.CR3</version.org.jboss.logbridge>
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -21,6 +21,7 @@
*/
package org.jboss.profileservice.management;
+import org.jboss.deployers.spi.management.ContextStateMapper;
import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -26,9 +26,12 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.management.ContextStateMapper;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.registry.KernelBus;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.logging.Logger;
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedParameter;
import org.jboss.managed.api.ManagedProperty;
@@ -47,6 +50,9 @@
*/
public class KernelBusRuntimeComponentDispatcher extends AbstractRuntimeComponentDispatcher
{
+
+ private static final Logger log = Logger.getLogger(KernelBusRuntimeComponentDispatcher.class);
+
private KernelBus bus;
private Kernel kernel;
@@ -206,4 +212,23 @@
ControllerState state = context.getState();
return state.getStateString();
}
+
+ public <T extends Enum<?>> T mapControllerState(Object name, ContextStateMapper<T> mapper)
+ {
+ if(name == null)
+ throw new IllegalArgumentException("null name");
+ if(mapper == null)
+ throw new IllegalArgumentException("null mapper");
+
+ KernelController controller = kernel.getController();
+ ControllerContext context = controller.getContext(name, null);
+ if (context == null)
+ throw new IllegalStateException("Context not installed: " + name);
+
+ ControllerState requiredState = null;
+ // FIXME
+ if(context instanceof KernelRegistryEntry == false)
+ requiredState = context.getRequiredState();
+ return mapper.map(context.getState(), requiredState);
+ }
}
Added: trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanManagedObjectFactory.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanManagedObjectFactory.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanManagedObjectFactory.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,580 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.management;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.Descriptor;
+import javax.management.DescriptorAccess;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanFeatureInfo;
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.Fields;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedParameter;
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ActivationPolicy;
+import org.jboss.managed.api.annotation.DefaultValueBuilderFactory;
+import org.jboss.managed.api.annotation.FieldsFactory;
+import org.jboss.managed.api.annotation.ManagementConstants;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementPropertyFactory;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
+import org.jboss.managed.api.annotation.Masked;
+import org.jboss.managed.api.annotation.RunStateProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.managed.plugins.ManagedOperationImpl;
+import org.jboss.managed.plugins.ManagedParameterImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.jboss.metatype.api.annotations.MetaMappingFactory;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.MetaTypeFactory;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.spi.values.DefaultValueBuilder;
+import org.jboss.metatype.spi.values.MetaMapper;
+import org.jboss.metatype.spi.values.MetaMapperFactory;
+
+/**
+ * A type of ManagedObject factory that generates a ManagedObject from an MBean
+ * MBeanInfo.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class MBeanManagedObjectFactory
+{
+ private static Logger log = Logger.getLogger(MBeanManagedObjectFactory.class);
+ /** The meta type factory */
+ private MetaTypeFactory metaTypeFactory = MetaTypeFactory.getInstance();
+
+ public MetaTypeFactory getMetaTypeFactory()
+ {
+ return metaTypeFactory;
+ }
+ public void setMetaTypeFactory(MetaTypeFactory metaTypeFactory)
+ {
+ this.metaTypeFactory = metaTypeFactory;
+ }
+
+ /**
+ * Builds a ManagedObject from the MBeanInfo.
+ * TODO: none of the org.jboss.managed.api.annotation.* annotations are
+ * taken from the MBeanInfo. The descriptor feature could be used for this.
+ *
+ * @param mbean
+ * @param info
+ * @param mbeanLoader
+ * @param metaData
+ * @return
+ * @throws Exception
+ */
+
+ public ManagedObject getManagedObject(ObjectName mbean, MBeanInfo info,
+ ClassLoader mbeanLoader, MetaData metaData)
+ throws Exception
+ {
+ return getManagedObject(mbean, info, mbeanLoader, metaData, null);
+ }
+
+ // FIXME - Hack until metadata mechanism is provided
+ public ManagedObject getManagedObject(ObjectName mbean, MBeanInfo info,
+ ClassLoader mbeanLoader, MetaData metaData, ViewUse[] defaultViewUse)
+ throws Exception
+ {
+ boolean trace = log.isTraceEnabled();
+
+ // Process the ManagementObject fields
+ boolean isRuntime = false;
+ String name = mbean.getCanonicalName();
+ String nameType = null;
+ String attachmentName = null;
+ Class<? extends Fields> moFieldsFactory = null;
+ Class<? extends ManagedProperty> moPropertyFactory = null;
+
+ // Build the ManagedProperties
+ Set<ManagedProperty> properties = new HashSet<ManagedProperty>();
+
+ MBeanAttributeInfo[] attributes = info.getAttributes();
+ for(MBeanAttributeInfo propertyInfo : attributes)
+ {
+
+ ManagementProperty managementProperty = getAnnotation(ManagementProperty.class, propertyInfo, metaData);
+ ManagementObjectID id = getAnnotation(ManagementObjectID.class, propertyInfo, metaData);
+ ManagementObjectRef ref = getAnnotation(ManagementObjectRef.class, propertyInfo, metaData);
+ ManagementRuntimeRef runtimeRef = getAnnotation(ManagementRuntimeRef.class, propertyInfo, metaData);
+ RunStateProperty rsp = getAnnotation(RunStateProperty.class, propertyInfo, metaData);
+ Masked masked = getAnnotation(Masked.class, propertyInfo, metaData);
+ DefaultValueBuilderFactory defaultsFactory = getAnnotation(DefaultValueBuilderFactory.class, propertyInfo, metaData);
+ HashMap<String, Annotation> propAnnotations = new HashMap<String, Annotation>();
+ if (managementProperty != null)
+ propAnnotations.put(ManagementProperty.class.getName(), managementProperty);
+ if (id != null)
+ {
+ propAnnotations.put(ManagementObjectID.class.getName(), id);
+ // This overrides the MO nameType
+ nameType = id.type();
+ }
+ if (ref != null)
+ propAnnotations.put(ManagementObjectRef.class.getName(), ref);
+ if (runtimeRef != null)
+ propAnnotations.put(ManagementRuntimeRef.class.getName(), runtimeRef);
+ if (rsp != null)
+ propAnnotations.put(RunStateProperty.class.getName(), rsp);
+ if (masked != null)
+ propAnnotations.put(Masked.class.getName(), masked);
+
+ // Check whether this property should be included
+ boolean includeProperty = propertyInfo.isReadable() | propertyInfo.isWritable();
+
+ if (includeProperty)
+ {
+ Fields fields = null;
+ Class<? extends Fields> factory = moFieldsFactory;
+ FieldsFactory ff = getAnnotation(FieldsFactory.class, propertyInfo, metaData);
+ if(ff != null)
+ factory = ff.value();
+ if (factory != null)
+ {
+ try
+ {
+ fields = factory.newInstance();
+ }
+ catch (Exception e)
+ {
+ log.debug("Failed to created Fields", e);
+ }
+ }
+ if (fields == null)
+ fields = new DefaultFieldsImpl();
+
+ if( propertyInfo instanceof Serializable )
+ {
+ Serializable pinfo = Serializable.class.cast(propertyInfo);
+ fields.setField(Fields.PROPERTY_INFO, pinfo);
+ }
+
+ String propertyName = propertyInfo.getName();
+ if (managementProperty != null)
+ propertyName = managementProperty.name();
+ if( propertyName.length() == 0 )
+ propertyName = propertyInfo.getName();
+ fields.setField(Fields.NAME, propertyName);
+
+ // This should probably always the the propertyInfo name?
+ String mappedName = propertyInfo.getName();
+ if (managementProperty != null)
+ mappedName = managementProperty.mappedName();
+ if( mappedName.length() == 0 )
+ mappedName = propertyInfo.getName();
+ fields.setField(Fields.MAPPED_NAME, mappedName);
+
+ String description = ManagementConstants.GENERATED;
+ if (managementProperty != null)
+ description = managementProperty.description();
+ if (description.equals(ManagementConstants.GENERATED))
+ description = propertyName;
+ fields.setField(Fields.DESCRIPTION, description);
+
+ if (trace)
+ {
+ log.trace("Building MangedProperty(name="+propertyName
+ +",mappedName="+mappedName
+ +") ,annotations="+propAnnotations);
+ }
+
+ boolean mandatory = false;
+ if (managementProperty != null)
+ mandatory = managementProperty.mandatory();
+ if (mandatory)
+ fields.setField(Fields.MANDATORY, Boolean.TRUE);
+
+ boolean readOnly = propertyInfo.isWritable() == false;
+ if (readOnly == false && managementProperty != null)
+ readOnly = managementProperty.readOnly();
+ if (readOnly)
+ fields.setField(Fields.READ_ONLY, Boolean.TRUE);
+
+ boolean managed = false;
+ if (managementProperty != null)
+ managed = managementProperty.managed();
+ // View Use
+ if (managementProperty != null)
+ {
+ ViewUse[] use = managementProperty.use();
+ fields.setField(Fields.VIEW_USE, use);
+ }
+ else if (defaultViewUse != null)
+ {
+ fields.setField(Fields.VIEW_USE, defaultViewUse);
+ }
+ // ActivationPolicy
+ ActivationPolicy apolicy = ActivationPolicy.IMMEDIATE;
+ if (managementProperty != null)
+ {
+ apolicy = managementProperty.activationPolicy();
+ }
+ fields.setField(Fields.ACTIVATION_POLICY, apolicy);
+ // The managed property type
+ MetaMapper[] mapperReturn = {null};
+ String propertyType = propertyInfo.getType();
+ MetaType metaType = null;
+ Class<?> type = null;
+ try
+ {
+ type = loadTypeClass(propertyType, mbeanLoader);
+ metaType = this.getMetaType(propertyInfo, type, metaData, false, mapperReturn);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create ManagedProperty on failure to load type:"+propertyType+", for property: "+propertyInfo.getName());
+ continue;
+ }
+
+ // Determine meta type based on property type
+ if(metaType == null)
+ {
+ if (managed)
+ {
+ if(type.isArray())
+ metaType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+ else if (Collection.class.isAssignableFrom(type))
+ metaType = new CollectionMetaType(type.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+ else
+ metaType = AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE;
+ }
+ else
+ {
+ metaType = metaTypeFactory.resolve(type);
+ }
+ }
+ fields.setField(Fields.META_TYPE, metaType);
+
+ // Default value
+ if(managementProperty != null)
+ {
+ String defaultValue = managementProperty.defaultValue();
+ if(defaultValue.length() > 0)
+ {
+ try
+ {
+ // Check for a DefaultValueBuilderFactory
+ DefaultValueBuilder builder = null;
+ if(defaultsFactory != null)
+ {
+ Class<? extends DefaultValueBuilder> factoryClass = defaultsFactory.value();
+ builder = factoryClass.newInstance();
+ }
+ if(builder != null)
+ {
+ MetaValue defaultMV = builder.buildMetaValue(defaultValue);
+ if(defaultMV != null)
+ fields.setField(Fields.DEFAULT_VALUE, defaultMV);
+ }
+ else
+ {
+ log.warn("Failed to find DefaultValueBuilder for type: "+metaType);
+ }
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to create default value for: "+propertyInfo, e);
+ }
+ }
+ }
+
+ // Property annotations
+ if (propAnnotations.isEmpty() == false)
+ fields.setField(Fields.ANNOTATIONS, propAnnotations);
+
+ ManagedProperty property = null;
+ Class<? extends ManagedProperty> mpClass = moPropertyFactory;
+ ManagementPropertyFactory mpf = getAnnotation(ManagementPropertyFactory.class, propertyInfo, metaData);
+ if (mpf != null)
+ mpClass = mpf.value();
+ if (mpClass != null)
+ property = AbstractManagedObjectFactory.createManagedProperty(mpClass, fields);
+ if (property == null)
+ property = new ManagedPropertyImpl(fields);
+ // Pass the MetaMapper as an attachment
+ if (mapperReturn[0] != null)
+ property.setTransientAttachment(MetaMapper.class.getName(), mapperReturn[0]);
+ properties.add(property);
+ }
+ else if (trace)
+ log.trace("Ignoring property: " + propertyInfo);
+ }
+
+ /* TODO: Operations. In general the bean metadata does not contain
+ operation information.
+ */
+ Set<ManagedOperation> operations = new HashSet<ManagedOperation>();
+
+ MBeanOperationInfo[] methodInfos = info.getOperations();
+ if (methodInfos != null && methodInfos.length > 0)
+ {
+ for (MBeanOperationInfo methodInfo : methodInfos)
+ {
+ ManagementOperation managementOp = getAnnotation(ManagementOperation.class, methodInfo, metaData);
+ if (managementOp == null)
+ continue;
+
+ try
+ {
+ ManagedOperation op = getManagedOperation(methodInfo, managementOp, mbeanLoader, metaData);
+ operations.add(op);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create ManagedOperation for: "+methodInfo.getName(), e);
+ }
+ }
+ }
+
+ ManagedObjectImpl result = new ManagedObjectImpl(mbean.getCanonicalName(), properties);
+ // TODO
+ Map<String, Annotation> empty = Collections.emptyMap();
+ result.setAnnotations(empty);
+ // Set the component name to name if this is a runtime MO with a name specified
+ result.setComponentName(name);
+ if (nameType != null)
+ result.setNameType(nameType);
+ if (attachmentName != null)
+ result.setAttachmentName(attachmentName);
+ if (operations.size() > 0 )
+ result.setOperations(operations);
+ for (ManagedProperty property : properties)
+ property.setManagedObject(result);
+ result.setTransientAttachment(MBeanInfo.class.getName(), info);
+
+ // Marker for associating the correct dispatcher
+ result.setTransientAttachment(MBeanRuntimeComponentDispatcher.class.getName(), true);
+ return result;
+ }
+
+ protected <X extends Annotation> X getAnnotation(Class<X> annotationType,
+ MBeanFeatureInfo info, MetaData metaData)
+ {
+ X annotation = null;
+ if(metaData != null)
+ {
+ annotation = metaData.getAnnotation(annotationType);
+ if(annotation == null && info instanceof DescriptorAccess)
+ {
+ DescriptorAccess daccess = (DescriptorAccess) info;
+ Descriptor descriptor = daccess.getDescriptor();
+ annotation = getAnnotation(annotationType, descriptor);
+ }
+ }
+ return annotation;
+ }
+ protected <X extends Annotation> X getAnnotation(Class<X> annotationType,
+ Descriptor descriptor)
+ {
+ // TODO...
+ return null;
+ }
+
+ /**
+ * Get the MetaType for info by looking for MetaMapping/MetaMappingFactory
+ * annotations in addition to the info type.
+ *
+ * @param methodInfo
+ * @param metaData
+ * @return the MetaType for info's type
+ */
+ protected MetaType getMetaType(MBeanFeatureInfo info, Type infoType, MetaData metaData,
+ boolean useTypeFactory, MetaMapper[] mapperReturn)
+ {
+ MetaType returnType = null;
+ // First look for meta mappings
+ MetaMapper<?> metaMapper = null;
+ MetaMapping metaMapping = getAnnotation(MetaMapping.class, info, metaData);
+ MetaMappingFactory metaMappingFactory = getAnnotation(MetaMappingFactory.class, info, metaData);
+ if(metaMappingFactory != null)
+ {
+ Class<? extends MetaMapperFactory<?>> mmfClass = metaMappingFactory.value();
+ try
+ {
+ MetaMapperFactory<?> mmf = mmfClass.newInstance();
+ String[] args = metaMappingFactory.args();
+ if(args.length > 0)
+ metaMapper = mmf.newInstance(args);
+ else
+ metaMapper = mmf.newInstance();
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create MetaMapperFactory: "+metaMappingFactory, e);
+ }
+ }
+ if(metaMapping != null)
+ {
+ // Use the mapping for the type
+ Class<? extends MetaMapper<?>> mapperClass = metaMapping.value();
+ try
+ {
+ metaMapper = mapperClass.newInstance();
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to create MetaMapper: "+metaMapping, e);
+ }
+ }
+ if(metaMapper != null)
+ {
+ returnType = metaMapper.getMetaType();
+ // Return the MetaMapper
+ if(mapperReturn != null && mapperReturn.length > 0)
+ mapperReturn[0] = metaMapper;
+ }
+
+ if(returnType == null && useTypeFactory)
+ {
+ // Use the type factory to convert the info type
+ returnType = metaTypeFactory.resolve(infoType);
+ }
+ return returnType;
+ }
+
+ protected ManagedOperation getManagedOperation(MBeanOperationInfo methodInfo,
+ ManagementOperation opAnnotation, ClassLoader mbeanLoader, MetaData metaData)
+ throws Exception
+ {
+ String name = methodInfo.getName();
+ String description = opAnnotation.description();
+ Impact impact = Impact.Unknown;
+ switch(methodInfo.getImpact())
+ {
+ case MBeanOperationInfo.ACTION:
+ impact = Impact.WriteOnly;
+ break;
+ case MBeanOperationInfo.ACTION_INFO:
+ impact = Impact.ReadWrite;
+ break;
+ case MBeanOperationInfo.INFO:
+ impact = Impact.ReadOnly;
+ break;
+ case MBeanOperationInfo.UNKNOWN:
+ impact = Impact.Unknown;
+ break;
+ }
+ // The op return type
+ MetaMapper[] returnTypeMapper = {null};
+ Class<?> returnTypeClass = loadTypeClass(methodInfo.getReturnType(), mbeanLoader);
+ MetaType returnType = getMetaType(methodInfo, returnTypeClass, metaData, true, returnTypeMapper);
+
+ // Process the op parameters
+ ArrayList<ManagedParameter> mparams = new ArrayList<ManagedParameter>();
+ MBeanParameterInfo[] paramInfo = methodInfo.getSignature();
+ if( paramInfo != null )
+ {
+ for(int i = 0; i < paramInfo.length; i ++)
+ {
+ MBeanParameterInfo pinfo = paramInfo[i];
+ String pname = pinfo.getName();
+ String pdescription = pinfo.getDescription();
+
+ // Generate a name if there is none
+ if (pname == null)
+ pname = "arg#" + i;
+ Fields fields = new DefaultFieldsImpl(pname);
+ if (pdescription != null)
+ fields.setField(Fields.DESCRIPTION, pdescription);
+ MetaMapper[] paramMapper = {null};
+ Class<?> paramType = loadTypeClass(pinfo.getType(), mbeanLoader);
+ MetaType metaType = getMetaType(pinfo, paramType, metaData, true, paramMapper);
+ fields.setField(Fields.META_TYPE, metaType);
+
+
+ ManagedParameterImpl mp = new ManagedParameterImpl(fields);
+ if(paramMapper[0] != null)
+ mp.setTransientAttachment(MetaMapper.class.getName(), paramMapper[0]);
+ mparams.add(mp);
+ }
+ }
+ ManagedParameter[] parameters = new ManagedParameter[mparams.size()];
+ mparams.toArray(parameters);
+
+ ManagedOperationImpl op = new ManagedOperationImpl(name, description, impact, parameters, returnType);
+ if(returnTypeMapper[0] != null)
+ op.setTransientAttachment(MetaMapper.class.getName(), returnTypeMapper[0]);
+ return op;
+ }
+
+ protected Class<?> loadTypeClass(String propertyType, ClassLoader loader)
+ throws ClassNotFoundException
+ {
+ Class<?> type = null;
+ // Check for a primitive type
+ if(propertyType.equals("byte"))
+ type = byte.class;
+ else if(propertyType.equals("char"))
+ type = char.class;
+ else if(propertyType.equals("short"))
+ type = short.class;
+ else if(propertyType.equals("int"))
+ type = int.class;
+ else if(propertyType.equals("long"))
+ type = long.class;
+ else if(propertyType.equals("float"))
+ type = float.class;
+ else if(propertyType.equals("double"))
+ type = double.class;
+ else if(propertyType.equals("void"))
+ type = void.class;
+ else if(propertyType.equals("boolean"))
+ type = boolean.class;
+
+ else
+ {
+ type = loader.loadClass(propertyType);
+ }
+ return type;
+
+ }
+}
Property changes on: trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanManagedObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.profileservice.management;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Arrays;
+
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.management.ContextStateMapper;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedParameter;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.EnumValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.spi.values.MetaMapper;
+import org.jboss.profileservice.spi.types.ControllerStateMetaType;
+
+/**
+ * MBean runtime component dispatcher.
+ *
+ * @author Jason T. Greene
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author Scott.Stark at jboss.org
+ */
+public class MBeanRuntimeComponentDispatcher extends AbstractRuntimeComponentDispatcher
+{
+ private final MBeanServer mbeanServer;
+
+ public MBeanRuntimeComponentDispatcher(MBeanServer mbeanServer)
+ {
+ this(mbeanServer, null);
+ }
+
+ public MBeanRuntimeComponentDispatcher(MBeanServer mbeanServer, MetaValueFactory valueFactory)
+ {
+ super(valueFactory);
+ if (mbeanServer == null)
+ throw new IllegalArgumentException("Null MBean Server");
+
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void start()
+ {
+ }
+
+ public MetaValue get(Object componentName, String propertyName)
+ {
+ ManagedProperty prop = AbstractRuntimeComponentDispatcher.getActiveProperty();
+
+ if(propertyName.equals("state") && prop.getMetaType().equals(ControllerStateMetaType.TYPE))
+ {
+ String stateString = getState(componentName);
+ EnumValueSupport state = new EnumValueSupport(ControllerStateMetaType.TYPE, stateString);
+ return state;
+ }
+
+ try
+ {
+ Object value = mbeanServer.getAttribute(new ObjectName(componentName.toString()), propertyName);
+ MetaValue mvalue = null;
+ if(value != null)
+ {
+ if(prop != null)
+ {
+ MetaMapper mapper = prop.getTransientAttachment(MetaMapper.class);
+ if(mapper != null)
+ mvalue = mapper.createMetaValue(prop.getMetaType(), value);
+ else
+ mvalue = create(value);
+ }
+ else
+ {
+ mvalue = create(value);
+ }
+ }
+ return mvalue;
+ }
+ catch (Throwable t)
+ {
+ throw new UndeclaredThrowableException(t, "Failed to get property '" + propertyName + "' on component '" + componentName + "'.");
+ }
+ }
+
+ public void set(Object componentName, String propertyName, MetaValue value)
+ {
+ try
+ {
+ ManagedProperty prop = AbstractRuntimeComponentDispatcher.getActiveProperty();
+ Object uvalue = null;
+ if(prop != null)
+ {
+ MetaMapper mapper = prop.getTransientAttachment(MetaMapper.class);
+ if(mapper != null)
+ uvalue = mapper.unwrapMetaValue(value);
+ else
+ uvalue = unwrap(value);
+ }
+ else
+ {
+ uvalue = unwrap(value);
+ }
+
+ mbeanServer.setAttribute(new ObjectName(componentName.toString()), new Attribute(propertyName, uvalue));
+ }
+ catch (Throwable t)
+ {
+ throw new UndeclaredThrowableException(t, "Failed to set property '" + propertyName + "' on component '" + componentName + "' to value [" + value + "].");
+ }
+ }
+
+ public Object invoke(Object componentName, String methodName, MetaValue... param)
+ {
+ try
+ {
+ ManagedOperation op = AbstractRuntimeComponentDispatcher.getActiveOperation();
+ String[] sig = new String[param.length];
+ Object[] args = new Object[param.length];
+ if(op != null)
+ {
+ ManagedParameter[] params = op.getParameters();
+ if(params != null && params.length == param.length)
+ {
+ for(int i=0; i < param.length; i++)
+ {
+ ManagedParameter mp = params[i];
+ MetaMapper<?> mapper = mp.getTransientAttachment(MetaMapper.class);
+ if(mapper != null)
+ args[i] = mapper.unwrapMetaValue(param[i]);
+ else
+ args[i] = unwrap(param[i]);
+ //
+ sig[i] = mp.getMetaType().getTypeName();
+ }
+ }
+ else
+ {
+ args = toArguments(param);
+ sig = toSignature(param);
+ }
+ }
+ else
+ {
+ args = toArguments(param);
+ sig = toSignature(param);
+ }
+ // Invoke
+ Object value = mbeanServer.invoke(new ObjectName(componentName.toString()), methodName, args, sig);
+ MetaValue mvalue = null;
+ if (value != null)
+ {
+ // Look for a return type MetaMapper
+ MetaMapper returnTypeMapper = op.getTransientAttachment(MetaMapper.class);
+ if (returnTypeMapper != null)
+ mvalue = returnTypeMapper.createMetaValue(op.getReturnType(), value);
+ else
+ mvalue = create(value);
+ }
+ return mvalue;
+ }
+ catch (Throwable t)
+ {
+ throw new UndeclaredThrowableException(t, "Failed to invoke method '" + methodName + "' on component '" + componentName + "' with parameters " + Arrays.asList(param) + ".");
+ }
+ }
+
+ public String getState(Object name)
+ {
+ try
+ {
+ if (mbeanServer.isRegistered(new ObjectName(name.toString())))
+ return ControllerState.INSTALLED.getStateString();
+ }
+ catch (Exception e)
+ {
+ // Failure = Not installed
+ }
+
+ return ControllerState.NOT_INSTALLED.getStateString();
+ }
+
+ public <T extends Enum<?>> T mapControllerState(Object name, ContextStateMapper<T> mapper)
+ {
+ if(name == null)
+ throw new IllegalArgumentException("null name");
+ if(mapper == null)
+ throw new IllegalArgumentException("null mapper");
+
+ ControllerState current = ControllerState.NOT_INSTALLED;
+
+ try
+ {
+ if (mbeanServer.isRegistered(new ObjectName(name.toString())))
+ current = ControllerState.INSTALLED;
+ }
+ catch (Exception e)
+ {
+ // Failure = Not installed
+ }
+
+ return mapper.map(current, ControllerState.INSTALLED);
+ }
+}
Property changes on: trunk/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagedOperationProxyFactory.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagedOperationProxyFactory.java 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagedOperationProxyFactory.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -18,7 +18,7 @@
* 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.profileservice.management;
import java.io.Serializable;
@@ -44,8 +44,8 @@
/**
* A factory for generating managed operations and properties delegating
- * request to a RuntimeComponentDispatcher proxy.
- *
+ * request to a RuntimeComponentDispatcher proxy.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
@@ -62,7 +62,19 @@
/** The runtime component dispatcher proxy. */
private DelegatingComponentDispatcher dispatcherProxy;
-
+
+ private String dispatchName;
+
+ public String getDispatchName()
+ {
+ return dispatchName;
+ }
+
+ public void setDispatchName(String dispatchName)
+ {
+ this.dispatchName = dispatchName;
+ }
+
public RuntimeComponentDispatcher getDispatcher()
{
return dispatcher;
@@ -71,12 +83,12 @@
{
this.dispatcher = dispatcher;
}
-
+
public InvokerLocator getLocator()
{
return locator;
}
-
+
public void setLocator(InvokerLocator locator)
{
this.locator = locator;
@@ -86,23 +98,23 @@
{
return dispatcherProxy;
}
-
+
public void start() throws Exception
{
if(this.dispatcher == null)
throw new IllegalStateException("Null dispatcher.");
if(this.locator == null)
throw new IllegalStateException("Null locator.");
-
+
this.dispatcherProxy = createDispatcherProxy();
}
-
+
public synchronized void clear()
{
this.properties.clear();
this.operations.clear();
}
-
+
public ManagedOperation getManagedOperation(Long opID)
{
ManagedOperation op = this.operations.get(opID);
@@ -110,7 +122,7 @@
throw new IllegalStateException("operation not found for id " + opID);
return op;
}
-
+
public ManagedProperty getManagedProperty(Long propID)
{
ManagedProperty prop = this.properties.get(propID);
@@ -122,7 +134,7 @@
/**
* Create a delegating managed property. This is used for ViewUse.STATISTIC properties,
* delegating the getValue() request to the dispatcher proxy.
- *
+ *
* @param delegate the original property
* @param componentName the component name
* @return the delegate managed property
@@ -138,7 +150,7 @@
/**
* Create managed operations for runtime components, where the invoke() can
* be invoked on the client side.
- *
+ *
* @param ops the managed operations
* @param componentName the component name
* @return a set of runtime operations
@@ -167,10 +179,10 @@
}
return opProxies;
}
-
+
/**
* Create a remoting DelegatingComponentDispatcher proxy.
- *
+ *
* @return the proxy
* @throws Exception
*/
@@ -181,11 +193,12 @@
interceptors.add(SecurityClientInterceptor.singleton);
interceptors.add(MergeMetaDataInterceptor.singleton);
interceptors.add(InvokeRemoteInterceptor.singleton);
-
- String dispatchName = "ProfileService.DelegatingComponentDispatcher";
+
Class<?>[] ifaces = {DelegatingComponentDispatcher.class};
-
+
DelegatingComponentDispatcher delegate = new DelegatingComponentDispatcherImpl(this, this.dispatcher);
+
+ String dispatchName = "ProfileService-" + this.dispatchName;
Dispatcher.singleton.registerTarget(dispatchName, delegate);
return (DelegatingComponentDispatcher) Remoting.createRemoteProxy(dispatchName,
getClass().getClassLoader(), ifaces, locator, interceptors, "ProfileService");
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -22,6 +22,7 @@
package org.jboss.profileservice.management;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -37,9 +38,15 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.management.ContextStateMapper;
import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.NameMatcher;
import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
@@ -61,6 +68,7 @@
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementOperation;
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.jboss.managed.api.annotation.ViewUse;
@@ -69,6 +77,7 @@
import org.jboss.managed.plugins.ManagedDeploymentImpl;
import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
import org.jboss.managed.plugins.jmx.ManagementFactoryUtils;
+import org.jboss.metadata.spi.MetaData;
import org.jboss.metatype.api.types.ArrayMetaType;
import org.jboss.metatype.api.types.CollectionMetaType;
import org.jboss.metatype.api.types.MetaType;
@@ -78,13 +87,17 @@
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.profileservice.spi.ManagedMBeanDeploymentFactory;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileDeployment;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.ManagedMBeanDeploymentFactory.MBeanComponent;
+import org.jboss.profileservice.spi.ManagedMBeanDeploymentFactory.MBeanDeployment;
import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+import org.jboss.system.server.profileservice.repository.AbstractProfileDeployment;
/**
* The default ManagementView implementation.
@@ -142,43 +155,64 @@
private List<String> rootDeployments = new ArrayList<String>();
/** The state mappings. */
- private Map<String, String> stateMappings = new HashMap<String, String>();
- private Map<String, String> deploymentStateMappings = new HashMap<String, String>();
+ private static final ContextStateMapper<RunState> runStateMapper;
+ private static final ContextStateMapper<DeploymentState> deploymentStateMapper;
/** The dispatcher handles ManagedOperation dispatches */
private RuntimeComponentDispatcher dispatcher;
/** The managed operation proxy factory. */
private ManagedOperationProxyFactory proxyFactory;
+ /** A proxy for pure JMX dispatch */
+ private ManagedOperationProxyFactory mbeanProxyFactory;
/** . */
private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
/** ManagedObjectFactory used for platform mbean ManagedObjects */
ManagedObjectFactory managedObjFactory = ManagedObjectFactory.getInstance();
-
-
-
+
+ /** A map of ManagedMBeanDeploymentFactory for proxying mbeans into the management layer */
+ private HashMap<String, ManagedMBeanDeploymentFactory> mdfs =
+ new HashMap<String, ManagedMBeanDeploymentFactory>();
+
+ /** The JMX Kernel for non MC managed JMXobjects */
+ private MBeanServer mbeanServer;
+
+ /** An MO Factory using MBeanInfo */
+ private MBeanManagedObjectFactory mbeanMOFactory = new MBeanManagedObjectFactory();
+
+ static
+ {
+ // Set default run state mappings for mc beans/mbeans
+ Map<String, RunState> runStateMappings = new HashMap<String, RunState>();
+ runStateMappings.put("**ERROR**", RunState.FAILED);
+ runStateMappings.put("Not Installed", RunState.STOPPED);
+ runStateMappings.put("PreInstall", RunState.STOPPED);
+ runStateMappings.put("Described", RunState.STOPPED);
+ runStateMappings.put("Instantiated", RunState.STOPPED);
+ runStateMappings.put("Configured", RunState.STOPPED);
+ runStateMappings.put("Create", RunState.STOPPED);
+ runStateMappings.put("Start", RunState.STOPPED);
+ runStateMappings.put("Installed", RunState.RUNNING);
+
+ runStateMapper = new ContextStateMapper<RunState>(runStateMappings,
+ RunState.STARTING, RunState.STOPPED, RunState.FAILED, RunState.UNKNOWN);
+
+ Map<String, DeploymentState> deploymentMappings = new HashMap<String, DeploymentState>();
+ deploymentMappings.put("**ERROR**", DeploymentState.FAILED);
+ deploymentMappings.put("Not Installed", DeploymentState.STOPPED);
+ deploymentMappings.put("Installed", DeploymentState.STARTED);
+
+ deploymentStateMapper = new ContextStateMapper<DeploymentState>(deploymentMappings,
+ DeploymentState.STARTING, DeploymentState.STOPPING, DeploymentState.FAILED, DeploymentState.UNKNOWN);
+ }
+
public ManagementViewImpl() throws IOException
{
-
currentLocale = Locale.getDefault();
formatter.setLocale(currentLocale);
i18n = ResourceBundle.getBundle(BUNDLE_NAME, currentLocale);
- // Set default run state mappings for mc beans/mbeans
- stateMappings.put("**ERROR**", RunState.FAILED.name());
- stateMappings.put("Not Installed", RunState.STOPPED.name());
- stateMappings.put("PreInstall", RunState.STARTING.name());
- stateMappings.put("Described", RunState.STARTING.name());
- stateMappings.put("Instantiated", RunState.STARTING.name());
- stateMappings.put("Configured", RunState.STARTING.name());
- stateMappings.put("Create", RunState.STARTING.name());
- stateMappings.put("Start", RunState.STARTING.name());
- stateMappings.put("Installed", RunState.RUNNING.name());
- // Set default deployment state mappings for managed deployments
- deploymentStateMappings.put("**ERROR**", DeploymentState.FAILED.name());
- deploymentStateMappings.put("Not Installed", DeploymentState.STOPPED.name());
- deploymentStateMappings.put("Installed", DeploymentState.STARTED.name());
}
-
+
public void start() throws Exception
{
// nothing
@@ -213,7 +247,54 @@
// load the profiles
loadProfiles(trace);
-
+
+ // Process mbean components that need to be exposed as ManagedDeployment/ManagedComponent
+ for(ManagedMBeanDeploymentFactory mdf : mdfs.values())
+ {
+ log.debug("Processing deployments for factory: "+mdf.getFactoryName());
+ Collection<MBeanDeployment> deployments = mdf.getDeployments(mbeanServer);
+ for(MBeanDeployment md : deployments)
+ {
+ log.debug("Saw MBeanDeployment: "+md);
+ HashMap<String, ManagedObject> unitMOs = new HashMap<String, ManagedObject>();
+ Collection<MBeanComponent> components = md.getComponents();
+ if(components != null)
+ {
+ for(MBeanComponent comp : components)
+ {
+ log.debug("Saw MBeanComponent: "+comp);
+ try
+ {
+ ManagedObject mo = createManagedObject(comp.getName(), mdf.getDefaultViewUse());
+
+ String name = comp.getName().getCanonicalName();
+ ManagementObject moAnn = createMOAnnotation(name, comp.getType(), comp.getSubtype());
+
+ // Both the ManagementObject and ManagementComponent annotation need to be in the MO annotations
+ mo.getAnnotations().put(ManagementObject.class.getName(), moAnn);
+ ManagementComponent mcAnn = moAnn.componentType();
+ mo.getAnnotations().put(ManagementComponent.class.getName(), mcAnn);
+ unitMOs.put(name, mo);
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to create ManagedObject for: "+comp, e);
+ }
+ }
+ }
+ ManagedDeploymentImpl mdi = new ManagedDeploymentImpl(md.getName(), md.getName(), null, unitMOs);
+ mdi.setTypes(Collections.singleton("external-mbean"));
+ try
+ {
+ processManagedDeployment(mdi, null, DeploymentState.STARTED, 0, trace);
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to process ManagedDeployment for: " + md.getName(), e);
+ }
+ }
+ }
+
// Process the bootstrap deployments
for(ManagedDeployment md : bootstrapManagedDeployments.values())
{
@@ -543,7 +624,7 @@
if (mc != null && md.getComponent(mo.getName()) == null)
{
ComponentType type = new ComponentType(mc.type(), mc.subtype());
- ManagedComponentImpl comp = new ManagedComponentImpl(type, md, mo);
+ ManagedComponentImpl comp = new TempManagedComponentImpl(type, md, mo);
md.addComponent(mo.getName(), comp);
log.debug("Processing ManagementComponent("+mo.getName()+"): "+comp);
Set<ManagedComponent> typeComps = compByCompType.get(type);
@@ -553,7 +634,7 @@
compByCompType.put(type, typeComps);
}
typeComps.add(comp);
- RunState state = updateRunState(null, comp);
+ RunState state = updateRunState(mo, comp);
}
// Scan for @ManagementObjectRef
@@ -673,9 +754,7 @@
name = runtimeMO.getComponentName();
if (name != null)
{
- String stateString = getControllerState(name);
- String runStateString = stateMappings.get(stateString);
- state = RunState.valueOf(runStateString);
+ state = getComponentMappedState(comp, runtimeMO, name, runStateMapper);
if (comp instanceof MutableManagedComponent)
{
MutableManagedComponent mcomp = MutableManagedComponent.class.cast(comp);
@@ -694,23 +773,52 @@
Object name = md.getName();
if(name != null)
{
- String stateString = getControllerState(name);
- String deploymenStateString = deploymentStateMappings.get(stateString);
- state = DeploymentState.valueOf(deploymenStateString);
+ state = getMappedState(name, deploymentStateMapper);
}
}
return state;
}
+ protected <T extends Enum<?>> T getMappedState(Object name, ContextStateMapper<T> mapper)
+ {
+ T state = mapper.getErrorState();
+ try
+ {
+ if(dispatcher != null)
+ {
+ state = dispatcher.mapControllerState(name, mapper);
+ }
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to get controller state", e);
+ }
+ return state;
+ }
- protected String getControllerState(Object name)
+ protected <T extends Enum<?>> T getComponentMappedState(ManagedComponent comp, ManagedObject mo, Object name, ContextStateMapper<T> mapper)
{
- String state = null;
- if(dispatcher != null)
+ T state = mapper.getErrorState();
+ try
{
- //TODO, update RuntimeComponentDispatcher
- AbstractRuntimeComponentDispatcher xdispatcher = (AbstractRuntimeComponentDispatcher) dispatcher;
- state = xdispatcher.getState(name);
+ RuntimeComponentDispatcher dispatcher;
+ if (mo != null && mo.getTransientAttachment(MBeanRuntimeComponentDispatcher.class.getName()) != null)
+ {
+ dispatcher = mbeanProxyFactory.getDispatcher();
+ }
+ else
+ {
+ dispatcher = this.dispatcher;
+ }
+
+ if (dispatcher != null)
+ {
+ state = dispatcher.mapControllerState(name, mapper);
+ }
}
+ catch(Exception e)
+ {
+ log.debug("Failed to get controller state", e);
+ }
return state;
}
@@ -814,6 +922,28 @@
this.dispatcher = dispatcher;
}
+
+ public MBeanServer getMbeanServer()
+ {
+ return mbeanServer;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+
+ public MBeanManagedObjectFactory getMbeanMOFactory()
+ {
+ return mbeanMOFactory;
+ }
+
+ public void setMbeanMOFactory(MBeanManagedObjectFactory mbeanMOFactory)
+ {
+ this.mbeanMOFactory = mbeanMOFactory;
+ }
+
/**
* Get the names of the deployment in the profile.
*/
@@ -894,6 +1024,19 @@
return new HashSet<String>(templates.keySet());
}
+ public void addManagedMBeanDeployments(ManagedMBeanDeploymentFactory factory)
+ {
+ log.info("addManagedDeployment, "+factory);
+ String name = factory.getFactoryName();
+ this.mdfs.put(name, factory);
+ }
+ public void removeManagedMBeanDeployments(ManagedMBeanDeploymentFactory factory)
+ {
+ log.info("removeManagedDeployment, "+factory);
+ String name = factory.getFactoryName();
+ this.mdfs.remove(name);
+ }
+
public void addTemplate(DeploymentTemplate template)
{
this.templates.put(template.getInfo().getName(), template);
@@ -970,7 +1113,16 @@
}
/**
- *
+ * Get a set of the component types in use in the profiles
+ * @return set of component types in use
+ */
+ public Set<ComponentType> getComponentTypes()
+ {
+ return compByCompType.keySet();
+ }
+
+ /**
+ *
* @param key
* @param type
* @return
@@ -979,7 +1131,24 @@
public Set<ManagedComponent> getComponentsForType(ComponentType type)
throws Exception
{
- Set<ManagedComponent> comps = compByCompType.get(type);
+ Set<ManagedComponent> comps = null;
+ // Check the any component type
+ if(type.equals(KnownComponentTypes.ANY_TYPE))
+ {
+ HashSet<ManagedComponent> all = new HashSet<ManagedComponent>();
+ for(Set<ManagedComponent> typeComps : compByCompType.values())
+ {
+ for(ManagedComponent comp : typeComps)
+ {
+ all.add(comp);
+ }
+ }
+ comps = all;
+ }
+ else
+ {
+ comps = compByCompType.get(type);
+ }
if(comps == null)
comps = Collections.emptySet();
return comps;
@@ -1399,6 +1568,10 @@
// Create the delegate property
Object componentName = prop.getManagedObject().getComponentName();
+
+ if (prop.getManagedObject().getTransientAttachment(MBeanRuntimeComponentDispatcher.class.getName()) != null)
+ return mbeanProxyFactory.createPropertyProxy(prop, componentName);
+
return proxyFactory.createPropertyProxy(prop, componentName);
}
@@ -1429,6 +1602,17 @@
// Create the delegate operation
return proxyFactory.createOperationProxies(ops, componentName);
}
+
+ private ManagedObject createManagedObject(ObjectName mbean, String defaultViewUse)
+ throws Exception
+ {
+ MBeanInfo info = mbeanServer.getMBeanInfo(mbean);
+ ClassLoader mbeanLoader = mbeanServer.getClassLoaderFor(mbean);
+ MetaData metaData = null;
+ ViewUse[] viewUse = defaultViewUse == null ? null : new ViewUse[]{ViewUse.valueOf(defaultViewUse)};
+ ManagedObject mo = mbeanMOFactory.getManagedObject(mbean, info, mbeanLoader, metaData, viewUse);
+ return mo;
+ }
private ManagedDeployment getManagedDeployment(ProfileDeployment ctx) throws DeploymentException
{
@@ -1455,4 +1639,111 @@
Profile profile = getProfileForDeployment(name);
return profile.getDeployment(name);
}
+
+ @SuppressWarnings("all")
+ private static final class ManagementObjectAnnotationImpl implements ManagementObject, Serializable
+ {
+ private static final long serialVersionUID=5355799336353299850L;
+
+ private final String name;
+ private final String type;
+ private final String subtype;
+
+ @SuppressWarnings("all")
+ private final class ManagementComponentAnnotationImpl implements ManagementComponent, Serializable
+ {
+ private static final long serialVersionUID=5355799336353299850L;
+
+ public String subtype()
+ {
+ return subtype;
+ }
+
+ public String type()
+ {
+ return type;
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return ManagementComponent.class;
+ }
+ }
+
+ private ManagementObjectAnnotationImpl(String name, String type, String subtype)
+ {
+ this.name=name;
+ this.type=type;
+ this.subtype=subtype;
+ }
+
+ public String attachmentName()
+ {
+ return "";
+ }
+
+ public ManagementProperty[] classProperties()
+ {
+ return new ManagementProperty[0];
+ }
+
+ public ManagementComponent componentType()
+ {
+ return new ManagementComponentAnnotationImpl();
+ }
+
+ public String description()
+ {
+ return "";
+ }
+
+ public boolean isRuntime()
+ {
+ return true;
+ }
+
+ public String name()
+ {
+ return name;
+ }
+
+ public ManagementOperation[] operations()
+ {
+ return new ManagementOperation[0];
+ }
+
+ public ManagementProperties properties()
+ {
+ return ManagementProperties.ALL;
+ }
+
+ public Class<?> targetInterface()
+ {
+ return Object.class;
+ }
+
+ public String type()
+ {
+ return "";
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return ManagementObject.class;
+ }
+ }
+
+ private ManagementObject createMOAnnotation(final String name, final String type, final String subtype)
+ {
+ return new ManagementObjectAnnotationImpl(name, type, subtype);
+ }
+ public ManagedOperationProxyFactory getMbeanProxyFactory()
+ {
+ return mbeanProxyFactory;
+ }
+
+ public void setMbeanProxyFactory(ManagedOperationProxyFactory mbeanProxyFactory)
+ {
+ this.mbeanProxyFactory = mbeanProxyFactory;
+ }
}
Copied: trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyDeploymentInfo.java (from rev 88769, branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ProxyDeploymentInfo.java)
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyDeploymentInfo.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyDeploymentInfo.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.management;
+
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.ComponentType;
+import org.jboss.profileservice.spi.MBeanDeploymentNameBuilder;
+
+/**
+ * Encapsulation of a collection of mbeans that should be exposed as a
+ * ManagedDeployment with ManagedComponents.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ProxyDeploymentInfo
+{
+ /** The root component type */
+ private String compType;
+ /** The root component subtype */
+ private String compSubtype;
+ /** The name pattern used to locate the root mbeans of the deployment */
+ private ObjectName pattern;
+ private MBeanDeploymentNameBuilder nameBuilder;
+
+ /** A map of attribute name to ComponentType:ComponentSubType for child components of the root component */
+ private Map<String, String> componentInfo;
+
+ public String getCompType()
+ {
+ return compType;
+ }
+ public void setCompType(String compType)
+ {
+ this.compType = compType;
+ }
+ public String getCompSubtype()
+ {
+ return compSubtype;
+ }
+ public void setCompSubtype(String compSubtype)
+ {
+ this.compSubtype = compSubtype;
+ }
+ public ComponentType getType()
+ {
+ return new ComponentType(compType, compSubtype);
+ }
+ public ObjectName getPattern()
+ {
+ return pattern;
+ }
+ public void setPattern(ObjectName pattern)
+ {
+ this.pattern = pattern;
+ }
+
+ public MBeanDeploymentNameBuilder getNameBuilder()
+ {
+ return nameBuilder;
+ }
+ public void setNameBuilder(MBeanDeploymentNameBuilder nameBuilder)
+ {
+ this.nameBuilder = nameBuilder;
+ }
+ public Map<String, String> getComponentInfo()
+ {
+ return componentInfo;
+ }
+ public void setComponentInfo(Map<String, String> componentInfo)
+ {
+ this.componentInfo = componentInfo;
+ }
+}
Added: trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyManagedDeploymentFactory.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyManagedDeploymentFactory.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ProxyManagedDeploymentFactory.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.management;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.profileservice.spi.ManagedMBeanDeploymentFactory;
+
+/**
+ * A ManagedDeploymentFactory that acts as a facade on top of mbean deployments
+ * given by an ObjectName pattern.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Jason T. Greene
+ * @version $Revision: 88974 $
+ */
+public class ProxyManagedDeploymentFactory implements ManagedMBeanDeploymentFactory
+{
+ /** Name under which the factory will be registered */
+ private String factoryName;
+
+ /** The map of patterns to locate root mbeans that go into the deployment ManagedObject set */
+ private Set<ProxyDeploymentInfo> rootMOPatterns;
+
+ /** The default view to expose fields as */
+ private String defaultViewUse;
+
+ public String getFactoryName()
+ {
+ return factoryName;
+ }
+ public void setFactoryName(String factoryName)
+ {
+ this.factoryName = factoryName;
+ }
+
+ public Set<ProxyDeploymentInfo> getRootMOPatterns()
+ {
+ return rootMOPatterns;
+ }
+ public void setRootMOPatterns(Set<ProxyDeploymentInfo> rootMOPatterns)
+ {
+ this.rootMOPatterns = rootMOPatterns;
+ }
+
+ public String getDefaultViewUse()
+ {
+ return this.defaultViewUse;
+ }
+
+ public void setDefaultViewUse(String defaultViewUse)
+ {
+ this.defaultViewUse = defaultViewUse;
+ }
+
+
+ public Collection<MBeanDeployment> getDeployments(MBeanServer mbeanServer)
+ {
+ Map<String, MBeanDeployment> tmp = new HashMap<String, MBeanDeployment>();
+ if(this.rootMOPatterns == null)
+ return tmp.values();
+
+ for(ProxyDeploymentInfo info : rootMOPatterns)
+ {
+ Set<ObjectName> names = mbeanServer.queryNames(info.getPattern(), null);
+ if(names != null)
+ {
+ for(ObjectName name : names)
+ {
+ String dname = info.getNameBuilder().getName(name, mbeanServer);
+ MBeanDeployment deployment = tmp.get(dname);
+ if(deployment == null)
+ {
+ deployment = new MBeanDeployment(dname);
+ tmp.put(dname, deployment);
+ }
+ String compType = info.getCompType();
+ String compSubtype = info.getCompSubtype();
+ MBeanComponent rootComp = new MBeanComponent(name, compType, compSubtype);
+ deployment.addComponent(rootComp);
+ Map<String, String> componentInfo = info.getComponentInfo();
+ if(componentInfo != null)
+ {
+ for(Map.Entry<String, String> comp : componentInfo.entrySet())
+ {
+ String compPropertyName = comp.getKey();
+ String compTypeInfo = comp.getValue();
+ try
+ {
+ // Query for the attribute containing names of child components
+ Object attribute = mbeanServer.getAttribute(name, compPropertyName);
+ // Type:Subtype is the format
+ String[] compTypeParts = compTypeInfo.split(":");
+ processComponents(attribute, compTypeParts[0], compTypeParts[1], deployment);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ return tmp.values();
+ }
+
+ /**
+ * Generate MBeanComponents for each name given by the attribute value. This
+ * processes the attribute value as an array or collection of strings or
+ * ObjectNames referencing other mbeans that are child type of components.
+ * @param attribute - the value containing the names of child components
+ * @param type - the child component type
+ * @param subtype - the child component subtype
+ * @param deployment - the deployment to add the component to
+ * @throws Exception - thrown on failure to parse a component name
+ */
+ private void processComponents(Object attribute, String type, String subtype, MBeanDeployment deployment)
+ throws Exception
+ {
+ if(attribute instanceof String[])
+ {
+ String[] names = (String[]) attribute;
+ for(String name : names)
+ {
+ ObjectName compName = new ObjectName(name);
+ MBeanComponent comp = new MBeanComponent(compName, type , subtype);
+ deployment.addComponent(comp);
+ }
+ }
+ else if(attribute instanceof ObjectName[])
+ {
+ ObjectName[] names = (ObjectName[]) attribute;
+ for(ObjectName compName : names)
+ {
+ MBeanComponent comp = new MBeanComponent(compName, type , subtype);
+ deployment.addComponent(comp);
+ }
+ }
+ else if(attribute instanceof Collection)
+ {
+ Collection names = (Collection) attribute;
+ for(Object name : names)
+ {
+ MBeanComponent comp = null;
+ ObjectName compName = null;
+ if(name instanceof ObjectName)
+ {
+ compName = (ObjectName) name;
+ }
+ else
+ {
+ compName = new ObjectName(name.toString());
+
+ }
+ comp = new MBeanComponent(compName, type , subtype);
+ deployment.addComponent(comp);
+ }
+ }
+ }
+
+
+}
Added: trunk/profileservice/src/main/org/jboss/profileservice/management/TempManagedComponentImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/TempManagedComponentImpl.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/TempManagedComponentImpl.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.profileservice.management;
+
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.RunStateMapper;
+import org.jboss.managed.plugins.ManagedComponentImpl;
+
+/**
+ * Temp managed component impl where getParent points to the defining
+ * ManagedObject.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class TempManagedComponentImpl extends ManagedComponentImpl
+{
+ private static final long serialVersionUID = 1;
+
+ public TempManagedComponentImpl(ComponentType type, ManagedDeployment owner, ManagedObject mo)
+ {
+ this(type, owner, mo, null);
+ }
+ public TempManagedComponentImpl(ComponentType type, ManagedDeployment owner, ManagedObject mo,
+ RunStateMapper stateMapper)
+ {
+ super(type, owner, mo, stateMapper);
+ }
+
+ @Override
+ public ManagedCommon getParent()
+ {
+ return getDelegate();
+ }
+
+}
Copied: trunk/profileservice/src/main/org/jboss/profileservice/management/mbean (from rev 88769, branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/mbean)
Deleted: trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java 2009-05-13 00:50:22 UTC (rev 88769)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * 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.profileservice.management.mbean;
-
-import java.util.List;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.profileservic.spi.MBeanDeploymentNameBuilder;
-
-/**
- * An MBeanDeploymentNameBuilder that supports multiple keys, prefix, suffix
- * and separator notions
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class ComplexMBeanDeploymentNameBuilder
- implements MBeanDeploymentNameBuilder
-{
- private String prefix = "";
- private String suffix = "";
- private String separator = "";
- private List<String> keyNames;
- public String getPrefix()
- {
- return prefix;
- }
- public void setPrefix(String prefix)
- {
- this.prefix = prefix;
- }
- public String getSuffix()
- {
- return suffix;
- }
- public void setSuffix(String suffix)
- {
- this.suffix = suffix;
- }
- public String getSeparator()
- {
- return separator;
- }
- public void setSeparator(String separator)
- {
- this.separator = separator;
- }
- public List<String> getKeyNames()
- {
- return keyNames;
- }
- public void setKeyNames(List<String> keyNames)
- {
- this.keyNames = keyNames;
- }
-
- public String getName(ObjectName name, MBeanServer server)
- {
- StringBuilder tmp = new StringBuilder(prefix);
- for(String key : keyNames)
- {
- String value = name.getKeyProperty(key);
- tmp.append(value);
- if(separator != null)
- tmp.append(separator);
- }
- // Remove the last separator
- if(separator != null)
- tmp.setLength(tmp.length() - separator.length());
- return tmp.toString();
- }
-}
Copied: trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java (from rev 88769, branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java)
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/ComplexMBeanDeploymentNameBuilder.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.management.mbean;
+
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.profileservice.spi.MBeanDeploymentNameBuilder;
+
+/**
+ * An MBeanDeploymentNameBuilder that supports multiple keys, prefix, suffix
+ * and separator notions
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ComplexMBeanDeploymentNameBuilder
+ implements MBeanDeploymentNameBuilder
+{
+ private String prefix = "";
+ private String suffix = "";
+ private String separator = "";
+ private List<String> keyNames;
+ public String getPrefix()
+ {
+ return prefix;
+ }
+ public void setPrefix(String prefix)
+ {
+ this.prefix = prefix;
+ }
+ public String getSuffix()
+ {
+ return suffix;
+ }
+ public void setSuffix(String suffix)
+ {
+ this.suffix = suffix;
+ }
+ public String getSeparator()
+ {
+ return separator;
+ }
+ public void setSeparator(String separator)
+ {
+ this.separator = separator;
+ }
+ public List<String> getKeyNames()
+ {
+ return keyNames;
+ }
+ public void setKeyNames(List<String> keyNames)
+ {
+ this.keyNames = keyNames;
+ }
+
+ public String getName(ObjectName name, MBeanServer server)
+ {
+ StringBuilder tmp = new StringBuilder(prefix);
+ for(String key : keyNames)
+ {
+ String value = name.getKeyProperty(key);
+ tmp.append(value);
+ if(separator != null)
+ tmp.append(separator);
+ }
+ // Remove the last separator
+ if(separator != null)
+ tmp.setLength(tmp.length() - separator.length());
+ return tmp.toString();
+ }
+}
Deleted: trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java 2009-05-13 00:50:22 UTC (rev 88769)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * 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.profileservice.management.mbean;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.profileservic.spi.MBeanDeploymentNameBuilder;
-
-/**
- * A simple MBeanDeploymentNameBuilder that returns the value of the key
- * property value as the name.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class SimpleMBeanDeploymentNameBuilder
- implements MBeanDeploymentNameBuilder
-{
- private String keyName = "name";
-
- public String getKeyName()
- {
- return keyName;
- }
- public void setKeyName(String keyName)
- {
- this.keyName = keyName;
- }
-
- /*
- * Return the key property specified by the keyName as the deployment name.
- * @param name - the
- */
- public String getName(ObjectName name, MBeanServer server)
- {
- return name.getKeyProperty(keyName);
- }
-}
Copied: trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java (from rev 88769, branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java)
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/mbean/SimpleMBeanDeploymentNameBuilder.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.management.mbean;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.profileservice.spi.MBeanDeploymentNameBuilder;
+
+/**
+ * A simple MBeanDeploymentNameBuilder that returns the value of the key
+ * property value as the name.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class SimpleMBeanDeploymentNameBuilder
+ implements MBeanDeploymentNameBuilder
+{
+ private String keyName = "name";
+
+ public String getKeyName()
+ {
+ return keyName;
+ }
+ public void setKeyName(String keyName)
+ {
+ this.keyName = keyName;
+ }
+
+ /*
+ * Return the key property specified by the keyName as the deployment name.
+ * @param name - the
+ */
+ public String getName(ObjectName name, MBeanServer server)
+ {
+ return name.getKeyProperty(keyName);
+ }
+}
Added: trunk/profileservice/src/main/org/jboss/profileservice/spi/MBeanDeploymentNameBuilder.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/spi/MBeanDeploymentNameBuilder.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/spi/MBeanDeploymentNameBuilder.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.spi;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * An spi for mapping mbean names to a deployment name.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface MBeanDeploymentNameBuilder
+{
+ /**
+ * Generate a deployment name from a given mbean name.
+ *
+ * @param name - an mbean name of a ManagedObject to include in the deployment
+ * @param server - the MBeanServer under which name is registered
+ * @return - the name of the deployment the mbean should belong to
+ */
+ public String getName(ObjectName name, MBeanServer server);
+}
Property changes on: trunk/profileservice/src/main/org/jboss/profileservice/spi/MBeanDeploymentNameBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Added: trunk/profileservice/src/main/org/jboss/profileservice/spi/ManagedMBeanDeploymentFactory.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/spi/ManagedMBeanDeploymentFactory.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/spi/ManagedMBeanDeploymentFactory.java 2009-05-16 03:30:17 UTC (rev 88975)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.spi;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface ManagedMBeanDeploymentFactory
+{
+ public static class MBeanDeployment
+ {
+ String name;
+ Collection <MBeanComponent> components;
+ public MBeanDeployment(String name)
+ {
+ this(name, new ArrayList<MBeanComponent>());
+ }
+ public MBeanDeployment(String name, Collection <MBeanComponent> components)
+ {
+ this.name = name;
+ this.components = components;
+ }
+ public String getName()
+ {
+ return name;
+ }
+ public Collection<MBeanComponent> getComponents()
+ {
+ return components;
+ }
+ public void setComponents(Collection<MBeanComponent> components)
+ {
+ this.components = components;
+ }
+ public synchronized void addComponent(MBeanComponent comp)
+ {
+ if(components == null)
+ components = new ArrayList<MBeanComponent>();
+ components.add(comp);
+ }
+ public String toString()
+ {
+ return "MBeanDeployment("+name+"), "+components;
+ }
+ }
+ public static class MBeanComponent
+ {
+ String type;
+ String subtype;
+ ObjectName name;
+ public MBeanComponent(ObjectName name, String type, String subtype)
+ {
+ super();
+ this.type = type;
+ this.subtype = subtype;
+ this.name = name;
+ }
+ public ObjectName getName()
+ {
+ return name;
+ }
+ public String getType()
+ {
+ return type;
+ }
+ public String getSubtype()
+ {
+ return subtype;
+ }
+ public String toString()
+ {
+ return "MBeanComponent("+name+","+type+","+subtype+")";
+ }
+ }
+ public String getFactoryName();
+ public Collection<MBeanDeployment> getDeployments(MBeanServer mbeanServer);
+ public String getDefaultViewUse();
+}
Property changes on: trunk/profileservice/src/main/org/jboss/profileservice/spi/ManagedMBeanDeploymentFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Modified: trunk/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-jboss-beans.xml 2009-05-16 02:50:24 UTC (rev 88974)
+++ trunk/profileservice/src/resources/profileservice-jboss-beans.xml 2009-05-16 03:30:17 UTC (rev 88975)
@@ -10,44 +10,17 @@
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="ProfileServiceAuthenticationManager" class="org.jboss.security.AuthenticationManager">
- <constructor factoryMethod="getAuthenticationManager">
- <factory bean="JNDIBasedSecurityManagement"/>
- <parameter>profileservice</parameter>
- </constructor>
- </bean>
- <bean name="ProfileServiceAuthorizationManager" class="org.jboss.security.AuthorizationManager">
- <constructor factoryMethod="getAuthorizationManager">
- <factory bean="JNDIBasedSecurityManagement"/>
- <parameter>profileservice</parameter>
- </constructor>
- </bean>
-
- <interceptor xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.aspects.security.AuthenticationInterceptor">
- <constructor>
- <parameter><inject bean="ProfileServiceAuthenticationManager"/></parameter>
- </constructor>
- </interceptor>
- <!-- TODO: the second param is a RealmMapping interface, but the
- JNDIBasedSecurityManagement.getAuthorizationManager returns an AuthorizationManager.
- The RoleBasedAuthorizationInterceptor should be updated to accept an
- AuthorizationManager. This only works because the AuthorizationManager
- still implements RealmMapping.
- -->
- <interceptor xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.aspects.security.RoleBasedAuthorizationInterceptor">
- <constructor>
- <parameter><inject bean="ProfileServiceAuthenticationManager"/></parameter>
- <parameter><inject bean="ProfileServiceAuthorizationManager"/></parameter>
- </constructor>
- </interceptor>
+ <!-- profileservice secureview application-policy definition -->
+ <application-policy xmlns="urn:jboss:security-beans:1.0" name="profileservice">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
+ <module-option name="unauthenticatedIdentity">nouser</module-option>
+ <module-option name="usersProperties">profileservice-users.properties</module-option>
+ <module-option name="rolesProperties">profileservice-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
-<!-- Uncomment to require secure access
- <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* $instanceof{org.jboss.deployers.spi.management.ManagementView}->$implements{org.jboss.deployers.spi.management.ManagementView}(..))">
- <interceptor-ref name="org.jboss.aspects.security.AuthenticationInterceptor"/>
- <interceptor-ref name="org.jboss.aspects.security.RoleBasedAuthorizationInterceptor"/>
- </bind>
--->
-
<bean name="ConnectorMBean">
<constructor factoryClass="org.jboss.mx.util.MBeanTyper" factoryMethod="typeMBean">
<parameter><inject bean="JMXKernel" property="mbeanServer"/></parameter>
@@ -104,11 +77,24 @@
</constructor>
</bean>
+ <bean name="MBeanRuntimeComponentDispatcher" class="org.jboss.profileservice.management.MBeanRuntimeComponentDispatcher">
+ <constructor>
+ <parameter name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></parameter>
+ </constructor>
+ </bean>
+
<bean name="ManagedOperationProxyFactory" class="org.jboss.profileservice.management.ManagedOperationProxyFactory">
<property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
<property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
+ <property name="dispatchName">kernel-dispatcher</property>
</bean>
+ <bean name="MBeanManagedOperationProxyFactory" class="org.jboss.profileservice.management.ManagedOperationProxyFactory">
+ <property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
+ <property name="dispatcher"><inject bean="MBeanRuntimeComponentDispatcher"/></property>
+ <property name="dispatchName">mbean-dispatcher</property>
+ </bean>
+
<!-- The default applications profile key -->
<bean name="ApplicationsProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
<constructor><parameter><inject bean="BootstrapProfileFactory" property="applicationsName" /></parameter></constructor>
@@ -129,16 +115,21 @@
</parameter>
</uninstall>
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
<property name="deploymentManager"><inject bean="DeploymentManager"/></property>
<property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
<property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
<property name="proxyFactory"><inject bean="ManagedOperationProxyFactory"/></property>
+ <property name="mbeanProxyFactory"><inject bean="MBeanManagedOperationProxyFactory"/></property>
<property name="bootstrapManagedDeployments"><inject bean="ProfileServiceBootstrap" property="bootstrapMDs"/></property>
<!-- Accept any implementor of DeploymentTemplate -->
<incallback method="addTemplate"/>
<uncallback method="removeTemplate"/>
+ <!-- Accept any implementor of ManagedDeployment -->
+ <incallback method="addManagedMBeanDeployments"/>
+ <uncallback method="removeManagedMBeanDeployments"/>
</bean>
<!--
@@ -162,6 +153,11 @@
<property name="remotingSubsystem">DeploymentManager</property>
</bean>
+ <!-- To remove the unsecure proxy binding, change the jndiName property to
+ a local binding like java:ProfileService and update the
+ deploy/profileservice-secured.jar ejb-jar.xml profileService
+ resource-ref/mapped-name.
+ -->
<bean name="ProfileServiceProxyFactory" class="org.jboss.profileservice.remoting.ProxyFactory">
<property name="dispatchName">ProfileService</property>
<property name="jndiName">ProfileService</property>
@@ -195,4 +191,115 @@
</uninstall>
<property name="metaValueFactory"><inject bean="MetaValueFactory"/></property>
</bean>
+
+ <!-- A MBeanDeploymentNameBuilder that just uses the name key as the name -->
+ <bean name="NameKeyMBeanDeploymentNameBuilder"
+ class="org.jboss.profileservice.management.mbean.SimpleMBeanDeploymentNameBuilder">
+ <property name="keyName">name</property>
+ </bean>
+ <bean name="HostMBeanDeploymentNameBuilder"
+ class="org.jboss.profileservice.management.mbean.SimpleMBeanDeploymentNameBuilder">
+ <property name="keyName">host</property>
+ </bean>
+ <!-- A MBeanDeploymentNameBuilder that combines the host,path keys as the name -->
+ <bean name="WarManagerMBeanDeploymentNameBuilder"
+ class="org.jboss.profileservice.management.mbean.ComplexMBeanDeploymentNameBuilder">
+ <property name="prefix">//</property>
+ <property name="keyNames">
+ <list elementClass="java.lang.String">
+ <value>host</value>
+ <value>path</value>
+ </list>
+ </property>
+ </bean>
+ <!-- A deployment for the following mbean patterns:
+ jboss.web:host=localhost,path=/jmx-console,type=Manager
+ jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=*
+ +- all servlets attribute names
+ -->
+ <bean name="WarManagedDeploymentFactory"
+ class="org.jboss.profileservice.management.ProxyManagedDeploymentFactory">
+ <property name="factoryName">War</property>
+
+ <property name="defaultViewUse">STATISTIC</property>
+ <property name="rootMOPatterns">
+ <set elementClass="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <!-- Manager -->
+ <bean class="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <property name="compType">MBean</property>
+ <property name="compSubtype">WebApplicationManager</property>
+ <property name="pattern">jboss.web:host=localhost,type=Manager,*</property>
+ <property name="nameBuilder">
+ <inject bean="WarManagerMBeanDeploymentNameBuilder"/>
+ </property>
+ </bean>
+ <!-- WebModule -->
+ <bean class="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <property name="compType">MBean</property>
+ <property name="compSubtype">WebApplication</property>
+ <property name="pattern">jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,*</property>
+ <property name="nameBuilder">
+ <inject bean="NameKeyMBeanDeploymentNameBuilder"/>
+ </property>
+ <property name="componentInfo">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <!-- Process the servlets components -->
+ <entry>
+ <key>servlets</key>
+ <value>MBean:Servlet</value>
+ </entry>
+ </map>
+ </property>
+ </bean>
+ </set>
+ </property>
+ </bean>
+ <!-- jboss.web:host=*,type=Host -->
+ <bean name="WebHostsManagedDeploymentFactory"
+ class="org.jboss.profileservice.management.ProxyManagedDeploymentFactory">
+ <property name="factoryName">WebHost</property>
+
+ <property name="defaultViewUse">STATISTIC</property>
+ <property name="rootMOPatterns">
+ <set elementClass="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <!-- Manager -->
+ <bean class="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <property name="compType">MBean</property>
+ <property name="compSubtype">WebHost</property>
+ <property name="pattern">jboss.web:type=Host,*</property>
+ <property name="nameBuilder">
+ <inject bean="HostMBeanDeploymentNameBuilder"/>
+ </property>
+ </bean>
+ </set>
+ </property>
+ </bean>
+ <!-- jboss.web:name=*,type=GlobalRequestProcessor/ThreadPool -->
+ <bean name="ConnectorManagedDeploymentFactory"
+ class="org.jboss.profileservice.management.ProxyManagedDeploymentFactory">
+ <property name="factoryName">Connector</property>
+
+ <property name="defaultViewUse">STATISTIC</property>
+ <property name="rootMOPatterns">
+ <set elementClass="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <!-- Manager -->
+ <bean class="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <property name="compType">MBean</property>
+ <property name="compSubtype">WebRequestProcessor</property>
+ <property name="pattern">jboss.web:type=GlobalRequestProcessor,*</property>
+ <property name="nameBuilder">
+ <inject bean="NameKeyMBeanDeploymentNameBuilder"/>
+ </property>
+ </bean>
+ <bean class="org.jboss.profileservice.management.ProxyDeploymentInfo">
+ <property name="compType">MBean</property>
+ <property name="compSubtype">WebThreadPool</property>
+ <property name="pattern">jboss.web:type=ThreadPool,*</property>
+ <property name="nameBuilder">
+ <inject bean="NameKeyMBeanDeploymentNameBuilder"/>
+ </property>
+ </bean>
+ </set>
+ </property>
+ </bean>
</deployment>
More information about the jboss-cvs-commits
mailing list