org.eclipse.gemini.blueprint.service.importer.support.internal.aop
Class ServiceDynamicInterceptor

java.lang.Object
  extended by org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker
      extended by org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceDynamicInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, ServiceReferenceProvider, org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware

public class ServiceDynamicInterceptor
extends ServiceInvoker
implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware

Interceptor adding dynamic behaviour for unary service (..1 cardinality). It will look for a service using the given filter, retrying if the service is down or unavailable. Will dynamically rebound a new service, if one is available with a higher service ranking and the interceptor is non sticky.

In case no service is available, it will throw an exception.

Note: this is a stateful interceptor and should not be shared.

Author:
Costin Leau

Field Summary
 
Fields inherited from class org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker
log
 
Constructor Summary
ServiceDynamicInterceptor(org.osgi.framework.BundleContext context, String filterClassName, org.osgi.framework.Filter filter, ClassLoader classLoader)
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 boolean equals(Object other)
           
 OsgiServiceLifecycleListener[] getListeners()
           
 RetryTemplate getRetryTemplate()
           
 org.osgi.framework.ServiceReference getServiceReference()
          Convenience method exposing the target (OSGi service) reference so that subinterceptors can access it.
 Object getTarget()
          Determine the target object to execute the invocation upon.
 org.osgi.framework.ServiceReference getTargetReference()
           
 int hashCode()
           
 void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
           
 void setListeners(OsgiServiceLifecycleListener[] listeners)
           
 void setMandatoryService(boolean mandatoryService)
           
 void setProxy(Object proxy)
           
 void setRetryTimeout(long timeout)
           
 void setServiceImporter(Object importer)
           
 void setServiceImporterName(String name)
           
 void setStateListeners(List stateListeners)
          Internal state listeners
 void setSticky(boolean sticky)
           
 void setUseBlueprintExceptions(boolean useBlueprintExceptions)
           
 
Methods inherited from class org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker
doInvoke, invoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceDynamicInterceptor

public ServiceDynamicInterceptor(org.osgi.framework.BundleContext context,
                                 String filterClassName,
                                 org.osgi.framework.Filter filter,
                                 ClassLoader classLoader)
Method Detail

getTarget

public Object getTarget()
Description copied from class: ServiceInvoker
Determine the target object to execute the invocation upon.

Specified by:
getTarget in class ServiceInvoker
Returns:

getTargetReference

public org.osgi.framework.ServiceReference getTargetReference()

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Specified by:
destroy in class ServiceInvoker

getServiceReference

public org.osgi.framework.ServiceReference getServiceReference()
Convenience method exposing the target (OSGi service) reference so that subinterceptors can access it. By default, returns null. This particular interceptor returns a delegated service reference so that callers can keep the reference even if the underlying target service reference changes in time.

Specified by:
getServiceReference in interface ServiceReferenceProvider
Overrides:
getServiceReference in class ServiceInvoker

setRetryTimeout

public void setRetryTimeout(long timeout)

getRetryTemplate

public RetryTemplate getRetryTemplate()

getListeners

public OsgiServiceLifecycleListener[] getListeners()

setListeners

public void setListeners(OsgiServiceLifecycleListener[] listeners)

setServiceImporter

public void setServiceImporter(Object importer)

setServiceImporterName

public void setServiceImporterName(String name)

setMandatoryService

public void setMandatoryService(boolean mandatoryService)

setProxy

public void setProxy(Object proxy)

setApplicationEventPublisher

public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
Specified by:
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware

setStateListeners

public void setStateListeners(List stateListeners)
Internal state listeners


setUseBlueprintExceptions

public void setUseBlueprintExceptions(boolean useBlueprintExceptions)

setSticky

public void setSticky(boolean sticky)

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2006-2013. All Rights Reserved.