You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2011/12/08 00:12:35 UTC

svn commit: r1211700 - in /karaf/trunk/demos/command/src/main/resources/resources/demos/command/src: ./ main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/karaf/ main/java/org/apache/karaf/demos/ main/java/org/apache/karaf/demos...

Author: jgoodyear
Date: Wed Dec  7 23:12:34 2011
New Revision: 1211700

URL: http://svn.apache.org/viewvc?rev=1211700&view=rev
Log:
[KARAF-1096] Update Custom Command demo

restoring the source code.


Added:
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java   (with props)
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java   (with props)
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/
    karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml   (with props)

Added: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java?rev=1211700&view=auto
==============================================================================
--- karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java (added)
+++ karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java Wed Dec  7 23:12:34 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.karaf.demos.command;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+
+@Command(scope = "mycommand", name = "hello", description="Says hello")
+public class MyCommand extends OsgiCommandSupport {
+
+    @Argument(index = 0, name = "arg", description = "The command argument", required = false, multiValued = false)
+    String arg = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        System.out.println("Executing My Command Demo");
+        return null;
+    }
+}

Propchange: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java?rev=1211700&view=auto
==============================================================================
--- karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java (added)
+++ karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java Wed Dec  7 23:12:34 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.karaf.demos.command;
+
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.console.Completer;
+
+import java.util.List;
+
+/**
+* <p>
+* My completer.
+* </p>
+*/
+
+public class MyCompleter implements Completer {
+
+    /**
+     * @param buffer it's the beginning string typed by the user
+     * @param cursor it's the position of the cursor
+     * @param candidates the list of completions proposed to the user
+     */
+    public int complete(String buffer, int cursor, List candidates) {
+
+        StringsCompleter delegate = new StringsCompleter();
+        delegate.getStrings().add("one");
+        delegate.getStrings().add("two");
+        delegate.getStrings().add("three");
+        return delegate.complete(buffer, cursor, candidates);
+    }
+}

Propchange: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/java/org/apache/karaf/demos/command/MyCompleter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml?rev=1211700&view=auto
==============================================================================
--- karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml (added)
+++ karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml Wed Dec  7 23:12:34 2011
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.apache.karaf.demos.command.MyCommand"/>
+            <completers>
+                <ref component-id="myCompleter"/>
+                <null/>
+            </completers>
+        </command>
+    </command-bundle>
+
+    <bean id="myCompleter" class="org.apache.karaf.demos.command.MyCompleter"/>
+
+</blueprint>

Propchange: karaf/trunk/demos/command/src/main/resources/resources/demos/command/src/main/resources/OSGI-INF/blueprint/mycommand.xml
------------------------------------------------------------------------------
    svn:eol-style = native