public class ComponentMojoUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
buildArchiveFileForProjectAndClassList(List<javassist.CtClass> classList,
WidgetRegistry widgetRegistry,
TouchUIWidgetRegistry touchUIWidgetRegistry,
InPlaceEditorRegistry inPlaceEditorRegistry,
ClassLoader classLoader,
javassist.ClassPool classPool,
File buildDirectory,
String componentPathBase,
String defaultComponentPathSuffix,
String defaultComponentGroup,
File existingArchiveFile,
File tempArchiveFile,
ComponentNameTransformer transformer,
boolean generateTouchUiDialogs,
boolean useCoral3Dialogs,
boolean generateClassicUiDialogs)
Add files to the already constructed Archive file by creating a new
Archive file, appending the contents of the existing Archive file to it,
and then adding additional entries for the newly constructed artifacts.
|
protected static String |
classNameFromFilePath(String filePath,
String rootPath)
Constructs a fully qualified class name based on the path to the class
file
|
static List<javassist.CtField> |
collectFields(javassist.CtClass ctClass) |
static List<javassist.CtField> |
collectFields(javassist.CtClass ctClass,
boolean suppressInheritedFields)
Constructs a list of all fields contained in the provided CtClass and any
of its parent classes.
|
static List<javassist.CtMethod> |
collectMethods(javassist.CtClass ctClass) |
static List<javassist.CtMethod> |
collectMethods(javassist.CtClass ctClass,
boolean suppressInheritedMethods) |
protected static void |
deleteTemporaryComponentOutputDirectory(File buildDirectory)
Deletes the temporary output directory which is created as part of the
build process to temporarily hold the generated files for components.
|
static List<javassist.CtClass> |
getAllComponentAnnotations(javassist.ClassPool classPool,
org.reflections.Reflections reflections,
Set<String> excludedClasses)
Retrieves a List of all classes which are annotated as Components and are
within the scope of the provided Reflections purview.
|
static List<TouchUIWidgetConfigHolder> |
getAllTouchUIWidgetAnnotations(javassist.ClassPool classPool,
ClassLoader classLoader,
org.reflections.Reflections reflections) |
static Map<String,ComponentNameTransformer> |
getAllTransformers(javassist.ClassPool classPool,
org.reflections.Reflections reflections)
Retrieves a List of all classes which are annotated as Transformers and
are within the scope of the provided Reflections purview.
|
static List<WidgetConfigHolder> |
getAllWidgetAnnotations(javassist.ClassPool classPool,
ClassLoader classLoader,
org.reflections.Reflections reflections)
Constructs a list of widget configurations based on the information
provided by classes annotated as Widgets.
|
protected static File |
getArchiveFileForProject(org.apache.maven.project.MavenProject project)
Finds and retrieves the constructed CQ Package archive file for the
project
|
static ClassLoader |
getClassLoader(List<String> paths,
ClassLoader mojoClassLoader)
Constructs a Class Loader based on a list of paths to classes and a
parent Class Loader
|
static javassist.ClassPool |
getClassPool(ClassLoader loader)
Constructs as Javassist ClassPool which pulls resources based on the
paths provided by the passed in ClassLoader
|
static String |
getComponentBasePathForComponentClass(javassist.CtClass componentClass,
String componentPathBase) |
static String |
getComponentNameForComponentClass(ComponentNameTransformer transformer,
javassist.CtClass componentClass)
Determines the name of the component class for use in constructing file
paths
|
static String |
getComponentPathSuffixForComponentClass(javassist.CtClass componentClass,
String defaultComponentPathSuffix)
Determines the suffix portion of the path leading to the artifacts of a
particular component
|
static List<InPlaceEditorConfigHolder> |
getInPlaceEditorAnnotations(javassist.ClassPool classPool,
ClassLoader classLoader,
org.reflections.Reflections reflections) |
static LogSingleton |
getLog() |
static File |
getOutputDirectoryForComponentClass(ComponentNameTransformer transformer,
javassist.CtClass componentClass,
File buildDirectory,
String componentPathBase,
String defaultComponentPathSuffix)
Determine the appropriate output directory for a component's artifacts
based on the component class as well as POM configuration.
|
static org.reflections.Reflections |
getReflections(ClassLoader classLoader)
Constructs a Reflections object suitable for reflecting on classes
accessible via the provided ClassLoader
|
protected static File |
getTempArchiveFileForProject(org.apache.maven.project.MavenProject project)
Create a temporary archive file which will live alongside the constructed
project CQ5 Package archive.
|
static void |
writeElementToArchiveFile(ComponentNameTransformer transformer,
File file,
javassist.CtClass componentClass,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream archiveStream,
Set<String> reservedNames,
String componentPathBase,
String defaultComponentPathSuffix,
String path)
Writes a provided file to a provided archive output stream at a path
determined by the class of the component.
|
static File |
writeElementToFile(ComponentNameTransformer transformer,
AbstractXmlElement xmlElement,
javassist.CtClass componentClass,
File buildDirectory,
String componentPathBase,
String defaultComponentPathSuffix,
String path)
Determines the name of the edit file to be written and writes the the
file which the provided EditConfig object represents to that determined
file.
|
public static final LogSingleton getLog()
public static ClassLoader getClassLoader(List<String> paths, ClassLoader mojoClassLoader) throws MalformedURLException
paths
- mojoClassLoader
- MalformedURLException
public static javassist.ClassPool getClassPool(ClassLoader loader)
javassist.NotFoundException
protected static String classNameFromFilePath(String filePath, String rootPath)
filePath
- rootPath
- public static void buildArchiveFileForProjectAndClassList(List<javassist.CtClass> classList, WidgetRegistry widgetRegistry, TouchUIWidgetRegistry touchUIWidgetRegistry, InPlaceEditorRegistry inPlaceEditorRegistry, ClassLoader classLoader, javassist.ClassPool classPool, File buildDirectory, String componentPathBase, String defaultComponentPathSuffix, String defaultComponentGroup, File existingArchiveFile, File tempArchiveFile, ComponentNameTransformer transformer, boolean generateTouchUiDialogs, boolean useCoral3Dialogs, boolean generateClassicUiDialogs) throws OutputFailureException, IOException, InvalidComponentClassException, InvalidComponentFieldException, ParserConfigurationException, TransformerException, ClassNotFoundException, javassist.CannotCompileException, javassist.NotFoundException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InstantiationException, TouchUIDialogWriteException, TouchUIDialogGenerationException
classList
- classLoader
- classPool
- buildDirectory
- componentPathBase
- defaultComponentPathSuffix
- defaultComponentGroup
- existingArchiveFile
- tempArchiveFile
- OutputFailureException
IOException
InvalidComponentClassException
InvalidComponentFieldException
ParserConfigurationException
TransformerException
ClassNotFoundException
javassist.CannotCompileException
javassist.NotFoundException
SecurityException
NoSuchFieldException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
InstantiationException
TouchUIDialogWriteException
TouchUIDialogGenerationException
protected static File getArchiveFileForProject(org.apache.maven.project.MavenProject project)
project
- protected static File getTempArchiveFileForProject(org.apache.maven.project.MavenProject project)
project
- public static File getOutputDirectoryForComponentClass(ComponentNameTransformer transformer, javassist.CtClass componentClass, File buildDirectory, String componentPathBase, String defaultComponentPathSuffix) throws OutputFailureException, ClassNotFoundException
componentClass
- componentPathBase
- OutputFailureException
ClassNotFoundException
public static String getComponentBasePathForComponentClass(javassist.CtClass componentClass, String componentPathBase) throws ClassNotFoundException
ClassNotFoundException
protected static void deleteTemporaryComponentOutputDirectory(File buildDirectory) throws IOException
buildDirectory
- IOException
public static String getComponentPathSuffixForComponentClass(javassist.CtClass componentClass, String defaultComponentPathSuffix) throws ClassNotFoundException
componentClass
- defaultComponentPathSuffix
- ClassNotFoundException
public static String getComponentNameForComponentClass(ComponentNameTransformer transformer, javassist.CtClass componentClass) throws ClassNotFoundException
componentClass
- ClassNotFoundException
public static List<WidgetConfigHolder> getAllWidgetAnnotations(javassist.ClassPool classPool, ClassLoader classLoader, org.reflections.Reflections reflections) throws ClassNotFoundException, javassist.NotFoundException, MalformedURLException
classPool
- classLoader
- reflections
- ClassNotFoundException
javassist.NotFoundException
MalformedURLException
public static List<TouchUIWidgetConfigHolder> getAllTouchUIWidgetAnnotations(javassist.ClassPool classPool, ClassLoader classLoader, org.reflections.Reflections reflections) throws javassist.NotFoundException, ClassNotFoundException
javassist.NotFoundException
ClassNotFoundException
public static List<InPlaceEditorConfigHolder> getInPlaceEditorAnnotations(javassist.ClassPool classPool, ClassLoader classLoader, org.reflections.Reflections reflections) throws javassist.NotFoundException, ClassNotFoundException
javassist.NotFoundException
ClassNotFoundException
public static List<javassist.CtClass> getAllComponentAnnotations(javassist.ClassPool classPool, org.reflections.Reflections reflections, Set<String> excludedClasses) throws ClassNotFoundException, javassist.NotFoundException, MalformedURLException
classPool
- reflections
- ClassNotFoundException
javassist.NotFoundException
MalformedURLException
public static Map<String,ComponentNameTransformer> getAllTransformers(javassist.ClassPool classPool, org.reflections.Reflections reflections) throws ClassNotFoundException, javassist.NotFoundException, MalformedURLException, InstantiationException, IllegalAccessException
classPool
- reflections
- ClassNotFoundException
javassist.NotFoundException
MalformedURLException
IllegalAccessException
InstantiationException
public static List<javassist.CtField> collectFields(javassist.CtClass ctClass, boolean suppressInheritedFields) throws javassist.NotFoundException
ctClass
- javassist.NotFoundException
public static List<javassist.CtField> collectFields(javassist.CtClass ctClass) throws javassist.NotFoundException
javassist.NotFoundException
public static List<javassist.CtMethod> collectMethods(javassist.CtClass ctClass, boolean suppressInheritedMethods)
public static List<javassist.CtMethod> collectMethods(javassist.CtClass ctClass)
public static org.reflections.Reflections getReflections(ClassLoader classLoader)
classLoader
- The ClassLoader containing classes to be reflected
uponpublic static void writeElementToArchiveFile(ComponentNameTransformer transformer, File file, javassist.CtClass componentClass, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream archiveStream, Set<String> reservedNames, String componentPathBase, String defaultComponentPathSuffix, String path) throws IOException, ClassNotFoundException
file
- componentClass
- archiveStream
- reservedNames
- A list of files which already exist within the Zip
Archive. If a file already exists for a particular component,
it is left untouched.componentPathBase
- IOException
ClassNotFoundException
public static File writeElementToFile(ComponentNameTransformer transformer, AbstractXmlElement xmlElement, javassist.CtClass componentClass, File buildDirectory, String componentPathBase, String defaultComponentPathSuffix, String path) throws TransformerException, ParserConfigurationException, IOException, OutputFailureException, ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
xmlElement
- componentClass
- TransformerException
ParserConfigurationException
IOException
OutputFailureException
ClassNotFoundException
NoSuchMethodException
InvocationTargetException
IllegalAccessException
SecurityException
IllegalArgumentException
Copyright © 2019 ICF Olson. All rights reserved.