[jboss-cvs] JBossAS SVN: r112155 - branches/JBPAPP_5_1_JBPAPP-6716/system-jmx/src/main/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 29 13:25:30 EDT 2011


Author: bmaxwell
Date: 2011-08-29 13:25:29 -0400 (Mon, 29 Aug 2011)
New Revision: 112155

Modified:
   branches/JBPAPP_5_1_JBPAPP-6716/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
Log:
[JBPAPP-6716] add message to RuntimeExceptions, add code to catch Malformed and try to create File

Modified: branches/JBPAPP_5_1_JBPAPP-6716/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
===================================================================
--- branches/JBPAPP_5_1_JBPAPP-6716/system-jmx/src/main/org/jboss/deployment/MainDeployer.java	2011-08-29 16:01:42 UTC (rev 112154)
+++ branches/JBPAPP_5_1_JBPAPP-6716/system-jmx/src/main/org/jboss/deployment/MainDeployer.java	2011-08-29 17:25:29 UTC (rev 112155)
@@ -296,23 +296,33 @@
    {
       log.debug("listDeployedModules");
 
-      HashMap map = new HashMap();
-      synchronized (deploymentList)
-      {
-         Collection col = new ArrayList(deploymentList);
-
-         // create a map entry for each deployment
-         for (Iterator it = col.iterator(); it.hasNext();)
-         {
-            DeploymentInfo info = (DeploymentInfo) it.next();
-            map.put(info.url, new SerializableDeploymentInfo(info));
-            // assign parent and sub deployments
-            fillParentAndChildrenSDI(info, map);
-         }
-      }
-
-      // map.values is not serializable, so we copy
-      return new ArrayList(map.values());
+//      HashMap map = new HashMap();
+//      synchronized (deploymentList)
+//      {
+//         Collection col = new ArrayList(deploymentList);
+//
+//         // create a map entry for each deployment
+//         for (Iterator it = col.iterator(); it.hasNext();)
+//         {
+//            DeploymentInfo info = (DeploymentInfo) it.next();
+//            map.put(info.url, new SerializableDeploymentInfo(info));
+//            // assign parent and sub deployments
+//            fillParentAndChildrenSDI(info, map);
+//         }
+//      }
+//
+//      // map.values is not serializable, so we copy
+//      return new ArrayList(map.values());
+//      Collection<DeploymentInfo> deploymentInfos = getDeployed();
+//      List<SerializableDeploymentInfo> serializedDeploymentInfos = new ArrayList<SerializableDeploymentInfo>(deploymentInfos.size());
+//      
+//      for(DeploymentInfo di : deploymentInfos)
+//      {
+//         serializedDeploymentInfos.add(new SerializableDeploymentInfo(di));
+//      }
+//      
+//      return serializedDeploymentInfos;
+      return getDeployed();
    }
 
    /**
@@ -585,7 +595,19 @@
    public void redeploy(String urlspec)
       throws DeploymentException, MalformedURLException
    {
-      redeploy(new URL(urlspec));
+      URL url;
+      try
+      {
+         url = new URL(urlspec);
+      }
+      catch (MalformedURLException e)
+      {
+         File file = new File(urlspec);
+         url = file.toURL();
+      }
+      
+      redeploy(url);
+//      redeploy(new URL(urlspec));
    }
 
    /**
@@ -652,7 +674,19 @@
    public void undeploy(String urlspec)
       throws DeploymentException, MalformedURLException
    {
-      undeploy(new URL(urlspec));
+      URL url;
+      try
+      {
+         url = new URL(urlspec);
+      }
+      catch (MalformedURLException e)
+      {
+         File file = new File(urlspec);
+         url = file.toURL();
+      }
+      
+      undeploy(url);
+      //undeploy(new URL(urlspec));
    }
 
    /**
@@ -1355,7 +1389,18 @@
    public boolean isDeployed(String url)
       throws MalformedURLException
    {
-      return isDeployed(new URL(url));
+      URL realUrl;
+      try
+      {
+         realUrl = new URL(url);
+      }
+      catch (MalformedURLException e)
+      {
+         File file = new File(url);
+         realUrl = file.toURL();
+      }
+      return isDeployed(realUrl);
+//      return isDeployed(new URL(url));
    }
 
    /**
@@ -1545,17 +1590,22 @@
       for (ManagedDeployment md : managedDeployments)
       {
          try
-         {
-            DeploymentInfo di = new DeploymentInfo(new URL(md.getName()), null, null);
+         {            
+            String urlPath = md.getName();
+//            log.info("ManagedDeployment name: " + urlPath);
+            if(urlPath.startsWith("vfs"))
+               urlPath = "file" + urlPath.substring(urlPath.indexOf(":"));               
+//                  urlPath = urlPath.substring(3);                        
+            
+//            VirtualFile file = VFS.createNewRoot(url);
+//            VirtualFile vfile = VFS.getRoot(new URL(urlPath));
+            
+            
+            DeploymentInfo di = new DeploymentInfo(new URL(urlPath), null, null);
             di.state = org.jboss.deployment.DeploymentState.getDeploymentState(md.getDeploymentState().toString());
-            deploymentInfos.add(di);
-
-            Map<String, ManagedProperty> props = md.getProperties();
-            for (Map.Entry<String, ManagedProperty> entry : props.entrySet())
-            {
-               log.info(md);
-               log.info("Name: " + entry.getKey() + " value: " + entry.getValue());
-            }
+            // this is a hack to prevent SerializableDeploymentInfo from having a null pointer
+            di.deployer = new JARDeployer();
+            deploymentInfos.add(di);                        
          }
          catch (Exception e)
          {
@@ -1584,7 +1634,8 @@
       catch(Exception e)
       {         
          log.error("Error getting deployments from ManagementView", e);
-         throw new RuntimeException(e);
+         // this only returning message for twiddle calls that don't have access to the profile exceptions
+         throw new RuntimeException(e.getMessage());
       }
    }
    
@@ -1666,7 +1717,8 @@
       catch(Exception e)
       {                 
          log.error("Error distributing / starting using DeploymentManager", e);
-         throw new RuntimeException(e);
+         // this only returning message for twiddle calls that don't have access to the profile exceptions
+         throw new RuntimeException(e.getMessage());
       }
    }
 
@@ -1696,7 +1748,8 @@
       catch(Exception e)
       {                 
          log.error("Error stopping / remove using DeploymentManager", e);
-         throw new RuntimeException(e);
+         // this only returning message for twiddle calls that don't have access to the profile exceptions
+         throw new RuntimeException(e.getMessage());
       }
    }      
    private void redeploy2(String urlspec) throws DeploymentException



More information about the jboss-cvs-commits mailing list