[jboss-cvs] JBossAS SVN: r59636 - in trunk: profileservice/src/main/org/jboss/profileservice/management and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 15 00:33:32 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-15 00:33:18 -0500 (Mon, 15 Jan 2007)
New Revision: 59636

Modified:
   trunk/profileservice/build.log
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   trunk/profileservice/src/main/org/jboss/profileservice/management/builders/ConnectionFactoryDeployerManagedObjectBuilder.java
   trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
   trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
   trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
   trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
   trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Add a deployment type notion to the profile and management views

Modified: trunk/profileservice/build.log
===================================================================
--- trunk/profileservice/build.log	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/profileservice/build.log	2007-01-15 05:33:18 UTC (rev 59636)
@@ -9,32 +9,15 @@
 _buildmagic:build-bypass-checker:
 
 _buildmagic:build-bypass-notice:
+     [echo] 
+Build disabled because module is already built. To force the module
+to build define build-bypass.disabled=true.
+  
 
 _buildmagic:build-bypass-check:
 
 jars:
 
-_buildmagic:init:
-
-init:
-
-_default:compile-classes:
-   [depend] Deleted 1 out of date files in 0 seconds
-    [javac] Compiling 1 source file to /home/svn/JBossHead/jboss-head/profileservice/output/classes
-    [javac] /home/svn/JBossHead/jboss-head/profileservice/src/main/org/jboss/profileservice/management/builders/ConnectionFactoryDeployerManagedObjectBuilder.java:59: warning: [deprecation] getDeploymentContext() in org.jboss.deployers.spi.deployer.DeploymentUnit has been deprecated
-    [javac]          Set<DeploymentContext> comps = unit.getDeploymentContext().getComponents();
-    [javac]                                             ^
-    [javac] 1 warning
-
-_default:compile-resources:
-
-_default:compile-etc:
-
-compile:
-
-module-jars:
-      [jar] Building jar: /home/svn/JBossHead/jboss-head/profileservice/output/lib/jboss-profileservice.jar
-
 most:
 
 main:

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -80,6 +80,22 @@
       this.mainDeployer = mainDeployer;
    }
 
+   /**
+    * Get the names of the deployment in the profile that have the
+    * given deployment type.
+    * @param key - the profile containing the deployment
+    * @param type - the deployment type
+    */
+   public Set<String> getDeploymentNamesForType(ProfileKey key, String type)
+      throws NoSuchProfileException
+   {
+      Profile profile = ps.getProfile(key);
+      if(ps == null )
+         throw new NoSuchProfileException("No profile for key: "+key);
+      Set<String> names = profile.getDeploymentNamesForType(type);
+      return names;
+   }
+
    public Set<String> getTemplateNames()
    {
       HashSet<String> tmp = new HashSet<String>(templates.keySet());

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/builders/ConnectionFactoryDeployerManagedObjectBuilder.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/builders/ConnectionFactoryDeployerManagedObjectBuilder.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/builders/ConnectionFactoryDeployerManagedObjectBuilder.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -21,6 +21,7 @@
  */
 package org.jboss.profileservice.management.builders;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -31,6 +32,9 @@
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
 import org.jboss.system.metadata.ServiceDeployment;
 import org.jboss.system.metadata.ServiceMetaData;
 
@@ -57,11 +61,14 @@
          ServiceDeployment dsMetaData = unit.getAttachment(ServiceDeployment.class);
          List<ServiceMetaData> services = dsMetaData.getServices();
          log.info(name+" services: "+services);
-         Set<DeploymentContext> comps = unit.getDeploymentContext().getComponents();
-         for(DeploymentContext ctx : comps)
-         {
-            log.info(ctx+": "+ctx.getTransientManagedObjects());            
-         }
+         String attachName = ServiceDeployment.class.getName();
+         HashSet<ManagedProperty> props = new HashSet<ManagedProperty>();
+         ManagedObject mo = new ManagedObjectImpl(attachName, props);
+         /*
+         ManagedProperty config = new ManagedPropertyImpl(mo);
+         props.add(new )
+         map.put(attachName, mo);
+         */
       }
    }
 }

Modified: trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -56,6 +56,15 @@
       throws NoSuchProfileException, NoSuchDeploymentException, Exception;
 
    /**
+    * Get the names of the deployment in the profile that have the
+    * given deployment type.
+    * @param key - the profile containing the deployment
+    * @param type - the deployment type
+    */
+   public Set<String> getDeploymentNamesForType(ProfileKey key, String type)
+      throws NoSuchProfileException;
+
+   /**
     * Get the registered DeploymentTemplate names.
     * 
     * TODO: probably needs a Map<String, DeploymentType> notion

Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collection;
+import java.util.Set;
 import java.util.zip.ZipInputStream;
 
 import org.jboss.deployers.spi.attachments.Attachments;
@@ -45,8 +46,9 @@
    public URI getDeploymentURI(DeploymentPhase phase);
    public void setDeploymentURI(URI uri, DeploymentPhase phase);
 
-   public Collection<String> getDeploymentNames();
-   public Collection<String> getDeploymentNames(DeploymentPhase phase);
+   public Set<String> getDeploymentNames();
+   public Set<String> getDeploymentNames(DeploymentPhase phase);
+   public Set<String> getDeploymentNamesForType(String type);
 
 
    // Upload a raw deployment
@@ -107,4 +109,5 @@
    // Managed object attachments for a deployment
    public void addManagedObject(String vfsPath, Attachments edits)
       throws Exception;
+
 }

Modified: trunk/system/src/main/org/jboss/profileservice/spi/Profile.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/profileservice/spi/Profile.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -23,6 +23,7 @@
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.virtual.VirtualFile;
@@ -56,7 +57,7 @@
     * Get the names of the deployments in the profile
     * @return names of deployments
         */
-   public Collection<String> getDeploymentNames();
+   public Set<String> getDeploymentNames();
 
    /**
     * Get the names of the deployments for the given phase defined in this profile
@@ -64,9 +65,18 @@
     * deployment is loaded
     * @return names of deployments
         */
-   public Collection<String> getDeploymentNames(DeploymentPhase phase);
+   public Set<String> getDeploymentNames(DeploymentPhase phase);
 
+   //public DeploymentInfo getDeploymentInfo(String name);
+
    /**
+    * Get the names of the deployment in the profile that have the
+    * given deployment type.
+    * @param type - the deployment type
+    */
+   public Set<String> getDeploymentNamesForType(String type);
+
+   /**
     * Get the root for deployments of the given phase.
     * 
     * @param phase

Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/ProfileImpl.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -22,11 +22,13 @@
 package org.jboss.system.server.profile.basic;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Set;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
@@ -77,7 +79,7 @@
     * Get the names of the applications in the profile
     * @return names of applications
     */
-   public Collection<String> getDeploymentNames()
+   public Set<String> getDeploymentNames()
    {
       HashSet<String> names = new HashSet<String>();
       names.addAll(this.bootstraps.keySet());
@@ -146,7 +148,7 @@
       return ctx;
    }
 
-   public Collection<String> getDeploymentNames(DeploymentPhase phase)
+   public Set<String> getDeploymentNames(DeploymentPhase phase)
    {
       HashSet<String> names = new HashSet<String>();
       switch( phase )
@@ -164,6 +166,27 @@
       return names;
    }
 
+   public Set<String> getDeploymentNamesForType(String type)
+   {
+      HashSet<String> names = new HashSet<String>();
+      for(DeploymentContext ctx : bootstraps.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      for(DeploymentContext ctx : deployers.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      for(DeploymentContext ctx : applications.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      return names;
+   }
+
    public Collection<DeploymentContext> getDeployments()
    {
       HashSet<DeploymentContext> deployments = new HashSet<DeploymentContext>();

Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -22,8 +22,10 @@
 package org.jboss.system.server.profile.repository;
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
 
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.profileservice.spi.DeploymentRepository;
@@ -74,15 +76,20 @@
     * Get the names of the deployments in the profile
     * @return names of deployments
     */
-   public Collection<String> getDeploymentNames()
+   public Set<String> getDeploymentNames()
    {
       return repository.getDeploymentNames();
    }
-   public Collection<String> getDeploymentNames(DeploymentPhase phase)
+   public Set<String> getDeploymentNames(DeploymentPhase phase)
    {
       return repository.getDeploymentNames(phase);
    }
 
+   public Set<String> getDeploymentNamesForType(String type)
+   {
+      return repository.getDeploymentNamesForType(type);
+   }
+
    public VirtualFile getRootFile(DeploymentPhase phase)
       throws Exception
    {

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -25,14 +25,17 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.NotSerializableException;
 import java.io.ObjectOutputStream;
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.zip.ZipInputStream;
 
 import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
@@ -143,7 +146,7 @@
             break;
       }
    }
-   public Collection<String> getDeploymentNames()
+   public Set<String> getDeploymentNames()
    {
       HashSet<String> names = new HashSet<String>();
       names.addAll(bootstrapCtxs.keySet());
@@ -151,7 +154,7 @@
       names.addAll(applicationCtxs.keySet());
       return names;
    }
-   public Collection<String> getDeploymentNames(DeploymentPhase phase)
+   public Set<String> getDeploymentNames(DeploymentPhase phase)
    {
       HashSet<String> names = new HashSet<String>();
       switch( phase )
@@ -168,6 +171,28 @@
       }
       return names;      
    }
+
+   public Set<String> getDeploymentNamesForType(String type)
+   {
+      HashSet<String> names = new HashSet<String>();
+      for(DeploymentContext ctx : bootstrapCtxs.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      for(DeploymentContext ctx : deployerCtxs.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      for(DeploymentContext ctx : applicationCtxs.values())
+      {
+         if( ctx.getTypes().contains(type) )
+            names.add(ctx.getName());
+      }
+      return names;
+   }
+
    public void addDeploymentContent(String name, ZipInputStream contentIS, DeploymentPhase phase)
       throws IOException
    {
@@ -194,7 +219,14 @@
       Attachments pmos = d.getPredeterminedManagedObjects();
       if( pmos != null && pmos.hasAttachments() == true )
          return;
-      this.saveAttachments(d);
+      try
+      {
+         saveAttachments(d);
+      }
+      catch(NotSerializableException e)
+      {
+         log.warn("Failed to save attachments for: "+d.getName()+", "+e);
+      }
    }
    public DeploymentContext getDeployment(String name, DeploymentPhase phase)
       throws Exception, NoSuchDeploymentException
@@ -463,7 +495,14 @@
       Collection<DeploymentContext> ctxs = applicationCtxs.values();
       for(DeploymentContext ctx : ctxs)
       {
-         this.loadAttachments(ctx);         
+         try
+         {
+            this.loadAttachments(ctx);
+         }
+         catch(Exception e)
+         {
+            log.error("Failed to load attachments, ignoring"+e);
+         }
       }
       return ctxs;
    }
@@ -518,6 +557,7 @@
             ctx.getTransientAttachments().addAttachment(key, value);
          }
       }
+      
    }
 
    /**

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-15 04:25:25 UTC (rev 59635)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-15 05:33:18 UTC (rev 59636)
@@ -29,6 +29,7 @@
 import org.jboss.deployers.spi.management.DeploymentTemplateInfo;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.managed.api.ManagedProperty;
+import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
 import org.jboss.profileservice.spi.Profile.DeploymentPhase;
@@ -49,7 +50,8 @@
    /** Basic test of accessing the ProfileService and checking the
     * available profile keys.
     */
-   public void testProfileKeys() throws Exception
+   public void testProfileKeys()
+      throws Exception
    {
       InitialContext ctx = super.getInitialContext();
       ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
@@ -60,6 +62,22 @@
    }
 
    /**
+    * Test that one can query for deployments of type jca-ds to
+    * obtain data source deployments.
+    */
+   public void testDataSourceType()
+      throws Exception
+   {
+      InitialContext ctx = super.getInitialContext();
+      ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+      ProfileKey key = new ProfileKey("default");
+      ManagementView mgtView = ps.getViewManager();
+      Set<String> names = mgtView.getDeploymentNamesForType(key, "jca-ds");
+      log.info("jca-ds names: "+names);
+      assertTrue("names.size > 0 ", names.size() > 0);
+   }
+
+   /**
     * Test adding a new hsql DataSource deployment
     * @throws Exception
     */




More information about the jboss-cvs-commits mailing list