|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.osgi.service.importer.support.AbstractOsgiServiceImportFactoryBean
org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean
public final class OsgiServiceProxyFactoryBean
OSGi (single) service importer. This implementation creates a managed OSGi service proxy that handles the OSGi service dynamics. The returned proxy will select only the best matching OSGi service for the configuration criteria. If the select service goes away (at any point in time), the proxy will automatically search for a replacement without the user intervention.
Note that the proxy instance remains the same and only the backing OSGi service changes. Due to the dynamic nature of OSGi, the backing object can change during method invocations.
| Constructor Summary | |
|---|---|
OsgiServiceProxyFactoryBean()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
void |
destroy()
|
Object |
getObject()
Returns a managed object for accessing OSGi service(s). Returns a managed proxy to the best matching OSGi service. |
Class |
getObjectType()
Returns the managed proxy type. |
int |
getRetryTimes()
Returns the number of attempts to rebind a target service before giving up. |
long |
getTimeout()
Returns the timeout (in milliseconds) this importer waits while trying to find a backing service. |
boolean |
isEagerInit()
The object created by this factory bean is eagerly initialized. |
boolean |
isPrototype()
The object returned by this FactoryBean is a not a prototype. |
boolean |
isSingleton()
The object managed by this factory is a singleton. |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
|
void |
setBeanClassLoader(ClassLoader classLoader)
This method is called automatically by the container. The class will automatically chain this classloader with the AOP infrastructure classes (even if these are not visible to the user) so that the proxy creation can be completed successfully. |
void |
setCardinality(Cardinality cardinality)
Sets the importer cardinality (0..1, 1..1, 0..N, or 1..N). Since this implementation creates a managed proxy, only single cardinalities are accepted. |
void |
setRetryTimes(int maxRetries)
Sets how many times should this importer attempt to rebind to a target service if the backing service currently used is unregistered. |
void |
setTimeout(long millisBetweenRetries)
Sets how long (in milliseconds) should this importer wait between failed attempts at rebinding to a service that has been unregistered. |
| Methods inherited from class org.springframework.osgi.service.importer.support.AbstractOsgiServiceImportFactoryBean |
|---|
getBeanClassLoader, getBeanName, getBundleContext, getCardinality, getContextClassLoader, getFilter, getInterfaces, getListeners, getUnifiedFilter, setBeanName, setBundleContext, setContextClassLoader, setFilter, setInterfaces, setListeners, setServiceBeanName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OsgiServiceProxyFactoryBean()
| Method Detail |
|---|
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic Class getObjectType()
getObjectType in interface FactoryBeanpublic Object getObject()
getObject in interface FactoryBeanpublic void setRetryTimes(int maxRetries)
setTimeout(long) is called. Thus, to change both the number of
retries and timeout, after initialization, one should call first {setRetryTimes(int)
followed by setTimeout(long). If the timeout value is
unchanged, retrieve the current value through getTimeout() and
pass it again to setTimeout(long).
maxRetries - The maxRetries to set.public int getRetryTimes()
public void setTimeout(long millisBetweenRetries)
millisBetweenRetries - The millisBetweenRetries to set.public long getTimeout()
public void setCardinality(Cardinality cardinality)
setCardinality in class AbstractOsgiServiceImportFactoryBeancardinality - importer cardinality.public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAware
public void destroy()
throws Exception
destroy in interface DisposableBeanExceptionpublic boolean isSingleton()
isSingleton in interface FactoryBeanpublic boolean isEagerInit()
isEagerInit in interface SmartFactoryBeanpublic boolean isPrototype()
isPrototype in interface SmartFactoryBeanpublic void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface BeanClassLoaderAwaresetBeanClassLoader in class AbstractOsgiServiceImportFactoryBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||