org.kuali.rice.core.api.resourceloader
Class LazyResourceFactoryBean

java.lang.Object
  extended by org.kuali.rice.core.api.resourceloader.LazyResourceFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

public class LazyResourceFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean

Loads a lazy proxy to a service from the GlobalResourceLoader. This proxy is created based on either the proxy interfaces that are injected into this bean, or derived from the objectType which is injected into this bean. If neither of these are injected, then an exception will be through during bean initialization. The attempt to fetch the resource from the GlobalResourceLoader won't be attempted until a method on the resulting proxy is invoked. If it fails to locate the resource, it will throw a ResourceLoaderException indicating the service could not be loaded.

This allows for referencing of a potentially remote service in the spring context during startup which won't get used until after startup. If the remote service gets used *during* startup, then it must be available from the GRL during startup or else the ResourceLoaderException will be thrown.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
LazyResourceFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  Class<?>[] detectProxyInterfaces()
           
 Object getObject()
           
 Class<?> getObjectType()
           
 Class<?>[] getProxyInterfaces()
           
 String getServiceName()
           
 String getServiceNamespace()
           
 boolean isSingleton()
           
 void setObjectType(Class<?> objectType)
           
 void setProxyInterfaces(Class<?>[] proxyInterfaces)
           
 void setServiceName(String serviceName)
           
 void setServiceNamespace(String serviceNamespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyResourceFactoryBean

public LazyResourceFactoryBean()
Method Detail

afterPropertiesSet

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

detectProxyInterfaces

protected Class<?>[] detectProxyInterfaces()

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<Object>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<Object>

setObjectType

public void setObjectType(Class<?> objectType)

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<Object>

getServiceNamespace

public String getServiceNamespace()

setServiceNamespace

public void setServiceNamespace(String serviceNamespace)

getServiceName

public String getServiceName()

setServiceName

public void setServiceName(String serviceName)

getProxyInterfaces

public Class<?>[] getProxyInterfaces()

setProxyInterfaces

public void setProxyInterfaces(Class<?>[] proxyInterfaces)


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.