[jboss-cvs] JBossAS SVN: r88254 - branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 6 07:07:07 EDT 2009


Author: emuckenhuber
Date: 2009-05-06 07:07:07 -0400 (Wed, 06 May 2009)
New Revision: 88254

Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
Log:
cache known deployment type when unavailable.

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-06 08:56:53 UTC (rev 88253)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-06 11:07:07 UTC (rev 88254)
@@ -46,6 +46,7 @@
 import org.jboss.deployers.client.spi.main.MainDeployer;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.NameMatcher;
 import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
@@ -68,7 +69,6 @@
 import org.jboss.managed.api.annotation.ManagementObjectID;
 import org.jboss.managed.api.annotation.ManagementObjectRef;
 import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
 import org.jboss.managed.plugins.ManagedComponentImpl;
@@ -95,6 +95,7 @@
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
 import org.jboss.system.server.profileservice.attachments.AttachmentStore;
+import org.jboss.system.server.profileservice.repository.AbstractProfileDeployment;
 
 /**
  * The default ManagementView implementation.
@@ -377,6 +378,11 @@
                {
                   ManagedDeployment md = getManagedDeployment(deployment);
                   processRootManagedDeployment(md, key, trace);
+                  
+                  // TODO update profileservice-spi
+                  // Cache the deployment types
+                  ((AbstractProfileDeployment)deployment)
+                     .addTransientAttachment(KnownDeploymentTypes.class.getName(), md.getTypes());
                }
                catch(DeploymentException e)
                {
@@ -385,15 +391,28 @@
                   ManagedDeployment md = new ManagedDeploymentImpl(deploymentName,
                         deployment.getRoot().getName());
                   
-                  int i = deploymentName.lastIndexOf(".");
-                  if(i != -1 && (i + 1) < deploymentName.length())
+                  // TODO update profileservice-spi
+                  // Try to get the cached deployment type 
+                  Collection<String> deploymentTypes = (Collection<String>) ((AbstractProfileDeployment)deployment)
+                        .getTransientAttachment(KnownDeploymentTypes.class.getName());
+                  
+                  if(deploymentTypes != null)
                   {
-                     String guessedType = deploymentName.substring(i + 1, deploymentName.length());
-                     if(guessedType.endsWith("/"))
-                        guessedType = guessedType.substring(0, guessedType.length() -1 );
-                     md.setTypes(new HashSet<String>(1));
-                     md.addType(guessedType);
+                     for(String deploymentType : deploymentTypes)
+                        md.addType(deploymentType);
                   }
+                  else
+                  {
+                     int i = deploymentName.lastIndexOf(".");
+                     if(i != -1 && (i + 1) < deploymentName.length())
+                     {
+                        String guessedType = deploymentName.substring(i + 1, deploymentName.length());
+                        if(guessedType.endsWith("/"))
+                           guessedType = guessedType.substring(0, guessedType.length() -1 );
+                        md.setTypes(new HashSet<String>(1));
+                        md.addType(guessedType);
+                     }  
+                  }
                   
                   processManagedDeployment(md, key, DeploymentState.STOPPED, 0, trace);
                }




More information about the jboss-cvs-commits mailing list