Package org.geotools.process.factory
Class AnnotatedBeanProcessFactory
Object
AnnotationDrivenProcessFactory
AnnotatedBeanProcessFactory
- All Implemented Interfaces:
ProcessFactory,Factory,OptionalFactory
- Direct Known Subclasses:
RasterProcessFactory,VectorProcessFactory
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:
- Create an instance passing in a list of "bean" classes you wish to publish:
ProcessFactory factory = new AnnotatedBeanProcessFactory( Text.text("Internal"),"internal", ExampleProcess); - Create an implementation of each bean class referenced:
- Annotate the class with
DescribeProcess:@DescribeProcess( title = "bounds", description = "Computes the overlall bounds of the input features") public class BoundsProcess { ... } - Supply an execute method (which we can call by reflection):
@DescribeResult(name = "bounds", description = "The feature collection bounds") public ReferencedEnvelope execute( @DescribeParameter(name = "features", description = "Collection whose bounds will be computed") FeatureCollection features) { return features.getBounds(); }
- Annotate the class with
- 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
Nested ClassesModifier and TypeClassDescriptionstatic classSubclass 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
ConstructorsConstructorDescriptionAnnotatedBeanProcessFactory(InternationalString title, String namespace, Class<?>... beanClasses) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectcreateProcessBean(Name name) Create an instance of the named process bean.getNames()List of processes published; generated from the classMap created in the constructuor.protected DescribeProcessgetProcessDescription(Name name) Used to go through the list of java beans; returning the DescribeProcess annotation for each one.protected MethodResolves to the execute method for the provided java bean.Methods inherited from class AnnotationDrivenProcessFactory
create, getDescription, getImplementationHints, getParameterInfo, getResultInfo, getTitle, getTitle, getVersion, isAvailable, lookupClipOnRenderingArea, lookupCustomizeReadParams, lookupInvertGridGeometry, lookupInvertQuery, supportsProgress
-
Constructor Details
-
AnnotatedBeanProcessFactory
public AnnotatedBeanProcessFactory(InternationalString title, String namespace, Class<?>... beanClasses)
-
-
Method Details
-
getProcessDescription
Used to go through the list of java beans; returning the DescribeProcess annotation for each one.- Specified by:
getProcessDescriptionin classAnnotationDrivenProcessFactory- Parameters:
name- Process name- Returns:
- DescribeProcess annotation for the named process
-
method
Resolves to the execute method for the provided java bean.- Specified by:
methodin classAnnotationDrivenProcessFactory- Returns:
- the "execute" method of the indicated java bean.
-
getNames
List of processes published; generated from the classMap created in the constructuor.- Returns:
- a set of names handled by this process factory
-
createProcessBean
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:
createProcessBeanin classAnnotationDrivenProcessFactory- Parameters:
name- Name of the process bean- Returns:
- intance of process bean; or null if the method is a static method
-