[jboss-cvs] JBossAS SVN: r64837 - in projects/microcontainer/trunk: deployers-impl/src/main/org/jboss/deployers/plugins/main and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 23 21:00:50 EDT 2007
Author: scott.stark at jboss.org
Date: 2007-08-23 21:00:49 -0400 (Thu, 23 Aug 2007)
New Revision: 64837
Added:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/DefaultManagedDeploymentCreator.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/DSServiceMetaData.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/Defaults.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
Removed:
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/BaseManagedObject.java
Modified:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/ConnMetaData.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/MCFDeployer.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/SecurityDeployment.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/TestManagedObjectDeployer.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java
projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/managed/ManagedDeploymentCreator.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedComponent.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedDeployment.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedObject.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementComponent.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementObject.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementOperation.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementProperty.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedComponentImpl.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedDeploymentImpl.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedObjectImpl.java
projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockDataSourceManagedObject.java
projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockTest.java
Log:
JBMICROCONT-181, refactor to integrate ManagedDeployment/ManagedComponent support
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -32,7 +32,6 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.client.spi.main.MainDeployer;
-//import org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.DeploymentState;
import org.jboss.deployers.spi.deployer.Deployers;
@@ -44,7 +43,6 @@
import org.jboss.logging.Logger;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.plugins.ManagedDeploymentImpl;
import org.jboss.util.graph.Graph;
import org.jboss.util.graph.Vertex;
@@ -53,7 +51,7 @@
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class MainDeployerImpl implements MainDeployer, MainDeployerStructure
{
@@ -68,7 +66,8 @@
/** The structural deployers */
private StructuralDeployers structuralDeployers;
- private ManagedDeploymentCreator mgtDeploymentCreator = null; // new DefaultManagedDeploymentCreator();
+ /** The ManagedDeploymentCreator plugin */
+ private ManagedDeploymentCreator mgtDeploymentCreator = null;
/** The deployments by name */
private Map<String, DeploymentContext> topLevelDeployments = new ConcurrentHashMap<String, DeploymentContext>();
@@ -134,6 +133,16 @@
structuralDeployers = deployers;
}
+ public ManagedDeploymentCreator getMgtDeploymentCreator()
+ {
+ return mgtDeploymentCreator;
+ }
+
+ public void setMgtDeploymentCreator(ManagedDeploymentCreator mgtDeploymentCreator)
+ {
+ this.mgtDeploymentCreator = mgtDeploymentCreator;
+ }
+
public Deployment getDeployment(String name)
{
DeploymentContext context = getTopLevelDeploymentContext(name);
@@ -420,8 +429,13 @@
if (context == null)
throw new IllegalArgumentException("Context not found: " + name);
- ManagedDeployment md = mgtDeploymentCreator.build(context.getDeploymentUnit());
- return md;
+ Map<String, ManagedObject> rootMOs = getManagedObjects(context);
+ ManagedDeployment root = mgtDeploymentCreator.build(context.getDeploymentUnit(), rootMOs, null);
+ for (DeploymentContext childContext : context.getChildren())
+ {
+ processManagedDeployment(childContext, root);
+ }
+ return root;
}
public Map<String, ManagedObject> getManagedObjects(String name) throws DeploymentException
@@ -480,6 +494,25 @@
}
/**
+ * Recursively process the DeploymentContext into ManagedDeployments.
+ *
+ * @param context
+ * @param parent
+ * @throws DeploymentException
+ */
+ protected void processManagedDeployment(DeploymentContext context, ManagedDeployment parent)
+ throws DeploymentException
+ {
+ for (DeploymentContext childContext : context.getChildren())
+ {
+ DeploymentUnit childUnit = childContext.getDeploymentUnit();
+ Map<String, ManagedObject> childMOs = getManagedObjects(childContext);
+ ManagedDeployment childMD = mgtDeploymentCreator.build(childUnit, childMOs, parent);
+ processManagedDeployment(childContext, childMD);
+ }
+ }
+
+ /**
* Determine the structure of a deployment
*
* @param deployment the deployment
Property changes on: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Revision Id
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/DefaultManagedDeploymentCreator.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/DefaultManagedDeploymentCreator.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/DefaultManagedDeploymentCreator.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.deployers.plugins.managed;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import org.jboss.deployers.spi.deployer.managed.ManagedComponentCreator;
+import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.ManagedDeploymentImpl;
+
+/**
+ * Create a ManagedDeployment for a DeploymentUnit and its ManagedObjects
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class DefaultManagedDeploymentCreator
+ implements ManagedDeploymentCreator
+{
+ private ManagedObjectFactory moFactory = ManagedObjectFactory.getInstance();
+ /** The metadata type to ManagedComponent handlers */
+ private Map<Class, ManagedComponentCreator> mdCreators;
+
+ public ManagedObjectFactory getMoFactory()
+ {
+ return moFactory;
+ }
+ public void setMoFactory(ManagedObjectFactory moFactory)
+ {
+ this.moFactory = moFactory;
+ }
+
+ public <T> void addManagedComponentCreator(ManagedComponentCreator<T> mcc)
+ {
+ Type type = mcc.getClass().getGenericInterfaces()[0];
+ ParameterizedType pt = (ParameterizedType) type;
+ Class ptType = (Class) pt.getActualTypeArguments()[0];
+ mdCreators.put(ptType, mcc);
+ }
+
+ public ManagedDeployment build(DeploymentUnit unit,
+ Map<String, ManagedObject> unitMOs,
+ ManagedDeployment parent)
+ {
+ DeploymentPhase phase = unit.getAttachment(DeploymentPhase.class);
+ if( phase == null )
+ phase = DeploymentPhase.APPLICATION;
+ ManagedDeployment md = new ManagedDeploymentImpl(unit.getName(), unit.getSimpleName(),
+ phase, parent, unitMOs);
+
+ return md;
+ }
+
+}
Property changes on: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/managed/DefaultManagedDeploymentCreator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/AbstractDeployerTest.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -31,9 +31,11 @@
import org.jboss.deployers.plugins.deployers.DeployerWrapper;
import org.jboss.deployers.plugins.deployers.DeployersImpl;
import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator;
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
import org.jboss.deployers.spi.deployer.Deployer;
import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -70,6 +72,8 @@
mainDeployer.setStructuralDeployers(structure);
Deployers theDeployers = createDeployers();
mainDeployer.setDeployers(theDeployers);
+ ManagedDeploymentCreator mdc = createManagedDeploymentCreator();
+ mainDeployer.setMgtDeploymentCreator(mdc);
if (deployers != null)
{
for (Deployer deployer : deployers)
@@ -82,7 +86,10 @@
{
return new AbstractStructureBuilder();
}
-
+ protected ManagedDeploymentCreator createManagedDeploymentCreator()
+ {
+ return new DefaultManagedDeploymentCreator();
+ }
protected StructuralDeployers createStructuralDeployers()
{
StructureBuilder builder = createStructureBuilder();
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/ConnMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/ConnMetaData.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/ConnMetaData.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -25,7 +25,6 @@
import java.util.Properties;
import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
@@ -115,7 +114,6 @@
}
@ManagementProperty(name="security-domain", managed=true)
- @ManagementObjectID(name="java:/jaas/DefaultDS", type="SecurityDomain")
public SecMetaData getSecurityMetaData()
{
return securityMetaData;
Added: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/DSServiceMetaData.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/DSServiceMetaData.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/DSServiceMetaData.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.test.deployers.deployer.support;
+
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Sample mbean service metadata to test tieing together runtime
+ * properties/operations to the root DSMetaData ManagedObject
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at ManagementObject(isRuntime=true)
+public class DSServiceMetaData
+{
+ /** The name of the ManagedObject this runtime view augments */
+ private String managementName;
+ private String runtimeProp1;
+ private int runtimeProp2;
+
+ @ManagementObjectID(type="DataSource")
+ public String getManagementName()
+ {
+ return managementName;
+ }
+ public void setManagementName(String managementName)
+ {
+ this.managementName = managementName;
+ }
+
+ @ManagementProperty
+ public String getRuntimeProp1()
+ {
+ return runtimeProp1;
+ }
+ public void setRuntimeProp1(String runtimeProp1)
+ {
+ this.runtimeProp1 = runtimeProp1;
+ }
+ @ManagementProperty
+ public int getRuntimeProp2()
+ {
+ return runtimeProp2;
+ }
+ public void setRuntimeProp2(int runtimeProp2)
+ {
+ this.runtimeProp2 = runtimeProp2;
+ }
+
+ @ManagementOperation(description="Flush the connection pool", impact=Impact.WriteOnly)
+ public void flushPool()
+ {
+
+ }
+}
Property changes on: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/DSServiceMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/MCFDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/MCFDeployer.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/MCFDeployer.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -5,18 +5,15 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
public class MCFDeployer
extends AbstractSimpleRealDeployer<DSMetaData>
- implements ManagedDeploymentCreator,
- ManagedObjectCreator
+ implements ManagedObjectCreator
{
public MCFDeployer()
@@ -47,10 +44,4 @@
}
}
- public ManagedDeployment build(DeploymentUnit unit)
- {
- ManagedDeployment md = null;
- return md;
- }
-
}
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/SecurityDeployment.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/SecurityDeployment.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/support/SecurityDeployment.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -25,6 +25,7 @@
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
/**
* @author Scott.Stark at jboss.org
@@ -45,4 +46,10 @@
{
this.domain = name;
}
+
+ @ManagementOperation
+ public void flush()
+ {
+
+ }
}
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/MockProfileService.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -21,16 +21,31 @@
*/
package org.jboss.test.deployers.managed.support;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.logging.Logger;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObjectID;
import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.plugins.ManagedComponentImpl;
+import org.jboss.managed.plugins.ManagedDeploymentImpl;
import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.SimpleValue;
/**
* Mock profile service for testing implementation details.
@@ -42,67 +57,165 @@
{
private static final Logger log = Logger.getLogger(MockProfileService.class);
+ private DeployerClient main;
/** id/type key to ManagedObject map */
private Map<String, ManagedObject> moRegistry = new HashMap<String, ManagedObject>();
+ private Map<String, Deployment> deployments = new HashMap<String, Deployment>();
+ private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
+ private Map<String, Set<ManagedProperty>> unresolvedRefs = new HashMap<String, Set<ManagedProperty>>();
- private Map<String, List<ManagedProperty>> unresolvedRefs = new HashMap<String, List<ManagedProperty>>();
+ public MockProfileService(DeployerClient main)
+ {
+ this.main = main;
+ }
+ public void addDeployment(Deployment ctx)
+ throws DeploymentException
+ {
+ main.addDeployment(ctx);
+ deployments.put(ctx.getName(), ctx);
+ }
+ public void process()
+ throws DeploymentException
+ {
+ main.process();
+ for(String name : deployments.keySet())
+ {
+ ManagedDeployment md = main.getManagedDeployment(name);
+ log.info(name+" ManagedDeployment: " + md);
+ Map<String, ManagedObject> mos = md.getManagedObjects();
+ log.info(name+" ManagedObjects: " + mos);
+ for(ManagedObject mo : mos.values())
+ {
+ processManagedObject(mo, md);
+ }
+ managedDeployments.put(name, md);
+ }
+ }
+
+ public ManagedObject getManagedObject(String name)
+ {
+ ManagedObject mo = moRegistry.get(name);
+ return mo;
+ }
+ public ManagedDeployment getManagedDeployment(String name)
+ {
+ ManagedDeployment md = managedDeployments.get(name);
+ return md;
+ }
+
/**
*
* @param mo
+ * @param md -
*/
- public void processManagedObject(ManagedObject mo)
+ protected void processManagedObject(ManagedObject mo, ManagedDeployment md)
{
String key = mo.getName() + "/" + mo.getNameType();
- log.info("ID for ManagedObject: "+key+", attachmentName: "+mo.getAttachmentName());
+ log.debug("ID for ManagedObject: "+key+", attachmentName: "+mo.getAttachmentName());
ManagedObject prevMO = moRegistry.put(key, mo);
if( prevMO != null )
log.warn("Duplicate mo for key: "+key+", prevMO: "+prevMO);
+ // Check for unresolved refs
+ checkForReferences(key, mo);
- // Check for unresolved refs
- List<ManagedProperty> referers = unresolvedRefs.get(key);
- if (referers != null)
+ // Create ManagedComponents for
+ ManagementComponent mc = (ManagementComponent) mo.getAnnotations().get(ManagementComponent.class.getName());
+ if (mc != null)
{
- for(ManagedProperty prop : referers)
- {
- prop.setTargetManagedObject(mo);
- }
- referers.clear();
+ ComponentType type = new ComponentType(mc.type(), mc.subtype());
+ ManagedComponentImpl comp = new ManagedComponentImpl(type, md, mo);
+ md.addComponent(mo.getName(), comp);
}
// Scan for @ManagementObjectRef
- for(ManagedProperty prop : mo.getProperties())
+ for(ManagedProperty prop : mo.getProperties().values())
{
+ log.debug("Checking property: "+prop);
+ // See if this is a ManagementObjectID
+ ManagementObjectID id = (ManagementObjectID) prop.getAnnotations().get(ManagementObjectID.class.getName());
+ if (id != null)
+ {
+ SimpleValue refValue = (SimpleValue) prop.getValue();
+ String refName = (String) refValue.getValue();
+ if (refName == null)
+ refName = id.name();
+ String propKey = refName + "/" + id.type();
+ log.debug("ManagedProperty level ID for ManagedObject: "+propKey+", attachmentName: "+mo.getAttachmentName());
+ moRegistry.put(propKey, mo);
+ checkForReferences(propKey, mo);
+ }
+
+ // See if this is a ManagementObjectRef
ManagementObjectRef ref = (ManagementObjectRef) prop.getAnnotations().get(ManagementObjectRef.class.getName());
if ( ref != null )
{
- String targetKey = ref.name() + "/" + ref.type();
+ // The reference key is the prop value + ref.type()
+ log.debug("Property("+prop.getName()+") references: "+ref);
+ SimpleValue refValue = (SimpleValue) prop.getValue();
+ String refName = (String) refValue.getValue();
+ if (refName == null)
+ refName = ref.name();
+ String targetKey = refName + "/" + ref.type();
ManagedObject target = moRegistry.get(targetKey);
if (target != null)
{
+ log.debug("Resolved property("+prop.getName()+") reference to: "+targetKey);
prop.setTargetManagedObject(target);
}
else
{
- referers = (List<ManagedProperty>) unresolvedRefs.get(targetKey);
+ Set<ManagedProperty> referers = unresolvedRefs.get(targetKey);
if (referers == null)
{
- referers = new ArrayList<ManagedProperty>();
+ referers = new HashSet<ManagedProperty>();
unresolvedRefs.put(targetKey, referers);
}
referers.add(prop);
}
}
- if (prop.getMetaType() == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
+
+ MetaType propType = prop.getMetaType();
+ if (propType == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
{
- ManagedObject propMO = (ManagedObject) prop.getValue();
- processManagedObject(propMO);
+ GenericValue gv = (GenericValue) prop.getValue();
+ ManagedObject propMO = (ManagedObject) gv.getValue();
+ processManagedObject(propMO, md);
}
+ else if (propType.isArray())
+ {
+ ArrayMetaType amt = (ArrayMetaType) propType;
+ MetaType etype = amt.getElementType();
+ if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
+ {
+ ArrayValue<GenericValue> avalue = (ArrayValue<GenericValue>) prop.getValue();
+ for(int n = 0; n < avalue.getLength(); n ++)
+ {
+ GenericValue gv = (GenericValue) avalue.getValue(n);
+ ManagedObject propMO = (ManagedObject) gv.getValue();
+ processManagedObject(propMO, md);
+ }
+ }
+ }
}
}
- public Map<String, List<ManagedProperty>> getUnresolvedRefs()
+ public Map<String, Set<ManagedProperty>> getUnresolvedRefs()
{
return unresolvedRefs;
}
+
+ protected void checkForReferences(String key, ManagedObject mo)
+ {
+ Set<ManagedProperty> referers = unresolvedRefs.get(key);
+ log.debug("checkForReferences, "+key+" has referers: "+referers);
+ if (referers != null)
+ {
+ for(ManagedProperty prop : referers)
+ {
+ prop.setTargetManagedObject(mo);
+ }
+ unresolvedRefs.remove(key);
+ }
+ }
}
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/TestManagedObjectDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/TestManagedObjectDeployer.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/support/TestManagedObjectDeployer.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.deployers.managed.support;
+import java.util.Collection;
import java.util.Map;
import java.util.Set;
@@ -63,7 +64,7 @@
attachment = attachment.clone();
ManagedObjectImpl managedObject = new ManagedObjectImpl(TestAttachment.class.getName());
managedObject.setAttachment(attachment);
- Set<ManagedProperty> properties = managedObject.getProperties();
+ Collection<ManagedProperty> properties = managedObject.getProperties().values();
properties.add(new ManagedPropertyImpl(managedObject, new TestFields(attachment, "string1")));
properties.add(new ManagedPropertyImpl(managedObject, new TestFields(attachment, "string2")));
managedObjects.put(TestAttachment.class.getName(), managedObject);
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -36,9 +36,12 @@
import org.jboss.deployers.plugins.attachments.AttachmentsImpl;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
+import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.GenericValue;
import org.jboss.reflect.plugins.ClassInfoImpl;
import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl;
import org.jboss.reflect.spi.AnnotationValue;
@@ -80,7 +83,7 @@
ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
ManagedObject mo = mof.createManagedObject(DSMetaData.class);
- Set<ManagedProperty> props = mo.getProperties();
+ Map<String, ManagedProperty> props = mo.getProperties();
assertEquals(2, props.size());
}
@@ -88,10 +91,10 @@
public void testManagedDeployment()
throws Exception
{
- MockProfileService ps = new MockProfileService();
DeployerClient main = getMainDeployer();
+ MockProfileService ps = new MockProfileService(main);
- // Deploy a datasource
+ // Deploy a datasource with local and xa factories
Deployment ctx1 = createSimpleDeployment("deployment1");
DSMetaData dsmd = new DSMetaData();
LocalDataSourceMetaData ds = new LocalDataSourceMetaData();
@@ -100,9 +103,9 @@
ds.setMinSize(10);
ds.setPassword("password1".toCharArray());
ds.setUsername("username1");
- SecMetaData smd = new SecMetaData();
- smd.setDomain("java:/jaas/domain1");
- ds.setSecurityMetaData(smd);
+ SecMetaData smd1 = new SecMetaData();
+ smd1.setDomain("java:/jaas/domain1");
+ ds.setSecurityMetaData(smd1);
XADataSourceMetaData xads = new XADataSourceMetaData();
xads.setJndiName("java:DefaultXADS2");
@@ -112,7 +115,9 @@
ds.setUsername("username2");
xads.setXaDataSourceClass("org.jboss.xa.SomeXADS");
xads.setXaResourceTimeout(300);
- xads.setSecurityMetaData(smd);
+ SecMetaData smd2 = new SecMetaData();
+ smd2.setDomain("java:/jaas/domain2");
+ xads.setSecurityMetaData(smd2);
ArrayList<ConnMetaData> deployments = new ArrayList<ConnMetaData>();
deployments.add(ds);
@@ -121,32 +126,86 @@
MutableAttachments a1 = (MutableAttachments) ctx1.getPredeterminedManagedObjects();
a1.addAttachment(DSMetaData.class, dsmd);
- main.addDeployment(ctx1);
+ ps.addDeployment(ctx1);
- // Deploy a security domain
- Deployment ctx2 = createSimpleDeployment("deployment2");
- MutableAttachments a2 = (MutableAttachments) ctx2.getPredeterminedManagedObjects();
- SecurityDeployment sd = new SecurityDeployment();
- a2.addAttachment(SecurityDeployment.class, sd);
- main.addDeployment(ctx2);
- main.process();
+ // Deploy security domain1
+ Deployment secCtx1 = createSimpleDeployment("sec-domain1");
+ MutableAttachments sda1 = (MutableAttachments) secCtx1.getPredeterminedManagedObjects();
+ SecurityDeployment sd1 = new SecurityDeployment();
+ sd1.setDomainName("java:/jaas/domain1");
+ sda1.addAttachment(SecurityDeployment.class, sd1);
+ ps.addDeployment(secCtx1);
+ // Deploy security domain2
+ Deployment secCtx2 = createSimpleDeployment("sec-domain2");
+ MutableAttachments sda2 = (MutableAttachments) secCtx2.getPredeterminedManagedObjects();
+ SecurityDeployment sd2 = new SecurityDeployment();
+ sd2.setDomainName("java:/jaas/domain2");
+ sda2.addAttachment(SecurityDeployment.class, sd2);
+ ps.addDeployment(secCtx2);
- //
- Map<String, ManagedObject> mds1 = main.getManagedObjects("deployment1");
- log.info("deployment1 ManagedObjects: " + mds1);
- for(ManagedObject mo : mds1.values())
- ps.processManagedObject(mo);
- Map<String, List<ManagedProperty>> unresolvedRefs = ps.getUnresolvedRefs();
+ // Process the deployments to build the ManagedObjects
+ ps.process();
+
+ // Validate the deployment1 ManagedObjects
+ ManagedDeployment mo1 = ps.getManagedDeployment("deployment1");
+ assertNotNull("deployment1 ManagedDeployment", mo1);
+ ManagedProperty deploymentsProp = mo1.getProperty("deployments");
+ assertNotNull("deployments prop", deploymentsProp);
+ // Get the deployments property MOs
+ Object deploymentsValue = deploymentsProp.getValue();
+ assertTrue("deploymentsValue instanceof ArrayValue", deploymentsValue instanceof ArrayValue);
+ ArrayValue deploymentsArray = (ArrayValue) deploymentsValue;
+ ManagedObject localDataMO = null;
+ ManagedObject xaDataMO = null;
+ for(int n = 0; n < deploymentsArray.getLength(); n ++)
+ {
+ GenericValue gv = (GenericValue) deploymentsArray.getValue(n);
+ ManagedObject propMO = (ManagedObject) gv.getValue();
+ if (propMO.getAttachmentName().equals(LocalDataSourceMetaData.class.getName()))
+ localDataMO = propMO;
+ else if (propMO.getAttachmentName().equals(XADataSourceMetaData.class.getName()))
+ xaDataMO = propMO;
+ }
+ // Get the LocalDataSourceMetaData/SecMetaData/domain ManagedProperty
+ assertNotNull("LocalDataSourceMetaData MO", localDataMO);
+ log.debug("LocalDataSourceMetaData MO.props: "+localDataMO.getProperties());
+ ManagedProperty localSecDomainProp = localDataMO.getProperty("security-domain");
+ assertNotNull("localSecDomainProp", localSecDomainProp);
+ GenericValue localSecDomainPropGV = (GenericValue) localSecDomainProp.getValue();
+ ManagedObject localSecDomainPropMO = (ManagedObject) localSecDomainPropGV.getValue();
+ ManagedProperty localSecDomainRefProp = localSecDomainPropMO.getProperty("domain-name");
+ assertNotNull("localSecDomainRefProp", localSecDomainRefProp);
+ // Get the XADataSourceMetaData/SecMetaData/domain ManagedProperty
+ log.debug("XADataSourceMetaData MO: "+xaDataMO);
+ assertNotNull("XADataSourceMetaData MO.props", xaDataMO.getProperties());
+ ManagedProperty xaSecDomainProp = localDataMO.getProperty("security-domain");
+ assertNotNull("xaSecDomainProp", xaSecDomainProp);
+ GenericValue xaSecDomainPropGV = (GenericValue) xaSecDomainProp.getValue();
+ ManagedObject xaSecDomainPropMO = (ManagedObject) xaSecDomainPropGV.getValue();
+ ManagedProperty xaSecDomainRefProp = xaSecDomainPropMO.getProperty("domain-name");
+ assertNotNull("xaSecDomainRefProp", xaSecDomainRefProp);
+
+ // Should be 0 unresolved ManagementObjectRef for the sec-domain1/sec-domain2
+ Map<String, Set<ManagedProperty>> unresolvedRefs = ps.getUnresolvedRefs();
log.info("unresolvedRefs: "+unresolvedRefs);
+ assertEquals("Should be 0 ManagementObjectRef", 0, unresolvedRefs.size());
- Map<String, ManagedObject> mds2 = main.getManagedObjects("deployment2");
- log.info("deployment2 ManagedObjects: " +mds2);
- for(ManagedObject mo : mds2.values())
- ps.processManagedObject(mo);
+ Map<String, ManagedObject> sd1MDs = main.getManagedObjects("sec-domain1");
+ Map<String, ManagedObject> sd2MDs = main.getManagedObjects("sec-domain2");
- //
+ // Validate that the sec-domain1 ManagedObject is the target of the localSecDomainRefProp
+ ManagedObject sd1MO = sd1MDs.get("org.jboss.test.deployers.deployer.support.SecurityDeployment");
+ assertNotNull("org.jboss.test.deployers.deployer.support.SecurityDeployment MO1", sd1MO);
+ ManagedObject localSecDomainPropTarget = localSecDomainRefProp.getTargetManagedObject();
+ assertEquals(sd1MO, localSecDomainPropTarget);
+
+ // Validate that the sec-domain2 ManagedObject is the target of the xaSecDomainRefProp
+ ManagedObject sd2MO = sd2MDs.get("org.jboss.test.deployers.deployer.support.SecurityDeployment");
+ assertNotNull("org.jboss.test.deployers.deployer.support.SecurityDeployment MO2", sd2MO);
+ ManagedObject xaSecDomainPropTarget = xaSecDomainRefProp.getTargetManagedObject();
+ assertEquals(sd2MO, xaSecDomainPropTarget);
}
-
+
protected DeployerClient getMainDeployer()
{
return createMainDeployer(deployer);
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/managed/test/DeployerManagedObjectUnitTestCase.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -144,14 +144,9 @@
ManagedObject mo = mof.createManagedObject(DSMetaData.class);
// Validate the expected properties
- Set<ManagedProperty> props = mo.getProperties();
- assertEquals(2, props.size());
- HashMap<String, ManagedProperty> propsMap = new HashMap<String, ManagedProperty>();
- for(ManagedProperty prop : props)
- {
- propsMap.put(prop.getName(), prop);
- }
- log.info("DSMetaData properties: "+props);
+ Map<String, ManagedProperty> propsMap = mo.getProperties();
+ assertEquals(2, propsMap.size());
+ log.info("DSMetaData properties: "+propsMap);
// display-name
ManagedProperty displayName = propsMap.get("display-name");
@@ -173,14 +168,9 @@
// Validate the ConnMetaData ManagedObject
ManagedObject localConnMO = ManagedObject.class.cast(value.getValue(0));
assertEquals(ConnMetaData.class.getName(), localConnMO.getName());
- props = localConnMO.getProperties();
- assertEquals(8, props.size());
- propsMap.clear();
- for(ManagedProperty prop : props)
- {
- propsMap.put(prop.getName(), prop);
- }
- log.info("ConnMetaData properties: "+props);
+ propsMap = localConnMO.getProperties();
+ assertEquals(8, propsMap.size());
+ log.info("ConnMetaData properties: "+propsMap);
ManagedProperty dsType = propsMap.get("datasource-type");
assertNotNull(dsType);
Set<MetaValue> dsTypeValues = dsType.getLegalValues();
@@ -204,14 +194,9 @@
ManagedObject mo = mof.initManagedObject(dsmd, null, null);
// Validate the expected properties
- Set<ManagedProperty> props = mo.getProperties();
- assertEquals(2, props.size());
- HashMap<String, ManagedProperty> propsMap = new HashMap<String, ManagedProperty>();
- for(ManagedProperty prop : props)
- {
- propsMap.put(prop.getName(), prop);
- }
- log.info("DSMetaData properties: "+props);
+ Map<String, ManagedProperty> propsMap = mo.getProperties();
+ assertEquals(2, propsMap.size());
+ log.info("DSMetaData properties: "+propsMap);
// display-name
ManagedProperty displayName = propsMap.get("display-name");
@@ -244,28 +229,18 @@
assertNotNull(xaConnMO);
// Validate the LocalDataSourceMetaData ManagedObject
- props = localConnMO.getProperties();
- assertEquals(8, props.size());
- propsMap.clear();
- for(ManagedProperty prop : props)
- {
- propsMap.put(prop.getName(), prop);
- }
- log.info("LocalDataSourceMetaData properties: "+props);
+ propsMap = localConnMO.getProperties();
+ assertEquals(8, propsMap.size());
+ log.info("LocalDataSourceMetaData properties: "+propsMap);
ManagedProperty dsType = propsMap.get("datasource-type");
assertNotNull(dsType);
Set<MetaValue> dsTypeValues = dsType.getLegalValues();
assertTrue(dsTypeValues.containsAll(AllowedDsTypes.values));
// Validate the XADataSourceMetaData ManagedObject
- props = xaConnMO.getProperties();
- assertEquals(10, props.size());
- propsMap.clear();
- for(ManagedProperty prop : props)
- {
- propsMap.put(prop.getName(), prop);
- }
- log.info("XADataSourceMetaData properties: "+props);
+ propsMap = xaConnMO.getProperties();
+ assertEquals(10, propsMap.size());
+ log.info("XADataSourceMetaData properties: "+propsMap);
ManagedProperty xaDataSourceClass = propsMap.get("xaDataSourceClass");
assertNotNull(xaDataSourceClass);
ManagedProperty xaResourceTimeout = propsMap.get("xaResourceTimeout");
Modified: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/managed/ManagedDeploymentCreator.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/managed/ManagedDeploymentCreator.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/managed/ManagedDeploymentCreator.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -21,8 +21,11 @@
*/
package org.jboss.deployers.spi.deployer.managed;
+import java.util.Map;
+
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
/**
* A plugin interface for building up a ManagedDeployment.
@@ -41,5 +44,6 @@
* @param unit - the deployment unit to process
* @param md - the unit ManagedDeployment
*/
- public ManagedDeployment build(DeploymentUnit unit);
+ public ManagedDeployment build(DeploymentUnit unit, Map<String, ManagedObject> unitMOs,
+ ManagedDeployment parent);
}
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedComponent.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedComponent.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedComponent.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -21,51 +21,21 @@
*/
package org.jboss.managed.api;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedProperty;
-
/**
* A runtime component associated with a deployment.
*
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public interface ManagedComponent
+public interface ManagedComponent extends ManagedObject
{
/**
- * The component name, typically only unique within the ManagedDeployment
- * @return omponent name
- */
- public String getName();
- /**
* The component classification as a type/subtype.
* @return component type.
*/
public ComponentType getType();
- /**
- * Get the managed property names
- *
- * @return the property names
- */
- public Set<String> getPropertyNames();
- /**
- * Get a property
- *
- * @param name the name
- * @return the property
- */
- public ManagedProperty getProperty(String name);
/**
- * Get the properties
- *
- * @return the properties
- */
- public Map<String, ManagedProperty> getProperties();
-
- /**
* The deployment the component is associated with.
* @return component deployment.
*/
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedDeployment.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedDeployment.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedDeployment.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -100,7 +100,16 @@
public Map<String, ManagedProperty> getProperties();
/**
+ * Get the managed object names
*
+ * @return the property names
+ */
+ public Set<String> getManagedObjectNames();
+ public Map<String, ManagedObject> getManagedObjects();
+ public ManagedObject getManagedObject(String name);
+
+ /**
+ *
* @return the parent
*/
public ManagedDeployment getParent();
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedObject.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedObject.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/ManagedObject.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -91,7 +91,7 @@
*
* @return the properties
*/
- Set<ManagedProperty> getProperties();
+ Map<String, ManagedProperty> getProperties();
/**
* Get the operations
Added: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/Defaults.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/Defaults.java (rev 0)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/Defaults.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.managed.api.annotation;
+
+/**
+ * Defaults for annotations
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Defaults
+{
+ @ManagementComponent(type="", subtype="")
+ private static class COMP_TYPE_CLASS {}
+ /** The ManagementComponent uninitialized default */
+ public static final ManagementComponent COMP_TYPE = defaultCompType();
+
+ public static synchronized ManagementComponent defaultCompType()
+ {
+ return COMP_TYPE_CLASS.class.getAnnotation(ManagementComponent.class);
+ }
+}
Property changes on: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/Defaults.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementComponent.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementComponent.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementComponent.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -33,9 +33,10 @@
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
- at Target({ElementType.METHOD})
+ at Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ManagementComponent
{
- String name() default "";
+ String type();
+ String subtype();
}
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementObject.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementObject.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementObject.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -45,17 +45,32 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface ManagementObject
{
- /** The name used for ManagementObjectRef resolution */
+ /** The name used for ManagementObjectRef resolution. Generally
+ * this is taken from a property annotated with
+ * {@linkplain ManagementObjectID}.
+ */
String name() default ManagementConstants.GENERATED;
- /** The name type used for ManagementObjectRef resolution */
+ /** The name type used for ManagementObjectRef resolution. Generally
+ * this is taken from a property annotated with
+ * {@linkplain ManagementObjectID}.
+ */
String type() default "";
/** The metadata attachment name for the ManagedObject */
String attachmentName() default "";
+ /** Is this a runtime extension of another ManagedObject. This
+ * is used to tie together
+ */
+ boolean isRuntime() default false;
+ /** The component type for MCs that are ManagedComponents */
+ ManagementComponent componentType() default @ManagementComponent(type="", subtype="");
+
/** What properties to include */
ManagementProperties properties() default ManagementProperties.ALL;
- /** The exposed operations */
+ /** The exposed operations. If empty
+ * TODO:
+ */
ManagementOperation[] operations() default {};
/** The class to use for the ManagedProperty implementation */
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementOperation.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementOperation.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementOperation.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -38,10 +38,8 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface ManagementOperation
{
- /** The runtime target for the operation. TODO: how is this resolved? */
- String target() ;
/** The name of the operation */
- String name();
+ String name() default "";
/** The detyped signature (ala jmx) of the operation */
String[] signature() default {};
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementProperty.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementProperty.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/api/annotation/ManagementProperty.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -63,7 +63,7 @@
boolean ignored() default false;
/** The views this property should be used in */
- ViewUse[] use() default {ViewUse.RUNTIME};
+ ViewUse[] use() default {ViewUse.CONFIGURATION};
/** The class to use for the ManagedProperty implementation */
Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
Deleted: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/BaseManagedObject.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/BaseManagedObject.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/BaseManagedObject.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.managed.plugins;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.managed.api.ManagedProperty;
-
-/**
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class BaseManagedObject implements Serializable
-{
- private static final long serialVersionUID = 1;
- private String simpleName;
- private Map<String, ManagedProperty> properties;
-
- public BaseManagedObject(String simpleName, Map<String, ManagedProperty> properties)
- {
- this.simpleName = simpleName;
- this.properties = properties;
- }
-
- public String getSimpleName()
- {
- return simpleName;
- }
- public String getName()
- {
- return simpleName;
- }
-
- /**
- * Get the managed property names
- *
- * @return the property names
- */
- public Set<String> getPropertyNames()
- {
- return properties.keySet();
- }
-
- /**
- * Get a property
- *
- * @param name the name
- * @return the property
- */
- public ManagedProperty getProperty(String name)
- {
- ManagedProperty prop = properties.get(name);
- return prop;
- }
-
- /**
- * Get the properties
- *
- * @return the properties
- */
- public Map<String, ManagedProperty> getProperties()
- {
- return properties;
- }
-
- /**
- * Append the name and props
- * @param sb the buffer to append the name and props to
- */
- protected void toString(StringBuilder sb)
- {
- sb.append("simpleName=");
- sb.append(simpleName);
- sb.append(", properties=");
- sb.append(properties);
- }
-}
Added: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DelegateManagedObjectImpl.java (rev 0)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DelegateManagedObjectImpl.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.managed.plugins;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+
+/**
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class DelegateManagedObjectImpl
+ implements ManagedObject
+{
+ private static final long serialVersionUID = 1;
+ private ManagedObject delegate;
+
+ public DelegateManagedObjectImpl(ManagedObject delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Map<String, Annotation> getAnnotations()
+ {
+ return delegate.getAnnotations();
+ }
+
+ public Serializable getAttachment()
+ {
+ return delegate.getAttachment();
+ }
+
+ public String getAttachmentName()
+ {
+ return delegate.getAttachmentName();
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
+ public String getNameType()
+ {
+ return delegate.getNameType();
+ }
+
+ public Set<ManagedOperation> getOperations()
+ {
+ return delegate.getOperations();
+ }
+
+ public Map<String, ManagedProperty> getProperties()
+ {
+ return delegate.getProperties();
+ }
+
+ public ManagedProperty getProperty(String name)
+ {
+ return delegate.getProperty(name);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return delegate.getPropertyNames();
+ }
+
+
+}
Property changes on: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DelegateManagedObjectImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedComponentImpl.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedComponentImpl.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedComponentImpl.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -22,11 +22,14 @@
package org.jboss.managed.plugins;
import java.io.Serializable;
+import java.util.HashSet;
import java.util.Map;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
/**
@@ -34,7 +37,7 @@
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public class ManagedComponentImpl extends BaseManagedObject
+public class ManagedComponentImpl extends DelegateManagedObjectImpl
implements ManagedComponent, Serializable
{
private static final long serialVersionUID = 1;
@@ -42,13 +45,14 @@
private ManagedDeployment owner;
private ComponentType type;
- ManagedComponentImpl(String name, ComponentType type, Map<String, ManagedProperty> properties, ManagedDeployment owner)
+ public ManagedComponentImpl(ComponentType type, ManagedDeployment owner,
+ ManagedObject mo)
{
- super(name, properties);
+ super(mo);
this.type = type;
this.owner = owner;
}
-
+
public ManagedDeployment getDeployment()
{
return owner;
@@ -63,7 +67,8 @@
{
StringBuilder tmp = new StringBuilder(super.toString());
tmp.append('{');
- super.toString(tmp);
+ tmp.append("name=");
+ tmp.append(super.getName());
tmp.append(", type=");
tmp.append(type);
tmp.append(", owner=ManagedDeployment@");
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedDeploymentImpl.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedDeploymentImpl.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedDeploymentImpl.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -31,6 +31,7 @@
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
/**
@@ -39,32 +40,43 @@
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public class ManagedDeploymentImpl extends BaseManagedObject
+public class ManagedDeploymentImpl
implements ManagedDeployment, Serializable
{
private static final long serialVersionUID = 1;
private String name;
+ private String simpleName;
private Set<String> types;
private DeploymentPhase phase;
private ManagedDeployment parent;
+ private Map<String, ManagedObject> unitMOs;
+ private Map<String, ManagedProperty> properties;
private Map<String, ManagedComponent> components = new HashMap<String, ManagedComponent>();
private ArrayList<ManagedDeployment> children = new ArrayList<ManagedDeployment>();
- public ManagedDeploymentImpl(String name, DeploymentPhase phase,
- Map<String, ManagedProperty> properties,
- ManagedDeployment parent)
+ public ManagedDeploymentImpl(String name, String simpleName, DeploymentPhase phase,
+ ManagedDeployment parent, Map<String, ManagedObject> unitMOs)
{
// TODO: simple vs full deployment name
- super(name, properties);
this.name = name;
this.phase = phase;
this.parent = parent;
+ this.unitMOs = unitMOs;
+ properties = new HashMap<String, ManagedProperty>();
+ for(ManagedObject mo : unitMOs.values())
+ {
+ properties.putAll(mo.getProperties());
+ }
}
-
+
public String getName()
{
return name;
}
+ public String getSimpleName()
+ {
+ return simpleName;
+ }
public boolean addType(String type)
{
@@ -130,11 +142,40 @@
return null;
}
+ public Map<String, ManagedProperty> getProperties()
+ {
+ return properties;
+ }
+
+ public ManagedProperty getProperty(String name)
+ {
+ return properties.get(name);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return properties.keySet();
+ }
+
+ public Set<String> getManagedObjectNames()
+ {
+ return unitMOs.keySet();
+ }
+ public Map<String, ManagedObject> getManagedObjects()
+ {
+ return unitMOs;
+ }
+ public ManagedObject getManagedObject(String name)
+ {
+ return unitMOs.get(name);
+ }
+
public String toString()
{
StringBuilder tmp = new StringBuilder(super.toString());
tmp.append('{');
- super.toString(tmp);
+ tmp.append("name=");
+ tmp.append(getName());
tmp.append(", types=");
tmp.append(types);
tmp.append(", phase=");
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedObjectImpl.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedObjectImpl.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/ManagedObjectImpl.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -57,7 +57,7 @@
/** The object annotations <Class name, Annotation> */
private Map<String, Annotation> annotations = Collections.emptyMap();
/** The properties */
- private Set<ManagedProperty> properties;
+ private Map<String, ManagedProperty> properties;
/** The operations */
private Set<ManagedOperation> operations;
@@ -68,7 +68,7 @@
*/
public ManagedObjectImpl(String name)
{
- this(name, new HashSet<ManagedProperty>(), new HashSet<ManagedOperation>(), null);
+ this(name, name, null, toMap(null), new HashSet<ManagedOperation>(), null);
}
/**
@@ -79,7 +79,7 @@
*/
public ManagedObjectImpl(String name, Set<ManagedProperty> properties)
{
- this(name, properties, new HashSet<ManagedOperation>(), null);
+ this(name, name, null, properties, new HashSet<ManagedOperation>(), null);
}
/**
@@ -92,18 +92,22 @@
public ManagedObjectImpl(String name, Set<ManagedProperty> properties,
HashSet<ManagedOperation> operations)
{
- this(name, properties, operations, null);
+ this(name, name, null, properties, operations, null);
}
/**
* Create a new ManagedObjectImpl
*
* @param name - The object name used for ManagementRef resolution
+ * @param nameType - The name type/qualifier used for ManagementRef resolution
+ * @param attachmentName the attachment name
* @param properties the properties
* @param operations the operations
* @param attachment the attachment
*/
- public ManagedObjectImpl(String name, Set<ManagedProperty> properties,
+ public ManagedObjectImpl(String name, String nameType,
+ String attachmentName,
+ Set<ManagedProperty> properties,
HashSet<ManagedOperation> operations, Serializable attachment)
{
if (name == null)
@@ -112,22 +116,14 @@
throw new IllegalArgumentException("Null properties");
this.name = name;
- this.properties = properties;
+ this.properties = toMap(properties);
this.operations = operations;
setAttachment(attachment);
}
-
- /**
- * Create a new ManagedObjectImpl
- *
- * @param name - The object name used for ManagementRef resolution
- * @param nameType - The name type/qualifier used for ManagementRef resolution
- * @param attachmentName the attachment name
- * @param properties the properties
- * @param attachment the attachment
- */
- public ManagedObjectImpl(String name, String nameType, String attachmentName,
- Set<ManagedProperty> properties, Serializable attachment)
+ public ManagedObjectImpl(String name, String nameType,
+ String attachmentName,
+ Map<String, ManagedProperty> properties,
+ HashSet<ManagedOperation> operations, Serializable attachment)
{
if (name == null)
throw new IllegalArgumentException("Null name");
@@ -135,9 +131,8 @@
throw new IllegalArgumentException("Null properties");
this.name = name;
- this.nameType = nameType;
- this.attachmentName = attachmentName;
this.properties = properties;
+ this.operations = operations;
setAttachment(attachment);
}
@@ -186,10 +181,7 @@
public Set<String> getPropertyNames()
{
- Set<String> result = new HashSet<String>(properties.size());
- for (ManagedProperty property : properties)
- result.add(property.getName());
- return result;
+ return properties.keySet();
}
public ManagedProperty getProperty(String name)
@@ -197,15 +189,10 @@
if (name == null)
throw new IllegalArgumentException("Null name");
- for (ManagedProperty property : properties)
- {
- if (name.equals(property.getName()))
- return property;
- }
- return null;
+ return properties.get(name);
}
- public Set<ManagedProperty> getProperties()
+ public Map<String, ManagedProperty> getProperties()
{
return properties;
}
@@ -253,4 +240,33 @@
{
return "ManagedObject{" + name + "}";
}
+
+ /**
+ * Append the name and props
+ * @param sb the buffer to append the name and props to
+ */
+ protected void toString(StringBuilder sb)
+ {
+ sb.append("name=");
+ sb.append(name);
+ sb.append(", nameType=");
+ sb.append(nameType);
+ sb.append(", attachmentName=");
+ sb.append(attachmentName);
+ sb.append(", properties=");
+ sb.append(properties);
+ }
+
+ private static Map<String, ManagedProperty> toMap(Set<ManagedProperty> props)
+ {
+ HashMap<String, ManagedProperty> properties = new HashMap<String, ManagedProperty>();
+ if (props != null)
+ {
+ for (ManagedProperty prop : props)
+ {
+ properties.put(prop.getName(), prop);
+ }
+ }
+ return properties;
+ }
}
Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/factory/AbstractManagedObjectFactory.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -460,10 +460,10 @@
{
BeanInfo beanInfo = configuration.getBeanInfo(object.getClass());
- Set<ManagedProperty> properties = managedObject.getProperties();
+ Map<String, ManagedProperty> properties = managedObject.getProperties();
if (properties != null && properties.size() > 0)
{
- for (ManagedProperty property : properties)
+ for (ManagedProperty property : properties.values())
{
MetaValue value = getValue(beanInfo, property, object);
if (value != null)
Modified: projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockDataSourceManagedObject.java
===================================================================
--- projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockDataSourceManagedObject.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockDataSourceManagedObject.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.managed.mock;
+import java.util.Map;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
@@ -74,11 +75,11 @@
throw new RuntimeException("Error creating dom", e);
}
- Set<ManagedProperty> properties = getProperties();
- properties.add(new ManagedPropertyImpl(this, new MockDOMFields(element, "jndi-name")));
- properties.add(new ManagedPropertyImpl(this, new MockDOMFields(element, "connection-url")));
- properties.add(new ManagedPropertyImpl(this, new MockDOMFields(element, "user")));
- properties.add(new ManagedPropertyImpl(this, new MockDOMFields(element, "password")));
+ Map<String, ManagedProperty> properties = getProperties();
+ properties.put("jndi-name", new ManagedPropertyImpl(this, new MockDOMFields(element, "jndi-name")));
+ properties.put("connection-url", new ManagedPropertyImpl(this, new MockDOMFields(element, "connection-url")));
+ properties.put("user", new ManagedPropertyImpl(this, new MockDOMFields(element, "user")));
+ properties.put("password", new ManagedPropertyImpl(this, new MockDOMFields(element, "password")));
}
/**
Modified: projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockTest.java
===================================================================
--- projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockTest.java 2007-08-24 00:56:33 UTC (rev 64836)
+++ projects/microcontainer/trunk/managed/src/tests/org/jboss/test/managed/mock/MockTest.java 2007-08-24 01:00:49 UTC (rev 64837)
@@ -95,7 +95,7 @@
getLog().debug(mock.prettyPrint());
getLog().debug("Displaying properties...");
- for (ManagedProperty property : mo.getProperties())
+ for (ManagedProperty property : mo.getProperties().values())
getLog().debug(property.getName() + "=" + property.getValue());
ManagedProperty jndiName = mo.getProperty("jndi-name");
More information about the jboss-cvs-commits
mailing list