o code readingness
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@684237 13f79535-47bb-0310-9956-ffa450edef68master
parent
4c3d449369
commit
126320356b
|
|
@ -47,35 +47,6 @@ import java.util.Set;
|
|||
public class BeanshellMojoDescriptorExtractor
|
||||
extends AbstractScriptedMojoDescriptorExtractor
|
||||
{
|
||||
private MojoDescriptor createMojoDescriptor( String basedir, String resource, PluginDescriptor pluginDescriptor )
|
||||
throws InvalidPluginDescriptorException
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = new MojoDescriptor();
|
||||
mojoDescriptor.setPluginDescriptor( pluginDescriptor );
|
||||
|
||||
mojoDescriptor.setLanguage( "bsh" );
|
||||
mojoDescriptor.setComponentConfigurator( "bsh" );
|
||||
|
||||
mojoDescriptor.setImplementation( resource );
|
||||
|
||||
Interpreter interpreter = new Interpreter();
|
||||
|
||||
try
|
||||
{
|
||||
interpreter.set( "file", new File( basedir, resource ) );
|
||||
|
||||
interpreter.set( "mojoDescriptor", mojoDescriptor );
|
||||
|
||||
interpreter.eval( new InputStreamReader( getClass().getResourceAsStream( "/extractor.bsh" ) ) );
|
||||
}
|
||||
catch ( EvalError evalError )
|
||||
{
|
||||
throw new InvalidPluginDescriptorException( "Error scanning beanshell script", evalError );
|
||||
}
|
||||
|
||||
return mojoDescriptor;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected String getScriptFileExtension()
|
||||
{
|
||||
|
|
@ -117,4 +88,40 @@ public class BeanshellMojoDescriptorExtractor
|
|||
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param basedir not null
|
||||
* @param resource not null
|
||||
* @param pluginDescriptor not null
|
||||
* @return a new Mojo descriptor instance
|
||||
* @throws InvalidPluginDescriptorException if any
|
||||
*/
|
||||
private MojoDescriptor createMojoDescriptor( String basedir, String resource, PluginDescriptor pluginDescriptor )
|
||||
throws InvalidPluginDescriptorException
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = new MojoDescriptor();
|
||||
mojoDescriptor.setPluginDescriptor( pluginDescriptor );
|
||||
|
||||
mojoDescriptor.setLanguage( "bsh" );
|
||||
mojoDescriptor.setComponentConfigurator( "bsh" );
|
||||
|
||||
mojoDescriptor.setImplementation( resource );
|
||||
|
||||
Interpreter interpreter = new Interpreter();
|
||||
|
||||
try
|
||||
{
|
||||
interpreter.set( "file", new File( basedir, resource ) );
|
||||
|
||||
interpreter.set( "mojoDescriptor", mojoDescriptor );
|
||||
|
||||
interpreter.eval( new InputStreamReader( getClass().getResourceAsStream( "/extractor.bsh" ) ) );
|
||||
}
|
||||
catch ( EvalError evalError )
|
||||
{
|
||||
throw new InvalidPluginDescriptorException( "Error scanning beanshell script", evalError );
|
||||
}
|
||||
|
||||
return mojoDescriptor;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue