[jboss-cvs] JBossAS SVN: r99399 - trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 14 05:22:10 EST 2010


Author: alesj
Date: 2010-01-14 05:22:10 -0500 (Thu, 14 Jan 2010)
New Revision: 99399

Modified:
   trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyIntegrationDeployer.java
   trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyScannerDeployer.java
Log:
Some minor code opts.

Modified: trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyIntegrationDeployer.java
===================================================================
--- trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyIntegrationDeployer.java	2010-01-14 10:13:41 UTC (rev 99398)
+++ trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyIntegrationDeployer.java	2010-01-14 10:22:10 UTC (rev 99399)
@@ -2,6 +2,7 @@
 
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.metadata.web.jboss.JBossServletMetaData;
@@ -29,9 +30,10 @@
    {
       super();
 
-      this.addInput(JBossWebMetaData.class);
-      this.addInput(ResteasyDeployment.class);
-      this.addOutput(JBossWebMetaData.class);
+      addRequiredInput(JBossWebMetaData.class);
+      addRequiredInput(ResteasyDeployment.class);
+      addOutput(JBossWebMetaData.class);
+      setStage(DeploymentStages.PRE_REAL); // TODO -- right stage?
    }
 
    protected void populateWebMetadata()
@@ -56,23 +58,14 @@
 
    protected void internalDeploy(DeploymentUnit du) throws DeploymentException
    {
-      JBossWebMetaData webdata = du.getAttachment(JBossWebMetaData.class);
-      if (webdata == null)
+      if (du.isAttachmentPresent(ResteasyScannerDeployer.JAXRS_APPLICATION_CLASS_DEPLOYMENT))
       {
-         return;
-      }
-
-      if (du.getAttachment(ResteasyScannerDeployer.JAXRS_APPLICATION_CLASS_DEPLOYMENT) != null)
-      {
          // do not do this deployer if there is an application class a previous deployer will handle it
          return;
       }
 
+      JBossWebMetaData webdata = du.getAttachment(JBossWebMetaData.class);
       ResteasyDeployment resteasy = du.getAttachment(ResteasyDeployment.class);
-      if (resteasy == null)
-      {
-         return;
-      }
 
       LOGGER.info("Found ResteasyDeployment...");
 

Modified: trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyScannerDeployer.java
===================================================================
--- trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyScannerDeployer.java	2010-01-14 10:13:41 UTC (rev 99398)
+++ trunk/resteasy-int/jar/src/main/java/org/jboss/resteasy/integration/deployers/ResteasyScannerDeployer.java	2010-01-14 10:22:10 UTC (rev 99399)
@@ -1,6 +1,7 @@
 package org.jboss.resteasy.integration.deployers;
 
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.logging.Logger;
@@ -33,19 +34,18 @@
    {
       super();
 
-      this.addInput(JBossWebMetaData.class);
-      this.addOutput(JBossWebMetaData.class);
-      this.addOutput(JAXRS_APPLICATION_CLASS_DEPLOYMENT);
-      this.addOutput(ResteasyDeployment.class);
+      addRequiredInput(JBossWebMetaData.class);
+      addInput(AnnotationRepository.class);
+      addInput(ResteasyDeployment.class);
+      addOutput(JBossWebMetaData.class);
+      addOutput(JAXRS_APPLICATION_CLASS_DEPLOYMENT);
+      addOutput(ResteasyDeployment.class);
+      setStage(DeploymentStages.PRE_REAL); // TODO -- right stage?
    }
 
    protected void internalDeploy(DeploymentUnit du) throws DeploymentException
    {
       JBossWebMetaData webdata = du.getAttachment(JBossWebMetaData.class);
-      if (webdata == null)
-      {
-         return;
-      }
       boolean applicationClassDeployed = deployApplicationClass(du, webdata);
 
       // If an Application class is present, we assume the user wants to totally control deployment
@@ -124,7 +124,6 @@
       if (scanAll == false) return;
 
       AnnotationRepository env = du.getAttachment(AnnotationRepository.class);
-
       if (env == null)
       {
          LOGGER.info("Expecting AnnotationRepository class for scanning WAR for JAX-RS classes");




More information about the jboss-cvs-commits mailing list