JBoss API: Class GenericProxy

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  BeanProxy, HomeProxy

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

Abstract superclass of JRMP client-side proxies.

Version:
  $Revision: 1.11 $
Author:
  Rickard Öberg (rickard.oberg@telkel.com), Jason Dillon <jason@planet57.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 static java.lang.Object[]` | `EMPTY_ARGS` An empty method parameter list.
`protected static java.lang.reflect.Method` | `EQUALS` `Object.equals(java.lang.Object)` method reference.
`protected static java.lang.reflect.Method` | `HASH_CODE` `Object.hashCode()` method reference.
`protected InitialContextHandle` | `initialContextHandle` Provides access to the correct naming context for handle objects.
`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 java.lang.reflect.Method` | `TO_STRING` `Object.toString()` method reference.
`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 javax.naming.InitialContext` | `createInitialContext()` Create an `InitialContext` using the saved environment or create a vanilla `InitialContext` when the enviroment is null.
`protected java.rmi.MarshalledObject` | `createMarshalledObject(java.lang.Object id, java.lang.reflect.Method method, java.lang.Object[] args)` Create a `MarshalledObject` suitable for invoking a remote container with.
`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 java.lang.Object` | `invokeContainer(java.lang.Object id, java.lang.reflect.Method method, java.lang.Object[] args)` Invoke the container to handle this method invocation.
`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

### EMPTY_ARGS

    protected static final java.lang.Object[] EMPTY_ARGS

  An empty method parameter list.

### TO_STRING

    protected static final java.lang.reflect.Method TO_STRING

  `Object.toString()` method reference.

### HASH_CODE

    protected static final java.lang.reflect.Method HASH_CODE

  `Object.hashCode()` method reference.

### EQUALS

    protected static final java.lang.reflect.Method EQUALS

  `Object.equals(java.lang.Object)` method reference.

### 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.`

### initialContextHandle

    protected InitialContextHandle initialContextHandle

  Provides access to the correct naming context for handle objects.

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.

### createInitialContext

    protected javax.naming.InitialContext createInitialContext()
                                                        throws javax.naming.NamingException

  Create an `InitialContext` using the saved environment or create a vanilla `InitialContext` when the enviroment is null.
  Returns:
    `InitialContext` suitable for the bean that this is a proxy for.
  Throws:
    `javax.naming.NamingException` - Failed to create `InitialContext`.

### invokeContainer

    protected java.lang.Object invokeContainer(java.lang.Object id,
                                               java.lang.reflect.Method method,
                                               java.lang.Object[] args)
                                        throws java.lang.Throwable

  Invoke the container to handle this method invocation.

  If optimization is enabled and this is a local proxy, then the container is invoked directly, else a remote call is made.

  Parameters:
    `id` - ???
    `method` - The method to invoke.
    `args` - The arguments passed to the method.
  Throws:
    `java.lang.Throwable` - Failed to invoke container.

### createMarshalledObject

    protected java.rmi.MarshalledObject createMarshalledObject(java.lang.Object id,
                                                               java.lang.reflect.Method method,
                                                               java.lang.Object[] args)
                                                        throws javax.transaction.SystemException,
                                                               java.io.IOException

  Create a `MarshalledObject` suitable for invoking a remote container with.
  Parameters:
    `id` - ???
    `method` - The method to invoke.
    `args` - The arguments passed to the method.
  Returns:
    `MarshalledObject` suitable for invoking a remote container with.
  Throws:
    `javax.transaction.SystemException` - Failed to get transaction.
    `java.io.IOException` - Failed to create `MarshalledObject`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 The JBoss Organization. All Rights Reserved.