org.jboss.deployers.vfs.spi.structure.helpers
Class AbstractStructureDeployer

java.lang.Object
  extended by org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer
All Implemented Interfaces:
Ordered, StructureDeployer
Direct Known Subclasses:
AbstractVFSStructureDeployer

public abstract class AbstractStructureDeployer
extends Object
implements StructureDeployer

AbstractStructureDeployer.

We don't care about the order by default.

Version:
$Revision: 1.1 $
Author:
Adrian Brock, Ales Justin

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.deployers.spi.Ordered
Ordered.OrderedComparator
 
Field Summary
protected  org.jboss.logging.Logger log
          The log
 
Fields inherited from interface org.jboss.deployers.spi.Ordered
COMPARATOR
 
Constructor Summary
AbstractStructureDeployer()
           
 
Method Summary
protected  void addAllChildren(StructureContext context)
          Add all children as candidates
protected  void addAllChildren(org.jboss.virtual.VirtualFile root, org.jboss.virtual.VirtualFile parent, StructureMetaData metaData, VFSStructuralDeployers deployers)
          Add all children as candidates
 void addCandidateAnnotation(Class<? extends Annotation> annotationClass)
          Add candidate annotation.
protected  void addChildren(StructureContext context, org.jboss.virtual.VisitorAttributes attributes)
          Add all children as candidates
protected  void addChildren(org.jboss.virtual.VirtualFile root, org.jboss.virtual.VirtualFile parent, StructureMetaData metaData, VFSStructuralDeployers deployers, org.jboss.virtual.VisitorAttributes attributes)
          Add all children as candidates
protected  void addClassPath(StructureContext structureContext, org.jboss.virtual.VirtualFile entry, boolean includeEntry, boolean includeRootManifestCP, ContextInfo context)
          Add an entry to the context classpath.
protected  void applyContextInfo(StructureContext context, ContextInfo result)
          Apply context info.
protected  ContextInfo applyMetadataPath(StructureContext context, String metaDataPath)
          Apply metadata on root to create context.
protected  ContextInfo applyMetadataPaths(StructureContext context, String[] metaDataPaths)
          Apply metadata on root to create context.
protected  void applyStructure(StructureContext context, ContextInfo contextInfo)
          Apply structure metadata on context.
protected  boolean checkCandidateAnnotations(StructureContext context, org.jboss.virtual.VirtualFile... roots)
          Check for candidate annotations.
protected abstract  AnnotationEnvironment createAnnotationEnvironment(org.jboss.virtual.VirtualFile root)
          Create annotation environment
protected  ContextInfo createContext(StructureContext context)
          Create a context
protected  ContextInfo createContext(StructureContext context, String metaDataPath)
          Create a context
protected  ContextInfo createContext(StructureContext context, String[] metaDataPaths)
          Create a context
 Set<Class<? extends Annotation>> getCandidateAnnotations()
          Get the candidate annotations.
 CandidateStructureVisitorFactory getCandidateStructureVisitorFactory()
          Get the candidateStructureVisitorFactory.
 int getRelativeOrder()
          Get the relative order
static String getRelativePath(StructureContext context, org.jboss.virtual.VirtualFile child)
          Get the relative path between two virtual files
static String getRelativePath(org.jboss.virtual.VirtualFile parent, org.jboss.virtual.VirtualFile child)
          Get the relative path between two virtual files
protected static boolean isLeaf(org.jboss.virtual.VirtualFile file)
          Tests whether the virtual file is a leaf
 boolean isSupportsCandidateAnnotations()
          Do we support candidate annotations lookup.
 void setCandidateAnnotations(Set<Class<? extends Annotation>> candidateAnnotations)
          Set the candidate annotations.
 void setCandidateStructureVisitorFactory(CandidateStructureVisitorFactory candidateStructureVisitorFactory)
          Set the candidateStructureVisitorFactory.
 void setContextInfoOrder(Integer contextInfoOrder)
           
 void setRelativeOrder(int order)
          Set the relative order.
 void setSupportsCandidateAnnotations(boolean supportsCandidateAnnotations)
          Set supportsCandidateAnnotations flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.deployers.vfs.spi.structure.StructureDeployer
determineStructure
 

Field Detail

log

protected org.jboss.logging.Logger log
The log

Constructor Detail

AbstractStructureDeployer

public AbstractStructureDeployer()
Method Detail

getRelativePath

public static final String getRelativePath(StructureContext context,
                                           org.jboss.virtual.VirtualFile child)
Get the relative path between two virtual files

Parameters:
context - the structure context
child - the child
Returns:
the relative path

getRelativePath

public static final String getRelativePath(org.jboss.virtual.VirtualFile parent,
                                           org.jboss.virtual.VirtualFile child)
Get the relative path between two virtual files

Parameters:
parent - the parent
child - the child
Returns:
the relative path

getRelativeOrder

public int getRelativeOrder()
Description copied from interface: Ordered
Get the relative order

Specified by:
getRelativeOrder in interface Ordered
Returns:
the relative order

setRelativeOrder

public void setRelativeOrder(int order)
Description copied from interface: Ordered
Set the relative order.

Specified by:
setRelativeOrder in interface Ordered
Parameters:
order - the order

setContextInfoOrder

public void setContextInfoOrder(Integer contextInfoOrder)

getCandidateAnnotations

public Set<Class<? extends Annotation>> getCandidateAnnotations()
Get the candidate annotations.

Returns:
the candidate annotations

setCandidateAnnotations

public void setCandidateAnnotations(Set<Class<? extends Annotation>> candidateAnnotations)
Set the candidate annotations.

Parameters:
candidateAnnotations - the candidate annotations

addCandidateAnnotation

public void addCandidateAnnotation(Class<? extends Annotation> annotationClass)
Add candidate annotation.

Parameters:
annotationClass - the candidate annotation class

isSupportsCandidateAnnotations

public boolean isSupportsCandidateAnnotations()
Description copied from interface: StructureDeployer
Do we support candidate annotations lookup.

Specified by:
isSupportsCandidateAnnotations in interface StructureDeployer
Returns:
true if candidate annotaiotns lookup is supported, false otherwise

setSupportsCandidateAnnotations

public void setSupportsCandidateAnnotations(boolean supportsCandidateAnnotations)
Set supportsCandidateAnnotations flag.

Parameters:
supportsCandidateAnnotations - the support candidate annotations flag

getCandidateStructureVisitorFactory

public CandidateStructureVisitorFactory getCandidateStructureVisitorFactory()
Get the candidateStructureVisitorFactory.

Returns:
the candidateStructureVisitorFactory.

setCandidateStructureVisitorFactory

public void setCandidateStructureVisitorFactory(CandidateStructureVisitorFactory candidateStructureVisitorFactory)
Set the candidateStructureVisitorFactory.

Parameters:
candidateStructureVisitorFactory - the candidateStructureVisitorFactory.
Throws:
IllegalArgumentException - for a null candidate structure

addClassPath

protected void addClassPath(StructureContext structureContext,
                            org.jboss.virtual.VirtualFile entry,
                            boolean includeEntry,
                            boolean includeRootManifestCP,
                            ContextInfo context)
                     throws IOException
Add an entry to the context classpath.

Parameters:
structureContext - - the structure context
entry - - the candidate file to add as a classpath entry
includeEntry - - a flag indicating if the entry should be added to the classpath
includeRootManifestCP - - a flag indicating if the entry metainf manifest classpath should be included.
context - - the context to populate
Throws:
IOException - on any IO error

createAnnotationEnvironment

protected abstract AnnotationEnvironment createAnnotationEnvironment(org.jboss.virtual.VirtualFile root)
Create annotation environment

Parameters:
root - the deployment root
Returns:
new annotation environment

checkCandidateAnnotations

protected boolean checkCandidateAnnotations(StructureContext context,
                                            org.jboss.virtual.VirtualFile... roots)
Check for candidate annotations.

Parameters:
context - the structure context
roots - the roots to check
Returns:
return true if one of the roots includes some candidate annotation

addAllChildren

protected void addAllChildren(StructureContext context)
                       throws Exception
Add all children as candidates

Parameters:
context - the structure context
Throws:
Exception - for any error

addChildren

protected void addChildren(StructureContext context,
                           org.jboss.virtual.VisitorAttributes attributes)
                    throws Exception
Add all children as candidates

Parameters:
context - the structure context
attributes - the visitor attributes uses VisitorAttributes.DEFAULT when null
Throws:
Exception - for any error

addAllChildren

protected void addAllChildren(org.jboss.virtual.VirtualFile root,
                              org.jboss.virtual.VirtualFile parent,
                              StructureMetaData metaData,
                              VFSStructuralDeployers deployers)
                       throws Exception
Add all children as candidates

Parameters:
root - the root context
parent - the parent context
metaData - the structure meta data
deployers - the structure deployers
Throws:
Exception - for any error

addChildren

protected void addChildren(org.jboss.virtual.VirtualFile root,
                           org.jboss.virtual.VirtualFile parent,
                           StructureMetaData metaData,
                           VFSStructuralDeployers deployers,
                           org.jboss.virtual.VisitorAttributes attributes)
                    throws Exception
Add all children as candidates

Parameters:
root - the root context
parent - the parent context
metaData - the structure meta data
deployers - the structure deployers
attributes - the visitor attributes uses VisitorAttributes.DEFAULT when null
Throws:
Exception - for any error

isLeaf

protected static boolean isLeaf(org.jboss.virtual.VirtualFile file)
                         throws IOException
Tests whether the virtual file is a leaf

Parameters:
file - the virtual file
Returns:
true when it is a leaf
Throws:
IOException - for any error

createContext

protected ContextInfo createContext(StructureContext context)
Create a context

Parameters:
context - the structure context
Returns:
the context info
Throws:
IllegalArgumentException - for a null root or structure metaData

createContext

protected ContextInfo createContext(StructureContext context,
                                    String metaDataPath)
Create a context

Parameters:
context - the structure context
metaDataPath - the metadata path
Returns:
the context info
Throws:
IllegalArgumentException - for a null root or structure metaData

applyMetadataPath

protected ContextInfo applyMetadataPath(StructureContext context,
                                        String metaDataPath)
Apply metadata on root to create context.

Parameters:
context - the context
metaDataPath - the metadata path
Returns:
the context info

createContext

protected ContextInfo createContext(StructureContext context,
                                    String[] metaDataPaths)
Create a context

Parameters:
context - the structure context
metaDataPaths - the metadata paths
Returns:
the context info
Throws:
IllegalArgumentException - for a null root or structure metaData

applyMetadataPaths

protected ContextInfo applyMetadataPaths(StructureContext context,
                                         String[] metaDataPaths)
Apply metadata on root to create context.

Parameters:
context - the structure context
metaDataPaths - the metadata paths
Returns:
the context info

applyStructure

protected void applyStructure(StructureContext context,
                              ContextInfo contextInfo)
Apply structure metadata on context.

Parameters:
context - the structure context
contextInfo - the new created context

applyContextInfo

protected void applyContextInfo(StructureContext context,
                                ContextInfo result)
Apply context info. Can be overridden for specific root.

Parameters:
context - the structure context
result - the new context info


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.