[jboss-cvs] JBossAS SVN: r60095 - in trunk/system/src/main/org/jboss: profileservice/aop and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 29 00:26:05 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-29 00:26:04 -0500 (Mon, 29 Jan 2007)
New Revision: 60095

Added:
   trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeListener.java
   trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeVisitor.java
   trunk/system/src/main/org/jboss/profileservice/aop/DeployerAspects.java
Modified:
   trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java
   trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java
   trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
Log:
Update MainDeployer.process usage, and add a ComponentType vistor/listener.

Added: trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeListener.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeListener.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeListener.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.management;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+
+/**
+ * Callback interface for deployment ComponentType identification.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface ComponentTypeListener
+{
+   public void updateComponentType(DeploymentUnit unit, ComponentType type);
+}


Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeListener.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Added: trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeVisitor.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeVisitor.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeVisitor.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.management;
+
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+
+/**
+ * Visitor api for determining the ComponentType of a deployment.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface ComponentTypeVisitor
+{
+   public ComponentType visit(DeploymentUnit unit);
+}


Property changes on: trunk/system/src/main/org/jboss/deployers/spi/management/ComponentTypeVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Added: trunk/system/src/main/org/jboss/profileservice/aop/DeployerAspects.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/aop/DeployerAspects.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/profileservice/aop/DeployerAspects.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -0,0 +1,133 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.profileservice.aop;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.management.ComponentType;
+import org.jboss.deployers.spi.management.ComponentTypeListener;
+import org.jboss.deployers.spi.management.ComponentTypeVisitor;
+import org.jboss.logging.Logger;
+
+/**
+ * Aspects that integrate with the profile service.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class DeployerAspects 
+{
+   private static Logger log = Logger.getLogger(DeployerAspects.class);
+
+   /** TODO: static as a hack due to issues with aop in the bootstrap
+    */
+   private static ComponentTypeVisitor compVisitor;
+   private static ComponentTypeListener compListener;
+
+   public static ComponentTypeVisitor getCompVisitor()
+   {
+      return compVisitor;
+   }
+   /**
+    * Set the ComponentTypeVisitor 
+    * @return
+    */
+   public static void setCompVisitor(ComponentTypeVisitor compVisitor)
+   {
+      DeployerAspects.compVisitor = compVisitor;
+   }
+
+   public static ComponentTypeListener getCompListener()
+   {
+      return compListener;
+   }
+   public static void setCompListener(ComponentTypeListener compListener)
+   {
+      DeployerAspects.compListener = compListener;
+   }
+
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      log.debug(invocation);
+      MethodInvocation mi = (MethodInvocation) invocation;
+      String methodName = mi.getActualMethod().getName();
+      Object value = null;
+      if( methodName.equals("prepareDeploy") )
+         value = prepareDeploy(mi);
+      else if( methodName.equals("commitDeploy") )
+         value = commitDeploy(mi);
+      else if( methodName.equals("prepareUndeploy") )
+         value = prepareUndeploy(mi);
+      else if( methodName.equals("commitUndeploy") )
+         value = commitUndeploy(mi);
+      else
+         value = invocation.invokeNext();
+      return value;
+   }
+
+   public Object prepareDeploy(MethodInvocation invocation)
+      throws Throwable
+   {
+      Object target = invocation.getTargetObject();
+      Object[] args = invocation.getArguments();
+      log.debug("prepareDeploy, target="+target);
+      return invocation.invokeNext();
+   }
+   public Object commitDeploy(MethodInvocation invocation)
+      throws Throwable
+   {
+      Object value = invocation.invokeNext();
+      Object[] args = invocation.getArguments();
+      DeploymentUnit unit = (DeploymentUnit) args[0];
+      log.debug("commitDeploy, unit="+unit);
+      if( compVisitor != null )
+      {
+         ComponentType type = compVisitor.visit(unit);
+         if( type != null && compListener != null )
+            compListener.updateComponentType(unit, type);
+      }
+      return value;
+   }
+   
+   public Object prepareUndeploy(MethodInvocation invocation)
+      throws Throwable
+   {
+      Object target = invocation.getTargetObject();
+      log.debug("prepareUndeploy, target="+target);
+      return invocation.invokeNext();
+   }
+   public Object commitUndeploy(MethodInvocation invocation)
+      throws Throwable
+   {
+      Object target = invocation.getTargetObject();
+      Object value = invocation.invokeNext();
+      log.debug("commitUndeploy, target="+target);
+      return value;
+   }
+
+}


Property changes on: trunk/system/src/main/org/jboss/profileservice/aop/DeployerAspects.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Modified: trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java	2007-01-29 05:18:26 UTC (rev 60094)
+++ trunk/system/src/main/org/jboss/profileservice/aop/MainDeployerAspect.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -38,7 +38,6 @@
 
    public Object process(Invocation invocation) throws Throwable
    {
-      System.out.println("=============> MainDeployerAspect!!!!");
       return invocation.invokeNext();
    }
 }

Modified: trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java	2007-01-29 05:18:26 UTC (rev 60094)
+++ trunk/system/src/main/org/jboss/profileservice/aop/PersistAspect.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -37,7 +37,6 @@
 
    public Object setValue(Invocation invocation) throws Throwable
    {
-      System.out.println("=============> PersistAspect!!!!");
       return invocation.invokeNext();
    }
 }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2007-01-29 05:18:26 UTC (rev 60094)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2007-01-29 05:26:04 UTC (rev 60095)
@@ -343,13 +343,8 @@
          if (first == null)
             first = d;
       }
-      Collection<DeploymentContext> ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
+      deployer.process();
       checkIncomplete();
-      for (DeploymentContext d : ctxs)
-      {
-         profile.updateDeployment(d, DeploymentPhase.BOOTSTRAP);
-      }
-      deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
 
       Thread thread = Thread.currentThread();
       ClassLoader old = thread.getContextClassLoader();
@@ -363,25 +358,15 @@
          Collection<DeploymentContext> profileDeployers = profile.getDeployments(DeploymentPhase.DEPLOYER);
          for (DeploymentContext d : profileDeployers)
             deployer.addDeploymentContext(d);
-         ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
+         deployer.process();
          checkIncomplete();
-         for (DeploymentContext d : ctxs)
-         {
-            profile.updateDeployment(d, DeploymentPhase.DEPLOYER);
-         }
-         deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
 
          // Deploy the profile deployments
          Collection<DeploymentContext> profileDeployments = profile.getDeployments(DeploymentPhase.APPLICATION);
          for (DeploymentContext d : profileDeployments)
             deployer.addDeploymentContext(d);
-         ctxs = deployer.process(-1, Deployer.CLASSLOADER_DEPLOYER);
+         deployer.process();
          checkIncomplete();
-         for (DeploymentContext d : ctxs)
-         {
-            profile.updateDeployment(d, DeploymentPhase.APPLICATION);
-         }
-         deployer.process(Deployer.CLASSLOADER_DEPLOYER, Integer.MAX_VALUE);
       }
       finally
       {




More information about the jboss-cvs-commits mailing list