[seam-commits] Seam SVN: r13594 - in sandbox/encore: core/src/main/java/org/jboss/encore/grammar/java and 22 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 10 15:33:35 EDT 2010


Author: lincolnthree
Date: 2010-08-10 15:33:32 -0400 (Tue, 10 Aug 2010)
New Revision: 13594

Added:
   sandbox/encore/model/src/main/java/org/jboss/encore/model/events/FileModified.java
   sandbox/encore/model/src/main/java/org/jboss/encore/model/project/
   sandbox/encore/model/src/main/java/org/jboss/encore/model/project/AbstractProject.java
   sandbox/encore/model/src/main/java/org/jboss/encore/model/project/MavenProject.java
   sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenProjectTest.java
   sandbox/encore/plugin-api/
   sandbox/encore/plugin-api/pom.xml
   sandbox/encore/plugin-api/src/
   sandbox/encore/plugin-api/src/main/
   sandbox/encore/plugin-api/src/main/java/
   sandbox/encore/plugin-api/src/main/java/org/
   sandbox/encore/plugin-api/src/main/java/org/jboss/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/AcceptUserInput.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Shutdown.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Startup.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Command.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Default.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Help.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Option.java
   sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Plugin.java
   sandbox/encore/plugin-api/src/main/resources/
   sandbox/encore/plugin-api/src/test/
   sandbox/encore/plugin-api/src/test/java/
   sandbox/encore/plugin-api/src/test/resources/
Removed:
   sandbox/encore/model/src/main/java/org/jboss/encore/model/AbstractProject.java
   sandbox/encore/model/src/main/java/org/jboss/encore/model/MavenJavaProject.java
   sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenJavaProjectTest.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/events/
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/plugins/
Modified:
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Annotation.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/AnnotationTarget.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Field.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Import.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/JavaClass.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Method.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/AnnotationImpl.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/FieldImpl.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/ImportImpl.java
   sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/MethodImpl.java
   sandbox/encore/model/pom.xml
   sandbox/encore/pom.xml
   sandbox/encore/shell/pom.xml
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Main.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Shell.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/CommandLibraryExtension.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/Execution.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/PluginMetadata.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ClearPlugin.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/Echo.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ExitShell.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/HelpPlugin.java
   sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/PwdPlugin.java
Log:
Began Maven POM Project Model API. Began separating plugin-api from shell.

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Annotation.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Annotation.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Annotation.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -31,7 +31,7 @@
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface Annotation extends Internal, Mutable
+public interface Annotation extends Internal, Mutable<JavaClass>
 {
    boolean isSingleValue();
 

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/AnnotationTarget.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/AnnotationTarget.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/AnnotationTarget.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -31,7 +31,7 @@
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface AnnotationTarget<T> extends Internal, Mutable<T>
+public interface AnnotationTarget<T> extends Internal, Mutable<JavaClass>
 {
    public abstract Annotation addAnnotation();
 

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Field.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Field.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Field.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -22,14 +22,12 @@
 
 package org.jboss.encore.grammar.java;
 
-import org.jboss.encore.grammar.Internal;
-import org.jboss.encore.grammar.Mutable;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface Field extends Mutable<Field>, Internal, VisibilityScoped<Field>, AnnotationTarget<Field>
+public interface Field extends VisibilityScoped<Field>, AnnotationTarget<Field>
 {
    String getName();
 

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Import.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Import.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Import.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -29,7 +29,7 @@
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface Import extends Internal, Mutable
+public interface Import extends Internal, Mutable<JavaClass>
 {
    public String getName();
 

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/JavaClass.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/JavaClass.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/JavaClass.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -24,14 +24,11 @@
 
 import java.util.List;
 
-import org.jboss.encore.grammar.Internal;
-import org.jboss.encore.grammar.Mutable;
-
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface JavaClass extends Internal, Mutable<JavaClass>, Abstractable<JavaClass>, VisibilityScoped<JavaClass>, AnnotationTarget<JavaClass>
+public interface JavaClass extends Abstractable<JavaClass>, VisibilityScoped<JavaClass>, AnnotationTarget<JavaClass>
 {
    /*
     * Annotation modifiers

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Method.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Method.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/Method.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -22,14 +22,12 @@
 
 package org.jboss.encore.grammar.java;
 
-import org.jboss.encore.grammar.Internal;
-import org.jboss.encore.grammar.Mutable;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-public interface Method extends Internal, Mutable<Method>, Abstractable<Method>, VisibilityScoped<Method>, AnnotationTarget<Method>
+public interface Method extends Abstractable<Method>, VisibilityScoped<Method>, AnnotationTarget<Method>
 {
    public String getBody();
 

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/AnnotationImpl.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/AnnotationImpl.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/AnnotationImpl.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -32,7 +32,6 @@
 import org.eclipse.jdt.core.dom.MemberValuePair;
 import org.eclipse.jdt.core.dom.NormalAnnotation;
 import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.jboss.encore.grammar.Mutable;
 import org.jboss.encore.grammar.java.Annotation;
 import org.jboss.encore.grammar.java.AnnotationTarget;
 import org.jboss.encore.grammar.java.JavaClass;
@@ -329,13 +328,9 @@
    }
 
    @Override
-   public Annotation applyChanges()
+   public JavaClass applyChanges()
    {
-      if (parent instanceof Mutable)
-      {
-         ((Mutable) parent).applyChanges();
-      }
-      return this;
+      return parent.applyChanges();
    }
 
    @Override

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/FieldImpl.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/FieldImpl.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/FieldImpl.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -84,10 +84,9 @@
    }
 
    @Override
-   public Field applyChanges()
+   public JavaClass applyChanges()
    {
-      parent.applyChanges();
-      return this;
+      return parent.applyChanges();
    }
 
    @Override

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/ImportImpl.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/ImportImpl.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/ImportImpl.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -86,10 +86,9 @@
    }
 
    @Override
-   public Import applyChanges()
+   public JavaClass applyChanges()
    {
-      parent.applyChanges();
-      return this;
+      return parent.applyChanges();
    }
 
    @Override

Modified: sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/MethodImpl.java
===================================================================
--- sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/MethodImpl.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/core/src/main/java/org/jboss/encore/grammar/java/impl/MethodImpl.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -328,10 +328,9 @@
    }
 
    @Override
-   public Method applyChanges()
+   public JavaClass applyChanges()
    {
-      parent.applyChanges();
-      return this;
+      return parent.applyChanges();
    }
 
    @Override

Modified: sandbox/encore/model/pom.xml
===================================================================
--- sandbox/encore/model/pom.xml	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/model/pom.xml	2010-08-10 19:33:32 UTC (rev 13594)
@@ -17,22 +17,43 @@
    <description>Simplified project bootstrapping and incremental enhancement framework</description>
 
    <dependencies>
-      <!-- Resource manipulation dependencies -->
       <dependency>
-        <groupId>org.jboss.encore</groupId>
-        <artifactId>encore-core</artifactId>
-        <version>${project.version}</version>
+         <groupId>org.jboss.encore</groupId>
+         <artifactId>encore-core</artifactId>
+         <version>${project.version}</version>
       </dependency>
       <dependency>
          <groupId>org.jboss.shrinkwrap</groupId>
          <artifactId>shrinkwrap-api</artifactId>
-         <version>1.0.0-alpha-9</version>
+         <version>1.0.0-alpha-11</version>
       </dependency>
+      <!--
       <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-impl-base</artifactId>
+         <version>1.0.0-alpha-11</version>
+         <scope>test</scope>  Don't rely upon internals for compilation
+      </dependency> 
+      -->
+      <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-descriptors</artifactId>
+         <version>1.0.0-SNAPSHOT</version>
+         <!-- Requires checkout & Manual 'mvn install': http://github.com/shrinkwrap/descriptors -->
+      </dependency>
+      
+      <dependency>
+         <groupId>org.apache.maven</groupId>
+         <artifactId>maven-model</artifactId>
+         <version>3.0-beta-1</version>
+      </dependency>
+      <dependency>
          <groupId>javax.enterprise</groupId>
          <artifactId>cdi-api</artifactId>
          <version>1.0</version>
       </dependency>
+      
+      
    </dependencies>
 
 </project>

Deleted: sandbox/encore/model/src/main/java/org/jboss/encore/model/AbstractProject.java
===================================================================
--- sandbox/encore/model/src/main/java/org/jboss/encore/model/AbstractProject.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/model/src/main/java/org/jboss/encore/model/AbstractProject.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.encore.model;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-
-import org.jboss.encore.grammar.java.JavaClass;
-import org.jboss.encore.model.events.JavaFileCreated;
-
-/**
- * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
- * 
- */
-public abstract class AbstractProject implements Project
-{
-   @Inject
-   Event<JavaFileCreated> event;
-
-   private File createJavaFile(File sourceFolder, final String classPackage, final String className, final char[] data)
-   {
-      BufferedWriter writer = null;
-      try
-      {
-         String pkg = getDefaultSourceFolder() + File.separator + classPackage.replaceAll("\\.", File.separator);
-
-         File file = new File(pkg + File.separator + className + ".java");
-
-         if (!file.mkdirs())
-         {
-            throw new IOException("Failed to create required directory structure for file: " + file);
-         }
-
-         file.delete();
-
-         if (!file.createNewFile())
-         {
-            throw new IOException("Failed to create file because it already exists: " + file);
-         }
-
-         writer = new BufferedWriter(new FileWriter(file));
-         writer.write(data);
-         writer.close();
-
-         // event.fire(new JavaFileCreated(file));
-         return file;
-      }
-      catch (IOException e)
-      {
-         throw new ProjectModelException(e);
-      }
-   }
-
-   private File createJavaFile(final String classPackage, final String className, String data)
-   {
-      return createJavaFile(getDefaultSourceFolder(), classPackage, className, data.toCharArray());
-   }
-
-   @Override
-   public File createJavaFile(JavaClass clazz)
-   {
-      return createJavaFile(clazz.getPackage(), clazz.getName(), clazz.toString());
-   }
-
-   @Override
-   public boolean delete(File file)
-   {
-      if (file.isDirectory())
-      {
-         for (File c : file.listFiles())
-         {
-            if (!delete(c))
-            {
-               throw new ProjectModelException("Could not delete file or folder: " + file);
-            }
-         }
-      }
-      return file.delete();
-   }
-
-}

Deleted: sandbox/encore/model/src/main/java/org/jboss/encore/model/MavenJavaProject.java
===================================================================
--- sandbox/encore/model/src/main/java/org/jboss/encore/model/MavenJavaProject.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/model/src/main/java/org/jboss/encore/model/MavenJavaProject.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.encore.model;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
- * 
- */
-public class MavenJavaProject extends AbstractProject
-{
-   private File projectRoot = null;
-
-   public MavenJavaProject(File directory)
-   {
-      if (!directory.isDirectory())
-      {
-         throw new ProjectModelException("Cannot load project from directory that does not exist.");
-      }
-      projectRoot = directory;
-   }
-
-   @Override
-   public List<File> getSourceFolders()
-   {
-      List<File> result = new ArrayList<File>();
-      result.add(getDefaultSourceFolder());
-      result.add(new File(getProjectRoot().getAbsolutePath() + "/src/test/java"));
-      return result;
-   }
-
-   @Override
-   public File getDefaultSourceFolder()
-   {
-      return new File(getProjectRoot().getAbsolutePath() + "/src/main/java");
-   }
-
-   @Override
-   public File getProjectRoot()
-   {
-      return projectRoot;
-   }
-
-}

Added: sandbox/encore/model/src/main/java/org/jboss/encore/model/events/FileModified.java
===================================================================
--- sandbox/encore/model/src/main/java/org/jboss/encore/model/events/FileModified.java	                        (rev 0)
+++ sandbox/encore/model/src/main/java/org/jboss/encore/model/events/FileModified.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.model.events;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public class FileModified extends FileEvent
+{
+   public FileModified(final File file)
+   {
+      super(file);
+   }
+
+}

Copied: sandbox/encore/model/src/main/java/org/jboss/encore/model/project/AbstractProject.java (from rev 13585, sandbox/encore/model/src/main/java/org/jboss/encore/model/AbstractProject.java)
===================================================================
--- sandbox/encore/model/src/main/java/org/jboss/encore/model/project/AbstractProject.java	                        (rev 0)
+++ sandbox/encore/model/src/main/java/org/jboss/encore/model/project/AbstractProject.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.model.project;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+
+import org.jboss.encore.grammar.java.JavaClass;
+import org.jboss.encore.model.Project;
+import org.jboss.encore.model.ProjectModelException;
+import org.jboss.encore.model.events.JavaFileCreated;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public abstract class AbstractProject implements Project
+{
+   @Inject
+   Event<JavaFileCreated> event;
+
+   private File createJavaFile(File sourceFolder, final String classPackage, final String className, final char[] data)
+   {
+      BufferedWriter writer = null;
+      try
+      {
+         String pkg = getDefaultSourceFolder() + File.separator + classPackage.replaceAll("\\.", File.separator);
+
+         File file = new File(pkg + File.separator + className + ".java");
+
+         if (!file.mkdirs())
+         {
+            throw new IOException("Failed to create required directory structure for file: " + file);
+         }
+
+         file.delete();
+
+         if (!file.createNewFile())
+         {
+            throw new IOException("Failed to create file because it already exists: " + file);
+         }
+
+         writer = new BufferedWriter(new FileWriter(file));
+         writer.write(data);
+         writer.close();
+
+         // event.fire(new JavaFileCreated(file));
+         return file;
+      }
+      catch (IOException e)
+      {
+         throw new ProjectModelException(e);
+      }
+   }
+
+   private File createJavaFile(final String classPackage, final String className, String data)
+   {
+      return createJavaFile(getDefaultSourceFolder(), classPackage, className, data.toCharArray());
+   }
+
+   @Override
+   public File createJavaFile(JavaClass clazz)
+   {
+      return createJavaFile(clazz.getPackage(), clazz.getName(), clazz.toString());
+   }
+
+   @Override
+   public boolean delete(File file)
+   {
+      if (file.isDirectory())
+      {
+         for (File c : file.listFiles())
+         {
+            if (!delete(c))
+            {
+               throw new ProjectModelException("Could not delete file or folder: " + file);
+            }
+         }
+      }
+      return file.delete();
+   }
+
+}

Copied: sandbox/encore/model/src/main/java/org/jboss/encore/model/project/MavenProject.java (from rev 13585, sandbox/encore/model/src/main/java/org/jboss/encore/model/MavenJavaProject.java)
===================================================================
--- sandbox/encore/model/src/main/java/org/jboss/encore/model/project/MavenProject.java	                        (rev 0)
+++ sandbox/encore/model/src/main/java/org/jboss/encore/model/project/MavenProject.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.model.project;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.jboss.encore.model.ProjectModelException;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public class MavenProject extends AbstractProject
+{
+   private File projectRoot = null;
+
+   public MavenProject(File directory)
+   {
+      if (!directory.isDirectory())
+      {
+         throw new ProjectModelException("Cannot load project from directory that does not exist.");
+      }
+      projectRoot = directory;
+   }
+
+   @Override
+   public List<File> getSourceFolders()
+   {
+      List<File> result = new ArrayList<File>();
+      result.add(getDefaultSourceFolder());
+      result.add(new File(getProjectRoot().getAbsolutePath() + "/src/test/java"));
+      return result;
+   }
+
+   @Override
+   public File getDefaultSourceFolder()
+   {
+      return new File(getProjectRoot().getAbsolutePath() + "/src/main/java");
+   }
+
+   @Override
+   public File getProjectRoot()
+   {
+      return projectRoot;
+   }
+
+   public Model getPOM()
+   {
+      try
+      {
+         Model result = new Model();
+         result.setPomFile(getPOMFile());
+
+         MavenXpp3Reader reader = new MavenXpp3Reader();
+         FileInputStream stream = new FileInputStream(getPOMFile());
+         if (stream.available() > 0)
+         {
+            result = reader.read(stream);
+         }
+         stream.close();
+
+         return result;
+      }
+      catch (IOException e)
+      {
+         throw new ProjectModelException("Could not open POM file: " + getPOMFile(), e);
+      }
+      catch (XmlPullParserException e)
+      {
+         throw new ProjectModelException("Could not parse POM file: " + getPOMFile(), e);
+      }
+   }
+
+   public void setPOM(Model pom)
+   {
+      try
+      {
+         MavenXpp3Writer writer = new MavenXpp3Writer();
+         FileWriter fw = new FileWriter(getPOMFile());
+         writer.write(fw, pom);
+         fw.close();
+      }
+      catch (IOException e)
+      {
+         throw new ProjectModelException("Could not write POM file: " + getPOMFile(), e);
+      }
+   }
+
+   private File getPOMFile()
+   {
+      File file = new File(getProjectRoot() + "/pom.xml");
+      if (!file.exists())
+      {
+         try
+         {
+            if (!file.createNewFile())
+            {
+               throw new ProjectModelException("Could not create POM file because it already exists: " + file);
+            }
+         }
+         catch (IOException e)
+         {
+            throw new ProjectModelException("Could not create POM file: " + file, e);
+         }
+      }
+      return file;
+   }
+}

Deleted: sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenJavaProjectTest.java
===================================================================
--- sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenJavaProjectTest.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenJavaProjectTest.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.encore.model.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.encore.grammar.java.JavaClass;
-import org.jboss.encore.grammar.java.JavaParser;
-import org.jboss.encore.model.MavenJavaProject;
-import org.jboss.encore.model.Project;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
- * 
- */
-public class MavenJavaProjectTest
-{
-   private static final String PKG = MavenJavaProjectTest.class.getSimpleName().toLowerCase();
-   private static File tempFolder;
-   private static Project project;
-
-   @BeforeClass
-   public static void before() throws IOException
-   {
-      tempFolder = File.createTempFile(PKG, null);
-      tempFolder.delete();
-      tempFolder.mkdirs();
-      project = new MavenJavaProject(tempFolder);
-   }
-
-   @AfterClass
-   public static void after()
-   {
-      if (tempFolder.exists())
-      {
-         assertTrue(project.delete(tempFolder));
-      }
-   }
-
-   @Test
-   public void testGetDefaultSourceDir() throws Exception
-   {
-      assertEquals(new File(project.getProjectRoot() + "/src/main/java/"), project.getDefaultSourceFolder());
-   }
-
-   @Test
-   public void testCreateJavaFile() throws Exception
-   {
-      String name = "JustCreated";
-      JavaClass clazz = JavaParser.createClass().setName(name).setPackage(PKG);
-      clazz.applyChanges();
-      File file = project.createJavaFile(clazz);
-      assertEquals(name + ".java", file.getName());
-
-      JavaClass result = JavaParser.parse(file);
-      assertEquals(name, result.getName());
-      assertEquals(PKG, result.getPackage());
-      assertTrue(project.delete(file));
-      assertEquals(clazz, result);
-   }
-}

Copied: sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenProjectTest.java (from rev 13585, sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenJavaProjectTest.java)
===================================================================
--- sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenProjectTest.java	                        (rev 0)
+++ sandbox/encore/model/src/test/java/org/jboss/encore/model/test/MavenProjectTest.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.encore.model.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.jboss.encore.grammar.java.JavaClass;
+import org.jboss.encore.grammar.java.JavaParser;
+import org.jboss.encore.model.project.MavenProject;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public class MavenProjectTest
+{
+   private static final String PKG = MavenProjectTest.class.getSimpleName().toLowerCase();
+   private static File tempFolder;
+   private static MavenProject project;
+
+   @BeforeClass
+   public static void before() throws IOException
+   {
+      tempFolder = File.createTempFile(PKG, null);
+      tempFolder.delete();
+      tempFolder.mkdirs();
+      project = new MavenProject(tempFolder);
+   }
+
+   @AfterClass
+   public static void after()
+   {
+      if (tempFolder.exists())
+      {
+         assertTrue(project.delete(tempFolder));
+      }
+   }
+
+   @Test
+   public void testGetDefaultSourceDir() throws Exception
+   {
+      assertEquals(new File(project.getProjectRoot() + "/src/main/java/"), project.getDefaultSourceFolder());
+   }
+
+   @Test
+   public void testCreateJavaFile() throws Exception
+   {
+      String name = "JustCreated";
+      JavaClass clazz = JavaParser.createClass().setName(name).setPackage(PKG);
+      clazz.applyChanges();
+      File file = project.createJavaFile(clazz);
+      assertEquals(name + ".java", file.getName());
+
+      JavaClass result = JavaParser.parse(file);
+      assertEquals(name, result.getName());
+      assertEquals(PKG, result.getPackage());
+      assertTrue(project.delete(file));
+      assertEquals(clazz, result);
+   }
+
+   @Test
+   public void testCreatePOM() throws Exception
+   {
+      Model pom = project.getPOM();
+      pom.setGroupId("org.jboss.seam");
+      pom.setArtifactId("seam-scaffolding");
+      pom.setVersion("X-SNAPSHOT");
+      project.setPOM(pom);
+      File file = pom.getPomFile();
+      assertTrue(file.exists());
+
+      MavenXpp3Reader reader = new MavenXpp3Reader();
+      Model result = reader.read(new FileInputStream(file));
+      assertEquals(pom.getArtifactId(), result.getArtifactId());
+   }
+}

Added: sandbox/encore/plugin-api/pom.xml
===================================================================
--- sandbox/encore/plugin-api/pom.xml	                        (rev 0)
+++ sandbox/encore/plugin-api/pom.xml	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,27 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <artifactId>encore</artifactId>
+      <groupId>org.jboss.encore</groupId>
+      <version>1.0.0-SNAPSHOT</version>
+   </parent>
+   
+   <groupId>org.jboss.encore</groupId>
+   <artifactId>encore-plugin-api</artifactId>
+   <version>1.0.0-SNAPSHOT</version>
+   <name>Encore Shell Plugin API</name>
+   
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-se</artifactId>
+         <version>1.0.1-Final</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-extensions</artifactId>
+         <version>1.0.0.Alpha2</version>
+      </dependency>
+   </dependencies>
+</project>
\ No newline at end of file

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/AcceptUserInput.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/AcceptUserInput.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/AcceptUserInput.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.events;
+
+/**
+ * Informs the Shell that it should begin accepting User Input
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public class AcceptUserInput
+{
+
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Shutdown.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Shutdown.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Shutdown.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.events;
+
+/**
+ * The shell shutdown event.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public enum Shutdown
+{
+   NORMAL, ERROR
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Startup.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Startup.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/events/Startup.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.events;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public class Startup
+{
+
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Command.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Command.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Command.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.plugins;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Represents a single command to be run on a Shell.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at Qualifier
+ at Target({ METHOD, PARAMETER, TYPE, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Command
+{
+   /**
+    * One or more names for this command.
+    */
+   String[] value() default {};
+
+   /**
+    * Help text for this command.
+    */
+   String help() default "";
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Default.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Default.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Default.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.plugins;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Defines a @{@link Command} as the plugin default. It will be run if no other
+ * command matches the input line.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at Target({ TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Default
+{
+
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Help.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Help.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Help.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.plugins;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Describes help text for a plug-in.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at Target({ TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Help
+{
+   /**
+    * The help text.
+    */
+   String value();
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Option.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Option.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Option.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.plugins;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * A command option.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at Qualifier
+ at Target({ METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Option
+{
+   /**
+    * The name of this option.
+    */
+   String value() default "";
+
+   /**
+    * Specify whether or not this option is required.
+    */
+   boolean required() default false;
+
+   /**
+    * The default value for this option, if not provided in user input.
+    */
+   String defaultValue() default "";
+
+   /**
+    * Help text for this option.
+    */
+   String help() default "";
+}

Added: sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Plugin.java
===================================================================
--- sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Plugin.java	                        (rev 0)
+++ sandbox/encore/plugin-api/src/main/java/org/jboss/encore/shell/api/plugins/Plugin.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.shell.api.plugins;
+
+
+/**
+ * A custom {@link Plugin} must implement this interface in order to be detected and installed at framework boot-time.
+ * In order to create plugin shell-commands, one must create a method annotated with @{@link Command}. Any command
+ * method parameters to be provided as input through the shell must be individually annotated with the @{@link Option}
+ * annotation; other (non-annotated) command parameters are ignored.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+public interface Plugin
+{
+
+}

Modified: sandbox/encore/pom.xml
===================================================================
--- sandbox/encore/pom.xml	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/pom.xml	2010-08-10 19:33:32 UTC (rev 13594)
@@ -15,6 +15,7 @@
       <module>core</module>
       <module>model</module>
       <module>shell</module>
+      <module>plugin-api</module>
    </modules>
 
    <properties>

Modified: sandbox/encore/shell/pom.xml
===================================================================
--- sandbox/encore/shell/pom.xml	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/pom.xml	2010-08-10 19:33:32 UTC (rev 13594)
@@ -23,6 +23,12 @@
          <version>1.0.0-SNAPSHOT</version>
       </dependency>
       <dependency>
+         <groupId>org.jboss.encore</groupId>
+         <artifactId>encore-plugin-api</artifactId>
+         <version>1.0.0-SNAPSHOT</version>
+      </dependency>
+      
+      <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-se</artifactId>
          <version>1.0.1-Final</version>

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Main.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Main.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Main.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -21,8 +21,8 @@
  */
 package org.jboss.encore.shell;
 
-import org.jboss.encore.shell.events.AcceptUserInput;
-import org.jboss.encore.shell.events.Startup;
+import org.jboss.encore.shell.api.events.AcceptUserInput;
+import org.jboss.encore.shell.api.events.Startup;
 import org.jboss.weld.environment.se.Weld;
 import org.jboss.weld.environment.se.WeldContainer;
 

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Shell.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Shell.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/Shell.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -31,11 +31,11 @@
 import jline.console.ConsoleReader;
 import jline.console.completer.Completer;
 
+import org.jboss.encore.shell.api.events.AcceptUserInput;
+import org.jboss.encore.shell.api.events.Shutdown;
+import org.jboss.encore.shell.api.events.Startup;
 import org.jboss.encore.shell.cli.Execution;
 import org.jboss.encore.shell.cli.ExecutionParser;
-import org.jboss.encore.shell.events.AcceptUserInput;
-import org.jboss.encore.shell.events.Shutdown;
-import org.jboss.encore.shell.events.Startup;
 import org.jboss.weld.environment.se.bindings.Parameters;
 import org.slf4j.Logger;
 

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/CommandLibraryExtension.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/CommandLibraryExtension.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/CommandLibraryExtension.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -34,11 +34,11 @@
 import javax.enterprise.inject.spi.ProcessBean;
 import javax.inject.Named;
 
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Option;
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Option;
+import org.jboss.encore.shell.api.plugins.Plugin;
 import org.jboss.encore.shell.util.Annotations;
 
 /**
@@ -101,7 +101,8 @@
                commandMeta.setDefault(true);
             }
 
-            // Default commands are invoked via the name of the plug-in, not by plug-in + command
+            // Default commands are invoked via the name of the plug-in, not by
+            // plug-in + command
             if (!commandMeta.isDefault())
             {
                if (command.value().length == 0)

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/Execution.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/Execution.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/Execution.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -28,7 +28,7 @@
 import javax.enterprise.inject.spi.BeanManager;
 import javax.inject.Inject;
 
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
@@ -57,8 +57,7 @@
             Plugin plugin = null;
             if (bean != null)
             {
-               CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
-                        .createCreationalContext(bean);
+               CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager.createCreationalContext(bean);
                if (context != null)
                {
                   plugin = (Plugin) manager.getReference(bean, pluginType, context);

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/PluginMetadata.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/PluginMetadata.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/PluginMetadata.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -24,7 +24,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ClearPlugin.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ClearPlugin.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ClearPlugin.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -25,10 +25,10 @@
 import javax.inject.Named;
 
 import org.jboss.encore.shell.Shell;
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/Echo.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/Echo.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/Echo.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -24,11 +24,11 @@
 import javax.inject.Inject;
 
 import org.jboss.encore.shell.Shell;
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Option;
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Option;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ExitShell.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ExitShell.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/ExitShell.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -25,14 +25,15 @@
 import javax.inject.Inject;
 import javax.inject.Named;
 
-import org.jboss.encore.shell.events.Shutdown;
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.events.Shutdown;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
- * Implements a {@link Plugin} that fires the shell {@link Shutdown#NORMAL} event.
+ * Implements a {@link Plugin} that fires the shell {@link Shutdown#NORMAL}
+ * event.
  * 
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/HelpPlugin.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/HelpPlugin.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/HelpPlugin.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -25,12 +25,12 @@
 import javax.inject.Named;
 
 import org.jboss.encore.shell.Shell;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Option;
+import org.jboss.encore.shell.api.plugins.Plugin;
 import org.jboss.encore.shell.cli.PluginRegistry;
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Option;
-import org.jboss.encore.shell.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>

Modified: sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/PwdPlugin.java
===================================================================
--- sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/PwdPlugin.java	2010-08-10 14:52:18 UTC (rev 13593)
+++ sandbox/encore/shell/src/main/java/org/jboss/encore/shell/cli/builtin/PwdPlugin.java	2010-08-10 19:33:32 UTC (rev 13594)
@@ -27,10 +27,10 @@
 import javax.inject.Named;
 
 import org.jboss.encore.shell.Shell;
-import org.jboss.encore.shell.plugins.Command;
-import org.jboss.encore.shell.plugins.Default;
-import org.jboss.encore.shell.plugins.Help;
-import org.jboss.encore.shell.plugins.Plugin;
+import org.jboss.encore.shell.api.plugins.Command;
+import org.jboss.encore.shell.api.plugins.Default;
+import org.jboss.encore.shell.api.plugins.Help;
+import org.jboss.encore.shell.api.plugins.Plugin;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>



More information about the seam-commits mailing list