[jboss-cvs] JBossAS SVN: r76250 - in projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors: container and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Jul 26 21:05:22 EDT 2008
Author: ALRubinger
Date: 2008-07-26 21:05:21 -0400 (Sat, 26 Jul 2008)
New Revision: 76250
Added:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/StatefulSessionContainerMethodInvocation.java
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/currentinvocation/
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/currentinvocation/CurrentContainerInvocation.java
Log:
Add support for EJB3 Proxy invocations to interceptors module
Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/StatefulSessionContainerMethodInvocation.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/StatefulSessionContainerMethodInvocation.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/container/StatefulSessionContainerMethodInvocation.java 2008-07-27 01:05:21 UTC (rev 76250)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.lang.reflect.Method;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+
+/**
+ * StatefulSessionContainerMethodInvocation
+ *
+ * An invocation on an EJB3 SFSB Container
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StatefulSessionContainerMethodInvocation extends ContainerMethodInvocation
+{
+ // --------------------------------------------------------------------------------||
+ // Instance Members ---------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private Object sessionId;
+
+ // --------------------------------------------------------------------------------||
+ // Constructors -------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /*
+ * These all delegate to the superclass implementation
+ * and are here for visibility alone
+ */
+
+ public StatefulSessionContainerMethodInvocation(MethodInfo info)
+ {
+ super(info);
+ }
+
+ public StatefulSessionContainerMethodInvocation(Interceptor[] interceptors, long methodHash, Method advisedMethod,
+ Method unadvisedMethod, Advisor advisor)
+ {
+ super(interceptors, methodHash, advisedMethod, unadvisedMethod, advisor);
+ }
+
+ public StatefulSessionContainerMethodInvocation(Interceptor[] newchain)
+ {
+ super(newchain);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Accessors / Mutators -----------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ public Object getSessionId()
+ {
+ return sessionId;
+ }
+
+ public void setSessionId(Object sessionId)
+ {
+ this.sessionId = sessionId;
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/currentinvocation/CurrentContainerInvocation.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/currentinvocation/CurrentContainerInvocation.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/currentinvocation/CurrentContainerInvocation.java 2008-07-27 01:05:21 UTC (rev 76250)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.currentinvocation;
+
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aspects.currentinvocation.CurrentInvocation;
+import org.jboss.ejb3.interceptors.container.ContainerMethodInvocation;
+import org.jboss.logging.Logger;
+
+/**
+ * CurrentContainerInvocation
+ *
+ * A simple extension to CurrentInvocation which handles casting to
+ * EJB3 ContainerMethodInvocation as a convenience
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class CurrentContainerInvocation extends CurrentInvocation
+{
+ private static final Logger log = Logger.getLogger(CurrentContainerInvocation.class);
+
+ // -------------------------------------------------------------------------------------------------||
+ // Functional Methods ------------------------------------------------------------------------------||
+ // -------------------------------------------------------------------------------------------------||
+
+ /**
+ * Retrieves the ContainerMethodInvocation associated with the current
+ * Thread / request if one is associated. Returns null
+ * otherwise
+ *
+ * @return
+ */
+ public static ContainerMethodInvocation getCurrentInvocation()
+ {
+ // Obtain current invocation
+ Invocation currentInvocation = CurrentInvocation.getCurrentInvocation();
+
+ // Cast and return
+ try
+ {
+ return ContainerMethodInvocation.class.cast(currentInvocation);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new RuntimeException("Current invocation is not of type " + ContainerMethodInvocation.class.getName()
+ + " but instead is " + currentInvocation.getClass().getName(), cce);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list