|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.softamis.cluster4spring.support.provider.BaseEndpointProvider<E,SI> org.softamis.cluster4spring.support.provider.MultiURLEndpointProvider<E,SI> org.softamis.cluster4spring.support.provider.AbstractUrlListEndpointProvider<E,SI> org.softamis.cluster4spring.support.provider.AbstractDiscoveringEndpointProvider<E,SI>
SI
- type of data used to invoke remote service (such as remote service URL)E
- type of endpoints that could be created by this factorypublic abstract class AbstractDiscoveringEndpointProvider<E extends Endpoint<SI>,SI extends ServiceMoniker>
Base abstract class for implementation of EndpointProvider
that automatically discovers
services based on service name and service group. Such auto-discoverable
services are published via appropriate ServicePublisher
.
Class contains all basic logic related to discovering, but does not include any
references to underlying services storage.
Field Summary | |
---|---|
protected java.lang.String |
fProtocolName
Name of protocol |
protected java.lang.String |
fServiceGroup
Group to which service belong |
protected java.lang.String |
fServiceKey
|
protected java.lang.String |
fServiceName
Name of service |
Fields inherited from class org.softamis.cluster4spring.support.provider.AbstractUrlListEndpointProvider |
---|
fCacheLock, fEndpointsCache |
Fields inherited from class org.softamis.cluster4spring.support.provider.MultiURLEndpointProvider |
---|
fEndpointSelectionPolicy |
Fields inherited from class org.softamis.cluster4spring.support.provider.BaseEndpointProvider |
---|
fCacheEndpoints |
Constructor Summary | |
---|---|
protected |
AbstractDiscoveringEndpointProvider()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by Spring as part of bean lifecycle. |
protected void |
checkServiceName()
|
protected java.lang.String |
createServiceKey(java.lang.String aBeanName)
Represensts implementation of actual algorythm of service key calculation. |
protected java.util.List<E> |
doRefreshServiceEndpointsList(org.springframework.remoting.support.RemoteInvocationFactory aRemoteInvocationFactory,
EndpointFactory<E,SI> aEndpointFactory,
java.lang.String aBeanName)
Creates list of endpoints available for service. |
protected java.util.List<E> |
getCachedEndpoints(org.springframework.remoting.support.RemoteInvocationFactory aRemoteInvocationFactory,
EndpointFactory<E,SI> aEndpointFactory,
java.lang.String aBeanName)
Obtains endpoints from endpoints cache. |
java.lang.String |
getProtocolName()
Returns name of protocol |
java.lang.String |
getServiceGroup()
Returns group to which service belong |
java.lang.String |
getServiceName()
Returns name of service |
protected abstract void |
invalidateServiceInRegistry(java.lang.String aServiceKey,
SI aServiceInfo)
Methods used to notify underlying services registry that particular service location should be invalidated. |
protected abstract boolean |
isRefreshRequiredForCachedEndpoints(java.lang.String aServiceKey)
Determines whether refresh for cached endpoints is required. |
void |
markInvalid(java.lang.String aBeanName,
E aEndpoint)
Marks given endpoint invalid. |
protected void |
markServiceInvalidInternal(java.lang.String aServiceKey,
java.util.Set<SI> aServiceInfos,
SI aServiceInfo)
Notifies underlying registry that given service url under given service key is invalid if service url is contained in provided set of service urls |
protected java.lang.String |
obtainServiceKey(java.lang.String aBeanName)
Returns key of service in consuming registry. |
protected abstract java.util.Set<SI> |
obtainServiceUrlsFromRegistry(java.lang.String aServiceKey)
Returns set of service url's from service locations registry |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent aEvent)
Handles application event |
protected void |
onContextClosed()
Handles ContextClosed application event. |
protected void |
onContextRefreshed()
Handles ContextRefreshed application event. |
void |
setProtocolName(java.lang.String aProtocolName)
Sets name of protocol. |
void |
setServiceGroup(java.lang.String aServiceGroup)
Sets group to which service belong. |
void |
setServiceName(java.lang.String aServiceName)
Sets name of service |
Methods inherited from class org.softamis.cluster4spring.support.provider.AbstractUrlListEndpointProvider |
---|
doGetCachedEndpoints, getServiceEndpointsList, refresh, saveFreshEndpointsToCache |
Methods inherited from class org.softamis.cluster4spring.support.provider.MultiURLEndpointProvider |
---|
createDefaultEndpointSelectionPolicy, getEndpoint, setEndpointSelectionPolicy |
Methods inherited from class org.softamis.cluster4spring.support.provider.BaseEndpointProvider |
---|
doCreateServiceEndpoint, isCacheEndpoints, setCacheEndpoints |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String fServiceName
protected java.lang.String fServiceKey
protected java.lang.String fProtocolName
protected java.lang.String fServiceGroup
Constructor Detail |
---|
protected AbstractDiscoveringEndpointProvider()
Method Detail |
---|
protected abstract boolean isRefreshRequiredForCachedEndpoints(java.lang.String aServiceKey)
Determines whether refresh for cached endpoints is required. Implementation will rely on underlying services registry.
aServiceKey
- key used to check whether cahe should be refreshed
ConsumingRegistry.isDirty(java.io.Serializable)
protected abstract java.util.Set<SI> obtainServiceUrlsFromRegistry(java.lang.String aServiceKey) throws java.lang.Exception
aServiceKey
- key used to obtain service urls
java.lang.Exception
protected abstract void invalidateServiceInRegistry(java.lang.String aServiceKey, SI aServiceInfo)
aServiceKey
- key used to obtain service urlsaServiceInfo
- information about particular service locationpublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class AbstractUrlListEndpointProvider<E extends Endpoint<SI>,SI extends ServiceMoniker>
java.lang.Exception
MultiURLEndpointProvider.createDefaultEndpointSelectionPolicy()
protected java.util.List<E> getCachedEndpoints(org.springframework.remoting.support.RemoteInvocationFactory aRemoteInvocationFactory, EndpointFactory<E,SI> aEndpointFactory, java.lang.String aBeanName)
getCachedEndpoints
in class AbstractUrlListEndpointProvider<E extends Endpoint<SI>,SI extends ServiceMoniker>
aRemoteInvocationFactory
- factory to create remote invocationsaEndpointFactory
- factory used to create endpointsaBeanName
-
isRefreshRequiredForCachedEndpoints(String)
protected java.util.List<E> doRefreshServiceEndpointsList(org.springframework.remoting.support.RemoteInvocationFactory aRemoteInvocationFactory, EndpointFactory<E,SI> aEndpointFactory, java.lang.String aBeanName) throws org.springframework.remoting.RemoteAccessException
ConsumingRegistry
and
based on this list tries to create list of endpoints.
If endpoint creation is failed for some service url, method notes such url and after
endpoints creation notifies ConsumingRegistry
that particular service
url is invalid.
doRefreshServiceEndpointsList
in class AbstractUrlListEndpointProvider<E extends Endpoint<SI>,SI extends ServiceMoniker>
aRemoteInvocationFactory
- factory used to create remote invocationaEndpointFactory
- factory used to create endpointsaBeanName
-
org.springframework.remoting.RemoteAccessException
- throws if list of endpoints could not be createdpublic void markInvalid(java.lang.String aBeanName, E aEndpoint)
markInvalid
in interface EndpointProvider<E extends Endpoint<SI>,SI extends ServiceMoniker>
aBeanName
- name of bean that is used as proxy for remote serviceaEndpoint
- endpoint to be marked invalidBaseEndpointProvider.setCacheEndpoints(boolean)
public void onApplicationEvent(org.springframework.context.ApplicationEvent aEvent)
onApplicationEvent
in interface org.springframework.context.ApplicationListener
aEvent
- event to handleonContextRefreshed()
,
onContextClosed()
protected void onContextRefreshed()
ContextRefreshed
application event.
onApplicationEvent(ApplicationEvent)
protected void onContextClosed()
ContextClosed
application event. On closing context
clears endpoints cache
onApplicationEvent(ApplicationEvent)
protected java.lang.String obtainServiceKey(java.lang.String aBeanName)
serviceGroup/serviceName
. If service name is not specified during provider
configuration, given name of proxy bean is used instead of service name.
aBeanName
- name of proxy bean
ConsumingRegistry
protected java.lang.String createServiceKey(java.lang.String aBeanName)
serviceGroup/serviceName
This method should be overriden if some custom implementation is necesary.
aBeanName
-
protected void markServiceInvalidInternal(java.lang.String aServiceKey, java.util.Set<SI> aServiceInfos, SI aServiceInfo)
aServiceKey
- key used to identify services url in ConsumingRegistryaServiceInfos
- list of services urlsaServiceInfo
- service url that should be marked invalidprotected void checkServiceName()
public java.lang.String getServiceGroup()
public void setServiceGroup(java.lang.String aServiceGroup)
aServiceGroup
- group to which service belongpublic java.lang.String getServiceName()
public void setServiceName(java.lang.String aServiceName)
aServiceName
- name of servicepublic java.lang.String getProtocolName()
public void setProtocolName(java.lang.String aProtocolName)
aProtocolName
- name of protocol
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |