org.restlet.ext.spring
Class SpringBeanFinder

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Finder
              extended by org.restlet.ext.spring.SpringFinder
                  extended by org.restlet.ext.spring.SpringBeanFinder
All Implemented Interfaces:
BeanFactoryAware

public class SpringBeanFinder
extends SpringFinder
implements BeanFactoryAware

An alternative to SpringFinder which uses Spring's BeanFactory mechanism to load a prototype bean by name. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.

Author:
Rhett Sutphin

Constructor Summary
SpringBeanFinder()
          Default constructor.
SpringBeanFinder(BeanFactory beanFactory, java.lang.String beanName)
          Constructor.
 
Method Summary
 Resource createResource()
          Creates a new instance of the resource class designated by the "targetClass" property.
 BeanFactory getBeanFactory()
          Returns the parent bean factory.
 java.lang.String getBeanName()
          Returns the bean name.
 void setBeanFactory(BeanFactory beanFactory)
          Sets the parent bean factory.
 void setBeanName(java.lang.String beanName)
          Sets the bean name.
 
Methods inherited from class org.restlet.ext.spring.SpringFinder
createTarget
 
Methods inherited from class org.restlet.Finder
createResource, createTarget, findTarget, getTargetClass, handle, setTargetClass
 
Methods inherited from class org.restlet.Restlet
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext, start, stop
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringBeanFinder

public SpringBeanFinder()
Default constructor.


SpringBeanFinder

public SpringBeanFinder(BeanFactory beanFactory,
                        java.lang.String beanName)
Constructor.

Parameters:
beanFactory - The Spring bean factory.
beanName - The bean name.
Method Detail

createResource

public Resource createResource()
Description copied from class: SpringFinder
Creates a new instance of the resource class designated by the "targetClass" property. For easier Spring configuration, the default target resource's constructor is invoked. The created instance is initialized by the calling Finder.createResource(Request, Response) method, by invoking the Resource.init(Context, Request, Response) method on the resource.

Overrides:
createResource in class SpringFinder
Returns:
The created resource or null.

getBeanFactory

public BeanFactory getBeanFactory()
Returns the parent bean factory.

Returns:
The parent bean factory.

getBeanName

public java.lang.String getBeanName()
Returns the bean name.

Returns:
The bean name.

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Sets the parent bean factory.

Specified by:
setBeanFactory in interface BeanFactoryAware
Parameters:
beanFactory - The parent bean factory.

setBeanName

public void setBeanName(java.lang.String beanName)
Sets the bean name.

Parameters:
beanName - The bean name.


Copyright © 2005-2008 Noelios Technologies.