/** * For commands that need a connection factory and authentication information */ public abstract class JmsConnectionCommandSupport extends JmsCommandSupport { @Argument(index = 0, name = "connectionFactory", description = "The JMS connection factory name", required = true, multiValued = false) @Completion(ConnectionFactoriesNameCompleter.class) String connectionFactory; @Option(name = "-u", aliases = { "--username" }, description = "Username to connect to the JMS broker", required = false, multiValued = false) String username = "karaf"; @Option(name = "-p", aliases = { "--password" }, description = "Password to connect to the JMS broker", required = false, multiValued = false) String password = "karaf"; }
public abstract class AbstractRouteCommand extends CamelControllerImpl implements Action { @Argument(index = 0, name = "context", description = "The Camel context name.", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String context; @Argument(index = 1, name = "route", description = "The Camel route ID or a wildcard expression", required = true, multiValued = false) @Completion(RouteCompleter.class) String route; }
@Command(scope = "instance", name = "status", description = "Check the current status of an instance.") @Service public class StatusCommand extends InstanceCommandSupport { @Argument(index = 0, name = "name", description = "The name of the instance", required = true, multiValued = false) @Completion(InstanceCompleter.class) private String name; protected Object doExecute() throws Exception { Instance instance = getExistingInstance(name); System.out.println(instance.getState()); return null; } }
@Command(scope = "obr", name = "start", description = "Deploys and starts a list of bundles using OBR.") @Service public class StartCommand extends ObrCommandSupport { @Argument(index = 0, name = "bundles", description = "List of bundles to deploy (separated by whitespaces). The bundles are identified using the following syntax: symbolic_name,version where version is optional.", required = true, multiValued = true) protected List<String> bundles; @Option(name = "-d", aliases = { "--deployOptional" }, description = "Deploy optional bundles", required = false, multiValued = false) protected boolean deployOptional = false; protected void doExecute(RepositoryAdmin admin) throws Exception { doDeploy(admin, bundles, true, deployOptional); } }
@Command(scope = "jms", name = "delete", description = "Delete a JMS connection factory") @Service public class DeleteCommand extends JmsCommandSupport { @Argument(index = 0, name = "name", description = "The JMS connection factory name", required = true, multiValued = false) @Completion(ConnectionFactoriesFileNameCompleter.class) String name; @Override public Object execute() throws Exception { getJmsService().delete(name); return null; } }
@Command(scope = "obr", name = "start", description = "Deploys and starts a list of bundles using OBR.") @Service public class StartCommand extends ObrCommandSupport { @Argument(index = 0, name = "bundles", description = "List of bundles to deploy (separated by whitespaces). The bundles are identified using the following syntax: symbolic_name,version where version is optional.", required = true, multiValued = true) protected List<String> bundles; @Option(name = "-d", aliases = { "--deployOptional" }, description = "Deploy optional bundles", required = false, multiValued = false) protected boolean deployOptional = false; protected void doExecute(RepositoryAdmin admin) throws Exception { doDeploy(admin, bundles, true, deployOptional); } }
@Command(scope = "jdbc", name = "ds-delete", description = "Delete a JDBC datasource") @Service public class DeleteCommand extends JdbcCommandSupport { @Argument(index = 0, name = "name", description = "The JDBC datasource name (the one used at creation time)", required = true, multiValued = false) @Completion(DataSourcesNameCompleter.class) String name; @Override public Object execute() throws Exception { this.getJdbcService().delete(name); return null; } }
@Command(scope = "camel", name = "context-stop", description = "Stop a Camel context. It becomes unavailable and can not be started again.") @Service public class ContextStop extends CamelControllerImpl implements Action { @Argument(index = 0, name = "context", description = "The name of the Camel context.", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String context; @Override public Object execute() throws Exception { ContextStopCommand command = new ContextStopCommand(context); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "route-list", description = "List Camel routes.") @Service public class RouteList extends CamelControllerImpl implements Action { @Argument(index = 0, name = "name", description = "The Camel context name where to look for the route", required = false, multiValued = false) @Completion(CamelContextCompleter.class) String name; public Object execute() throws Exception { RouteListCommand command = new RouteListCommand(name); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "context-resume", description = "Resumes a Camel context.") @Service public class ContextResume extends CamelControllerImpl implements Action { @Argument(index = 0, name = "context", description = "The name of the Camel context.", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String context; @Override public Object execute() throws Exception { ContextResumeCommand command = new ContextResumeCommand(context); return command.execute(this, System.out, System.err); } }
@Command(scope = "jdbc", name = "ds-delete", description = "Delete a JDBC datasource") @Service public class DeleteCommand extends JdbcCommandSupport { @Argument(index = 0, name = "name", description = "The JDBC datasource name (the one used at creation time)", required = true, multiValued = false) @Completion(DataSourcesNameCompleter.class) String name; @Override public Object execute() throws Exception { this.getJdbcService().delete(name); return null; } }
@Command(scope = "camel", name = "rest-show", description = "Display the Camel REST definition in XML") @Service public class RestShow extends CamelControllerImpl implements Action { @Argument(index = 0, name = "name", description = "The name of the Camel context", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String name; public Object execute() throws Exception { RestShowCommand command = new RestShowCommand(name); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "context-start", description = "Start a Camel context.") @Service public class ContextStart extends CamelControllerImpl implements Action { @Argument(index = 0, name = "context", description = "The name of the Camel context.", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String context; @Override public Object execute() throws Exception { ContextStartCommand command = new ContextStartCommand(context); return command.execute(this, System.out, System.err); } }
@Command(scope = "instance", name = "rmi-server-port-change", description = "Changes the RMI server port (used by management layer) of an existing instance.") @Service public class ChangeRmiServerPortCommand extends InstanceCommandSupport { @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false) @Completion(InstanceCompleter.class) private String instance = null; @Argument(index = 1, name = "port", description = "The new RMI server port to set", required = true, multiValued = false) private int port = 0; protected Object doExecute() throws Exception { getExistingInstance(instance).changeRmiServerPort(port); return null; } }
@Command(scope = "camel", name = "rest-api-doc", description = "List the Camel REST services API documentation (requires camel-swagger-java on classpath)") @Service public class RestApiDoc extends CamelControllerImpl implements Action { @Argument(index = 0, name = "name", description = "The Camel context name where to look for the REST services", required = true, multiValued = false) @Completion(CamelContextCompleter.class) String name; public Object execute() throws Exception { RestApiDocCommand command = new RestApiDocCommand(name); return command.execute(this, System.out, System.err); } }
@Command(scope = "instance", name = "status", description = "Check the current status of an instance.") @Service public class StatusCommand extends InstanceCommandSupport { @Argument(index = 0, name = "name", description = "The name of the instance", required = true, multiValued = false) @Completion(InstanceCompleter.class) private String name; protected Object doExecute() throws Exception { Instance instance = getExistingInstance(name); System.out.println(instance.getState()); return null; } }
@Command(scope = "instance", name = "opts-change", description = "Changes the Java options of an existing container instance.") @Service public class ChangeOptsCommand extends InstanceCommandSupport { @Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false) @Completion(InstanceCompleter.class) private String instance = null; @Argument(index = 1, name = "javaOpts", description = "The new Java options to set", required = true, multiValued = false) private String javaOpts; protected Object doExecute() throws Exception { getExistingInstance(instance).changeJavaOpts(javaOpts); return null; } }
@Command(scope = "config", name = "property-set", description = "Sets a property in the currently edited configuration.") @Service public class PropSetCommand extends ConfigPropertyCommandSupport { @Argument(index = 0, name = "property", description = "The name of the property to set", required = true, multiValued = false) @Completion(ConfigurationPropertyCompleter.class) String prop; @Argument(index = 1, name = "value", description = "The value of the property", required = true, multiValued = false) Object value; @Override public void propertyAction(TypedProperties props) { props.put(prop, value); } }
@Command(scope = "cluster", name = "consumer-status", description = "Status of a cluster event consumer") @Service public class ConsumerStatusCommand extends ConsumerSupport { @Argument(index = 0, name = "node", description = "The node(s) ID or alias", required = false, multiValued = true) @Completion(AllNodeCompleter.class) List<String> nodes; @Override protected Object doExecute() throws Exception { return doExecute(nodes, null); } }
@Command(scope = "cluster", name = "producer-status", description = "Status of a cluster event producer") @Service public class ProducerStatusCommand extends ProducerSupport { @Argument(index = 0, name = "node", description = "The node(s) ID or alias", required = false, multiValued = true) @Completion(AllNodeCompleter.class) List<String> nodes; @Override protected Object doExecute() throws Exception { return doExecute(nodes, null); } }