Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 39762 invoked from network); 22 Oct 2010 17:04:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Oct 2010 17:04:41 -0000 Received: (qmail 57237 invoked by uid 500); 22 Oct 2010 17:04:41 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 57197 invoked by uid 500); 22 Oct 2010 17:04:41 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 57190 invoked by uid 99); 22 Oct 2010 17:04:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Oct 2010 17:04:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Oct 2010 17:04:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C038E238890D; Fri, 22 Oct 2010 17:03:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101022170341.C038E238890D@eris.apache.org> 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 @@ + + + 4.0.0 + + org.apache.activemq + apollo-scala + 6.0-SNAPSHOT + + + org.apache.activemq + apollo-cli + 6.0-SNAPSHOT + + ${artifactId} + + + + + + org.scala-lang + scala-library + compile + ${scala-version} + + + org.scala-lang + scala-compiler + ${scala-version} + compile + true + + + + org.apache.activemq + apollo-web + 6.0-SNAPSHOT + war + + + + org.mortbay.jetty + jetty + ${jetty-version} + true + + + org.mortbay.jetty + jetty-util + ${jetty-version} + true + + + + org.apache.karaf.shell + org.apache.karaf.shell.console + ${karaf-version} + + + + + + + + ${project.basedir}/src/main/resources + + **/* + + + + ${project.basedir}/src/main/filtered-resources + true + + **/* + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.1.1 + + + + java + + + + + org.apache.activemq.apollo.cli.Apollo + test + + ${arg} + + + + + + + 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 '' 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 @@ 0.9.24 1.5-ea01 + 2.1.0 + 2.14 2.4.3 @@ -159,6 +161,7 @@ apollo-stomp apollo-web apache-activemq-apollo + apollo-cli