[jboss-cvs] JBossAS SVN: r68675 - in projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors: direct and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 8 08:11:13 EST 2008
Author: wolfc
Date: 2008-01-08 08:11:13 -0500 (Tue, 08 Jan 2008)
New Revision: 68675
Added:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java
Removed:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/aop/ManagedObjectContainer.java
Modified:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/AbstractContainer.java
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java
Log:
getContainer on ManagedObjectAdvisor
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/AbstractContainer.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/AbstractContainer.java 2008-01-08 12:19:38 UTC (rev 68674)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/AbstractContainer.java 2008-01-08 13:11:13 UTC (rev 68675)
@@ -31,7 +31,6 @@
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.util.MethodHashing;
import org.jboss.ejb3.interceptors.lang.ClassHelper;
-import org.jboss.ejb3.interceptors.proxy.aop.ManagedObjectContainer;
import org.jboss.logging.Logger;
/**
@@ -40,11 +39,11 @@
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @version $Revision: $
*/
-public abstract class AbstractContainer<T>
+public abstract class AbstractContainer<T, C extends AbstractContainer<T, C>>
{
private static final Logger log = Logger.getLogger(AbstractContainer.class);
- private ManagedObjectContainer advisor;
+ private ManagedObjectAdvisor<T, C> advisor;
public AbstractContainer(String name, Domain domain, Class<? extends T> beanClass)
{
@@ -52,7 +51,7 @@
assert domain != null : "domain is null";
assert beanClass != null : "beanClass is null";
- this.advisor = new ManagedObjectContainer(name, domain, beanClass);
+ this.advisor = new ManagedObjectAdvisor<T, C>((C) this, name, domain, beanClass);
}
public AbstractContainer(String name, String domainName, Class<? extends T> beanClass)
Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java 2008-01-08 13:11:13 UTC (rev 68675)
@@ -0,0 +1,186 @@
+/*
+ * 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.ejb3.interceptors.container;
+
+import java.util.List;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.ClassAdvisor;
+import org.jboss.aop.Domain;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.InstanceAdvisorDelegate;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.introduction.AnnotationIntroduction;
+import org.jboss.aop.joinpoint.Joinpoint;
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.ejb3.interceptors.ManagedObject;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ManagedObjectAdvisor<T, C extends AbstractContainer<T, C>> extends ClassAdvisor implements InstanceAdvisor
+{
+ private static final Logger log = Logger.getLogger(ManagedObjectAdvisor.class);
+
+ private C container;
+ private InstanceAdvisorDelegate instanceAdvisorDelegate;
+
+ protected ManagedObjectAdvisor(C container, String name, AspectManager manager, Class<?> beanClass)
+ {
+ super(name, manager);
+ assert beanClass != null : "beanClass is null";
+
+ // For convenience we add the ManagedObject annotation
+ annotations.addClassAnnotation(ManagedObject.class, new Object());
+
+ // Poking starts here
+ attachClass(beanClass);
+
+ this.instanceAdvisorDelegate = new InstanceAdvisorDelegate(this, this);
+ }
+
+ private void deployAnnotationIntroduction(AnnotationIntroduction introduction)
+ {
+ log.debug("deploy annotation introduction " + introduction);
+ // Poke introductions into the overrides
+ deployAnnotationOverride(introduction);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void deployAnnotationIntroductions()
+ {
+ List<AnnotationIntroduction> annotationIntroductions = getManager().getAnnotationIntroductions();
+ if (annotationIntroductions != null)
+ {
+ for(AnnotationIntroduction ai : annotationIntroductions)
+ {
+ deployAnnotationIntroduction(ai);
+ }
+ }
+ }
+
+ public C getContainer()
+ {
+ return container;
+ }
+
+ @Override
+ protected void rebindClassMetaData()
+ {
+ super.rebindClassMetaData();
+
+ // Why does AOP not process the annotation introductions!?
+ deployAnnotationIntroductions();
+ }
+
+
+ public void appendInterceptor(Interceptor interceptor)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void appendInterceptor(int index, Interceptor interceptor)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void appendInterceptorStack(String stackName)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Domain getDomain()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getInstance()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Interceptor[] getInterceptors()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Interceptor[] getInterceptors(Interceptor[] baseChain)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public SimpleMetaData getMetaData()
+ {
+ return instanceAdvisorDelegate.getMetaData();
+ }
+
+ public Object getPerInstanceAspect(String aspectName)
+ {
+ // TODO: is this correct?
+ return instanceAdvisorDelegate.getPerInstanceAspect(aspectName);
+ }
+
+ public Object getPerInstanceAspect(AspectDefinition def)
+ {
+ return instanceAdvisorDelegate.getPerInstanceAspect(def);
+ }
+
+ public Object getPerInstanceJoinpointAspect(Joinpoint joinpoint, AspectDefinition def)
+ {
+ return instanceAdvisorDelegate.getPerInstanceJoinpointAspect(joinpoint, def);
+ }
+
+ public boolean hasInterceptors()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void insertInterceptor(Interceptor interceptor)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void insertInterceptor(int index, Interceptor interceptor)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void insertInterceptorStack(String stackName)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void removeInterceptor(String name)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void removeInterceptorStack(String name)
+ {
+ throw new RuntimeException("NYI");
+ }
+}
Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/ManagedObjectAdvisor.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java 2008-01-08 12:19:38 UTC (rev 68674)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/direct/DirectContainer.java 2008-01-08 13:11:13 UTC (rev 68675)
@@ -43,7 +43,7 @@
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @version $Revision: $
*/
-public class DirectContainer<T> extends AbstractContainer<T>
+public class DirectContainer<T> extends AbstractContainer<T, DirectContainer<T>>
{
private static final Logger log = Logger.getLogger(DirectContainer.class);
@@ -102,7 +102,6 @@
return getAdvisor().getClazz();
}
- // FIXME: copy of ProxyContainer.invoke
public Object invokeIndirect(Object target, Method method, Object arguments[]) throws Throwable
{
long methodHash = MethodHashing.calculateHash(method);
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java 2008-01-08 12:19:38 UTC (rev 68674)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/ProxyContainer.java 2008-01-08 13:11:13 UTC (rev 68675)
@@ -44,7 +44,7 @@
* @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @version $Revision: $
*/
-public class ProxyContainer<T> extends AbstractContainer<T>
+public class ProxyContainer<T> extends AbstractContainer<T, ProxyContainer<T>>
{
private static final Logger log = Logger.getLogger(ProxyContainer.class);
Deleted: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/aop/ManagedObjectContainer.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/aop/ManagedObjectContainer.java 2008-01-08 12:19:38 UTC (rev 68674)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/proxy/aop/ManagedObjectContainer.java 2008-01-08 13:11:13 UTC (rev 68675)
@@ -1,179 +0,0 @@
-/*
- * 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.ejb3.interceptors.proxy.aop;
-
-import java.util.List;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.Domain;
-import org.jboss.aop.InstanceAdvisor;
-import org.jboss.aop.InstanceAdvisorDelegate;
-import org.jboss.aop.advice.AspectDefinition;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.introduction.AnnotationIntroduction;
-import org.jboss.aop.joinpoint.Joinpoint;
-import org.jboss.aop.metadata.SimpleMetaData;
-import org.jboss.ejb3.interceptors.ManagedObject;
-import org.jboss.logging.Logger;
-
-/**
- * Comment
- *
- * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
- * @version $Revision: $
- */
-public class ManagedObjectContainer extends ClassAdvisor implements InstanceAdvisor
-{
- private static final Logger log = Logger.getLogger(ManagedObjectContainer.class);
-
- private InstanceAdvisorDelegate instanceAdvisorDelegate;
-
- public ManagedObjectContainer(String name, AspectManager manager, Class<?> beanClass)
- {
- super(name, manager);
- assert beanClass != null : "beanClass is null";
-
- annotations.addClassAnnotation(ManagedObject.class, new Object());
-
- // Poking starts here
- attachClass(beanClass);
-
- this.instanceAdvisorDelegate = new InstanceAdvisorDelegate(this, this);
- }
-
- private void deployAnnotationIntroduction(AnnotationIntroduction introduction)
- {
- log.debug("deploy annotation introduction " + introduction);
- // Poke introductions into the overrides
- deployAnnotationOverride(introduction);
- }
-
- @SuppressWarnings("unchecked")
- private void deployAnnotationIntroductions()
- {
- List<AnnotationIntroduction> annotationIntroductions = getManager().getAnnotationIntroductions();
- if (annotationIntroductions != null)
- {
- for(AnnotationIntroduction ai : annotationIntroductions)
- {
- deployAnnotationIntroduction(ai);
- }
- }
- }
-
- @Override
- protected void rebindClassMetaData()
- {
- super.rebindClassMetaData();
-
- // Why does AOP not process the annotation introductions!?
- deployAnnotationIntroductions();
- }
-
-
- public void appendInterceptor(Interceptor interceptor)
- {
- throw new RuntimeException("NYI");
- }
-
- public void appendInterceptor(int index, Interceptor interceptor)
- {
- throw new RuntimeException("NYI");
- }
-
- public void appendInterceptorStack(String stackName)
- {
- throw new RuntimeException("NYI");
- }
-
- public Domain getDomain()
- {
- throw new RuntimeException("NYI");
- }
-
- public Object getInstance()
- {
- throw new RuntimeException("NYI");
- }
-
- public Interceptor[] getInterceptors()
- {
- throw new RuntimeException("NYI");
- }
-
- public Interceptor[] getInterceptors(Interceptor[] baseChain)
- {
- throw new RuntimeException("NYI");
- }
-
- public SimpleMetaData getMetaData()
- {
- return instanceAdvisorDelegate.getMetaData();
- }
-
- public Object getPerInstanceAspect(String aspectName)
- {
- // TODO: is this correct?
- return instanceAdvisorDelegate.getPerInstanceAspect(aspectName);
- }
-
- public Object getPerInstanceAspect(AspectDefinition def)
- {
- return instanceAdvisorDelegate.getPerInstanceAspect(def);
- }
-
- public Object getPerInstanceJoinpointAspect(Joinpoint joinpoint, AspectDefinition def)
- {
- return instanceAdvisorDelegate.getPerInstanceJoinpointAspect(joinpoint, def);
- }
-
- public boolean hasInterceptors()
- {
- throw new RuntimeException("NYI");
- }
-
- public void insertInterceptor(Interceptor interceptor)
- {
- throw new RuntimeException("NYI");
- }
-
- public void insertInterceptor(int index, Interceptor interceptor)
- {
- throw new RuntimeException("NYI");
- }
-
- public void insertInterceptorStack(String stackName)
- {
- throw new RuntimeException("NYI");
- }
-
- public void removeInterceptor(String name)
- {
- throw new RuntimeException("NYI");
- }
-
- public void removeInterceptorStack(String name)
- {
- throw new RuntimeException("NYI");
- }
-}
More information about the jboss-cvs-commits
mailing list