User: mnf999
Date: 01/11/14 08:43:19
Modified: src/main/org/jboss/ejb MethodInvocation.java
Log:
The new Invocation object, it is just a generalized invocation that carries
Transaction and security with it. Then we keep some variables directly but it should
really work through the payload. The payload is just a map of objects that the
invocation carries around. The old MethodInvocation is now an extension of this guy.
The Invocation also carries a list of mbeans that he is supposed to go through. This
will be interesting when we move to the "router" view of the JMX base and the
Invocations are just stand-alone objects that travel through the base. The EJB view
here is secondary. Note: I have left "funky" constructors to provide backward
compatibility with the old codebase and way of doing things.
Revision Changes Path
1.15 +49 -160 jboss/src/main/org/jboss/ejb/MethodInvocation.java
Index: MethodInvocation.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/MethodInvocation.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MethodInvocation.java 2001/09/01 19:50:30 1.14
+++ MethodInvocation.java 2001/11/14 16:43:19 1.15
@@ -11,6 +11,7 @@
import java.security.Principal;
import javax.transaction.Transaction;
+import org.jboss.invocation.Invocation;
/**
* MethodInvocation
@@ -21,16 +22,29 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>.
* @author <a href="mailto:[EMAIL PROTECTED]">Ole Husgaard</a>
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
-public class MethodInvocation
+public class MethodInvocation extends Invocation
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
- // Static --------------------------------------------------------
+ // Private -------------------------------------------------------
+
+ /**
+ * The internal ID of the enterprise bean who is the target
+ * of this invocation.
+ */
+ private Object id;
+
+ // Static --------------------------------------------------------
+ public static final Integer
+ //For legacy reasons only
+ TARGET_ID = new Integer(new String("TARGET_ID").hashCode()),
+ ENTERPRISE_CONTEXT = new Integer(new String("ENTERPRISE_CONTEXT").hashCode());
+
// Constructors --------------------------------------------------
/**
@@ -50,106 +64,43 @@
* @param credential
* The security credentials to use in this invocation.
*/
- public MethodInvocation(Object id, Method m, Object[] args, Transaction tx,
- Principal identity, Object credential)
- {
- this.id = id;
- this.m = m;
- this.args = args;
- this.tx = tx;
- this.identity = identity;
- this.credential = credential;
- }
+ public MethodInvocation(Transaction tx,
+ Principal identity,
+ Object credential,
+ String[] mbeans,
+ Object id,
+ Method m,
+ Object[] args)
+ {
+
+ super(tx, identity, credential, mbeans, m, args);
+
+ setId(id);
+ }
+
+ public MethodInvocation(Object id,
+ Method m,
+ Object[] arguments,
+ Transaction tx,
+ Principal identity,
+ Object credential)
+ {
+ super(tx, identity, credential, null, m, arguments);
+
+ setId(id);
+ }
-
// Public --------------------------------------------------------
/**
* Return the invocation target ID.
* This is the internal ID of the invoked enterprise bean.
- */
- public Object getId()
- {
- return id;
- }
-
- /**
- * Return the invocation method.
*/
- public Method getMethod()
- {
- return m;
- }
+ public void setId(Object id) { payload.put(TARGET_ID, id);}
+ public Object getId() { return payload.get(TARGET_ID);}
+
/**
- * Return the invocation argument list.
- */
- public Object[] getArguments()
- {
- return args;
- }
-
- /**
- * This method sets the transaction associated with the method.
- * Note that this doesn't mean that the transaction is associated
- * with the thread. In fact this is the only place it exists until
- * the TxInterceptor logic. Notably it might be the case that the
- * tx associated here is different than the one on the target instance.
- */
- public void setTransaction(Transaction tx)
- {
-
-//DEBUG Logger.debug("Setting a transaction on Method invocation"+hashCode()+"
"+m.getName()+" with "+tx);
-
- this.tx = tx;
- }
-
- /**
- * Return the transaction associated with the method.
- *
- * If no transaction is associated with this method but we have
- * a transaction propagation context, import the TPC into the
- * transaction manager, and associate the resulting transaction
- * with this method before returning it.
- */
- public Transaction getTransaction()
- {
- return tx;
- }
-
- /**
- * Change the security identity of this invocation.
- */
- public void setPrincipal(Principal identity)
- {
- this.identity = identity;
- }
-
- /**
- * Return the security identity of this invocation.
- */
- public Principal getPrincipal()
- {
- return identity;
- }
-
- /**
- * Change the security credentials of this invocation.
- */
- public void setCredential(Object credential)
- {
- this.credential = credential;
- }
-
- /**
- * Return the security credentials of this invocation.
- */
- public Object getCredential()
- {
- return credential;
- }
-
- /**
* Set the enterprise context of this invocation.
*
* Once a context is associated to a Method Invocation,
@@ -158,77 +109,15 @@
*/
public void setEnterpriseContext(EnterpriseContext ctx)
{
- this.ctx = ctx;
+ payload.put(ENTERPRISE_CONTEXT, ctx);
- //Set the transaction
- // MF FIXME: wrong decision. Setting the context is just an assocation of the
- // the Method invocation to the instance. Decisions on the transaction
association
- // should be done elsewhere (new interceptor)
- //ctx.setTransaction(tx);
-
- // Set the principal
- // MF FIXME: a warning really. The association of the context variables (tx,
principal)
- // to the enterprise Context should not be done here but by the final
interceptor in the
- // container, it will signify that the instance is indeed ready for calling
+ // marcf: we should remove the association from here, should be done in the
interceptor that sets this
if (ctx != null) {
ctx.setPrincipal(identity);
}
}
+
+ public EnterpriseContext getEnterpriseContext() { return (EnterpriseContext)
payload.get(ENTERPRISE_CONTEXT);}
- /**
- * Return the enterprise context of this invocation.
- */
- public EnterpriseContext getEnterpriseContext()
- {
- return ctx;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- /**
- * The internal ID of the enterprise bean who is the target
- * of this invocation.
- */
- private Object id;
-
- /**
- * The method to invoke.
- *
- * This method is declared in the remote or home interface
- * of the target enterprise bean.
- */
- private Method m;
-
- /**
- * The argument list of this invocation.
- */
- private Object[] args;
-
- /**
- * The transaction of this invocation.
- */
- private Transaction tx;
-
- /**
- * The security identity of this invocation.
- */
- private Principal identity;
-
- /**
- * The security credentials of this invocation.
- */
- private Object credential;
-
- /**
- * The container bean context of the target bean.
- */
- private EnterpriseContext ctx;
-
-
- // Inner classes -------------------------------------------------
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development