User: fleury
Date: 00/08/14 08:07:54
Modified: src/main/org/jboss/ejb/plugins/jrmp/interfaces
HomeProxy.java HomeHandleImpl.java
Log:
Information for the tests
Revision Changes Path
1.13 +125 -110
jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/HomeProxy.java
Index: HomeProxy.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/HomeProxy.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HomeProxy.java 2000/08/12 00:14:57 1.12
+++ HomeProxy.java 2000/08/14 15:07:53 1.13
@@ -24,7 +24,7 @@
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class HomeProxy
extends GenericProxy
@@ -49,17 +49,17 @@
try
{
// EJB methods
- getEJBMetaData = EJBHome.class.getMethod("getEJBMetaData", new
Class[0]);
+ getEJBMetaData = EJBHome.class.getMethod("getEJBMetaData", new Class[0]);
getHomeHandle = EJBHome.class.getMethod("getHomeHandle", new Class[0]);
removeByHandle = EJBHome.class.getMethod("remove", new Class[]
{Handle.class});
- removeByPrimaryKey = EJBHome.class.getMethod("remove", new Class[]
{Object.class});
- // Get the "remove" method from the EJBObject
- removeObject = EJBObject.class.getMethod("remove", new Class[0]);
-
- // Object methods
- toStr = Object.class.getMethod("toString", new Class[0]);
+ removeByPrimaryKey = EJBHome.class.getMethod("remove", new Class[]
{Object.class});
+ // Get the "remove" method from the EJBObject
+ removeObject = EJBObject.class.getMethod("remove", new Class[0]);
+
+ // Object methods
+ toStr = Object.class.getMethod("toString", new Class[0]);
eq = Object.class.getMethod("equals", new Class[] { Object.class });
- hash = Object.class.getMethod("hashCode", new Class[0]);
+ hash = Object.class.getMethod("hashCode", new Class[0]);
} catch (Exception e)
{
e.printStackTrace();
@@ -70,9 +70,9 @@
// Constructors --------------------------------------------------
public HomeProxy(String name, EJBMetaData ejbMetaData, ContainerRemote
container, boolean optimize)
{
- super(name, container, optimize);
-
- this.ejbMetaData = ejbMetaData;
+ super(name, container, optimize);
+
+ this.ejbMetaData = ejbMetaData;
}
// Public --------------------------------------------------------
@@ -81,9 +81,9 @@
public Object invoke(Object proxy, Method m, Object[] args)
throws Throwable
{
-
-
- // Normalize args to always be an array
+
+
+ // Normalize args to always be an array
// Isn't this a bug in the proxy call??
if (args == null)
args = new Object[0];
@@ -91,120 +91,135 @@
// Implement local methods
if (m.equals(toStr))
{
+ System.out.println("HomeProxy:toStr");
return name+"Home";
}
else if (m.equals(eq))
{
- // equality of the proxy home is based on names...
+ // equality of the proxy home is based on names...
+
+ System.out.println("HomeProxy:eq");
return new Boolean(invoke(proxy,toStr, args).equals(name+"Home"));
}
- else if (m.equals(hash))
+ else if (m.equals(hash))
{
- return new Integer(this.hashCode());
+
+ System.out.println("HomeProxy:hash");
+ return new Integer(this.hashCode());
}
- // Implement local EJB calls
- else if (m.equals(getHomeHandle))
+ // Implement local EJB calls
+ else if (m.equals(getHomeHandle))
{
+
+ System.out.println("HomeProxy:getHomeHandle");
return new HomeHandleImpl(name);
}
-
- else if (m.equals(getEJBMetaData))
+
+ else if (m.equals(getEJBMetaData))
{
+
+ System.out.println("HomeProxy:getEJBMetaData");
return ejbMetaData;
+ }
+
+
+ else if (m.equals(removeByHandle))
+ {
+
+ System.out.println("HomeProxy:removeByHandle");
+ // First get the EJBObject
+ EJBObject object = ((Handle) args[0]).getEJBObject();
+
+ // remove the object from here
+ object.remove();
+
+ // Return Void
+ return Void.TYPE;
}
-
-
- else if (m.equals(removeByHandle))
- {
- // First get the EJBObject
- EJBObject object = ((Handle) args[0]).getEJBObject();
-
- // remove the object from here
- object.remove();
-
- // Return Void
- return Void.TYPE;
- }
-
- // The trick is simple we trick the container in believe it is a remove() on
the instance
- else if (m.equals(removeByPrimaryKey))
- {
- if (optimize && isLocal())
- {
- return container.invoke(
- // The first
argument is the id
- args[0],
- // Pass the
"removeMethod"
- removeObject,
- // this is a
remove() on the object
- new Object[0],
- // Tx stuff
- tm != null ?
tm.getTransaction() : null,
- // Security
attributes
-
getPrincipal(), getCredential());
- } else
- {
+
+ // The trick is simple we trick the container in believe it is a remove() on
the instance
+ else if (m.equals(removeByPrimaryKey))
+ {
+
+ System.out.println("HomeProxy:removeByPK");
+ if (optimize && isLocal())
+ {
+ return container.invoke(
+ // The first argument is the id
+ args[0],
+ // Pass the "removeMethod"
+ removeObject,
+ // this is a remove() on the object
+ new Object[0],
+ // Tx stuff
+ tm != null ? tm.getTransaction() : null,
+ // Security attributes
+ getPrincipal(), getCredential());
+ } else
+ {
- // Build a method invocation that carries the identity of the
target object
- RemoteMethodInvocation rmi = new RemoteMethodInvocation(
-
// The first argument is the id
-
args[0],
-
// Pass the "removeMethod"
-
removeObject,
-
// this is a remove() on the object
-
new Object[0]);
+ // Build a method invocation that carries the identity of the target object
+ RemoteMethodInvocation rmi = new RemoteMethodInvocation(
+ // The first argument is the id
+ args[0],
+ // Pass the "removeMethod"
+ removeObject,
+ // this is a remove() on the object
+ new Object[0]);
- // Set the transaction context
- rmi.setTransaction(tm != null? tm.getTransaction() : null);
-
- // Set the security stuff
- // MF fixme this will need to use "thread local" and
therefore same construct as above
- // rmi.setPrincipal(sm != null? sm.getPrincipal() : null);
- // rmi.setCredential(sm != null? sm.getCredential() : null);
- // is the credential thread local? (don't think so... but...)
- rmi.setPrincipal( getPrincipal() );
- rmi.setCredential( getCredential() );
-
- // Invoke on the remote server, enforce marshalling
- return container.invokeHome(new MarshalledObject(rmi));
- }
- }
-
- // If not taken care of, go on and call the container
- else
- {
- // Delegate to container
- // Optimize if calling another bean in same EJB-application
- if (optimize && isLocal())
- {
- return container.invokeHome( // The method and arguments for the
invocation
- m, args,
- //
Transaction attributes
- tm !=
null ? tm.getTransaction() : null,
- //
Security attributes
-
getPrincipal(), getCredential());
- } else
- {
- // Create a new MethodInvocation for distribution
- RemoteMethodInvocation rmi = new RemoteMethodInvocation(null, m,
args);
-
- // Set the transaction context
- rmi.setTransaction(tm != null? tm.getTransaction() : null);
-
- // Set the security stuff
- // MF fixme this will need to use "thread local" and
therefore same construct as above
- // rmi.setPrincipal(sm != null? sm.getPrincipal() : null);
- // rmi.setCredential(sm != null? sm.getCredential() : null);
- // is the credential thread local? (don't think so... but...)
- rmi.setPrincipal( getPrincipal() );
- rmi.setCredential( getCredential() );
-
- // Invoke on the remote server, enforce marshalling
- return container.invokeHome(new MarshalledObject(rmi));
- }
+ // Set the transaction context
+ rmi.setTransaction(tm != null? tm.getTransaction() : null);
+
+ // Set the security stuff
+ // MF fixme this will need to use "thread local" and therefore same
construct as above
+ // rmi.setPrincipal(sm != null? sm.getPrincipal() : null);
+ // rmi.setCredential(sm != null? sm.getCredential() : null);
+ // is the credential thread local? (don't think so... but...)
+ rmi.setPrincipal( getPrincipal() );
+ rmi.setCredential( getCredential() );
+
+ // Invoke on the remote server, enforce marshalling
+ return container.invoke(new MarshalledObject(rmi));
+ }
+ }
+
+ // If not taken care of, go on and call the container
+ else
+ {
+
+ System.out.println("HomeProxy:"+m.getName());
+ // Delegate to container
+ // Optimize if calling another bean in same EJB-application
+ if (optimize && isLocal())
+ {
+ return container.invokeHome( // The method and arguments for the
invocation
+ m, args,
+ // Transaction attributes
+ tm != null ? tm.getTransaction() : null,
+ // Security attributes
+ getPrincipal(), getCredential());
+ } else
+ {
+ // Create a new MethodInvocation for distribution
+ RemoteMethodInvocation rmi = new RemoteMethodInvocation(null, m, args);
+
+ // Set the transaction context
+ rmi.setTransaction(tm != null? tm.getTransaction() : null);
+
+ // Set the security stuff
+ // MF fixme this will need to use "thread local" and therefore same
construct as above
+ // rmi.setPrincipal(sm != null? sm.getPrincipal() : null);
+ // rmi.setCredential(sm != null? sm.getCredential() : null);
+ // is the credential thread local? (don't think so... but...)
+ rmi.setPrincipal( getPrincipal() );
+ rmi.setCredential( getCredential() );
+
+ // Invoke on the remote server, enforce marshalling
+ return container.invokeHome(new MarshalledObject(rmi));
+ }
}
}
1.3 +9 -9
jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/HomeHandleImpl.java
Index: HomeHandleImpl.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/HomeHandleImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HomeHandleImpl.java 2000/08/12 00:13:04 1.2
+++ HomeHandleImpl.java 2000/08/14 15:07:53 1.3
@@ -20,7 +20,7 @@
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class HomeHandleImpl
implements HomeHandle
@@ -44,16 +44,16 @@
public EJBHome getEJBHome()
throws RemoteException
{
- try {
+ try {
- return (EJBHome) new InitialContext().lookup(name);
+ return (EJBHome) new InitialContext().lookup(name);
- }
- catch (NamingException e) {
-
- e.printStackTrace();
- throw new RemoteException("Could not get EJBHome");
- }
+ }
+ catch (NamingException e) {
+
+ e.printStackTrace();
+ throw new RemoteException("Could not get EJBHome");
+ }
}
// Package protected ---------------------------------------------