org.jboss.ejb.plugins.jrmp.interfaces
Class GenericProxy

java.lang.Object
  |
  +--org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
EntityProxy, HomeProxy, StatefulSessionProxy, StatelessSessionProxy

public abstract class GenericProxy
extends java.lang.Object
implements java.io.Externalizable

Abstract superclass of JRMP client-side proxies.

Version:
$Revision: 1.10 $
Author:
Rickard Öberg (rickard.oberg@telkel.com)
See Also:
ContainerRemote, Serialized Form

Field Summary
protected  ContainerRemote container
          The remote interface of the container invoker of the container we proxy for.
protected  java.lang.String name
          The JNDI name of the container that we proxy for.
protected  boolean optimize
          If true, this proxy will attempt to optimize VM-local calls.
protected static TransactionPropagationContextFactory tpcFactory
          Factory for transaction propagation contexts.
 
Constructor Summary
  GenericProxy()
          A public, no-args constructor for externalization to work.
protected GenericProxy(java.lang.String name, ContainerRemote container, boolean optimize)
          Create a new GenericProxy.
 
Method Summary
static void addLocal(java.lang.String jndiName, ContainerRemote invoker)
          Add an invoker to the invokers map.
protected  java.lang.Object getCredential()
          Return the credentials to use for invocations with this proxy.
protected  java.security.Principal getPrincipal()
          Return the principal to use for invocations with this proxy.
protected  javax.transaction.Transaction getTransaction()
          Return the transaction associated with the current thread.
protected  java.lang.Object getTransactionPropagationContext()
          Return the transaction propagation context of the transaction associated with the current thread.
protected  boolean isLocal()
          Returns true iff this instance lives in the same VM as its container.
 void readExternal(java.io.ObjectInput in)
          Un-externalize this instance.
static void removeLocal(java.lang.String jndiName)
          Remove an invoker from the invokers map.
static void setTPCFactory(TransactionPropagationContextFactory tpcf)
          Set the transaction propagation context factory.
static void setTransactionManager(javax.transaction.TransactionManager txMan)
          Set the transaction manager.
 void writeExternal(java.io.ObjectOutput out)
          Externalize this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tpcFactory

protected static TransactionPropagationContextFactory tpcFactory
Factory for transaction propagation contexts. When set to a non-null value, it is used to get transaction propagation contexts for remote method invocations. If null, transactions are not propagated on remote method invocations.

name

protected java.lang.String name
The JNDI name of the container that we proxy for.

container

protected ContainerRemote container
The remote interface of the container invoker of the container we proxy for.

optimize

protected boolean optimize
If true, this proxy will attempt to optimize VM-local calls.
Constructor Detail

GenericProxy

public GenericProxy()
A public, no-args constructor for externalization to work.

GenericProxy

protected GenericProxy(java.lang.String name,
                       ContainerRemote container,
                       boolean optimize)
Create a new GenericProxy.
Parameters:
name - The JNDI name of the container that we proxy for.
container - The remote interface of the container invoker of the container we proxy for.
optimize - If true, this proxy will attempt to optimize VM-local calls.
Method Detail

addLocal

public static void addLocal(java.lang.String jndiName,
                            ContainerRemote invoker)
Add an invoker to the invokers map.

removeLocal

public static void removeLocal(java.lang.String jndiName)
Remove an invoker from the invokers map.

setTransactionManager

public static void setTransactionManager(javax.transaction.TransactionManager txMan)
Set the transaction manager.

setTPCFactory

public static void setTPCFactory(TransactionPropagationContextFactory tpcf)
Set the transaction propagation context factory.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Externalize this instance. If this instance lives in a different VM than its container invoker, the remote interface of the container invoker is not externalized.
Specified by:
writeExternal in interface java.io.Externalizable

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Un-externalize this instance. If this instance is deserialized in the same VM as its container invoker, the remote interface of the container invoker is restored by looking up the name in the invokers map.
Specified by:
readExternal in interface java.io.Externalizable

getPrincipal

protected java.security.Principal getPrincipal()
Return the principal to use for invocations with this proxy.

getCredential

protected java.lang.Object getCredential()
Return the credentials to use for invocations with this proxy.

getTransaction

protected javax.transaction.Transaction getTransaction()
                                                throws javax.transaction.SystemException
Return the transaction associated with the current thread. Returns null if the transaction manager was never set, or if no transaction is associated with the current thread.

getTransactionPropagationContext

protected java.lang.Object getTransactionPropagationContext()
                                                     throws javax.transaction.SystemException
Return the transaction propagation context of the transaction associated with the current thread. Returns null if the transaction manager was never set, or if no transaction is associated with the current thread.

isLocal

protected boolean isLocal()
Returns true iff this instance lives in the same VM as its container.


Copyright © 2000 The JBoss Organization. All Rights Reserved.