[jboss-cvs] JBossAS SVN: r91266 - in branches/Branch_5_x: main and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 14 18:35:44 EDT 2009


Author: ALRubinger
Date: 2009-07-14 18:35:44 -0400 (Tue, 14 Jul 2009)
New Revision: 91266

Modified:
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/main/build.xml
   branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
   branches/Branch_5_x/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml
   branches/Branch_5_x/server/src/main/org/jboss/naming/NamingProviderURLWriter.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImpl.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImplMBean.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
   branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernelMBean.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java
Log:
[JBAS-7098] Update AS to new jboss-bootstrap Alphas and refactor for extensible JBossASBasedServer

Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-07-14 22:35:44 UTC (rev 91266)
@@ -54,11 +54,11 @@
     <version.org.jboss.aspects.currentinvocation>1.0.0.GA</version.org.jboss.aspects.currentinvocation>
     <version.org.jboss.aspects.remoting>1.0.1.GA</version.org.jboss.aspects.remoting>
     <version.org.jboss.aspects.security>1.0.1</version.org.jboss.aspects.security>
-    <version.org.jboss.bootstrap.impl.as>2.0.0-alpha-2</version.org.jboss.bootstrap.impl.as>
-    <version.org.jboss.bootstrap.impl.base>2.0.0-alpha-2</version.org.jboss.bootstrap.impl.base>
-    <version.org.jboss.bootstrap.impl.mc>2.0.0-alpha-1</version.org.jboss.bootstrap.impl.mc>
+    <version.org.jboss.bootstrap.impl.as>2.0.0-alpha-3</version.org.jboss.bootstrap.impl.as>
+    <version.org.jboss.bootstrap.impl.base>2.0.0-alpha-3</version.org.jboss.bootstrap.impl.base>
+    <version.org.jboss.bootstrap.impl.mc>2.0.0-alpha-2</version.org.jboss.bootstrap.impl.mc>
     <version.org.jboss.bootstrap.spi>2.0.0-alpha-2</version.org.jboss.bootstrap.spi>
-    <version.org.jboss.bootstrap.spi.as>2.0.0-alpha-2</version.org.jboss.bootstrap.spi.as>
+    <version.org.jboss.bootstrap.spi.as>2.0.0-alpha-3</version.org.jboss.bootstrap.spi.as>
     <version.org.jboss.bootstrap.spi.mc>2.0.0-alpha-1</version.org.jboss.bootstrap.spi.mc>
     <version.org.jboss.aspects.transaction>1.0.0.GA</version.org.jboss.aspects.transaction>
     <version.org.jboss.cache.core>3.1.0.GA</version.org.jboss.cache.core>

Modified: branches/Branch_5_x/main/build.xml
===================================================================
--- branches/Branch_5_x/main/build.xml	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/main/build.xml	2009-07-14 22:35:44 UTC (rev 91266)
@@ -195,6 +195,7 @@
       </fileset>
       <fileset dir="${inflated.spi.as.dir}">
         <include name="org/jboss/bootstrap/spi/as/config/JBossASServerConfig.class"/>
+      	<include name="org/jboss/bootstrap/spi/as/config/JBossASBasedServerConfig.class"/>
       	<include name="org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.class"/>
       </fileset>
       <fileset dir="${inflated.spi.mc.dir}">

Modified: branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-07-14 22:35:44 UTC (rev 91266)
@@ -151,7 +151,7 @@
          <!-- Here we use the constructor version that takes the Server impl and 
               uses it to find the data dir. You could alternatively use a version 
               that takes a URI or a File. -->
-         <parameter class="org.jboss.bootstrap.spi.as.server.JBossASServer"><inject bean="JBossServer"/></parameter>
+         <parameter class="org.jboss.bootstrap.spi.as.server.JBossASBasedServer"><inject bean="JBossServer"/></parameter>
       </constructor>
    </bean>
          

Modified: branches/Branch_5_x/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml	2009-07-14 22:35:44 UTC (rev 91266)
@@ -31,7 +31,7 @@
    <attribute access="write-only" setMethod="setServer">
        <description>Server object from which the OutputDirURL can be obtained if not directly configured</description>
        <name>Server</name>
-       <type>org.jboss.bootstrap.spi.as.server.JBossASServer</type>
+       <type>org.jboss.bootstrap.spi.as.server.JBossASBasedServer</type>
    </attribute>
    
    <attribute access="read-write" getMethod="getBootstrapURL" setMethod="setBootstrapURL">

Modified: branches/Branch_5_x/server/src/main/org/jboss/naming/NamingProviderURLWriter.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/naming/NamingProviderURLWriter.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/server/src/main/org/jboss/naming/NamingProviderURLWriter.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -26,7 +26,7 @@
 import java.io.PrintWriter;
 import java.net.URI;
 
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 import org.jboss.logging.Logger;
 
 /**
@@ -43,7 +43,7 @@
    private static final Logger log = Logger.getLogger(NamingProviderURLWriter.class);
    
    private String bootstrapUrl;
-   private JBossASServer server;
+   private JBossASBasedServer<?, ?> server;
    private URI outputDir;
    private String filename = DEFAULT_PERSIST_FILE_NAME;
    private File outputFile;
@@ -68,7 +68,7 @@
       this.filename = name;
    }
 
-   public void setServer(JBossASServer server)
+   public void setServer(JBossASBasedServer<?, ?> server)
    {
       this.server = server;
    }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -36,8 +36,8 @@
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.bootstrap.spi.as.JBossASBootstrap;
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.deployers.client.spi.IncompleteDeploymentException;
@@ -94,7 +94,10 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class ProfileServiceBootstrap implements JBossASBootstrap, KernelRegistryPlugin
+public class ProfileServiceBootstrap<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+      implements
+         JBossASBootstrap<K, T>,
+         KernelRegistryPlugin
 {
    /** The log */
    private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
@@ -222,7 +225,7 @@
    /**
     * 
     */
-   public void start(JBossASServer server)
+   public void start(K server)
       throws Exception
    {
       shutdown.set(false);
@@ -290,14 +293,14 @@
       }
    }
 
-   public void prepareShutdown(JBossASServer server)
+   public void prepareShutdown(K server)
    {
       shutdown.set(true);
       if (mainDeployer != null)
          mainDeployer.prepareShutdown();
    }
 
-   public void shutdown(JBossASServer server)
+   public void shutdown(K server)
    {
       // Disable modification checks on all mutable profiles
       for(ProfileKey key : profileService.getActiveProfileKeys())
@@ -400,167 +403,162 @@
     * @param server - the Bootstrap.start Server instance. This must be an
     * MCServer in order for there to be KernelDeployments available.
     */
-   protected void initBootstrapMDs(JBossASServer server)
+   protected void initBootstrapMDs(K server)
    {
-      if(mof == null || mgtDeploymentCreator == null)
+      if (mof == null || mgtDeploymentCreator == null)
       {
          log.warn("Skipping ManagedDeployment creation due to missing mof, mgtDeploymentCreator");
          return;
       }
 
       Map<String, KernelDeployment> serverDeployments = null;
-      if(server instanceof JBossASServer)
+      // Build ManagedDeployments for the KernelDeployments
+      Kernel kernel = server.getKernel();
+      serverDeployments = server.getDeployments();
+      ManagedDeployment firstDeployment = null;
+      for (KernelDeployment kd : serverDeployments.values())
       {
-         // Build ManagedDeployments for the KernelDeployments
-         JBossASServer mcserver = JBossASServer.class.cast(server);
-         Kernel kernel = mcserver.getKernel();
-         serverDeployments = mcserver.getDeployments();
-         ManagedDeployment firstDeployment = null;
-         for(KernelDeployment kd : serverDeployments.values())
+         BootstrapDeployment deploymentUnit = new BootstrapDeployment(kd);
+         KernelDeploymentVisitor visitor = new KernelDeploymentVisitor();
+         try
          {
-            BootstrapDeployment deploymentUnit = new BootstrapDeployment(kd);
-            KernelDeploymentVisitor visitor = new KernelDeploymentVisitor();
-            try
-            {
-               visitor.deploy(deploymentUnit, kd);
-            }
-            catch(DeploymentException e)
-            {
-               log.debug("Failed to build ManagedDeployment for: "+kd, e);
-               continue;
-            }
+            visitor.deploy(deploymentUnit, kd);
+         }
+         catch (DeploymentException e)
+         {
+            log.debug("Failed to build ManagedDeployment for: " + kd, e);
+            continue;
+         }
 
-            /* Create minimal deployment ManagedObject. Don't use the ManagedObjectFactory
-             * as this will create ManagedObjects for the beans via the beansFactory
-             * property. We handle the beans below.
-            */
-            Set<ManagedProperty> kdProperties = new HashSet<ManagedProperty>();
-            HashSet<ManagedOperation> ops = null;
-            ManagedObject kdMO = new ManagedObjectImpl(kd.getName(), "",
-                  KernelDeployment.class.getName(),
-                  kdProperties, ops, (Serializable) kd);
-            Map<String, ManagedObject> kdMOs = new HashMap<String, ManagedObject>();
-            kdMOs.put(kd.getName(), kdMO);
+         /* Create minimal deployment ManagedObject. Don't use the ManagedObjectFactory
+          * as this will create ManagedObjects for the beans via the beansFactory
+          * property. We handle the beans below.
+         */
+         Set<ManagedProperty> kdProperties = new HashSet<ManagedProperty>();
+         HashSet<ManagedOperation> ops = null;
+         ManagedObject kdMO = new ManagedObjectImpl(kd.getName(), "", KernelDeployment.class.getName(), kdProperties,
+               ops, (Serializable) kd);
+         Map<String, ManagedObject> kdMOs = new HashMap<String, ManagedObject>();
+         kdMOs.put(kd.getName(), kdMO);
 
-            // Traverse the deployment components 
-            for(DeploymentUnit compUnit : deploymentUnit.getComponents())
-            {
-               BeanMetaData bmd = compUnit.getAttachment(BeanMetaData.class);
-               ManagedObject bmdMO = mof.initManagedObject(bmd, compUnit.getMetaData());
-               if(bmdMO == null)
-                  continue;
+         // Traverse the deployment components 
+         for (DeploymentUnit compUnit : deploymentUnit.getComponents())
+         {
+            BeanMetaData bmd = compUnit.getAttachment(BeanMetaData.class);
+            ManagedObject bmdMO = mof.initManagedObject(bmd, compUnit.getMetaData());
+            if (bmdMO == null)
+               continue;
 
-               Map<String, Annotation> moAnns = bmdMO.getAnnotations();
-               ManagementObject mo = (ManagementObject) moAnns.get(ManagementObject.class.getName());
-               // Reset the name to the bean name rather than the attachment name
-               if(bmdMO instanceof MutableManagedObject)
+            Map<String, Annotation> moAnns = bmdMO.getAnnotations();
+            ManagementObject mo = (ManagementObject) moAnns.get(ManagementObject.class.getName());
+            // Reset the name to the bean name rather than the attachment name
+            if (bmdMO instanceof MutableManagedObject)
+            {
+               MutableManagedObject mmo = (MutableManagedObject) bmdMO;
+               // Reset the name to the bean name if its the attachment name
+               if (mmo.getName().equals(mmo.getAttachmentName()))
+                  mmo.setName(bmd.getName());
+               mmo.setParent(kdMO);
+               // Add an alias property
+               Set<Object> bmdAliases = bmd.getAliases();
+               Map<String, ManagedProperty> oldProps = mmo.getProperties();
+               Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
+               if (bmdAliases != null && bmdAliases.size() > 0)
                {
-                  MutableManagedObject mmo = (MutableManagedObject) bmdMO;
-                  // Reset the name to the bean name if its the attachment name
-                  if(mmo.getName().equals(mmo.getAttachmentName()))
-                     mmo.setName(bmd.getName());
-                  mmo.setParent(kdMO);
-                  // Add an alias property
-                  Set<Object> bmdAliases = bmd.getAliases();
-                  Map<String, ManagedProperty> oldProps = mmo.getProperties();
-                  Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
-                  if(bmdAliases != null && bmdAliases.size() > 0)
+                  ArrayMetaType aliasType = new ArrayMetaType(SimpleMetaType.STRING, false);
+                  DefaultFieldsImpl fields = getFields("alias", aliasType);
+                  fields.setDescription("Aliases of the bean");
+                  String[] aliases = new String[bmdAliases.size()];
+                  Iterator<?> i = bmdAliases.iterator();
+                  for (int n = 0; i.hasNext(); n++)
                   {
-                     ArrayMetaType aliasType = new ArrayMetaType(SimpleMetaType.STRING, false);
-                     DefaultFieldsImpl fields = getFields("alias", aliasType);
-                     fields.setDescription("Aliases of the bean");
-                     String[] aliases = new String[bmdAliases.size()];
-                     Iterator<?> i = bmdAliases.iterator();
-                     for(int n = 0; i.hasNext(); n++)
-                     {
-                        aliases[n] = i.next().toString();
-                     }
-                     ArrayValueSupport value = new ArrayValueSupport(aliasType, aliases);
-                     fields.setValue(value);
-                     ManagedPropertyImpl aliasesMP = new ManagedPropertyImpl(bmdMO, fields);
-                     newProps.put("alias", aliasesMP);
+                     aliases[n] = i.next().toString();
                   }
-                  // Add a state property
-                  DefaultFieldsImpl stateFields = getFields("state", ControllerStateMetaType.TYPE);
-                  stateFields.setViewUse(new ViewUse[]{ViewUse.STATISTIC});
-                  EnumValue stateValue = getState(bmd.getName(), kernel);
-                  stateFields.setValue(stateValue);
-                  stateFields.setDescription("The bean controller state");
-                  ManagedPropertyImpl stateMP = new ManagedPropertyImpl(mmo, stateFields);
-                  newProps.put("state", stateMP);
-                  // Update the properties
-                  mmo.setProperties(newProps);
+                  ArrayValueSupport value = new ArrayValueSupport(aliasType, aliases);
+                  fields.setValue(value);
+                  ManagedPropertyImpl aliasesMP = new ManagedPropertyImpl(bmdMO, fields);
+                  newProps.put("alias", aliasesMP);
                }
-               log.debug("Created ManagedObject: "+bmdMO+" for bean: "+bmd.getName());
-               kdMOs.put(bmd.getName(), bmdMO);
-
+               // Add a state property
+               DefaultFieldsImpl stateFields = getFields("state", ControllerStateMetaType.TYPE);
+               stateFields.setViewUse(new ViewUse[]
+               {ViewUse.STATISTIC});
+               EnumValue stateValue = getState(bmd.getName(), kernel);
+               stateFields.setValue(stateValue);
+               stateFields.setDescription("The bean controller state");
+               ManagedPropertyImpl stateMP = new ManagedPropertyImpl(mmo, stateFields);
+               newProps.put("state", stateMP);
+               // Update the properties
+               mmo.setProperties(newProps);
             }
-            // Create the ManagedDeployment
-            ManagedDeployment md = mgtDeploymentCreator.build(deploymentUnit, kdMOs, null);
-            if(firstDeployment == null)
-               firstDeployment = md;
-            // Create the ManagedComponents
-            for(ManagedObject bmdMO : kdMOs.values())
-            {
-               if(bmdMO.getAttachmentName().equals(KernelDeployment.class.getName()))
-                  continue;
+            log.debug("Created ManagedObject: " + bmdMO + " for bean: " + bmd.getName());
+            kdMOs.put(bmd.getName(), bmdMO);
 
-               ComponentType type = KnownComponentTypes.MCBean.Any.getType();
-               Map<String, Annotation> moAnns = bmdMO.getAnnotations();
-               ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
-               if(mc != null)
-               {
-                  type = new ComponentType(mc.type(), mc.subtype());
-               }
-               ManagedComponentImpl comp = new ManagedComponentImpl(type, md, bmdMO);
-               md.addComponent(bmdMO.getName(), comp);
-               log.debug("Created ManagedComponent("+comp.getName()+") of type: "
-                     +type
-                     +" for MO: "+bmdMO.getName()
-                     +", componentName: "+bmdMO.getComponentName());               
-            }
+         }
+         // Create the ManagedDeployment
+         ManagedDeployment md = mgtDeploymentCreator.build(deploymentUnit, kdMOs, null);
+         if (firstDeployment == null)
+            firstDeployment = md;
+         // Create the ManagedComponents
+         for (ManagedObject bmdMO : kdMOs.values())
+         {
+            if (bmdMO.getAttachmentName().equals(KernelDeployment.class.getName()))
+               continue;
 
-            if(md != null)
-               bootstrapMDs.put(kd.getName(), md);
+            ComponentType type = KnownComponentTypes.MCBean.Any.getType();
+            Map<String, Annotation> moAnns = bmdMO.getAnnotations();
+            ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
+            if (mc != null)
+            {
+               type = new ComponentType(mc.type(), mc.subtype());
+            }
+            ManagedComponentImpl comp = new ManagedComponentImpl(type, md, bmdMO);
+            md.addComponent(bmdMO.getName(), comp);
+            log.debug("Created ManagedComponent(" + comp.getName() + ") of type: " + type + " for MO: "
+                  + bmdMO.getName() + ", componentName: " + bmdMO.getComponentName());
          }
 
-         // Add other Server managed objects
-         if(firstDeployment != null)
+         if (md != null)
+            bootstrapMDs.put(kd.getName(), md);
+      }
+
+      // Add other Server managed objects
+      if (firstDeployment != null)
+      {
+         ComponentType type = new ComponentType("MCBean", "MCServer");
+         ManagedObject serverMO = mof.initManagedObject(server, null);
+         if (serverMO.getOperations() != null && serverMO.getOperations().size() == 0)
          {
-            ComponentType type = new ComponentType("MCBean", "MCServer");
-            ManagedObject serverMO = mof.initManagedObject(mcserver, null);
-            if (serverMO.getOperations() != null && serverMO.getOperations().size() == 0)
+            ManagedOperationImpl shutdown = new ManagedOperationImpl("Shutdown the server", "shutdown");
+            if (serverMO instanceof MutableManagedObject)
             {
-               ManagedOperationImpl shutdown = new ManagedOperationImpl("Shutdown the server", "shutdown");
-               if(serverMO instanceof MutableManagedObject)
-               {
-                  HashSet<ManagedOperation> ops = new HashSet<ManagedOperation>();
-                  ops.add(shutdown);
-                  MutableManagedObject mmo = MutableManagedObject.class.cast(serverMO);
-                  mmo.setOperations(ops);
-               }
+               HashSet<ManagedOperation> ops = new HashSet<ManagedOperation>();
+               ops.add(shutdown);
+               MutableManagedObject mmo = MutableManagedObject.class.cast(serverMO);
+               mmo.setOperations(ops);
             }
-            ManagedComponentImpl serverComp = new ManagedComponentImpl(type, firstDeployment, serverMO);
-            firstDeployment.addComponent("MCServer", serverComp);
-            try
-            {
-               BeanInfo mcserverInfo = configurator.getBeanInfo(mcserver.getClass());
-               BeanKernelRegistryEntry entry = new BeanKernelRegistryEntry(mcserver, mcserverInfo);
-               bootstrapEntries.put(serverComp.getComponentName(), entry);
-            }
-            catch(Throwable t)
-            {
-               log.error("Failed to create BeanInfo for: "+serverComp, t);
-            }
-            // ServerConfig
-            type = new ComponentType("MCBean", "ServerConfig");
-            JBossASServerConfig config = mcserver.getConfiguration();
-            ManagedObject mo = mof.initManagedObject(config, null);
-            ManagedComponentImpl configComp = new ManagedComponentImpl(type, firstDeployment, mo);
-            firstDeployment.addComponent("ServerConfig", configComp);
-            log.debug("Created ManagedComponent of type: "+type+" for ServerConfig");
          }
+         ManagedComponentImpl serverComp = new ManagedComponentImpl(type, firstDeployment, serverMO);
+         firstDeployment.addComponent("MCServer", serverComp);
+         try
+         {
+            BeanInfo mcserverInfo = configurator.getBeanInfo(server.getClass());
+            BeanKernelRegistryEntry entry = new BeanKernelRegistryEntry(server, mcserverInfo);
+            bootstrapEntries.put(serverComp.getComponentName(), entry);
+         }
+         catch (Throwable t)
+         {
+            log.error("Failed to create BeanInfo for: " + serverComp, t);
+         }
+         // ServerConfig
+         type = new ComponentType("MCBean", "ServerConfig");
+         T config = server.getConfiguration();
+         ManagedObject mo = mof.initManagedObject(config, null);
+         ManagedComponentImpl configComp = new ManagedComponentImpl(type, firstDeployment, mo);
+         firstDeployment.addComponent("ServerConfig", configComp);
+         log.debug("Created ManagedComponent of type: " + type + " for ServerConfig");
       }
+
    }
 
    /**

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -30,7 +30,7 @@
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Marshaller;
 
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 import org.jboss.logging.Logger;
 import org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryContentMetadata;
 import org.jboss.xb.binding.Unmarshaller;
@@ -58,7 +58,7 @@
       resolver.addClassBindingForLocation("repository-content", RepositoryContentMetadata.class);
    }
    
-   public JAXBRepositoryContentMetadataPersister(JBossASServer server) throws Throwable
+   public JAXBRepositoryContentMetadataPersister(JBossASBasedServer<?, ?> server) throws Throwable
    {
       this(server.getConfiguration().getServerDataLocation());
    }

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImpl.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImpl.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImpl.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -25,7 +25,7 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
 
 /**
  * An mbean wrapper for the BaseServerConfig that exposes the config as the
@@ -34,9 +34,9 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public class ServerConfigImpl implements ServerConfigImplMBean
+public class ServerConfigImpl<T extends JBossASBasedServerConfig<T>> implements ServerConfigImplMBean<T>
 {
-   private JBossASServerConfig config;
+   private T config;
 
    /**
     * Construct a ServerConfigImpl with the ServerConfig pojo which will be used
@@ -44,12 +44,12 @@
     *
     * @param config - the ServerConfig pojo to expose as a ServerConfigImplMBean
     */
-   public ServerConfigImpl(JBossASServerConfig config)
+   public ServerConfigImpl(T config)
    {
       this.config = config;
    }
 
-   public JBossASServerConfig getConfig()
+   public T getConfig()
    {
       return config;
    }
@@ -63,46 +63,46 @@
     * All methods below this marker delegate to the underlying config 
     */
 
-   public JBossASServerConfig bindAddress(String arg0)
+   public T bindAddress(String arg0)
    {
       config.bindAddress(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootLibraryLocation(String arg0) throws IllegalArgumentException
+   public T bootLibraryLocation(String arg0) throws IllegalArgumentException
    {
       config.bootLibraryLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootLibraryLocation(URL arg0)
+   public T bootLibraryLocation(URL arg0)
    {
       config.bootLibraryLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig commonBaseLocation(String arg0) throws IllegalArgumentException
+   public T commonBaseLocation(String arg0) throws IllegalArgumentException
    {
       config.commonBaseLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig commonBaseLocation(URL arg0)
+   public T commonBaseLocation(URL arg0)
    {
       config.commonBaseLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig commonLibLocation(String arg0) throws IllegalArgumentException
+   public T commonLibLocation(String arg0) throws IllegalArgumentException
    {
       config.commonLibLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig commonLibLocation(URL arg0)
+   public T commonLibLocation(URL arg0)
    {
       config.commonLibLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
    public String getBindAddress()
@@ -195,172 +195,172 @@
       return config.isLoadNative();
    }
 
-   public JBossASServerConfig jbossHome(String arg0) throws IllegalArgumentException
+   public T jbossHome(String arg0) throws IllegalArgumentException
    {
       config.jbossHome(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig jbossHome(URL arg0)
+   public T jbossHome(URL arg0)
    {
       config.jbossHome(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig loadNative(Boolean arg0)
+   public T loadNative(Boolean arg0)
    {
       config.loadNative(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig nativeLibraryLocation(String arg0) throws IllegalArgumentException
+   public T nativeLibraryLocation(String arg0) throws IllegalArgumentException
    {
       config.nativeLibraryLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig nativeLibraryLocation(URL arg0)
+   public T nativeLibraryLocation(URL arg0)
    {
       config.nativeLibraryLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig partitionName(String arg0)
+   public T partitionName(String arg0)
    {
       config.partitionName(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverBaseLocation(String arg0) throws IllegalArgumentException
+   public T serverBaseLocation(String arg0) throws IllegalArgumentException
    {
       config.serverBaseLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverBaseLocation(URL arg0)
+   public T serverBaseLocation(URL arg0)
    {
       config.serverBaseLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverConfLocation(String arg0) throws IllegalArgumentException
+   public T serverConfLocation(String arg0) throws IllegalArgumentException
    {
       config.serverConfLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverConfLocation(URL arg0)
+   public T serverConfLocation(URL arg0)
    {
       config.serverConfLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverDataLocation(String arg0) throws IllegalArgumentException
+   public T serverDataLocation(String arg0) throws IllegalArgumentException
    {
       config.serverDataLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverDataLocation(URL arg0)
+   public T serverDataLocation(URL arg0)
    {
       config.serverDataLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverHomeLocation(String arg0) throws IllegalArgumentException
+   public T serverHomeLocation(String arg0) throws IllegalArgumentException
    {
       config.serverHomeLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverHomeLocation(URL arg0)
+   public T serverHomeLocation(URL arg0)
    {
       config.serverHomeLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverLibLocation(String arg0) throws IllegalArgumentException
+   public T serverLibLocation(String arg0) throws IllegalArgumentException
    {
       config.serverLibLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverLibLocation(URL arg0)
+   public T serverLibLocation(URL arg0)
    {
       config.serverLibLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverLogLocation(String arg0) throws IllegalArgumentException
+   public T serverLogLocation(String arg0) throws IllegalArgumentException
    {
       config.serverLogLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverLogLocation(URL arg0)
+   public T serverLogLocation(URL arg0)
    {
       config.serverLogLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverName(String arg0)
+   public T serverName(String arg0)
    {
       config.serverName(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverTempLocation(String arg0) throws IllegalArgumentException
+   public T serverTempLocation(String arg0) throws IllegalArgumentException
    {
       config.serverTempLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig serverTempLocation(URL arg0)
+   public T serverTempLocation(URL arg0)
    {
       config.serverTempLocation(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig udpGroup(String arg0)
+   public T udpGroup(String arg0)
    {
       config.udpGroup(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig udpPort(Integer arg0)
+   public T udpPort(Integer arg0)
    {
       config.udpPort(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootstrapHome(String arg0) throws IllegalArgumentException, IllegalStateException
+   public T bootstrapHome(String arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.bootstrapHome(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootstrapHome(URL arg0) throws IllegalArgumentException, IllegalStateException
+   public T bootstrapHome(URL arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.bootstrapHome(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootstrapName(String arg0) throws IllegalArgumentException, IllegalStateException
+   public T bootstrapName(String arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.bootstrapName(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootstrapUrl(String arg0) throws IllegalArgumentException, IllegalStateException
+   public T bootstrapUrl(String arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.bootstrapUrl(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig bootstrapUrl(URL arg0) throws IllegalArgumentException, IllegalStateException
+   public T bootstrapUrl(URL arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.bootstrapUrl(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
    public void freeze() throws IllegalStateException
@@ -394,10 +394,10 @@
       return config.isFrozen();
    }
 
-   public JBossASServerConfig property(String arg0, String arg1) throws IllegalArgumentException, IllegalStateException
+   public T property(String arg0, String arg1) throws IllegalArgumentException, IllegalStateException
    {
       config.property(arg0, arg1);
-      return this;
+      return this.covarientReturn();
    }
 
    public Boolean isUsePlatformMBeanServer()
@@ -405,10 +405,10 @@
       return config.isUsePlatformMBeanServer();
    }
 
-   public JBossASServerConfig usePlatformMBeanServer(Boolean arg0)
+   public T usePlatformMBeanServer(Boolean arg0)
    {
       config.usePlatformMBeanServer(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
    public String getProperty(String arg0) throws IllegalArgumentException
@@ -416,17 +416,26 @@
       return config.getProperty(arg0);
    }
 
-   public JBossASServerConfig properties(Map<String, String> arg0) throws IllegalArgumentException,
+   public T properties(Map<String, String> arg0) throws IllegalArgumentException,
          IllegalStateException
    {
       config.properties(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
-   public JBossASServerConfig properties(Properties arg0) throws IllegalArgumentException, IllegalStateException
+   public T properties(Properties arg0) throws IllegalArgumentException, IllegalStateException
    {
       config.properties(arg0);
-      return this;
+      return this.covarientReturn();
    }
 
+   /**
+    * Returns this reference represented as T
+    * @return
+    */
+   private T covarientReturn(){
+      @SuppressWarnings("unchecked")
+      final T thisRef =(T)this; 
+      return thisRef; 
+   }
 }

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImplMBean.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImplMBean.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerConfigImplMBean.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -23,13 +23,13 @@
 
 import javax.management.ObjectName;
 
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
 import org.jboss.mx.util.ObjectNameFactory;
 
 /**
  * MBean interface.
  */
-public interface ServerConfigImplMBean extends JBossASServerConfig
+public interface ServerConfigImplMBean<T extends JBossASBasedServerConfig<T>> extends JBossASBasedServerConfig<T>
 {
    /** Default ObjectName */
    ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:type=ServerConfig");

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/ServerImplMBean.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -21,15 +21,19 @@
  */
 package org.jboss.system.server;
 
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 
 /**
  * MBean interface.
  */
-public interface ServerImplMBean extends JBossASServer, ServerConstants
+public interface ServerImplMBean<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+      extends
+         JBossASBasedServer<K, T>,
+         ServerConstants
 {
    // Attributes ----------------------------------------------------
-   
+
    /**
     * Hint to the JVM to run the garbage collector.
     */

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -43,8 +43,8 @@
 import javax.management.ObjectName;
 
 import org.jboss.bootstrap.spi.Bootstrap;
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 import org.jboss.bootstrap.spi.config.ConfigurationInitializer;
 import org.jboss.bootstrap.spi.config.ConfigurationValidator;
 import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
@@ -81,18 +81,18 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public class JMXKernel extends JBossObject
-   implements JMXKernelMBean, NotificationEmitter
+public class JMXKernel<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>> extends JBossObject
+   implements JMXKernelMBean<K,T>, NotificationEmitter
 {
    private final static ObjectName DEFAULT_LOADER_NAME =
       ObjectNameFactory.create(ServerConstants.DEFAULT_LOADER_NAME);
 
    /** The JMX MBeanServer which will serve as our communication bus. */
    private MBeanServer mbeanServer;
-   private JBossASServer serverImpl;
+   private K serverImpl;
    private ServiceController controller;
-   private JBossASServerConfig serverConfig;
-   private ServerConfigImplMBean serverConfigMBean;
+   private T serverConfig;
+   private JBossASBasedServerConfig<T> serverConfigMBean;
    private ServerInfoMBean serverInfo;
    /** The kernel */
    private Kernel kernel;
@@ -105,11 +105,11 @@
    /** Whether to use the old classloader */
    private boolean oldClassLoader;
    
-   public JBossASServer getServerImpl()
+   public K getServerImpl()
    {
       return serverImpl;
    }
-   public void setServerImpl(JBossASServer serverImpl)
+   public void setServerImpl(K serverImpl)
    {
       this.serverImpl = serverImpl;
       this.notificationEmitter = (NotificationEmitter) serverImpl;
@@ -128,7 +128,6 @@
     * Get the optional server configuration metadata
     * @return a possibly empty map of configuration metadata.
     */
-   @SuppressWarnings("unchecked")
    public Map<String, Object> getMetaData()
    {
       return Collections.emptyMap();
@@ -189,14 +188,14 @@
       System.setProperty(ServerConstants.MBEAN_SERVER_BUILDER_CLASS_PROPERTY, builder);
 
       serverConfig = serverImpl.getConfiguration();
-      serverConfigMBean = new ServerConfigImpl(serverConfig);
+      serverConfigMBean = new ServerConfigImpl<T>(serverConfig);
       // Check if we'll use the platform MBeanServer or instantiate our own
       if (serverConfig.isUsePlatformMBeanServer())
       {
          // jdk1.5+
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
-         Class clazz = cl.loadClass("java.lang.management.ManagementFactory");
-         Class[] sig = null;
+         Class<?> clazz = cl.loadClass("java.lang.management.ManagementFactory");
+         Class<?>[] sig = null;
          Method method = clazz.getMethod("getPlatformMBeanServer", sig);
          Object[] args = null;
          mbeanServer = (MBeanServer) method.invoke(null, args);
@@ -311,7 +310,7 @@
 //      serverImpl.exit(exitcode);
 //   }
 
-   public JBossASServerConfig getConfig()
+   public T getConfig()
    {
       return serverConfig;
    }
@@ -411,22 +410,22 @@
       return serverImpl.getKernel();
    }
 
-   public void addBootstrap(final Bootstrap<JBossASServer, JBossASServerConfig> arg0) throws IllegalArgumentException
+   public void addBootstrap(final Bootstrap<K,T> arg0) throws IllegalArgumentException
    {
       serverImpl.addBootstrap(arg0);
    }
 
-   public ConfigurationInitializer<JBossASServerConfig> getConfigInitializer()
+   public ConfigurationInitializer<T> getConfigInitializer()
    {
       return serverImpl.getConfigInitializer();
    }
 
-   public JBossASServerConfig getConfiguration()
+   public T getConfiguration()
    {
       return serverImpl.getConfiguration();
    }
 
-   public ServerInitializer<JBossASServer, JBossASServerConfig> getServerInitializer()
+   public ServerInitializer<K,T> getServerInitializer()
    {
       return serverImpl.getServerInitializer();
    }
@@ -436,7 +435,7 @@
       return serverImpl.getState();
    }
 
-   public ConfigurationValidator<JBossASServerConfig> getValidator()
+   public ConfigurationValidator<T> getValidator()
    {
       return serverImpl.getValidator();
    }
@@ -471,33 +470,33 @@
       serverImpl.registerEventHandlers(arg0, arg1);
    }
 
-   public void removeBootstrap(final Bootstrap<JBossASServer, JBossASServerConfig> arg0)
+   public void removeBootstrap(final Bootstrap<K, T> arg0)
          throws IllegalArgumentException
    {
       serverImpl.removeBootstrap(arg0);
 
    }
 
-   public void setConfigInitializer(final ConfigurationInitializer<JBossASServerConfig> arg0)
+   public void setConfigInitializer(final ConfigurationInitializer<T> arg0)
          throws IllegalStateException
    {
       serverImpl.setConfigInitializer(arg0);
 
    }
 
-   public void setConfiguration(final JBossASServerConfig arg0)
+   public void setConfiguration(final T arg0)
    {
       serverImpl.setConfiguration(arg0);
    }
 
-   public void setServerInitializer(final ServerInitializer<JBossASServer, JBossASServerConfig> arg0)
+   public void setServerInitializer(final ServerInitializer<K, T> arg0)
          throws IllegalStateException
    {
       serverImpl.setServerInitializer(arg0);
 
    }
 
-   public void setValidator(final ConfigurationValidator<JBossASServerConfig> arg0) throws IllegalStateException
+   public void setValidator(final ConfigurationValidator<T> arg0) throws IllegalStateException
    {
       serverImpl.setValidator(arg0);
 

Modified: branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernelMBean.java
===================================================================
--- branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernelMBean.java	2009-07-14 22:19:57 UTC (rev 91265)
+++ branches/Branch_5_x/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernelMBean.java	2009-07-14 22:35:44 UTC (rev 91266)
@@ -21,9 +21,13 @@
  */
 package org.jboss.system.server.jmx;
 
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
 import org.jboss.system.server.ServerImplMBean;
 
-public interface JMXKernelMBean extends ServerImplMBean
+public interface JMXKernelMBean<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+      extends
+         ServerImplMBean<K, T>
 {
 
 }




More information about the jboss-cvs-commits mailing list