activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1026405 - in /activemq/activemq-apollo/trunk: ./ apollo-cli/ apollo-cli/src/ apollo-cli/src/main/ apollo-cli/src/main/resources/ apollo-cli/src/main/resources/META-INF/ apollo-cli/src/main/resources/META-INF/services/ apollo-cli/src/main/r...
Date Fri, 22 Oct 2010 17:03:41 GMT
Author: chirino
Date: Fri Oct 22 17:03:40 2010
New Revision: 1026405

URL: http://svn.apache.org/viewvc?rev=1026405&view=rev
Log:
adding a cli module.

Added:
    activemq/activemq-apollo/trunk/apollo-cli/
    activemq/activemq-apollo/trunk/apollo-cli/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/commands.index
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/banner.txt
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Exit.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Help.scala
Modified:
    activemq/activemq-apollo/trunk/pom.xml

Added: activemq/activemq-apollo/trunk/apollo-cli/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/pom.xml?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/pom.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-cli/pom.xml Fri Oct 22 17:03:40 2010
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.activemq</groupId>
+    <artifactId>apollo-scala</artifactId>
+    <version>6.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.activemq</groupId>
+  <artifactId>apollo-cli</artifactId>
+  <version>6.0-SNAPSHOT</version>
+
+  <name>${artifactId}</name>
+
+  <dependencies>
+    
+    <!-- Scala Support -->
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-library</artifactId>
+      <scope>compile</scope>
+      <version>${scala-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-compiler</artifactId>
+      <version>${scala-version}</version>
+      <scope>compile</scope>
+      <optional>true</optional>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-web</artifactId>
+      <version>6.0-SNAPSHOT</version>
+      <type>war</type>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <version>${jetty-version}</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>${jetty-version}</version>
+      <optional>true</optional>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>${karaf-version}</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>${project.basedir}/src/main/filtered-resources</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.1.1</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>java</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mainClass>org.apache.activemq.apollo.cli.Apollo</mainClass>
+          <classpathScope>test</classpathScope>
+          <arguments>
+            <argument>${arg}</argument>
+          </arguments>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/commands.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/commands.index?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/commands.index
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/META-INF/services/org.apache.activemq.apollo/commands.index
Fri Oct 22 17:03:40 2010
@@ -0,0 +1,22 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.cli.Exit
+org.apache.activemq.apollo.cli.Help
+#org.apache.activemq.apollo.cli.Create
+#org.apache.activemq.apollo.cli.Start
+#org.apache.activemq.apollo.cli.Stop
+#org.apache.activemq.apollo.cli.Run

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/banner.txt
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/banner.txt?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/banner.txt
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/banner.txt
Fri Oct 22 17:03:40 2010
@@ -0,0 +1,12 @@
+  ____
+ / ___|  ___ __ _| | __ _| |_ ___
+ \___ \ / __/ _` | |/ _`
| __/ _ \
+  ___) | (_| (_| | | (_| | ||
 __/
+ |____/ \___\__,_|_|\__,_|\__\___
+
+  Scalate (${project.version})
+
+Hit '<tab>' for a list of available commands
+   and '[cmd] --help' for help on a specific command.
+Run 'exit' to exit the shell.
+

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
Fri Oct 22 17:03:40 2010
@@ -0,0 +1,91 @@
+/**
+ * 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.activemq.apollo.cli
+
+import org.osgi.service.command.CommandSession
+import org.apache.felix.gogo.commands.{Action, Option => option, Argument => argument,
Command => command}
+import org.apache.felix.gogo.runtime.shell.CommandShellImpl
+import org.apache.karaf.shell.console.Main
+import org.apache.karaf.shell.console.jline.Console
+import jline.Terminal
+import org.fusesource.jansi.Ansi
+import java.io.{OutputStream, PrintStream, InputStream}
+
+object Apollo {
+  def main(args: Array[String]) = {
+    Ansi.ansi()
+    new Apollo().run(args)
+  }
+
+  // Some ANSI helpers...
+  def ANSI(value:Any) =  "\u001B["+value+"m"
+  val BOLD =  ANSI(1)
+  val RESET = ANSI(0)
+}
+
+@command(scope="apollo", name = "apollo", description = "The Apollo Command line tool")
+class Apollo extends Main with Action {
+  import Apollo._
+
+  setUser("me")
+  setApplication("apollo")
+
+  var debug = false
+
+  override def getDiscoveryResource = "META-INF/services/org.apache.activemq.apollo/commands.index"
+
+  override def isMultiScopeMode() = false
+
+
+  protected override def createConsole(commandProcessor: CommandShellImpl, in: InputStream,
out: PrintStream, err: PrintStream, terminal: Terminal)  = {
+    new Console(commandProcessor, in, out, err, terminal, null) {
+      protected override def getPrompt = BOLD+"scalate> "+RESET
+      protected override def isPrintStackTraces = debug
+      protected override def welcome = {
+        val source = getClass().getResourceAsStream("banner.txt")
+        copy(source, session.getConsole())
+      }
+
+      def copy(in: InputStream, out: OutputStream): Long = {
+        var bytesCopied: Long = 0
+        val buffer = new Array[Byte](8192)
+        var bytes = in.read(buffer)
+        while (bytes >= 0) {
+          out.write(buffer, 0, bytes)
+          bytesCopied += bytes
+          bytes = in.read(buffer)
+        }
+
+        bytesCopied
+      }
+
+      protected override def setSessionProperties = {}
+    }
+  }
+
+  @argument(name = "args", description = "apollo sub command arguments", multiValued=true)
+  var args = Array[String]()
+
+  def execute(session: CommandSession): AnyRef = {
+    run(session, args)
+    null
+  }
+
+
+
+
+}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Exit.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Exit.scala?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Exit.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Exit.scala
Fri Oct 22 17:03:40 2010
@@ -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.
+ */
+
+package org.fusesource.scalate.tool.commands
+
+import java.{util => ju, lang => jl}
+import org.apache.felix.gogo.commands.{Action, Command => command}
+import org.osgi.service.command.CommandSession
+import org.apache.karaf.shell.console.CloseShellException
+
+/**
+ * The 'exit' sub command.
+ */
+@command(scope="apollo", name = "exit", description = "exit the shell")
+class Exit extends Action {
+
+  def execute(session: CommandSession): AnyRef = {
+    throw new CloseShellException
+  }
+
+}
\ No newline at end of file

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Help.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Help.scala?rev=1026405&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Help.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Help.scala
Fri Oct 22 17:03:40 2010
@@ -0,0 +1,27 @@
+/**
+ * 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.fusesource.scalate.tool.commands
+
+import org.apache.felix.gogo.commands.{Action, Option => option, Argument => argument,
Command => command}
+import org.apache.karaf.shell.console.HelpAction
+
+/**
+ * Provides help for the current shell or an individual command
+ */
+@command(scope="apollo", name = "help", description = "Displays this help or help about a
command")
+class Help extends HelpAction {
+}
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1026405&r1=1026404&r2=1026405&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Fri Oct 22 17:03:40 2010
@@ -112,6 +112,8 @@
     <logback-version>0.9.24</logback-version>
     <jersey-version>1.5-ea01</jersey-version>
     
+    <karaf-version>2.1.0</karaf-version>
+    
     <!-- maven plugin versions -->
     <maven-scala-plugin-version>2.14</maven-scala-plugin-version>
     <maven-surefire-plugin-version>2.4.3</maven-surefire-plugin-version>
@@ -159,6 +161,7 @@
     <module>apollo-stomp</module>
     <module>apollo-web</module>
     <module>apache-activemq-apollo</module>
+    <module>apollo-cli</module>
   </modules>
 
   <scm>



Mime
View raw message