@Command(value = "restart", help = "Reload all plugins and default configurations") public void restart() throws Exception { reinitializeEvent.fire(new ReinitializeEnvironment()); }
@Command("remove-facet") public void removeFacet(@Option(required = true, completer = InstalledFacetsCompleter.class, description = "Name of the facet to install") final String facetName) { try { Facet facet = factory.getFacetByName(facetName); removeFacets.fire(new RemoveFacets(facet.getClass())); } catch (FacetNotFoundException e) { throw new RuntimeException("Could not find a facet with the name: " + facetName + "; use 'project list-facets' to list all available facets.", e); } }
@Command("list-properties") public void listProps(final PipeOut out) { DependencyFacet deps = project.getFacet(DependencyFacet.class); Map<String, String> properties = deps.getProperties(); for (Entry<String, String> entry : properties.entrySet()) { out.print(entry.getKey() + "="); out.println(ShellColor.BLUE, entry.getValue()); } }
@Command("install-facet") public void installFacet(@Option(required = true, completer = AvailableFacetsCompleter.class, description = "Name of the facet to install") final String facetName) { try { Facet facet = factory.getFacetByName(facetName); installFacets.fire(new InstallFacets(facet.getClass())); } catch (FacetNotFoundException e) { throw new RuntimeException("Could not find a facet with the name: " + facetName + "; use 'project list-facets' to list all available facets.", e); } }
@Command(value = "make-executable", help = "Make the resulting jar executable by specifying the target Main class") public void makeExecutable( @Option(name = "mainClass", description = "the fully qualified main class [e.g: com.example.Main]", type = PromptType.JAVA_CLASS, required = true) final String mainClass) throws XmlPullParserException, IOException { modifyConfiguration(new ModifyNode() { @Override public void modify(final Node configuration) { Node relocationNode = configuration .getOrCreate("transformers") .getOrCreate( "transformer@implementation=org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"); relocationNode.getOrCreate("mainClass").text(mainClass); } }); }
@Command(help = "Exclude a dependency from the uber-jar") public void exclude(@Option(completer = InstalledDependencyCompleter.class) final Dependency dep) { modifyConfiguration(new ModifyNode() { @Override public void modify(final Node configuration) { Node excludes = configuration .getOrCreate("artifactSet") .getOrCreate("excludes"); for (Node n : excludes.get("exclude")) { if (DependencyBuilder.areEquivalent(DependencyBuilder.create(n.getText()), dep)) { return; } } excludes.createChild("exclude").text(dep.getGroupId() + ":" + dep.getArtifactId()); } }); }
@Command(value = "list-dependencies", help = "List all dependencies this project includes") public void listDeps(final PipeOut out) { DependencyFacet deps = project.getFacet(DependencyFacet.class); for (Dependency dep : deps.getDependencies()) { printDep(out, dep); } }
/** * Print SwitchYard version used in this application. * @param out shell output */ @Command(value = "get-version", help = "Show the version of SwitchYard used by this application.") public void getVersion(final PipeOut out) { String version = _project.getFacet(SwitchYardFacet.class).getVersion(); out.println("SwitchYard version " + version); }
@Command("update") public void updateDependencies() { if (!new VersionUpdater(project, shell, this.factory, manager).update()) { shell.println("No nothing to update"); } }
@Command(help = "Add a dependency to the uber-jar") public void include(@Option(completer = InstalledDependencyCompleter.class, description = "the dependency pattern to include [e.g: com.example.*:*]") final Dependency dep) { modifyConfiguration(new ModifyNode() { @Override public void modify(final Node configuration) { Node excludes = configuration .getOrCreate("artifactSet") .getOrCreate("includes"); for (Node n : excludes.get("include")) { if (DependencyBuilder.areEquivalent(DependencyBuilder.create(n.getText()), dep)) { return; } } excludes.createChild("include").text(dep.getGroupId() + ":" + dep.getArtifactId()); } }); }
@Command(value = "list-managed-dependencies", help = "List all managed dependencies this project includes") public void listManDeps(final PipeOut out) { DependencyFacet manDeps = project.getFacet(DependencyFacet.class); for (Dependency manDep : manDeps.getManagedDependencies()) { printDep(out, manDep); } }
@Command(value = "custom", help = "Add a custom field to an existing @Entity class") public void newCustomField( @Option(name = "named", required = true, description = "The field name", type = PromptType.JAVA_VARIABLE_NAME) final String fieldName, @Option(name = "type", required = true, type = PromptType.JAVA_CLASS, description = "The qualified Class to be used as this field's type") final String type ) { try { JavaClass entity = getJavaClass(); String javaType = (type.toLowerCase().endsWith(".java")) ? type.substring(0, type.length() - 5) : type; addFieldTo(entity, javaType, fieldName, Column.class); } catch (FileNotFoundException e) { shell.println("Could not locate the @Entity requested. No update was made."); } }
@Command(value = "list-plugins", help = "List all installed plugin JAR files.") public void listInstalled(PipeOut out, String input) { List<PluginEntry> plugins = InstalledPluginRegistry.list(); for (PluginEntry plugin : plugins) { if (Strings.isNullOrEmpty(input) || plugin.toString().contains(input)) { out.println(plugin.toString()); } } }
@Command(help = "Reset the current shade configuration (includes all dependencies).") public void reset() throws XmlPullParserException, IOException { assertInstalled(); if (shell.promptBoolean("Really reset configuration?")) { removeShadePlugin(); install(); } }
@Command("new-view") public void newView(final PipeOut out, @Option(name = "target") final Resource<?> target)
@Command("list-decorators") public void listDecorators(final PipeOut out) { CDIFacet cdi = project.getFacet(CDIFacet.class); List<String> decorators = cdi.getConfig().getDecorators(); for (String d : decorators) { out.println(d); } }
@Command("list-interceptors") public void listInterceptors(final PipeOut out) { CDIFacet cdi = project.getFacet(CDIFacet.class); List<String> interceptors = cdi.getConfig().getInterceptors(); for (String i : interceptors) { out.println(i); } }
@Command(help = "Setup the basic shade configuration (includes all dependencies)") public void setup(final PipeOut out) throws XmlPullParserException, IOException { if (!isInstalled()) { install(); } if (isInstalled()) { ShellMessages.success(out, "Shade plugin is installed."); } }
@Command("add-plugin") public void addPlugin( @Option(description = "dependency identifier of plugin, ex: \"org.jboss.forge:forge-maven-plugin:1.0.0.Final\"", required = true) final Dependency gav, final PipeOut out) { MavenPluginBuilder plugin = MavenPluginBuilder.create().setDependency(gav); if (!mavenPluginInstaller.isInstalled(project, plugin)) { mavenPluginInstaller.install(project, plugin); } }