org.geotools.process.factory
Class AnnotatedBeanProcessFactory

Object
  extended by AnnotationDrivenProcessFactory
      extended by AnnotatedBeanProcessFactory
All Implemented Interfaces:
Factory, OptionalFactory, ProcessFactory

public class AnnotatedBeanProcessFactory
extends AnnotationDrivenProcessFactory

Annotation driven process factory; used to wrap up a bunch of Java beans as a single Process Factory.

To make use of this class you will need to:

  1. Create an instance passing in a list of "bean" classes you wish to publish:
     ProcessFactory factory = new AnnotatedBeanProcessFactory( Text.text("Internal"),"internal", ExampleProcess);
  2. Create an implementation of each bean class referenced:
  3. Optional: If you are using this technique in an environment such as Spring you may wish to use a "marker interface" to allow Spring to discover implementations on the classpath.
     public class BoundsProcess implements GeoServerProcess {
         ...
     }
     


Nested Class Summary
static class AnnotatedBeanProcessFactory.BeanFactoryRegistry<T>
          Subclass of FactoryRegistry meant for convenience of looking up all the classes that implement a specific bean interface.
 
Field Summary
 
Fields inherited from class AnnotationDrivenProcessFactory
namespace
 
Constructor Summary
AnnotatedBeanProcessFactory(InternationalString title, String namespace, Class<?>... beanClasses)
           
 
Method Summary
protected  Object createProcessBean(Name name)
          Create an instance of the named process bean.
 Set<Name> getNames()
          List of processes published; generated from the classMap created in the constructuor.
protected  DescribeProcess getProcessDescription(Name name)
          Used to go through the list of java beans; returning the DescribeProcess annotation for each one.
protected  Method method(String className)
          Resolves to the execute method for the provided java bean.
 
Methods inherited from class AnnotationDrivenProcessFactory
create, getDescription, getImplementationHints, getParameterInfo, getResultInfo, getTitle, getTitle, getVersion, isAvailable, lookupInvertGridGeometry, lookupInvertQuery, supportsProgress
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotatedBeanProcessFactory

public AnnotatedBeanProcessFactory(InternationalString title,
                                   String namespace,
                                   Class<?>... beanClasses)
Method Detail

getProcessDescription

protected DescribeProcess getProcessDescription(Name name)
Used to go through the list of java beans; returning the DescribeProcess annotation for each one.

Specified by:
getProcessDescription in class AnnotationDrivenProcessFactory
Parameters:
name - Process name
Returns:
DescribeProcess annotation for the named process

method

protected Method method(String className)
Resolves to the execute method for the provided java bean.

Specified by:
method in class AnnotationDrivenProcessFactory
Returns:
the "execute" method of the indicated java bean.

getNames

public Set<Name> getNames()
List of processes published; generated from the classMap created in the constructuor.

Returns:
a set of names handled by this process factory

createProcessBean

protected Object createProcessBean(Name name)
Create an instance of the named process bean.

By having an actual object here we allow implementors to hold onto a bit of state if they wish. The object will need to have an execute method and be annotated with a describe process annotation.

Specified by:
createProcessBean in class AnnotationDrivenProcessFactory
Parameters:
name - Name of the process bean
Returns:
intance of process bean; or null if the method is a static method


Copyright © 1996-2014 Geotools. All Rights Reserved.