[jboss-cvs] JBossAS SVN: r102403 - in projects/profileservice/trunk/plugins/src: main/java/org/jboss/profileservice/plugins/management/actions and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 15 10:17:40 EDT 2010


Author: emuckenhuber
Date: 2010-03-15 10:17:39 -0400 (Mon, 15 Mar 2010)
New Revision: 102403

Added:
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java
Removed:
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessorHelper.java
Modified:
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/ManagementViewWrapper.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/ProfileViewUpdateAction.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileViewWrapper.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java
   projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/AbstractDeployTest.java
   projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java
Log:
limit merging of MOs to a single profile.

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/AggregatingLocalManagementView.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -47,7 +47,6 @@
 import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
@@ -87,9 +86,6 @@
    /** The proxy factory. */
    private AbstractManagementProxyFactory proxyFactory;
    
-   /** The processor helper. */
-   private ManagedDeploymentProcessorHelper processorHelper;
-   
    public AggregatingLocalManagementView()
    {
       currentLocale = Locale.getDefault();
@@ -117,7 +113,6 @@
       {
          throw new IllegalStateException("null proxy factory");
       }
-      this.processorHelper = new ManagedDeploymentProcessorHelper(proxyFactory);
    }
    
    /**
@@ -137,8 +132,6 @@
          if(view.load())
             changed = true;
       }
-      // FIXME
-      processorHelper.clear();
       // 
       if(wasInterrupted)
       {
@@ -160,7 +153,7 @@
          throw new IllegalArgumentException("null profile view");
       }
       // FIXME
-      view.setProcessorHelper(processorHelper);
+      view.setManagementProxyFactory(proxyFactory);
       this.views.add(view);
    }
    

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/ManagementViewWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/ManagementViewWrapper.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/ManagementViewWrapper.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -140,7 +140,6 @@
    }
 
    @SuppressWarnings("deprecation")
-   @Override
    public void process() throws Exception
    {
       getDelegateView().process();

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/RegisteredProfileViewsWrapper.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -21,11 +21,9 @@
 */
 package org.jboss.profileservice.plugins.management;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
@@ -35,8 +33,10 @@
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.management.event.ProfileLifeCycleEvent;
+import org.jboss.profileservice.management.event.ProfileLifeCycleEvent.LifeCycleState;
 import org.jboss.profileservice.plugins.management.actions.ProfileViewUpdateAction;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
+import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
 import org.jboss.profileservice.plugins.management.view.RegisteredProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
@@ -48,6 +48,7 @@
 import org.jboss.profileservice.spi.action.engine.EventBus;
 import org.jboss.profileservice.spi.action.engine.ModificationEvent;
 import org.jboss.profileservice.spi.managed.ManagedProfile;
+import org.jboss.util.collection.ConcurrentSet;
 
 
 /**
@@ -60,11 +61,11 @@
 {
 
    /** The profiles. */
-   private List<ProfileKey> registeredKeys = new ArrayList<ProfileKey>();
+   private Set<ProfileKey> registeredKeys = new ConcurrentSet<ProfileKey>();
    private Map<ProfileKey, RegisteredProfileView> viewsByName = new ConcurrentHashMap<ProfileKey, RegisteredProfileView>();  
    
-   /** The helper. */
-   private ManagedDeploymentProcessorHelper helper;
+   /** The managed proxy factory. */
+   private AbstractManagementProxyFactory proxyFactory;
    
    /** The action controller. */
    private final ActionController controller;
@@ -82,8 +83,8 @@
    {
       boolean changed = false;
       
-      List<ProfileKey> have = registeredKeys;
-      this.registeredKeys = new ArrayList<ProfileKey>();
+      Set<ProfileKey> have = registeredKeys;
+      this.registeredKeys = new ConcurrentSet<ProfileKey>();
       // Additions
       for(ProfileKey key : controller.getActiveProfiles())
       {
@@ -101,8 +102,11 @@
       for(ProfileKey key : have)
       {
          ProfileView view = viewsByName.remove(key);
-         getEventBus().removeListener(view);
-         changed = true;
+         if(view != null)
+         {
+            getEventBus().removeListener(view);
+            changed = true;            
+         }
       }
       // Load and process
       for(RegisteredProfileView view : viewsByName.values())
@@ -111,7 +115,7 @@
          {
             ProfileKey key = view.getKey();
             ManagedProfile managedProfile = controller.getManagedProfile(key);
-            ProfileModificationAction<ProfileModificationContext> action = new ProfileViewUpdateAction(managedProfile, view, helper);
+            ProfileModificationAction<ProfileModificationContext> action = new ProfileViewUpdateAction(managedProfile, view, proxyFactory);
 
             controller.perform(key, ProfileModificationType.GET, Collections.singletonList(action));
             
@@ -121,7 +125,7 @@
       //
       return changed;
    }
-
+   
    RegisteredProfileView createProfileView(ProfileKey key)
    {
       return new RegisteredProfileView(key);
@@ -141,9 +145,9 @@
    /**
     * {@inheritDoc}
     */
-   public void setProcessorHelper(ManagedDeploymentProcessorHelper processorHelper)
+   public void setManagementProxyFactory(AbstractManagementProxyFactory proxyFactory)
    {
-      this.helper = processorHelper;
+      this.proxyFactory = proxyFactory;
    }
 
    /**
@@ -292,7 +296,14 @@
     */
    public void notify(ModificationEvent event)
    {
-      // nothing here
+      if(event instanceof ProfileLifeCycleEvent)
+      {
+         ProfileLifeCycleEvent lifeCycle = ProfileLifeCycleEvent.class.cast(event);
+         if(lifeCycle.getState() == LifeCycleState.UNINSTALLED)
+         {
+            // TODO remove
+         }
+      }
    }
 
    public ProfileKey resolveProfile(String deploymentName)

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/ProfileViewUpdateAction.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/ProfileViewUpdateAction.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/actions/ProfileViewUpdateAction.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -29,7 +29,8 @@
 import org.jboss.managed.api.DeploymentState;
 import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.plugins.ManagedDeploymentImpl;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
+import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
+import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
 import org.jboss.profileservice.plugins.spi.ProfileViewProcessingContext;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileDeployment;
@@ -58,18 +59,18 @@
    /** The managed profile. */
    private final ManagedProfile managedProfile;
 
-   /** The helper. */
-   private final ManagedDeploymentProcessorHelper helper;
+   /** The proxy factory. */
+   private final AbstractManagementProxyFactory proxyFactory;
    
    /** The context. */
    private final ProfileViewProcessingContext context;
 
    public ProfileViewUpdateAction(ManagedProfile managedProfile, ProfileViewProcessingContext context,
-         ManagedDeploymentProcessorHelper helper)
+         AbstractManagementProxyFactory proxyFactory)
    {
       this.managedProfile = managedProfile;
       this.context = context;
-      this.helper = helper;
+      this.proxyFactory = proxyFactory;
    }
 
    // -----
@@ -82,6 +83,7 @@
    
    public void complete()
    {
+      ManagedDeploymentProcessor processor = new ManagedDeploymentProcessor(proxyFactory);
       Profile profile = managedProfile.getProfile();
       for(ProfileDeployment deployment : profile.getDeployments())
       {
@@ -91,7 +93,7 @@
             {
                // Deployed
                ManagedDeployment md = managedProfile.getManagedDeployment(deployment);
-               helper.processRootManagedDeployment(md, context);
+               processor.processRootManagedDeployment(md, context);
                if(md.getTypes() != null && md.getTypes().isEmpty() == false)
                {
                   if(deployment.getTransientAttachments().hasAttachment(DEPLOYMENT_TYPES) == false)
@@ -105,7 +107,7 @@
                // Not deployed
                ManagedDeployment md = new ManagedDeploymentImpl(deployment.getName(), deployment.getSimpleName());
                updateStoppedDeploymentTypes(deployment, md);
-               helper.processManagedDeployment(md, DeploymentState.STOPPED, 0, context);
+               processor.processManagedDeployment(md, DeploymentState.STOPPED, 0, context);
             }            
          }
          catch(Exception e)

Copied: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java (from rev 102402, projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessorHelper.java)
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java	                        (rev 0)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessor.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -0,0 +1,156 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.plugins.management.util;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.spi.management.ContextStateMapper;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.DeploymentState;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.plugins.ManagedDeploymentImpl;
+import org.jboss.profileservice.plugins.spi.ProfileViewProcessingContext;
+
+/**
+ * The profile view processor helper.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ManagedDeploymentProcessor extends ManagedObjectRuntimeProcessor
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger(ManagedDeploymentProcessor.class);
+   
+   /** The deployment states. */
+   private static final ContextStateMapper<DeploymentState> deploymentStateMapper;
+   
+   static
+   {
+      Map<String, DeploymentState> deploymentMappings = new HashMap<String, DeploymentState>();
+      deploymentMappings.put("**ERROR**", DeploymentState.FAILED);
+      deploymentMappings.put("Not Installed", DeploymentState.STOPPED);
+      deploymentMappings.put("Installed", DeploymentState.STARTED);
+
+      deploymentStateMapper = new DefaultContextStateMapper<DeploymentState>(deploymentMappings,
+            DeploymentState.STARTING, DeploymentState.STOPPING, DeploymentState.FAILED, DeploymentState.UNKNOWN);
+   }
+   
+   public ManagedDeploymentProcessor(AbstractManagementProxyFactory proxyFactory)
+   {
+      super(proxyFactory);
+   }
+   
+   /**
+    * Process a root managed deployment.
+    * 
+    * @param md the managed deployment
+    * @param context the profile view context
+    * @throws Exception
+    */
+   public void processRootManagedDeployment(ManagedDeployment md, ProfileViewProcessingContext context) throws Exception
+   {
+      DeploymentState state = getDeploymentState(md);
+      processManagedDeployment(md, state, 0, context);      
+   }
+
+   /**
+    * Process a root managed deployment.
+    * 
+    * @param md the managed deployment
+    * @param state the deployment state
+    * @param context the profile view context
+    * @throws Exception
+    */
+   public void processRootManagedDeployment(ManagedDeployment md, DeploymentState state, ProfileViewProcessingContext context) throws Exception
+   {
+      processManagedDeployment(md, state, 0, context);
+   }
+   
+   /**
+    * Process a managed deployment.
+    * 
+    * @param md the managed deployment
+    * @param state the deployment state
+    * @param level the level
+    * @param context the profile view context
+    * @throws Exception
+    */
+   public void processManagedDeployment(ManagedDeployment md, DeploymentState state, int level, ProfileViewProcessingContext context) throws Exception
+   {
+      boolean trace = log.isTraceEnabled();
+      
+      String name = md.getName();
+      if (trace)
+      {
+         log.trace(name + " ManagedDeployment_" + level + ": " + md);
+      }
+
+      // Set the deployment state
+      if(state != null && md instanceof ManagedDeploymentImpl)
+         ManagedDeploymentImpl.class.cast(md).setDeploymentState(state);
+
+      Map<String, ManagedObject> mos = md.getManagedObjects();
+      for(ManagedObject mo : mos.values())
+      {
+         processManagedObject(mo, md, context);
+      }
+      // Add the deployment
+      context.addManagedDeployment(md);
+      
+      // Process children
+      List<ManagedDeployment> mdChildren = md.getChildren();
+      if(mdChildren != null && mdChildren.isEmpty() == false)
+      {
+         for(ManagedDeployment mdChild : mdChildren)
+         {
+            // process the child deployments, with the state of the parent.
+            processManagedDeployment(mdChild, state, level + 1, context);
+         }
+      }
+   }
+   
+   /**
+    * Get the deployment state.
+    * 
+    * @param md the managed deployment
+    * @return the deployment state
+    */
+   protected DeploymentState getDeploymentState(ManagedDeployment md)
+   {
+      DeploymentState state = md.getDeploymentState();
+      if (state == DeploymentState.UNKNOWN)
+      {
+         Object name = md.getName();
+         if (name != null)
+         {
+            state = getMappedState(name, deploymentStateMapper);
+         }
+      }
+      return state;
+   }
+   
+}

Deleted: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessorHelper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessorHelper.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/util/ManagedDeploymentProcessorHelper.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -1,158 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2010, Red Hat Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.profileservice.plugins.management.util;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.deployers.spi.management.ContextStateMapper;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.DeploymentState;
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.plugins.ManagedDeploymentImpl;
-import org.jboss.profileservice.plugins.spi.ProfileViewProcessingContext;
-
-/**
- * The profile view processor helper.
- * 
- * TODO we need to make the this stateless.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ManagedDeploymentProcessorHelper extends ManagedObjectRuntimeProcessor
-{
-
-   /** The logger. */
-   private static final Logger log = Logger.getLogger(ManagedDeploymentProcessorHelper.class);
-   
-   /** The deployment states. */
-   private static final ContextStateMapper<DeploymentState> deploymentStateMapper;
-   
-   static
-   {
-      Map<String, DeploymentState> deploymentMappings = new HashMap<String, DeploymentState>();
-      deploymentMappings.put("**ERROR**", DeploymentState.FAILED);
-      deploymentMappings.put("Not Installed", DeploymentState.STOPPED);
-      deploymentMappings.put("Installed", DeploymentState.STARTED);
-
-      deploymentStateMapper = new DefaultContextStateMapper<DeploymentState>(deploymentMappings,
-            DeploymentState.STARTING, DeploymentState.STOPPING, DeploymentState.FAILED, DeploymentState.UNKNOWN);
-   }
-   
-   public ManagedDeploymentProcessorHelper(AbstractManagementProxyFactory proxyFactory)
-   {
-      super(proxyFactory);
-   }
-   
-   /**
-    * Process a root managed deployment.
-    * 
-    * @param md the managed deployment
-    * @param context the profile view context
-    * @throws Exception
-    */
-   public void processRootManagedDeployment(ManagedDeployment md, ProfileViewProcessingContext context) throws Exception
-   {
-      DeploymentState state = getDeploymentState(md);
-      processManagedDeployment(md, state, 0, context);      
-   }
-
-   /**
-    * Process a root managed deployment.
-    * 
-    * @param md the managed deployment
-    * @param state the deployment state
-    * @param context the profile view context
-    * @throws Exception
-    */
-   public void processRootManagedDeployment(ManagedDeployment md, DeploymentState state, ProfileViewProcessingContext context) throws Exception
-   {
-      processManagedDeployment(md, state, 0, context);
-   }
-   
-   /**
-    * Process a managed deployment.
-    * 
-    * @param md the managed deployment
-    * @param state the deployment state
-    * @param level the level
-    * @param context the profile view context
-    * @throws Exception
-    */
-   public void processManagedDeployment(ManagedDeployment md, DeploymentState state, int level, ProfileViewProcessingContext context) throws Exception
-   {
-      boolean trace = log.isTraceEnabled();
-      
-      String name = md.getName();
-      if (trace)
-      {
-         log.trace(name + " ManagedDeployment_" + level + ": " + md);
-      }
-
-      // Set the deployment state
-      if(state != null && md instanceof ManagedDeploymentImpl)
-         ManagedDeploymentImpl.class.cast(md).setDeploymentState(state);
-
-      Map<String, ManagedObject> mos = md.getManagedObjects();
-      for(ManagedObject mo : mos.values())
-      {
-         processManagedObject(mo, md, context);
-      }
-      // Add the deployment
-      context.addManagedDeployment(md);
-      
-      // Process children
-      List<ManagedDeployment> mdChildren = md.getChildren();
-      if(mdChildren != null && mdChildren.isEmpty() == false)
-      {
-         for(ManagedDeployment mdChild : mdChildren)
-         {
-            // process the child deployments, with the state of the parent.
-            processManagedDeployment(mdChild, state, level + 1, context);
-         }
-      }
-   }
-   
-   /**
-    * Get the deployment state.
-    * 
-    * @param md the managed deployment
-    * @return the deployment state
-    */
-   protected DeploymentState getDeploymentState(ManagedDeployment md)
-   {
-      DeploymentState state = md.getDeploymentState();
-      if (state == DeploymentState.UNKNOWN)
-      {
-         Object name = md.getName();
-         if (name != null)
-         {
-            state = getMappedState(name, deploymentStateMapper);
-         }
-      }
-      return state;
-   }
-   
-}

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileViewWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileViewWrapper.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/AbstractProfileViewWrapper.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -28,7 +28,7 @@
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
+import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
 import org.jboss.profileservice.spi.action.engine.ModificationEvent;
@@ -40,8 +40,8 @@
 public abstract class AbstractProfileViewWrapper implements ProfileViewWrapper
 {
 
-   /** The processor helper... */
-   private ManagedDeploymentProcessorHelper processorHelper;
+   /** The management proxy factory. */
+   private AbstractManagementProxyFactory proxyFactory;
 
    /**
     * {@inheritDoc}
@@ -55,14 +55,22 @@
     */
    protected abstract ProfileView getDelegate();
    
-   public ManagedDeploymentProcessorHelper getProcessorHelper()
+   /**
+    * Get the management proxy factory.
+    * 
+    * @return the proxy factory.
+    */
+   public AbstractManagementProxyFactory getProxyFactory()
    {
-      return processorHelper;
+      return proxyFactory;
    }
-   
-   public void setProcessorHelper(ManagedDeploymentProcessorHelper processorHelper)
+
+   /**
+    * {@inheritDoc}
+    */
+   public void setManagementProxyFactory(AbstractManagementProxyFactory proxyFactory)
    {
-      this.processorHelper = processorHelper;
+      this.proxyFactory = proxyFactory;
    }
    
    /**

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/management/view/PlatformMBeanView.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -27,6 +27,7 @@
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
 import org.jboss.managed.plugins.jmx.ManagementFactoryUtils;
+import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.spi.ProfileKey;
 
@@ -92,9 +93,10 @@
    {
       if(managedObjects != null && managedObjects.isEmpty() == false)
       {
+         ManagedDeploymentProcessor processor = new ManagedDeploymentProcessor(getProxyFactory());
          for(ManagedObject mo : managedObjects)
          {
-            getProcessorHelper().processManagedObject(mo, null, view);
+            processor.processManagedObject(mo, null, view);
          }
       }
    }

Modified: projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java
===================================================================
--- projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/main/java/org/jboss/profileservice/plugins/spi/ProfileViewWrapper.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -21,7 +21,7 @@
 */
 package org.jboss.profileservice.plugins.spi;
 
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
+import org.jboss.profileservice.plugins.management.util.AbstractManagementProxyFactory;
 import org.jboss.profileservice.spi.ProfileKey;
 
 /**
@@ -31,8 +31,12 @@
 public interface ProfileViewWrapper extends ProfileView
 {
 
-   // FIXME
-   void setProcessorHelper(ManagedDeploymentProcessorHelper processorHelper);
+   /**
+    * Set a common management proxy factory.
+    * 
+    * @param proxyFactory the proxy factory.
+    */
+   void setManagementProxyFactory(AbstractManagementProxyFactory proxyFactory);
 
    /**
     * Try to resolve the {@code Profile} for a given deployment.

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/AbstractDeployTest.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/AbstractDeployTest.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/deploy/test/AbstractDeployTest.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -23,7 +23,6 @@
 
 import org.jboss.profileservice.management.AbstractActionController;
 import org.jboss.profileservice.plugins.management.RegisteredProfileViewsWrapper;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
 import org.jboss.profileservice.plugins.spi.ProfileView;
 import org.jboss.profileservice.plugins.spi.ProfileViewWrapper;
 import org.jboss.test.BaseTestCase;
@@ -35,7 +34,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class AbstractDeployTest extends BaseTestCase
+public abstract class AbstractDeployTest extends BaseTestCase
 {
 
    private AbstractActionController actionController;
@@ -43,7 +42,6 @@
    private DeployHandlerSupport deployHandler;
    
    private static final NoopManagementProxyFactory proxyFactory = new NoopManagementProxyFactory();
-   private ManagedDeploymentProcessorHelper helper;
    
    private ProfileViewWrapper view;
    
@@ -61,9 +59,8 @@
       this.deployHandler = new DeployHandlerSupport();
       this.deployHandler.setActionController(actionController);
 
-      this.helper = new ManagedDeploymentProcessorHelper(proxyFactory);
       this.view = new RegisteredProfileViewsWrapper(actionController);
-      this.view.setProcessorHelper(helper);
+      this.view.setManagementProxyFactory(proxyFactory);
 
    }
    

Modified: projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java
===================================================================
--- projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java	2010-03-15 12:49:17 UTC (rev 102402)
+++ projects/profileservice/trunk/plugins/src/test/java/org/jboss/test/profileservice/plugins/mgt/test/AbstractViewTestBase.java	2010-03-15 14:17:39 UTC (rev 102403)
@@ -31,7 +31,7 @@
 import org.jboss.managed.api.factory.ManagedObjectFactory;
 import org.jboss.managed.plugins.ManagedDeploymentImpl;
 import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
-import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessorHelper;
+import org.jboss.profileservice.plugins.management.util.ManagedDeploymentProcessor;
 import org.jboss.test.BaseTestCase;
 import org.jboss.test.profileservice.plugins.mgt.support.NoopManagementProxyFactory;
 import org.jboss.test.profileservice.plugins.mgt.support.TestComponentMetaData;
@@ -43,7 +43,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class AbstractViewTestBase extends BaseTestCase
+public abstract class AbstractViewTestBase extends BaseTestCase
 {
    
    /** The managed object factory. */
@@ -53,7 +53,7 @@
    private static final NoopManagementProxyFactory proxyFactory = new NoopManagementProxyFactory();
    
    /** The helper. */
-   private ManagedDeploymentProcessorHelper helper;
+   private ManagedDeploymentProcessor helper;
 
    public AbstractViewTestBase(String name)
    {
@@ -70,7 +70,7 @@
       return proxyFactory;
    }
    
-   public ManagedDeploymentProcessorHelper getHelper()
+   public ManagedDeploymentProcessor getHelper()
    {
       return helper;
    }
@@ -78,7 +78,7 @@
    public void setUp() throws Exception
    {
       super.setUp();
-      this.helper = new ManagedDeploymentProcessorHelper(proxyFactory);
+      this.helper = new ManagedDeploymentProcessor(proxyFactory);
    }
 
    protected ManagedDeployment createDeployment(String name, Object... objects)




More information about the jboss-cvs-commits mailing list