org.softamis.cluster4spring.rmi
Class RmiDiscoveringProxyFactoryBean<SI extends ServiceMoniker>

java.lang.Object
  extended by org.springframework.remoting.support.RemoteAccessor
      extended by org.softamis.cluster4spring.support.RemoteInvocationBasedAccessor
          extended by org.softamis.cluster4spring.support.RemoteClientInterceptor<RmiEndpoint<SI>,SI>
              extended by org.softamis.cluster4spring.rmi.support.RmiClientInterceptor<SI>
                  extended by org.softamis.cluster4spring.rmi.AbstractRmiProxyFactoryBean<SI>
                      extended by org.softamis.cluster4spring.rmi.support.AbstractRmiShortFormProxyFactoryBean<SI>
                          extended by org.softamis.cluster4spring.rmi.RmiDiscoveringProxyFactoryBean<SI>
All Implemented Interfaces:
java.util.EventListener, org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener

public class RmiDiscoveringProxyFactoryBean<SI extends ServiceMoniker>
extends AbstractRmiShortFormProxyFactoryBean<SI>

Implementation of RmiProxyFactoryBean that allows more compact form of describing bean properteis in configuration XML. This implementation does not accept endpoint provider, but creates it internally. Due to this, class has several additional properties that are used to setup EndpointProvider

As it follows from the class name, that class is intended to simply RmiProxyFactoryBeans which utilizes discovering endpoints provider.

While this factory may be considered less flexible comparing to usual combination (RmiProxyFactoryBean/DiscoveringEndpointProvider), it can be defined in configuration files in more compact form.

The following sample illustrates definition of RMI proxy factory bean in Spring XML:

 
   <bean id="remote.service" class="org.softamis.cluster4spring.rmi.RmiDiscoveringProxyFactoryBean">
     <property name=" " value=" "/>
   </bean>
 

Author:
Andrew Sazonov
See Also:
DiscoveringEndpointProviderEx

Field Summary
protected  org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI> fClientServicesRegistry
           
protected  boolean fListenRegistry
           
protected  java.lang.String fServiceGroup
           
protected  java.lang.String fServiceName
           
protected  EndpointSelectionPolicy<RmiEndpoint<SI>,SI> fServiceSelectionPolicy
           
 
Fields inherited from class org.softamis.cluster4spring.rmi.support.AbstractRmiShortFormProxyFactoryBean
fCacheEndpoints
 
Fields inherited from class org.softamis.cluster4spring.rmi.AbstractRmiProxyFactoryBean
fBeanFactory, fInterceptorNames, fRegisterTraceInterceptor, fRemoteInvocationTraceInterceptor, fServiceProxy
 
Fields inherited from class org.softamis.cluster4spring.rmi.support.RmiClientInterceptor
PROTOCOL_RMI
 
Fields inherited from class org.softamis.cluster4spring.support.RemoteClientInterceptor
fBeanName, fEndpointFactory, fEndpointProvider, fRefreshEndpointsOnConnectFailure, fRefreshEndpointsOnStartup, fSwitchEndpointOnFailure
 
Fields inherited from class org.softamis.cluster4spring.support.RemoteInvocationBasedAccessor
fRemoteInvocationFactory
 
Fields inherited from class org.springframework.remoting.support.RemoteAccessor
logger
 
Constructor Summary
RmiDiscoveringProxyFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by Spring as part of bean lifecycle and is used to check whether EndpointProvider is specified and perform other preparations
protected  DiscoveringEndpointProviderEx<RmiEndpoint<SI>,SI> createEndpointProvider()
           
protected  void doPreprocessApplicationEvent(org.springframework.context.ApplicationEvent aEvent)
          Utility method that is called during processing of application events.
 org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI> getClientServicesRegistry()
           
 EndpointSelectionPolicy<RmiEndpoint<SI>,SI> getServiceProvidingPolicy()
           
 boolean isListenRegistry()
           
 void setClientServicesRegistry(org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI> aClientServicesRegistry)
          Additional setup for discovering endpoints provider which allows to specify client services registry wich is used to discover remote services.
 void setListenRegistry(boolean aListenRegistry)
           
 void setServiceGroup(java.lang.String aServiceGroup)
          Allows to specify service group which will be used by endpoint provider
 void setServiceName(java.lang.String aServiceName)
          Allows to specify service name which will be used by endpoint provider
 void setServiceProvidingPolicy(EndpointSelectionPolicy<RmiEndpoint<SI>,SI> aServiceSelectionPolicy)
          Specifies policy will be used by endpoints provider for selection of particular endpoint from the list of endpoints available
 
Methods inherited from class org.softamis.cluster4spring.rmi.support.AbstractRmiShortFormProxyFactoryBean
isCacheEndpoints, setCacheEndpoints, setEndpointProvider
 
Methods inherited from class org.softamis.cluster4spring.rmi.AbstractRmiProxyFactoryBean
addSpecifiedAdvices, createDefaultRemoteInvocationTraceInterceptor, getEndpointFactory, getInterceptorNames, getObject, getObjectType, getProxyName, getRemoteInvocationTraceInterceptor, isRegisterTraceInterceptor, isSingleton, obtainRemoteInvocationTraceInterceptor, setBeanFactory, setEndpointFactory, setInterceptorNames, setRegisterTraceInterceptor, setRemoteInvocationTraceInterceptor
 
Methods inherited from class org.softamis.cluster4spring.rmi.support.RmiClientInterceptor
convertRmiAccessException, createDefaultEndpointFactory, doInvoke, getProtocol, isConnectFailure, isConnectFailureOnRemoteException, throwRmiAccessException
 
Methods inherited from class org.softamis.cluster4spring.support.RemoteClientInterceptor
doInvoke, getBeanName, handleRemoteConnectFailure, invoke, isRefreshEndpointsOnConnectFailure, isRefreshEndpointsOnStartup, isSwitchEndpointOnFailure, markServiceInvalid, obtainEndpointToExecute, onApplicationEvent, onContextClosed, onContextRefreshed, prepare, refreshAndRetry, refreshEndpointProvider, retry, setBeanName, setRefreshEndpointsOnConnectFailure, setRefreshEndpointsOnStartup, setSwitchEndpointOnFailure, throwRemoteLookupFailureException, throwServiceException
 
Methods inherited from class org.softamis.cluster4spring.support.RemoteInvocationBasedAccessor
getRemoteInvocationFactory, setRemoteInvocationFactory
 
Methods inherited from class org.springframework.remoting.support.RemoteAccessor
getServiceInterface, setServiceInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fServiceGroup

protected java.lang.String fServiceGroup

fServiceName

protected java.lang.String fServiceName

fServiceSelectionPolicy

protected EndpointSelectionPolicy<RmiEndpoint<SI extends ServiceMoniker>,SI extends ServiceMoniker> fServiceSelectionPolicy

fClientServicesRegistry

protected org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI extends ServiceMoniker> fClientServicesRegistry

fListenRegistry

protected boolean fListenRegistry
Constructor Detail

RmiDiscoveringProxyFactoryBean

public RmiDiscoveringProxyFactoryBean()
Method Detail

createEndpointProvider

protected DiscoveringEndpointProviderEx<RmiEndpoint<SI>,SI> createEndpointProvider()

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from class: RemoteClientInterceptor
Invoked by Spring as part of bean lifecycle and is used to check whether EndpointProvider is specified and perform other preparations

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class AbstractRmiProxyFactoryBean<SI extends ServiceMoniker>
Throws:
java.lang.Exception

doPreprocessApplicationEvent

protected void doPreprocessApplicationEvent(org.springframework.context.ApplicationEvent aEvent)
Description copied from class: RemoteClientInterceptor
Utility method that is called during processing of application events. May be overriden to perform some specific processing

Overrides:
doPreprocessApplicationEvent in class RemoteClientInterceptor<RmiEndpoint<SI extends ServiceMoniker>,SI extends ServiceMoniker>
Parameters:
aEvent - application event
See Also:
RemoteClientInterceptor.onApplicationEvent(ApplicationEvent)

setServiceGroup

public void setServiceGroup(java.lang.String aServiceGroup)
Allows to specify service group which will be used by endpoint provider

Parameters:
aServiceGroup - name of service group
See Also:
AbstractDiscoveringEndpointProvider.setServiceGroup(String)

setServiceName

public void setServiceName(java.lang.String aServiceName)
Allows to specify service name which will be used by endpoint provider

Parameters:
aServiceName - name of service group
See Also:
AbstractDiscoveringEndpointProvider.setServiceName(String)

isListenRegistry

public boolean isListenRegistry()

setListenRegistry

public void setListenRegistry(boolean aListenRegistry)

getClientServicesRegistry

public org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI> getClientServicesRegistry()

setClientServicesRegistry

public void setClientServicesRegistry(org.softamis.net.registry.ConsumingRegistry<java.lang.String,SI> aClientServicesRegistry)
Additional setup for discovering endpoints provider which allows to specify client services registry wich is used to discover remote services.

Parameters:
aClientServicesRegistry - registry should be used by provider
See Also:
DiscoveringEndpointProvider.setClientServicesRegistry(org.softamis.net.registry.ConsumingRegistry)

getServiceProvidingPolicy

public EndpointSelectionPolicy<RmiEndpoint<SI>,SI> getServiceProvidingPolicy()

setServiceProvidingPolicy

public void setServiceProvidingPolicy(EndpointSelectionPolicy<RmiEndpoint<SI>,SI> aServiceSelectionPolicy)
Specifies policy will be used by endpoints provider for selection of particular endpoint from the list of endpoints available

Parameters:
aServiceSelectionPolicy - endpoints selection policy will be used by endpoints provider
See Also:
MultiURLEndpointProvider.setEndpointSelectionPolicy(org.softamis.cluster4spring.support.EndpointSelectionPolicy)