@Command(scope = "obr", name = "url-add", description = "Adds a list of repository URLs to the OBR service.") @Service public class AddUrlCommand extends ObrCommandSupport { @Argument(index = 0, name = "urls", description = "Repository URLs to add to the OBR service separated by whitespaces", required = true, multiValued = true) List<String> urls; protected void doExecute(RepositoryAdmin admin) throws Exception { for (String url : urls) { admin.addRepository(url); } persistRepositoryList(admin); } }
@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 = "bundle", name = "stop", description = "Stop bundles.") @Service public class Stop extends BundlesCommand { @Option(name = "-t", aliases={"--transient"}, description="Keep the bundle as auto-start", required = false, multiValued = false) boolean transientStop; public Stop() { defaultAllBundles = false; errorMessage = "Error stopping bundle"; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.stop(transientStop ? Bundle.STOP_TRANSIENT : 0); } }
@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 = "config", name = "property-delete", description = "Deletes a property from the configuration being edited.") @Service public class PropDelCommand extends ConfigPropertyCommandSupport { @Argument(index = 0, name = "property", description = "The name of the property to delete", required = true, multiValued = false) String prop; @Override public void propertyAction(TypedProperties props) { props.remove(prop); } }
@Command(scope = "bundle", name = "start", description = "Starts bundles.") @Service public class Start extends BundlesCommand { @Option(name = "-t", aliases={"--transient"}, description="Keep the bundle as auto-start", required = false, multiValued = false) boolean transientStart; public Start() { defaultAllBundles = false; errorMessage = "Error starting bundle "; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.start(transientStart ? Bundle.START_TRANSIENT : 0); } }
@Command(scope = "jms", name = "consume", description = "Consume messages from a JMS queue.") @Service public class ConsumeCommand extends JmsConnectionCommandSupport { @Argument(index = 1, name = "queue", description = "The JMS queue where to consume messages", required = true, multiValued = false) String queue; @Option(name = "-s", aliases = { "--selector" }, description = "The selector to use to select the messages to consume", required = false, multiValued = false) String selector; @Override public Object execute() throws Exception { System.out.println(getJmsService().consume(connectionFactory, queue, selector, username, password) + " message(s) consumed"); return null; } }
@Command(scope = "config", name = "property-delete", description = "Deletes a property from the configuration being edited.") @Service public class PropDelCommand extends ConfigPropertyCommandSupport { @Argument(index = 0, name = "property", description = "The name of the property to delete", required = true, multiValued = false) String prop; @Override public void propertyAction(TypedProperties props) { props.remove(prop); } }
@Command(scope = "topo", name = "delete-history", description="Deletes history of all users.") @Service public class DeleteHistoryCommand implements Action { @Reference public HistoryManager historyManager; @Override public Object execute() throws Exception { historyManager.deleteHistory(); return null; } }
@Command(scope = "bundle", name = "stop", description = "Stop bundles.") @Service public class Stop extends BundlesCommand { @Option(name = "-t", aliases={"--transient"}, description="Keep the bundle as auto-start", required = false, multiValued = false) boolean transientStop; public Stop() { defaultAllBundles = false; errorMessage = "Error stopping bundle"; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.stop(transientStop ? Bundle.STOP_TRANSIENT : 0); } }
@Command(scope = "obr", name = "deploy", description = "Deploys a list of bundles using OBR service.") @Service public class DeployCommand extends ObrCommandSupport { @Argument(index = 0, name = "bundles", description = "List of bundle names 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 = "-s", aliases = { "--start" }, description = "Start the deployed bundles", required = false, multiValued = false) protected boolean start = false; @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, start, deployOptional); } }
@Command(scope = "obr", name = "url-add", description = "Adds a list of repository URLs to the OBR service.") @Service public class AddUrlCommand extends ObrCommandSupport { @Argument(index = 0, name = "urls", description = "Repository URLs to add to the OBR service separated by whitespaces", required = true, multiValued = true) List<String> urls; protected void doExecute(RepositoryAdmin admin) throws Exception { for (String url : urls) { admin.addRepository(url); } persistRepositoryList(admin); } }
@Command(scope = "collection", name = "list-collectors", description = "Lists all of the available collectors.") @Service public class ListCollectors implements Action { @Reference ServiceCollectorRegistry registry; @Override public Object execute() throws Exception { registry.getCollectorClassNames().stream().sorted().forEachOrdered(e -> { System.out.printf("%s\n", e); }); return null; } }
@Command(scope = "bundle", name = "start", description = "Starts bundles.") @Service public class Start extends BundlesCommand { @Option(name = "-t", aliases={"--transient"}, description="Keep the bundle as auto-start", required = false, multiValued = false) boolean transientStart; public Start() { defaultAllBundles = false; errorMessage = "Error starting bundle "; } @Override protected void executeOnBundle(Bundle bundle) throws Exception { bundle.start(transientStart ? Bundle.START_TRANSIENT : 0); } }
@Command(scope = "asset-topology", name = "regenerate", description="Regeneates the asset topology for given providerId") @Service public class RegenerateAssetTopologyCommand implements Action { @Reference public AssetGraphMLProvider assetGraphMLProvider; @Argument(index = 0, name = "providerId", description = "Unique providerId of asset topology (optional)", required = false, multiValued = false) String providerId = new GeneratorConfig().getProviderId(); @Override public Object execute() { System.out.println("Regenerating Asset Topology for providerId=" + providerId); assetGraphMLProvider.regenerateAssetTopology(providerId); System.out.println("Regenerating Asset Topology for providerId=" + providerId); return null; } }
@Command(scope = "shell", name = "printf", description = "Formats and prints arguments.") @Service public class PrintfAction implements Action { @Argument(index = 0, name = "format", description = "The format pattern to use", required = true, multiValued = false) private String format; @Argument(index = 1, name = "arguments", description = "The arguments for the given format pattern", required = true, multiValued = true) private Collection<Object> arguments = null; @Override public Object execute() throws Exception { System.out.printf(format, arguments.toArray()); return null; } }
@Command(scope = "bsm", name = "render-graph", description="Renders the current state machine graph to a .png file.") @Service public class RenderGraphShellCommand implements Action { @Reference public BusinessServiceStateMachine businessServiceStateMachine; @Override public Object execute() throws Exception { File tempFile = File.createTempFile("bsm-state-machine", ".png"); businessServiceStateMachine.renderGraphToPng(tempFile); System.out.println("Succesfully rendered state machine graph to " + tempFile.getAbsolutePath()); return null; } }
@Service @Command(scope = "booking", name = "list", description = "List booking") public class ListBookingCommand implements Action { @Option(name = "--url", description = "Location of the REST service", required = false, multiValued = false) String restLocation = "http://localhost:8181/cxf/booking/"; @Override public Object execute() throws Exception { List providers = new ArrayList(); providers.add(new JacksonJsonProvider()); WebClient webClient = WebClient.create(restLocation, providers); List<Booking> bookings = (List<Booking>) webClient.accept(MediaType.APPLICATION_JSON).getCollection(Booking.class); for (Booking booking : bookings) { System.out.println(booking.getId() + " " + booking.getCustomer() + " " + booking.getFlight()); } return null; } }