net.sourceforge.jfacets.groovy
Class GroovyFacetDescriptorManager

java.lang.Object
  extended by net.sourceforge.jfacets.groovy.GroovyFacetDescriptorManager
All Implemented Interfaces:
IFacetDescriptorManager, org.springframework.context.ApplicationContextAware

public class GroovyFacetDescriptorManager
extends Object
implements IFacetDescriptorManager, org.springframework.context.ApplicationContextAware

The Facet Descriptor Manager for Groovy Facets, which scans the CLASSPATH for "*.facet" or "*.groovy" Scripts, and creates associated descriptors.
The name, profileId and target type key has to be in the file path, which has to follow naming conventions :

 /  /  / .facet
 

Here is an example :
/admin/com.xyz.MyClass/View
maps to the
(View, admin, com.xyz.MyClass)
facet key.


Constructor Summary
GroovyFacetDescriptorManager(List<String> basePackages)
          Create the manager and set base packages.
 
Method Summary
 String computeScriptPath(String name, String profileId, Class targetObjectType)
          Utility method : Compute and return the path to a Facet Script for passed parameters.
 FacetDescriptor getDescriptor(String name, String profileId, Class targetObjectType)
          Return the descriptor sctrictly associated to passed params if any, null of not found.
 FacetDescriptor[] getDescriptors()
          Return all descriptors in an array.
 InputStream getStreamToScript(FacetDescriptor d)
          Return an input stream on the facet Script file, by using getClass().getResourceAtStream().
 void initialize()
          Loads all available Groovy Facet Descriptors by scanning the CLASSPATH with specified base packages.
 void setApplicationContext(org.springframework.context.ApplicationContext ctx)
          injected Spring context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyFacetDescriptorManager

public GroovyFacetDescriptorManager(List<String> basePackages)
Create the manager and set base packages.

Parameters:
basePackages -
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext ctx)
                           throws org.springframework.beans.BeansException
injected Spring context

Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

initialize

public void initialize()
Loads all available Groovy Facet Descriptors by scanning the CLASSPATH with specified base packages.


computeScriptPath

public String computeScriptPath(String name,
                                String profileId,
                                Class targetObjectType)
Utility method : Compute and return the path to a Facet Script for passed parameters.


getStreamToScript

public InputStream getStreamToScript(FacetDescriptor d)
Return an input stream on the facet Script file, by using getClass().getResourceAtStream().


getDescriptor

public FacetDescriptor getDescriptor(String name,
                                     String profileId,
                                     Class targetObjectType)
Return the descriptor sctrictly associated to passed params if any, null of not found.

Specified by:
getDescriptor in interface IFacetDescriptorManager

getDescriptors

public FacetDescriptor[] getDescriptors()
Return all descriptors in an array.

Specified by:
getDescriptors in interface IFacetDescriptorManager


Copyright © 2012. All Rights Reserved.