@Command(scope = "bundle", name = "id", description = "Gets the bundle ID.") @Service public class Id extends BundleCommand { @Override protected Object doExecute(Bundle bundle) throws Exception { return bundle.getBundleId(); } }
@Override public String getDescription() { return actionClass.getAnnotation(Command.class).description(); }
@Command(scope = "config", name = "cancel", description = "Cancels the changes to the configuration being edited.") @Service public class CancelCommand extends ConfigCommandSupport { protected Object doExecute() throws Exception { session.put(PROPERTY_CONFIG_PID, null); session.put(PROPERTY_CONFIG_PROPS, null); return null; } }
@Override public String getDescription() { return actionClass.getAnnotation(Command.class).description(); }
@Command(scope = "bundle", name = "uninstall", description = "Uninstall bundles.") @Service public class Uninstall extends BundlesCommand { public Uninstall() { defaultAllBundles = false; errorMessage = "Error uninstalling bundle"; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.uninstall(); } }
private static void listCommands() { System.out.println("Available commands:"); for (Map.Entry<String, Class<?>> entry : COMMANDS.entrySet()) { Command ann = entry.getValue().getAnnotation(Command.class); System.out.printf(" %s - %s\n", entry.getKey(), ann.description()); } System.out.println("Type 'command --help' for more help on the specified command."); }
@Command(scope = "bundle", name = "resolve", description = "Resolve bundles.") @Service public class Resolve extends BundlesCommand { protected Object doExecute(List<Bundle> bundles) throws Exception { FrameworkWiring wiring = bundleContext.getBundle(0).adapt(FrameworkWiring.class); wiring.resolveBundles(bundles == null || bundles.isEmpty() ? null : bundles); return null; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { } }
private static void listCommands() { System.out.println("Available commands:"); for (Map.Entry<String, Class<?>> entry : COMMANDS.entrySet()) { Command ann = entry.getValue().getAnnotation(Command.class); System.out.printf(" %s - %s\n", entry.getKey(), ann.description()); } System.out.println("Type 'command --help' for more help on the specified command."); }
@Command(scope = "bundle", name = "uninstall", description = "Uninstall bundles.") @Service public class Uninstall extends BundlesCommand { public Uninstall() { defaultAllBundles = false; errorMessage = "Error uninstalling bundle"; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.uninstall(); } }
@Command(scope = "bundle", name = "resolve", description = "Resolve bundles.") @Service public class Resolve extends BundlesCommand { protected Object doExecute(List<Bundle> bundles) throws Exception { FrameworkWiring wiring = bundleContext.getBundle(0).adapt(FrameworkWiring.class); wiring.resolveBundles(bundles == null || bundles.isEmpty() ? null : bundles); return null; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { } }
@Command(scope = "camel", name = "route-start", description = "Start a Camel route") @Service public class RouteStart extends AbstractRouteCommand { @Override public Object execute() throws Exception { RouteStartCommand command = new RouteStartCommand(route, context); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "route-resume", description = "Resume a Camel route") @Service public class RouteResume extends AbstractRouteCommand { @Override public Object execute() throws Exception { RouteResumeCommand command = new RouteResumeCommand(route, context); return command.execute(this, System.out, System.err); } }
/** * Forces device mastership rebalancing. */ @Service @Command(scope = "onos", name = "balance-masters", description = "Forces device mastership rebalancing") public class BalanceMastersCommand extends AbstractShellCommand { @Override protected void doExecute() { get(MastershipAdminService.class).balanceRoles(); } }
@Command(scope = "bundle", name = "id", description = "Gets the bundle ID.") @Service public class Id extends BundleCommand { @Override protected Object doExecute(Bundle bundle) throws Exception { return bundle.getBundleId(); } }
@Command(scope = "camel", name = "route-profile", description = "Display profile information about Camel route(s).") @Service public class RouteProfile extends AbstractRouteCommand { private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance(); @Override public Object execute() throws Exception { RouteProfileCommand command = new RouteProfileCommand(route, context); command.setStringEscape(stringEscape); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "route-suspend", description = "Suspend a Camel route") @Service public class RouteSuspend extends AbstractRouteCommand { @Override public Object execute() throws Exception { RouteSuspendCommand command = new RouteSuspendCommand(route, context); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "route-info", description = "Display information about a Camel route.") @Service public class RouteInfo extends AbstractRouteCommand { private StringEscape stringEscape = org.apache.camel.karaf.commands.internal.StringEscape.getInstance(); public Object execute() throws Exception { RouteInfoCommand command = new RouteInfoCommand(route, context); command.setStringEscape(stringEscape); return command.execute(this, System.out, System.err); } }
@Command(scope = "config", name = "cancel", description = "Cancels the changes to the configuration being edited.") @Service public class CancelCommand extends ConfigCommandSupport { protected Object doExecute() throws Exception { session.put(PROPERTY_CONFIG_PID, null); session.put(PROPERTY_CONFIG_PROPS, null); return null; } }
@Command(scope = "camel", name = "route-stop", description = "Stop a Camel route") @Service public class RouteStop extends AbstractRouteCommand { @Override public Object execute() throws Exception { RouteStopCommand command = new RouteStopCommand(route, context); return command.execute(this, System.out, System.err); } }
@Command(scope = "camel", name = "route-show", description = "Display the Camel route definition in XML") @Service public class RouteShow extends AbstractRouteCommand { public Object execute() throws Exception { RouteShowCommand command = new RouteShowCommand(route, context); return command.execute(this, System.out, System.err); } }