Class ReloadableComponentProxy
- java.lang.Object
-
- org.springframework.aop.framework.ProxyConfig
-
- org.springframework.aop.framework.AdvisedSupport
-
- org.springframework.aop.framework.ProxyCreatorSupport
-
- org.springframework.aop.framework.ProxyFactoryBean
-
- org.sakaiproject.entitybroker.util.ReloadableComponentProxy
-
- All Implemented Interfaces:
Serializable,org.springframework.aop.framework.Advised,org.springframework.aop.TargetClassAware,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.FactoryBean<Object>,org.springframework.beans.factory.InitializingBean
public class ReloadableComponentProxy extends org.springframework.aop.framework.ProxyFactoryBean implements org.springframework.beans.factory.InitializingBeanWARNING: Requires Spring 1.2.8 or newer libraries in the classpath
Allows you to define a Sakai component in a webapp so it can be reloaded, this makes development easier since it does not require all of Sakai to be restarted and yet allows you to expose beans to the Sakai component manager
WARNING: This is currently experimental as your bean will not be able to be found by the component manager while things are starting up (since your webapp will not have loaded up yet), it is basically only useful for development and some testing right now
How to use:
1) Create a bean for the service you want to proxy in your webapp application context (example: myLocalBean)
2) Create a bean in your webapp like so:
3) Put the interface for your service into shared (this has to be the same interface you are registering in proxyInterfaces)
4) UseComponentManager.get(Class)to load up the proxied bean in the service/thing that is using your service at the point where it is used (not in the init or it will fail):if (webappService == null) { webappService = (MyService) ComponentManager.get(MyService.class); } That's it. Good luck.- Author:
- Steven Githens (sgithens@caret.cam.ac.uk), Aaron Zeckoski (aaron@caret.cam.ac.uk)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ReloadableComponentProxy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidsetLocalSakaiComponentBean(Object localSakaiComponentBean)voidsetSakaiComponentName(String sakaiComponentName)-
Methods inherited from class org.springframework.aop.framework.ProxyFactoryBean
adviceChanged, createCompositeInterface, getObject, getObjectType, getProxy, isSingleton, setAdvisorAdapterRegistry, setAutodetectInterfaces, setBeanClassLoader, setBeanFactory, setFrozen, setInterceptorNames, setProxyClassLoader, setProxyInterfaces, setSingleton, setTargetName
-
Methods inherited from class org.springframework.aop.framework.ProxyCreatorSupport
addListener, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory
-
Methods inherited from class org.springframework.aop.framework.AdvisedSupport
addAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorChainFactory, getAdvisorCount, getAdvisors, getAdvisorsInternal, getInterceptorsAndDynamicInterceptionAdvice, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toString
-
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass
-
-
-
-
Method Detail
-
setSakaiComponentName
public void setSakaiComponentName(String sakaiComponentName)
- Parameters:
sakaiComponentName- (optional) the name to use for this bean in the component manager, if unset then this will use the name of the registered proxyInterface
-
setLocalSakaiComponentBean
public void setLocalSakaiComponentBean(Object localSakaiComponentBean)
- Parameters:
localSakaiComponentBean- this is the bean which you want to expose via the proxy
-
-