|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jsfcomp.facelets.deploy.FaceletAnnotationParser
public class FaceletAnnotationParser
The parser that scans the classpath for annotated classes, creating tag libraries and registers them with the facelets compiler.
parse()
,
Compiler
,
AnnotationTagLibrary
Field Summary | |
---|---|
static java.lang.String |
MANIFEST_SECTION_NAME
|
Constructor Summary | |
---|---|
FaceletAnnotationParser()
Default constructor (required for ParserFactory) |
Method Summary | |
---|---|
static void |
addToFacelets(java.util.Set<AnnotationTagLibrary> libraries)
Convenience method that gets the compiler from the facelet factory and registers the tag libraries with it. |
static void |
addToFacelets(java.util.Set<AnnotationTagLibrary> libraries,
com.sun.facelets.compiler.Compiler c)
Convenience method that adds the given libraries to the compiler given |
protected java.lang.String |
getClassName(java.lang.String name)
Translate a file system path or a jar file path into a class name. |
protected RegisterPriority |
getEffectivePriority(RegisterPriority value,
RegisterPriority defaultValue)
Get the effective priority |
protected java.util.Iterator<java.net.URL> |
getManifestsToScan()
|
protected java.lang.String |
getManifestValue(java.util.jar.Manifest mf,
java.lang.String namedSection,
java.lang.String attrName,
java.lang.String defaultValueIfNotSet)
Get a value from a named section in a manifest |
protected AnnotationTagLibrary |
getTagLibrary(java.lang.String ns)
Get a tag library. |
protected AnnotationTagLibraryFactory |
getTagLibraryFactory()
Get an instance of the tag library factory. |
protected boolean |
iteratorContains(java.util.Iterator<?> iter,
java.lang.Object value)
Utility function to see if a value is contained in an iterator |
protected java.lang.Iterable<ScanLocationInformation> |
obtainLocationsToScan()
Obtain the URLs to scan for class files. |
java.util.Set<AnnotationTagLibrary> |
parse()
The work-horse of the class. |
protected boolean |
parseClassesInPath(java.net.URL manifestPath,
java.util.jar.Manifest mf)
Checks a manifest to see if the path should be parsed. |
protected void |
parseComponent(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Parse a class that has the FaceletComponent annotation |
protected void |
parseConverter(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Parse a class that has the FaceletConverter annotation |
protected void |
parseFunctions(java.lang.Class<?> cls)
Parse a class for functions |
protected void |
parseRenderer(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Parse a class that has the FacesRenderer annotation |
protected void |
parseTagHandler(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Parse a class that has the FaceletTagHandler annotation |
protected void |
parseValidator(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Parse a class that has the FaceletValidator annotation |
protected void |
postScan(javax.faces.context.FacesContext context,
java.lang.Class<?> cls,
RegisterPriority defaultPriority)
Allows sub-classes to do any further work on the given class. |
protected void |
scanClass(javax.faces.context.FacesContext context,
java.lang.String name,
RegisterPriority defaultPriority)
Loads the Class for the given name and then checks it for facelet deployment annotations |
protected void |
scanClassesInDirectory(javax.faces.context.FacesContext context,
java.io.File dir,
RegisterPriority defaultPriority)
Scan the given directory |
protected void |
scanClassesInDirectory(javax.faces.context.FacesContext context,
java.io.File dir,
java.lang.StringBuilder path,
RegisterPriority defaultPriority)
Called from scanClassesInDirectory
and recursively calls itself looking for files with a .class extension in
sub-directories |
protected void |
scanClassesInJar(javax.faces.context.FacesContext context,
java.io.File jarFile,
RegisterPriority defaultPriority)
Scan the classes in a jar file on the classpath |
protected void |
scanClasspath(javax.faces.context.FacesContext context)
Scan the class path for annotated classes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MANIFEST_SECTION_NAME
Constructor Detail |
---|
public FaceletAnnotationParser()
Method Detail |
---|
public java.util.Set<AnnotationTagLibrary> parse() throws ParserException
ParserException
- thrown if there was an issue
during parsingpublic static void addToFacelets(java.util.Set<AnnotationTagLibrary> libraries) throws java.lang.IllegalStateException
FaceletFactory.getInstance()
returns an instance of
DefaultFaceletFactory
.
Once the compiler is obtained, it calls
addToFacelets(Set, Compiler)
.
java.lang.IllegalStateException
- thrown if the facelet factory instance is not
of type DefaultFaceletFactoryDefaultFaceletFactory.getCompiler()
,
DefaultFaceletFactory
,
FaceletFactory.getInstance()
public static void addToFacelets(java.util.Set<AnnotationTagLibrary> libraries, com.sun.facelets.compiler.Compiler c)
libraries
- the tag libraries to addc
- the compiler to add them toprotected void scanClassesInJar(javax.faces.context.FacesContext context, java.io.File jarFile, RegisterPriority defaultPriority) throws java.io.IOException, FactoryException
context
- the faces context to use when registering JSF itemsjarFile
- the jar file to scandefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
java.io.IOException
- opening and scanning the jar file errors
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void scanClassesInDirectory(javax.faces.context.FacesContext context, java.io.File dir, RegisterPriority defaultPriority) throws FactoryException
context
- the faces context to use when registering JSF itemsdir
- the directorydefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
protected void scanClassesInDirectory(javax.faces.context.FacesContext context, java.io.File dir, java.lang.StringBuilder path, RegisterPriority defaultPriority) throws FactoryException
scanClassesInDirectory
and recursively calls itself looking for files with a .class extension in
sub-directories
context
- the faces context to use when registering JSF itemsdir
- the current directorydefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
path
- the path to this directory starting after the directory in the
classpath (so the folders in this path should mirror the package of
the class file)
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected java.lang.String getClassName(java.lang.String name)
name
- the file name and relative path from the directory or the
entry name from the jar file
protected void scanClass(javax.faces.context.FacesContext context, java.lang.String name, RegisterPriority defaultPriority) throws FactoryException
context
- the faces context to use when registering JSF itemsname
- the class namedefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void postScan(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority) throws FactoryException
#scanClass(FacesContext, String), scanClass
.
context
- the faces context to use when registering JSF itemscls
- the class to scandefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void parseConverter(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority) throws FactoryException
FaceletConverter
annotation
context
- the faces context to use when registering JSF itemscls
- the classdefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void parseValidator(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority) throws FactoryException
FaceletValidator
annotation
context
- the faces context to use when registering JSF itemscls
- the classdefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void parseTagHandler(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority) throws FactoryException
FaceletTagHandler
annotation
context
- the faces context to use when registering JSF itemscls
- the classdefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void parseComponent(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority) throws FactoryException
FaceletComponent
annotation
context
- the faces context to use when registering JSF itemscls
- the classdefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryprotected void parseFunctions(java.lang.Class<?> cls) throws FactoryException
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryFaceletFunctionHolder
,
FaceletElFunction
protected void scanClasspath(javax.faces.context.FacesContext context) throws java.io.IOException, FactoryException
context
- the faces context to use when registering JSF items
java.io.IOException
- if an IO exception occurs from the file system
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryobtainLocationsToScan()
protected java.util.Iterator<java.net.URL> getManifestsToScan() throws java.io.IOException
java.io.IOException
protected java.lang.Iterable<ScanLocationInformation> obtainLocationsToScan() throws java.io.IOException
java.io.IOException
- opening and scanning the jar file errorsparseClassesInPath(URL, Manifest)
protected boolean parseClassesInPath(java.net.URL manifestPath, java.util.jar.Manifest mf)
If this is not overridden, it checks for an attribute Scan that is equal to true in the named manifest section net/sf/jsf-comp/facelets.
manifestPath
- The URL to the manifest filemf
- The manifest file data
protected void parseRenderer(javax.faces.context.FacesContext context, java.lang.Class<?> cls, RegisterPriority defaultPriority)
FacesRenderer
annotation
context
- the faces context to use when registering JSF itemscls
- the classdefaultPriority
- The default priority to use when the annotation is
set to RegisterPriority.DEFAULT
protected final AnnotationTagLibrary getTagLibrary(java.lang.String ns) throws FactoryException
ns
- the namespace
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactorygetTagLibraryFactory()
protected final boolean iteratorContains(java.util.Iterator<?> iter, java.lang.Object value)
protected AnnotationTagLibraryFactory getTagLibraryFactory() throws FactoryException
DeploymentFinderFactory.createFactory(FactoryType)
to
obtain the factory that should be used.
FactoryException
- if there was an error getting the
AnnotationTagLibraryFactoryDeploymentFinderFactory.createFactory(FactoryType)
,
DeploymentFinderFactory.FactoryType.TAGLIBRARY
protected final java.lang.String getManifestValue(java.util.jar.Manifest mf, java.lang.String namedSection, java.lang.String attrName, java.lang.String defaultValueIfNotSet)
mf
- the manifestnamedSection
- the section nameattrName
- the attribute namedefaultValueIfNotSet
- the value to return if the section or attribute
were not found
protected final RegisterPriority getEffectivePriority(RegisterPriority value, RegisterPriority defaultValue)
value
- the value from the annotationdefaultValue
- the default value from the manifest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |