[seam-issues] [JBoss JIRA] Issue Comment Edited: (SEAMREPORTS-13) Create a seam forge plugin for Seam Reports
George Gastaldi (JIRA)
jira-events at lists.jboss.org
Wed May 25 12:11:00 EDT 2011
[ https://issues.jboss.org/browse/SEAMREPORTS-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604367#comment-12604367 ]
George Gastaldi edited comment on SEAMREPORTS-13 at 5/25/11 12:09 PM:
----------------------------------------------------------------------
Code sample for creating a Seam Forge plugin
{code}
1. new-project --named plugin-example --topLevelPackage com.plugin.example
2. setup plugins
3. plugins new-plugin --named Runner --defaultCommand
4. forge source-plugin /path/to/plugin/project
5. runner --value hey
"Executed default command with value: hey"
----------------------------------------------------------------
____ _____
/ ___| ___ __ _ _ __ ___ | ___|__ _ __ __ _ ___
\___ \ / _ \/ _` | '_ ` _ \ | |_ / _ \| '__/ _` |/ _ \ \\
___) | __/ (_| | | | | | | | _| (_) | | | (_| | __/ //
|____/ \___|\__,_|_| |_| |_| |_| \___/|_| \__, |\___|
|___/
[no project] Desktop $
[no project] Desktop $ new-project --named plugin-example --topLevelPackage com.plugin.example
? Use [/Users/lbaxter/Desktop/plugin-example] as project directory? [Y/n]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/resources/META-INF/forge.xml
***SUCCESS*** Created project [plugin-example] in new working directory [/Users/lbaxter/Desktop/plugin-example]
[plugin-example] plugin-example $
[plugin-example] plugin-example $ setup plugins
? The [forge.api] facet depends on the following missing facet(s): [CDIFacet]. Install as well? [Y/n]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/resources/META-INF/beans.xml
***SUCCESS*** Installed [forge.spec.cdi] successfully.
***SUCCESS*** Installed [forge.api] successfully.
[plugin-example] plugin-example $
[plugin-example] plugin-example $ plugins new-plugin --named Runner --defaultCommand
? In which package you'd like to create [Runner], or enter for default: [com.plugin.example]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/java/com/plugin/example/Runner.java
Picked up type <JavaResource>: com.plugin.example.Runner
[plugin-example] Runner.java $
[plugin-example] Runner.java $
[plugin-example] Runner.java $ ls -la
package com.plugin.example;
import org.jboss.forge.shell.plugins.Plugin;
import org.jboss.forge.shell.plugins.Alias;
import org.jboss.forge.shell.ShellPrompt;
import javax.inject.Inject;
import org.jboss.forge.shell.plugins.PipeOut;
import org.jboss.forge.shell.plugins.Option;
import org.jboss.forge.shell.plugins.DefaultCommand;
public @Alias("runner") class Runner implements org.jboss.forge.shell.plugins.Plugin {
@Inject private ShellPrompt prompt;
@DefaultCommand public void run( PipeOut out, @Option(name="value") final String arg){
System.out.println("Executed default command with value: " + arg);
}
}
[plugin-example] Runner.java $
[plugin-example] Runner.java $ cd ../../../../../../../
[plugin-example] plugin-example $ forge source-plugin .
***INFO*** Invoking build with underlying build system.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building plugin-example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.606s
[INFO] Finished at: Tue May 03 13:52:54 EDT 2011
[INFO] Final Memory: 36M/81M
[INFO] ------------------------------------------------------------------------
***SUCCESS*** Build successful.
***INFO*** Installing plugin artifact.
Wrote /Users/lbaxter/.forge/plugins/com.plugin.example$plugin-example$1$1.0.0-SNAPSHOT.jar
***SUCCESS*** Installed from [plugin-example] successfully.
[plugin-example] plugin-example $
[plugin-example] plugin-example $
[plugin-example] plugin-example $ runner --value hey
Executed default command with value: hey
[plugin-example] plugin-example $
Oops!... I just wrote a Forge plugin.
{code}
was (Author: gastaldi):
{code}
1. new-project --named plugin-example --topLevelPackage com.plugin.example
2. setup plugins
3. plugins new-plugin --named Runner --defaultCommand
4. forge source-plugin /path/to/plugin/project
5. runner --value hey
"Executed default command with value: hey"
----------------------------------------------------------------
____ _____
/ ___| ___ __ _ _ __ ___ | ___|__ _ __ __ _ ___
\___ \ / _ \/ _` | '_ ` _ \ | |_ / _ \| '__/ _` |/ _ \ \\
___) | __/ (_| | | | | | | | _| (_) | | | (_| | __/ //
|____/ \___|\__,_|_| |_| |_| |_| \___/|_| \__, |\___|
|___/
[no project] Desktop $
[no project] Desktop $ new-project --named plugin-example --topLevelPackage com.plugin.example
? Use [/Users/lbaxter/Desktop/plugin-example] as project directory? [Y/n]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/resources/META-INF/forge.xml
***SUCCESS*** Created project [plugin-example] in new working directory [/Users/lbaxter/Desktop/plugin-example]
[plugin-example] plugin-example $
[plugin-example] plugin-example $ setup plugins
? The [forge.api] facet depends on the following missing facet(s): [CDIFacet]. Install as well? [Y/n]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/resources/META-INF/beans.xml
***SUCCESS*** Installed [forge.spec.cdi] successfully.
***SUCCESS*** Installed [forge.api] successfully.
[plugin-example] plugin-example $
[plugin-example] plugin-example $ plugins new-plugin --named Runner --defaultCommand
? In which package you'd like to create [Runner], or enter for default: [com.plugin.example]
Wrote /Users/lbaxter/Desktop/plugin-example/src/main/java/com/plugin/example/Runner.java
Picked up type <JavaResource>: com.plugin.example.Runner
[plugin-example] Runner.java $
[plugin-example] Runner.java $
[plugin-example] Runner.java $ ls -la
package com.plugin.example;
import org.jboss.forge.shell.plugins.Plugin;
import org.jboss.forge.shell.plugins.Alias;
import org.jboss.forge.shell.ShellPrompt;
import javax.inject.Inject;
import org.jboss.forge.shell.plugins.PipeOut;
import org.jboss.forge.shell.plugins.Option;
import org.jboss.forge.shell.plugins.DefaultCommand;
public @Alias("runner") class Runner implements org.jboss.forge.shell.plugins.Plugin {
@Inject private ShellPrompt prompt;
@DefaultCommand public void run( PipeOut out, @Option(name="value") final String arg){
System.out.println("Executed default command with value: " + arg);
}
}
[plugin-example] Runner.java $
[plugin-example] Runner.java $ cd ../../../../../../../
[plugin-example] plugin-example $ forge source-plugin .
***INFO*** Invoking build with underlying build system.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building plugin-example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.606s
[INFO] Finished at: Tue May 03 13:52:54 EDT 2011
[INFO] Final Memory: 36M/81M
[INFO] ------------------------------------------------------------------------
***SUCCESS*** Build successful.
***INFO*** Installing plugin artifact.
Wrote /Users/lbaxter/.forge/plugins/com.plugin.example$plugin-example$1$1.0.0-SNAPSHOT.jar
***SUCCESS*** Installed from [plugin-example] successfully.
[plugin-example] plugin-example $
[plugin-example] plugin-example $
[plugin-example] plugin-example $ runner --value hey
Executed default command with value: hey
[plugin-example] plugin-example $
Oops!... I just wrote a Forge plugin.
{code}
> Create a seam forge plugin for Seam Reports
> --------------------------------------------
>
> Key: SEAMREPORTS-13
> URL: https://issues.jboss.org/browse/SEAMREPORTS-13
> Project: Seam Reports
> Issue Type: Feature Request
> Reporter: George Gastaldi
>
> It would be nice to have a Seam Forge plugin.
> Forge developers could type then: "reports setup --provider PENTAHO" for example, to use the Seam Reports Pentaho module impl, for example.
> Info on how to create a plugin: http://docs.jboss.org/forge/1.0.0.Alpha3/reference/en-US/html_single/#forge.plugin.dev
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list