[jboss-cvs] JBossAS SVN: r72275 - in projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common: aop and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 16 08:32:51 EDT 2008


Author: ALRubinger
Date: 2008-04-16 08:32:51 -0400 (Wed, 16 Apr 2008)
New Revision: 72275

Added:
   projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/AOPDeployer.java
   projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/CommonInterceptor.java
   projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/aop/
Removed:
   projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/common/
Modified:
   projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/aop/LoggingInterceptor.java
Log:
[JBASPECT-2] Updated packages appropriately

Copied: projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/AOPDeployer.java (from rev 72274, projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/common/AOPDeployer.java)
===================================================================
--- projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/AOPDeployer.java	                        (rev 0)
+++ projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/AOPDeployer.java	2008-04-16 12:32:51 UTC (rev 72275)
@@ -0,0 +1,68 @@
+/*
+* 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.aspects.common;
+
+import java.net.URL;
+
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.logging.Logger;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AOPDeployer
+{
+   private static Logger log = Logger.getLogger(AOPDeployer.class);
+   
+   private String path;
+   
+   URL url;
+   
+   public AOPDeployer(String path)
+   {
+      this.path = path;
+   }
+   
+   public String deploy() throws Exception
+   {
+      url = Thread.currentThread().getContextClassLoader().getResource(path);
+      log.info("Deploying AOP from " + url);
+      AspectXmlLoader.deployXML(url);
+      return "Deployed " + url;
+   }
+   
+   public String undeploy()
+   {
+      try
+      {
+         log.info("Undeploying AOP from " + url);
+         AspectXmlLoader.undeployXML(url);
+      }
+      catch(Exception e)
+      {
+         log.warn("Error undeploying " + url, e); 
+      }
+      return "Undeployed " + url;
+   }
+}

Copied: projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/CommonInterceptor.java (from rev 72274, projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/common/CommonInterceptor.java)
===================================================================
--- projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/CommonInterceptor.java	                        (rev 0)
+++ projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/CommonInterceptor.java	2008-04-16 12:32:51 UTC (rev 72275)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.aspects.common;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A common interceptor without annotation, does nothing useful.
+ * 
+ * Can be used by an annotated interceptor, or one from metadata.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision$
+ */
+public class CommonInterceptor
+{
+   private static final Logger log = Logger.getLogger(CommonInterceptor.class);
+   
+   public static int preDestroys = 0, postConstructs = 0, aroundInvokes = 0;
+   
+   public void preDestroy(InvocationContext ctx) throws Exception
+   {
+      log.debug("preDestroy " + ctx);
+      preDestroys++;
+      ctx.proceed();
+   }
+   
+   public void postConstruct(InvocationContext ctx) throws Exception
+   {
+      log.debug("postConstruct " + ctx);
+      if(ctx.getTarget() == null)
+         throw new IllegalStateException("target is null");
+      postConstructs++;
+      ctx.proceed();
+   }
+   
+   public Object aroundInvoke(InvocationContext ctx) throws Exception
+   {
+      log.debug("aroundInvoke " + ctx);
+      aroundInvokes++;
+      return ctx.proceed();
+   }
+}

Copied: projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/aop (from rev 72274, projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/common/aop)

Modified: projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/aop/LoggingInterceptor.java
===================================================================
--- projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/common/aop/LoggingInterceptor.java	2008-04-16 12:22:24 UTC (rev 72274)
+++ projects/jboss-aspects/trunk/common/src/main/java/org/jboss/aspects/common/aop/LoggingInterceptor.java	2008-04-16 12:32:51 UTC (rev 72275)
@@ -19,7 +19,7 @@
  * 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.ejb3.test.interceptors.common.aop;
+package org.jboss.aspects.common.aop;
 
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;




More information about the jboss-cvs-commits mailing list