org.apache.maven.tools.plugin.extractor
Class AbstractScriptedMojoDescriptorExtractor

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.apache.maven.tools.plugin.extractor.AbstractScriptedMojoDescriptorExtractor
All Implemented Interfaces:
MojoDescriptorExtractor, org.codehaus.plexus.logging.LogEnabled

public abstract class AbstractScriptedMojoDescriptorExtractor
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements MojoDescriptorExtractor

Version:
$Id: AbstractScriptedMojoDescriptorExtractor.java 1212905 2011-12-10 22:31:48Z hboutemy $
Author:
jdcasey

Field Summary
 
Fields inherited from interface org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor
ROLE
 
Constructor Summary
AbstractScriptedMojoDescriptorExtractor()
           
 
Method Summary
protected  void copyScriptsToOutputDirectory(Map<String,Set<File>> scriptFilesKeyedByBasedir, String outputDirectory, PluginToolsRequest request)
           
 List<MojoDescriptor> execute(MavenProject project, PluginDescriptor pluginDescriptor)
          Execute the mojo extraction.
 List<MojoDescriptor> execute(PluginToolsRequest request)
          Execute the mojo extraction.
protected  List<MojoDescriptor> extractMojoDescriptors(Map<String,Set<File>> scriptFilesKeyedByBasedir, PluginToolsRequest request)
          Should be implemented in the sub classes.
protected  List<MojoDescriptor> extractMojoDescriptorsFromMetadata(Map<String,Set<File>> metadataFilesKeyedByBasedir, PluginToolsRequest request)
          Should be implemented in the sub classes.
protected  Map<String,Set<File>> gatherFilesByBasedir(File basedir, List<String> directories, String scriptFileExtension, PluginToolsRequest request)
           
protected  String getMetadataFileExtension(PluginToolsRequest request)
          Should be implemented in the sub classes.
protected abstract  String getScriptFileExtension(PluginToolsRequest request)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScriptedMojoDescriptorExtractor

public AbstractScriptedMojoDescriptorExtractor()
Method Detail

execute

public List<MojoDescriptor> execute(MavenProject project,
                                    PluginDescriptor pluginDescriptor)
                             throws ExtractionException,
                                    InvalidPluginDescriptorException
Execute the mojo extraction.

Specified by:
execute in interface MojoDescriptorExtractor
Returns:
a list of mojo descriptors.
Throws:
ExtractionException - if any
InvalidPluginDescriptorException - if any

execute

public List<MojoDescriptor> execute(PluginToolsRequest request)
                             throws ExtractionException,
                                    InvalidPluginDescriptorException
Execute the mojo extraction.

Specified by:
execute in interface MojoDescriptorExtractor
Parameters:
request - The PluginToolsRequest containing information for the extraction process.
Returns:
a list of mojo descriptors.
Throws:
ExtractionException - if any
InvalidPluginDescriptorException - if any

copyScriptsToOutputDirectory

protected void copyScriptsToOutputDirectory(Map<String,Set<File>> scriptFilesKeyedByBasedir,
                                            String outputDirectory,
                                            PluginToolsRequest request)
                                     throws ExtractionException
Parameters:
scriptFilesKeyedByBasedir - not null
outputDirectory - not null
Throws:
ExtractionException - if any

gatherFilesByBasedir

protected Map<String,Set<File>> gatherFilesByBasedir(File basedir,
                                                     List<String> directories,
                                                     String scriptFileExtension,
                                                     PluginToolsRequest request)
Parameters:
basedir - not null
directories - not null
scriptFileExtension - not null
Returns:
map with subdirs paths as key

extractMojoDescriptorsFromMetadata

protected List<MojoDescriptor> extractMojoDescriptorsFromMetadata(Map<String,Set<File>> metadataFilesKeyedByBasedir,
                                                                  PluginToolsRequest request)
                                                           throws ExtractionException,
                                                                  InvalidPluginDescriptorException
Should be implemented in the sub classes.

Parameters:
metadataFilesKeyedByBasedir - could be null
request - The plugin request, never null.
Returns:
always null
Throws:
ExtractionException - if any
InvalidPluginDescriptorException - if any

getMetadataFileExtension

protected String getMetadataFileExtension(PluginToolsRequest request)
Should be implemented in the sub classes.

Returns:
always null

extractMojoDescriptors

protected List<MojoDescriptor> extractMojoDescriptors(Map<String,Set<File>> scriptFilesKeyedByBasedir,
                                                      PluginToolsRequest request)
                                               throws ExtractionException,
                                                      InvalidPluginDescriptorException
Should be implemented in the sub classes.

Parameters:
scriptFilesKeyedByBasedir - could be null
request - The plugin request, never null.
Returns:
always null
Throws:
ExtractionException - if any
InvalidPluginDescriptorException - if any

getScriptFileExtension

protected abstract String getScriptFileExtension(PluginToolsRequest request)
Returns:
the file extension like .bsh for BeanShell.


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.