|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.gemini.blueprint.service.exporter.support.OsgiServiceFactoryBean
public class OsgiServiceFactoryBean
FactoryBean that transparently publishes other beans in the same application context as OSGi services returning the ServiceRegistration for the given object. Also known as an exporter this class handle the registration and unregistration of an OSGi service for the backing/target object.
The service properties used when publishing the service are determined by the OsgiServicePropertiesResolver. The default implementation usessetContextClassLoader(ExportContextClassLoader), since proxying is required, the target class has to meet
certain criterion described in the Spring AOP documentation. In short, final classes are not supported when class
enhancement is used.
| Field Summary |
|---|
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
OsgiServiceFactoryBean()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
void |
destroy()
|
String |
getBeanName()
Returns the bean name of this class when configured inside a Spring container. |
Class<?>[] |
getInterfaces()
Returns the interfaces that will be considered when exporting the target as an OSGi service. |
boolean |
getLazyListeners()
|
org.osgi.framework.ServiceRegistration |
getObject()
Returns a ServiceRegistration to the OSGi service for the target object. |
Class<? extends org.osgi.framework.ServiceRegistration> |
getObjectType()
|
int |
getOrder()
|
int |
getRanking()
Returns the OSGi ranking used when publishing the service. |
OsgiServicePropertiesResolver |
getResolver()
Returns the property resolver used for publishing the service. |
Map |
getServiceProperties()
Returns the properties used when exporting the target as an OSGi service. |
Object |
getTarget()
Returns the object exported as an OSGi service. |
String |
getTargetBeanName()
Returns the target bean name. |
boolean |
isSingleton()
|
void |
setAutoExport(AutoExport classExporter)
Deprecated. |
void |
setBeanClassLoader(ClassLoader classLoader)
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
|
void |
setBeanName(String name)
|
void |
setBundleContext(org.osgi.framework.BundleContext context)
Set the BundleContext that this bean runs in. |
void |
setCacheTarget(boolean cacheTarget)
Sets the caching of the exported target object. |
void |
setContextClassLoader(ExportContextClassLoader ccl)
Deprecated. As of Spring DM 2.0, replaced by setExportContextClassLoader(ExportContextClassLoaderEnum) |
void |
setExportContextClassLoader(ExportContextClassLoaderEnum ccl)
Sets the context class loader management strategy to use when invoking operations on the exposed target bean. |
void |
setInterfaceDetector(InterfaceDetector detector)
Sets the strategy used for automatically publishing classes. |
void |
setInterfaces(Class<?>[] interfaces)
Sets the interfaces advertised by the service.These will be advertised in the OSGi space and are considered when looking for a service. |
void |
setLazyListeners(boolean lazyListeners)
Sets the laziness of the exporter listeners. |
void |
setListeners(OsgiServiceRegistrationListener[] listeners)
Sets the listeners interested in registration and unregistration events. |
void |
setOrder(int order)
Set the ordering which will apply to this class's implementation of Ordered, used when applying multiple BeanPostProcessors. |
void |
setRanking(int ranking)
Shortcut for setting the ranking property of the published service. |
void |
setRegisterService(boolean register)
Controls whether the service actually gets published or not. |
void |
setResolver(OsgiServicePropertiesResolver resolver)
Sets the property resolver used when publishing the bean as an OSGi service. |
void |
setServiceProperties(Map serviceProperties)
Sets the properties used when exposing the target as an OSGi service. |
void |
setTarget(Object target)
Sets the given object to be export as an OSGi service. |
void |
setTargetBeanName(String name)
Sets the name of the bean managed by the Spring container, which will be exported as an OSGi service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OsgiServiceFactoryBean()
| Method Detail |
|---|
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeanpublic void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
public org.osgi.framework.ServiceRegistration getObject()
throws Exception
ServiceRegistration to the OSGi service for the target object.
getObject in interface org.springframework.beans.factory.FactoryBean<org.osgi.framework.ServiceRegistration>Exceptionpublic Class<? extends org.osgi.framework.ServiceRegistration> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<org.osgi.framework.ServiceRegistration>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<org.osgi.framework.ServiceRegistration>public void setContextClassLoader(ExportContextClassLoader ccl)
setExportContextClassLoader(ExportContextClassLoaderEnum)
ExportContextClassLoader.UNMANAGED is used.
Note: Since proxying is required for context class loader manager, the target class has to
meet certain criteria described in the Spring AOP documentation. In short, final classes are not supported when
class enhancement is used.
ccl - context class loader strategy to useExportContextClassLoaderpublic void setExportContextClassLoader(ExportContextClassLoaderEnum ccl)
ExportContextClassLoader.UNMANAGED is used.
Note: Since proxying is required for context class loader manager, the target class has to
meet certain criteria described in the Spring AOP documentation. In short, final classes are not supported when
class enhancement is used.
ccl - context class loader strategy to useExportContextClassLoaderpublic Object getTarget()
public void setTarget(Object target)
setTargetBeanName(String) is used.
target - the object to be exported as an OSGi servicepublic String getTargetBeanName()
public void setTargetBeanName(String name)
setTarget(Object).
name - target bean namepublic void setAutoExport(AutoExport classExporter)
AutoExport.DISABLED.
classExporter - class exporter used for automatically publishing service classes.AutoExportpublic void setInterfaceDetector(InterfaceDetector detector)
DefaultInterfaceDetector.DISABLED.
detector - public Map getServiceProperties()
public void setServiceProperties(Map serviceProperties)
ServicePropertiesChangeListener), any updates to the properties will be reflected by the service
registration.
serviceProperties - properties used for exporting the target as an OSGi servicepublic int getRanking()
public void setRanking(int ranking)
ranking - service rankingConstants.SERVICE_RANKINGpublic void setRegisterService(boolean register)
register - whether to register the service or not. The default is true.
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionpublic void setBundleContext(org.osgi.framework.BundleContext context)
BundleContextAwareBundleContext that this bean runs in. Normally this can
be used to initialize an object.
setBundleContext in interface BundleContextAwarecontext - the BundleContext object to be used
by this objectpublic OsgiServicePropertiesResolver getResolver()
public void setResolver(OsgiServicePropertiesResolver resolver)
resolver - service property resolverpublic Class<?>[] getInterfaces()
public void setInterfaces(Class<?>[] interfaces)
interfaces - array of classes to advertisepublic int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setOrder(int order)
Default value is Integer.MAX_VALUE, meaning that it's non-ordered.
order - ordering valuepublic String getBeanName()
public void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic void setCacheTarget(boolean cacheTarget)
public void setListeners(OsgiServiceRegistrationListener[] listeners)
listeners - registration/unregistration listeners.public void setLazyListeners(boolean lazyListeners)
lazyListeners - false if the listeners should be called when the service is registered, true if the
invocations should occur after the first service/factory bean requestpublic boolean getLazyListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||