Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2005 The Apache Software Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | * |
| 16 | */ |
Richard S. Hall | 5a03159 | 2005-08-19 19:53:58 +0000 | [diff] [blame^] | 17 | package org.apache.felix.shell; |
Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame] | 18 | |
| 19 | import java.io.PrintStream; |
| 20 | |
| 21 | /** |
Richard S. Hall | 5a03159 | 2005-08-19 19:53:58 +0000 | [diff] [blame^] | 22 | * This interface is used to define commands for the Felix impl |
Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame] | 23 | * service. Any bundle wishing to create commands for the |
Richard S. Hall | 5a03159 | 2005-08-19 19:53:58 +0000 | [diff] [blame^] | 24 | * impl service simply needs to create a service object that |
Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame] | 25 | * implements this interface and then register it with the OSGi |
Richard S. Hall | 5a03159 | 2005-08-19 19:53:58 +0000 | [diff] [blame^] | 26 | * framework. The impl service automatically includes any |
Richard S. Hall | 930fecc | 2005-08-16 18:33:34 +0000 | [diff] [blame] | 27 | * registered command services in its list of available commands. |
| 28 | **/ |
| 29 | public interface Command |
| 30 | { |
| 31 | /** |
| 32 | * Returns the name of the command that is implemented by the |
| 33 | * interface. The command name should not contain whitespace |
| 34 | * and should also be unique. |
| 35 | * @return the name of the command. |
| 36 | **/ |
| 37 | public String getName(); |
| 38 | |
| 39 | /** |
| 40 | * Returns the usage string for the command. The usage string is |
| 41 | * a short string that illustrates how to use the command on the |
| 42 | * command line. This information is used when generating command |
| 43 | * help information. An example usage string for the <tt>install</tt> |
| 44 | * command is: |
| 45 | * <pre> |
| 46 | * install <URL> [<URL> ...] |
| 47 | * </pre> |
| 48 | * @return the usage string for the command. |
| 49 | **/ |
| 50 | public String getUsage(); |
| 51 | |
| 52 | /** |
| 53 | * Returns a short description of the command; this description |
| 54 | * should be as short as possible. This information is used when |
| 55 | * generating the command help information. |
| 56 | * @return a short description of the command. |
| 57 | **/ |
| 58 | public String getShortDescription(); |
| 59 | |
| 60 | /** |
| 61 | * Executes the command using the supplied command line, output |
| 62 | * print stream, and error print stream. |
| 63 | * @param line the complete command line, including the command name. |
| 64 | * @param out the print stream to use for standard output. |
| 65 | * @param err the print stream to use for standard error. |
| 66 | **/ |
| 67 | public void execute(String line, PrintStream out, PrintStream err); |
| 68 | } |