org.apache.tuscany.sca.binding.rmi.provider
Class RMIServiceBindingProvider

java.lang.Object
  extended by org.apache.tuscany.sca.binding.rmi.provider.RMIServiceBindingProvider
All Implemented Interfaces:
ServiceBindingProvider

public class RMIServiceBindingProvider
extends java.lang.Object
implements ServiceBindingProvider

Implementation of a Service for the RMIBinding.


Nested Class Summary
protected  class RMIServiceBindingProvider.RMIServiceClassLoader
           
 
Constructor Summary
RMIServiceBindingProvider(RuntimeComponent rc, RuntimeComponentService rcs, RMIBinding binding, RMIHost rmiHost)
           
 
Method Summary
protected  java.rmi.Remote createRmiService(Interface serviceInterface)
           
protected  byte[] generateRemoteInterface(java.lang.Class serviceInterface)
          if the interface of the component whose serviceBindings must be exposed as RMI Service, does not implement java.rmi.Remote, then generate such an interface.
 InterfaceContract getBindingInterfaceContract()
          Get the effective interface contract imposed by the binding.
protected  int getPort(java.lang.String port)
           
protected  java.lang.Class<?> getTargetJavaClass(Interface targetInterface)
           
protected  java.lang.Object invokeTarget(Operation op, java.lang.Object[] args)
           
 void start()
          This method will be invoked when the component service binding is activated.
 void stop()
          This method will be invoked when the component service binding is deactivated.
 boolean supportsOneWayInvocation()
          For bindings that invoke one-way callback operations asynchronously, there is no need to perform a thread switch before calling the invoker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMIServiceBindingProvider

public RMIServiceBindingProvider(RuntimeComponent rc,
                                 RuntimeComponentService rcs,
                                 RMIBinding binding,
                                 RMIHost rmiHost)
Method Detail

start

public void start()
Description copied from interface: ServiceBindingProvider
This method will be invoked when the component service binding is activated.

Specified by:
start in interface ServiceBindingProvider

stop

public void stop()
Description copied from interface: ServiceBindingProvider
This method will be invoked when the component service binding is deactivated.

Specified by:
stop in interface ServiceBindingProvider

getPort

protected int getPort(java.lang.String port)

createRmiService

protected java.rmi.Remote createRmiService(Interface serviceInterface)

invokeTarget

protected java.lang.Object invokeTarget(Operation op,
                                        java.lang.Object[] args)
                                 throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

generateRemoteInterface

protected byte[] generateRemoteInterface(java.lang.Class serviceInterface)
if the interface of the component whose serviceBindings must be exposed as RMI Service, does not implement java.rmi.Remote, then generate such an interface. This method will stop with just generating the bytecode. Defining the class from the byte code must be the responsibility of the caller of this method, since it requires a ClassLoader to be created to define and load this interface.


getTargetJavaClass

protected java.lang.Class<?> getTargetJavaClass(Interface targetInterface)

getBindingInterfaceContract

public InterfaceContract getBindingInterfaceContract()
Description copied from interface: ServiceBindingProvider
Get the effective interface contract imposed by the binding. For example, it will be interface contract introspected from the WSDL portType used by the endpoint for a WebService binding.

Specified by:
getBindingInterfaceContract in interface ServiceBindingProvider
Returns:
The effective interface contract, if null is returned, the interface contract for the component service will be used

supportsOneWayInvocation

public boolean supportsOneWayInvocation()
Description copied from interface: ServiceBindingProvider
For bindings that invoke one-way callback operations asynchronously, there is no need to perform a thread switch before calling the invoker. This method indicates whether the binding has this capability.

Specified by:
supportsOneWayInvocation in interface ServiceBindingProvider
Returns:
true if the callback invoker is able to invoke one-way operations asynchronously, false if all invocations are synchronous