geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r696738 - in /geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main: java/org/apache/geronimo/gshell/commands/admin/ resources/META-INF/spring/ resources/org/apache/geronimo/gshell/commands/admin/
Date Thu, 18 Sep 2008 17:40:27 GMT
Author: jdillon
Date: Thu Sep 18 10:40:27 2008
New Revision: 696738

URL: http://svn.apache.org/viewvc?rev=696738&view=rev
Log:
Add command to install a new GShell plugin

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
  (with props)
    geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/ListPluginsCommand.java
    geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/META-INF/spring/components.xml

Added: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java?rev=696738&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
Thu Sep 18 10:40:27 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.commands.admin;
+
+import org.apache.geronimo.gshell.application.plugin.PluginManager;
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.model.application.PluginArtifact;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Install a GShell plugin.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InstallPluginCommand
+    implements CommandAction
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private PluginManager pluginManager;
+
+    @Option(name="-g", aliases={"--groupId"}, argumentRequired=true, metaVar="GROUP-ID",
required=true)
+    private String groupId;
+
+    @Option(name="-a", aliases={"--artifactId"}, argumentRequired=true, metaVar="ARTIFACT-ID",
required=true)
+    private String artifactId;
+
+    @Option(name="-v", aliases={"--version"}, argumentRequired=true, metaVar="VERSION", required=true)
+    private String version;
+    
+    public Object execute(final CommandContext context) throws Exception {
+        assert context != null;
+        IO io = context.getIo();
+
+        PluginArtifact artifact = new PluginArtifact();
+        artifact.setGroupId(groupId);
+        artifact.setArtifactId(artifactId);
+        artifact.setVersion(version);
+
+        io.out.println("Loading plugin: " + artifact.getId());
+        
+        assert pluginManager != null;
+        try {
+            pluginManager.loadPlugin(artifact);
+            return Result.SUCCESS;
+        }
+        catch (Exception e) {
+            log.error("Failed to load plugin", e);
+            return Result.FAILURE;
+        }
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/ListPluginsCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/ListPluginsCommand.java?rev=696738&r1=696737&r2=696738&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/ListPluginsCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/ListPluginsCommand.java
Thu Sep 18 10:40:27 2008
@@ -31,7 +31,7 @@
 import java.util.Set;
 
 /**
- * ???
+ * List installed GShell plugins.
  *
  * @version $Rev$ $Date$
  */

Modified: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/META-INF/spring/components.xml?rev=696738&r1=696737&r2=696738&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/META-INF/spring/components.xml
Thu Sep 18 10:40:27 2008
@@ -53,6 +53,14 @@
                         <bean class="org.apache.geronimo.gshell.commands.admin.ListPluginsCommand"/>
                     </property>
                 </bean>
+
+                <bean class="org.apache.geronimo.gshell.wisdom.command.CommandImpl">
+                    <property name="id" value="gshell-admin:install-plugin"/>
+
+                    <property name="action">
+                        <bean class="org.apache.geronimo.gshell.commands.admin.InstallPluginCommand"/>
+                    </property>
+                </bean>
             </list>
         </property>
     </bean>

Added: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties?rev=696738&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
(added)
+++ geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
Thu Sep 18 10:40:27 2008
@@ -0,0 +1,35 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev$ $Date$
+##
+
+command.name=install-plugin
+
+command.description=Install a GShell plugin.
+
+command.option.groupId=Specify the groupId
+
+command.option.artifactId=Specify the artifactId
+
+command.option.version=Specify the version
+
+command.manual=\
+  TODO: install-plugin manual
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/resources/org/apache/geronimo/gshell/commands/admin/InstallPluginCommand.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message