[jboss-cvs] JBossAS SVN: r88299 - in projects/jboss-jca/trunk: standalone/src/main/java/org/jboss/jca/standalone and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 6 15:51:12 EDT 2009


Author: jesper.pedersen
Date: 2009-05-06 15:51:12 -0400 (Wed, 06 May 2009)
New Revision: 88299

Added:
   projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml
Modified:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/hack/MainScanner.java
   projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
   projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap.xml
Log:
[JBJCA-89] Standalone profile - move scanner to bootstrap

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/hack/MainScanner.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/hack/MainScanner.java	2009-05-06 19:28:49 UTC (rev 88298)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/hack/MainScanner.java	2009-05-06 19:51:12 UTC (rev 88299)
@@ -25,6 +25,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.JarURLConnection;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
@@ -33,15 +34,11 @@
 import java.util.List;
 import java.util.Properties;
 
-import org.jboss.bootstrap.spi.Server;
-import org.jboss.bootstrap.spi.microcontainer.MCServer;
-import org.jboss.dependency.spi.ControllerState;
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.client.spi.main.MainDeployer;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.kernel.Kernel;
 import org.jboss.logging.Logger;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
@@ -66,28 +63,52 @@
 
    /**
     * Constructor
-    * @param server The server
-    * @param deployDirectory The deploy directory that needs to be scanned
     */
-   public MainScanner(Object server, URL deployDirectory)
+   public MainScanner()
    {
-      if (server == null)
-         throw new IllegalArgumentException("Server is null");
+   }
 
-      if (deployDirectory == null)
-         throw new IllegalArgumentException("DeployDirectory is null");
+   /**
+    * Set the main deployer instance
+    * @param md The instance
+    */
+   public void setMainDeployer(MainDeployer md)
+   {
+      mainDeployer = md;
+   }
 
-      if (!(server instanceof MCServer))
-         throw new IllegalArgumentException("Server is not a MCServer instance");
+   /**
+    * Set the main deployer instance
+    * @param md The instance
+    */
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
 
-      MCServer mcServer = (MCServer)server;
-      Kernel kernel = mcServer.getKernel();
+   /**
+    * Set the deploy directory
+    * @param deploy The instance
+    */
+   public void setDeployDirectory(String deploy)
+   {
+      try
+      {
+         deployDirectory = new URL(deploy);
+      }
+      catch (MalformedURLException mue)
+      {
+         // Ignore for now
+      }
+   }
 
-      this.mainDeployer = 
-         (MainDeployer)kernel.getController().getContext("MainDeployer", ControllerState.INSTALLED).getTarget();
-      this.deployDirectory = deployDirectory;
-
-      log.debug("MainScanner created.");
+   /**
+    * Set the deploy directory
+    * @param deploy The instance
+    */
+   public String getDeployDirectory()
+   {
+      return deployDirectory.toString();
    }
 
    /**
@@ -98,6 +119,12 @@
    {
       log.debug("MainScanner starting.");
 
+      if (mainDeployer == null)
+         throw new IllegalArgumentException("MainDeployer is null");
+
+      if (deployDirectory == null)
+         throw new IllegalArgumentException("DeployDirectory is null");
+
       ClassLoader tccl = Thread.currentThread().getContextClassLoader();
 
       Enumeration<URL> urls = tccl.getResources("META-INF/jboss-beans.xml");
@@ -116,8 +143,6 @@
 
       deployDirectory(deployDirectory);
       
-      mainDeployer.checkComplete();
-
       log.debug("MainScanner started.");
    }
 

Modified: projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java	2009-05-06 19:28:49 UTC (rev 88298)
+++ projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java	2009-05-06 19:51:12 UTC (rev 88299)
@@ -45,9 +45,6 @@
    /** The server */
    private Object server;
 
-   /** The main deployer */
-   private Object mainScanner;
-
    /**
     * Default constructor
     */
@@ -103,12 +100,14 @@
          Field serverConfigFieldServerName = serverConfigClass.getDeclaredField("SERVER_NAME");
 
          SecurityActions.setSystemProperty("xb.builder.useUnorderedSequence", "true");
+         SecurityActions.setSystemProperty("jboss.deploy.url", deployDirectory.toURI().toURL().toString());
 
          Properties props = new Properties(SecurityActions.getSystemProperties());
          props.put((String)serverConfigFieldHomeUrl.get(null), root.toURI().toURL().toString());
          props.put((String)serverConfigFieldHomeDir.get(null), root.getAbsolutePath());
          props.put((String)serverConfigFieldServerName.get(null), "jca");
 
+         props.put("jboss.deploy.url", deployDirectory.toURI().toURL().toString());
          props.put("jboss.lib.url", libDirectory.toURI().toURL().toString());
 
          String loggingManager = props.getProperty("java.util.logging.manager");
@@ -122,15 +121,6 @@
          serverMethodInit.invoke(server, props, null);
 
          serverMethodStart.invoke(server);
-
-         // Start the main scanner
-         Class mainScannerClass = Class.forName("org.jboss.jca.deployers.hack.MainScanner", true, classLoader);
-         Constructor mainScannerConstructor = mainScannerClass.getDeclaredConstructor(Object.class, URL.class);
-         mainScanner = mainScannerConstructor.newInstance(server, deployDirectory);
-
-         Method  mainScannerMethodStart = mainScannerClass.getDeclaredMethod("start"); 
-
-         mainScannerMethodStart.invoke(mainScanner);
       }
       catch (Throwable t)
       {
@@ -145,19 +135,6 @@
    {
       try
       {
-         if (mainScanner != null)
-         {
-            Method mainScannerMethodStop = mainScanner.getClass().getDeclaredMethod("stop"); 
-            mainScannerMethodStop.invoke(mainScanner);
-         }
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace(System.err);
-      }
-
-      try
-      {
          if (server != null)
          {
             Method serverMethodShutdown = server.getClass().getDeclaredMethod("shutdown"); 

Added: projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml	2009-05-06 19:51:12 UTC (rev 88299)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   The hot deployment scanner
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <bean name="HDScanner" class="org.jboss.jca.deployers.hack.MainScanner">
+    <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+    <property name="deployDirectory">${jboss.deploy.url}</property>
+  </bean>
+
+</deployment>

Modified: projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap.xml	2009-05-06 19:28:49 UTC (rev 88298)
+++ projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap.xml	2009-05-06 19:51:12 UTC (rev 88299)
@@ -7,5 +7,6 @@
   <url>bootstrap/classloader.xml</url>
   <url>bootstrap/aop.xml</url>
   <url>bootstrap/deployers.xml</url>
+  <url>bootstrap/hdscanner.xml</url>
 
 </bootstrap> 




More information about the jboss-cvs-commits mailing list