private void outputConstraintAdded(String property, Class<? extends java.lang.annotation.Annotation> constraintClass) { shell.println("Constraint " + constraintClass.getSimpleName() + " has been successfully added on property named '" + property + "'\n"); } }
protected Project initializeJavaProject() throws Exception { getShell().setCurrentResource(createTempFolder()); queueInputLines(""); getShell().execute("new-project --named test --topLevelPackage com.test"); Project project = getProject(); tempFolder = project.getProjectRoot(); tempFolders.add(tempFolder); return project; }
private PackagingType updatePackaging(final Facet facet) throws Abort { List<PackagingType> types = ConstraintInspector.getCompatiblePackagingTypes(facet.getClass()); String facetName = ConstraintInspector.getName(facet.getClass()); PackagingType packaging = project.getFacet(PackagingFacet.class).getPackagingType(); if (types.isEmpty() || types.contains(packaging)) { return null; } else if (shell.promptBoolean("Facet [" + facetName + "] requires packaging type(s) " + types + ", but is currently [" + packaging + "]. Update packaging? (Note: this could deactivate other plugins in your project.)")) { if (types.size() == 1) { return types.get(0); } else { return shell.promptChoiceTyped("Select a new packaging type:", types); } } else { throw new Abort(); } }
@Override public boolean keyPress(final int key) { if (!shell.isExecuting() && (key == 4)) { if (this.numEOFs < ignoreEOFs) { shell.println(); shell.println("(Press CTRL-D again or type 'exit' to quit.)"); this.numEOFs++; } else { shell.println("exit"); shutdown.fire(new Shutdown(Status.NORMAL)); } return true; } return false; }
@DefaultCommand public void run() { shell.println(shell.getCurrentResource().getFullyQualifiedName()); } }
@DefaultCommand public void run() { shell.println(shell.getCurrentDirectory().getFullyQualifiedName()); } }
dir = shell.getCurrentDirectory().getChildDirectory(name); || !shell.promptBoolean("Use [" + dir.getFullyQualifiedName() + "] as project directory?"))) if (shell.getCurrentResource() == null) dir = shell.getCurrentDirectory(); do newDir = shell.getCurrentDirectory(); shell.println(); if (!projectFactory.containsProject(newDir.reify(DirectoryResource.class))) newDir = shell.promptFile( "Where would you like to create the project? [Press ENTER to use the current directory: " + newDir + "]", dir); newDir = shell.promptFile("Where would you like to create the project?"); && shell.promptBoolean("Add new project as a sub-project of [" + parentDir.getFullyQualifiedName() + "]?")) shell.setCurrentResource(project.getProjectRoot()); ShellMessages.success(out, "Created project [" + name + "] in new working directory [" + dir.getFullyQualifiedName() + "]");
/** * Display info about the analytics usage */ @Command("info") public void displayInfo() { shell.print("Analytics is: "); shell.println(ShellColor.BOLD, isEnabled() ? "enabled" : "disabled"); Date lastRunDate = getLastRunDate(); if (lastRunDate != null) { DateFormat dateInstance = DateFormat.getDateInstance(DateFormat.LONG); shell.print("Analytics was last run at: "); shell.println(ShellColor.BOLD, dateInstance.format(lastRunDate)); } shell.print("Forge Version: "); shell.println(ShellColor.BOLD, getForgeVersion()); shell.print("Operating System: "); shell.println(ShellColor.BOLD, getOS()); shell.print("Java Version: "); shell.println(ShellColor.BOLD, getJavaVersion()); shell.print("Installed Plugins: "); shell.println(ShellColor.BOLD, getInstalledPlugins().toString()); }
final PipeOut out) { ValidateModel validate = null; ValidatorTypes validatorType = _shell.promptChoiceTyped("Choose validator type", Arrays.asList(ValidatorTypes.values())); String clazz = _shell.promptCommon("Validator class name", PromptType.JAVA_CLASS); javaValidate.setClazz(clazz); validate = javaValidate; XmlSchemaType schemaType = _shell.promptChoiceTyped("Schema type", Arrays.asList(XmlSchemaType.values())); xmlValidate.setSchemaType(schemaType); String schemaCatalog = _shell.promptCommon("Schema catalog file location (if needed)", PromptType.ANY); if (schemaCatalog != null && schemaCatalog.trim().length() > 0) { FileEntryModel entry = new V1FileEntryModel(ValidateNamespace.DEFAULT.uri()).setFile(schemaCatalog); String schemaFile = _shell.promptCommon("Schema file location", PromptType.ANY); FileEntryModel entry = new V1FileEntryModel(ValidateNamespace.DEFAULT.uri()).setFile(schemaFile); SchemaFilesModel files = new V1SchemaFilesModel(ValidateNamespace.DEFAULT.uri()).addEntry(entry); xmlValidate.setSchemaFiles(files); boolean namespaceAware = _shell.promptBoolean("Namespace aware?"); xmlValidate.setNamespaceAware(namespaceAware); boolean failOnWarn = _shell.promptBoolean("Fail on warning?"); xmlValidate.setFailOnWarning(failOnWarn); validate = xmlValidate;
PathspecParser pathspecParser = new PathspecParser(resourceFactory, shell.getCurrentResource(), path); List<Resource<?>> targets = pathspecParser.search(); shell.println("No such resource"); shell.println("Multiple targets"); shell.println("----------------"); int offset = shell.getCurrentResource().getFullyQualifiedName().length(); shell.println(" --> ." + r.getFullyQualifiedName().substring(offset)); shell.setCurrentResource(resource); if (shell.getCurrentResource() == null) shell.println("No such resource: " + resource); return; shell.println("Picked up type <" + shell.getCurrentResource().getClass().getSimpleName() + ">: " + resource);
if (lineBuffer.getCurrentLine() - shell.getHeight() + 1 == 0) String bottomLineReset = new Ansi().cursor(shell.getAbsoluteHeight(), 0).toString(); shell.print(statusBarCache = new StringBuilder(bottomLineReset) .append(attr(47, 30)) .append(prompt) .append(pad(shell.getWidth() - prompt.length())) .append(attr(0)) .append(bottomLineReset) .append(attr(0)).toString()); shell.flush(); int scanCode = shell.scan(); case 'J': case 16: lineBuffer.rewindBuffer(shell.getHeight() - 1, lineBuffer.getCurrentLine() - 1); lineBuffer.setLineWidth(shell.getWidth()); return -1; lineBuffer.rewindBuffer(shell.getHeight() - 1, lineBuffer.getCurrentLine() - shell.getHeight()); lineBuffer.setLineWidth(shell.getWidth()); return -1; case 14: case '\n': lineBuffer.setLineWidth(shell.getWidth()); return -2;
entityPackage = shell.promptCommon( "In which package you'd like to create this @Entity, or enter for default", PromptType.JAVA_PACKAGE, jpa.getEntityPackage()); shell.println("Created @Entity [" + javaClass.getQualifiedName() + "]"); shell.execute("pick-up " + javaFileLocation.getFullyQualifiedName().replace(" ", "\\ "));
if (!option.hasCustomCompleter()) value = shell.promptEnum(optionDescriptor, (Class<Enum>) option.getType()); value = shell.promptCompleter(optionDescriptor, option.getCompleterType()); value = shell.promptCommon(optionDescriptor, promptType, defaultPackage); value = shell.promptCommon(optionDescriptor, promptType); value = shell.promptEnum(optionDescriptor, (Class<Enum>) option.getType()); value = shell.promptBoolean(optionDescriptor); value = shell.promptFile(optionDescriptor); value = shell.promptCommon(optionDescriptor, promptType); value = shell.prompt(optionDescriptor);
if (_shell.promptBoolean("backup standalone.xml '" + backup.getAbsolutePath() + "' already exists: remove it?")) { backup.delete(); } else {
ejbPackage = shell.promptCommon( "In which package you'd like to create this EJB class, or enter for default", PromptType.JAVA_PACKAGE, javaSourceFacet.getBasePackage()); if (shell.promptBoolean("The EJB class already exists, do you want to overwrite it?")) String destinationType = shell.promptCommon( "Destination type: javax.jms.Queue or javax.jms.Topic:", PromptType.JAVA_CLASS, JMSDestinationType.QUEUE.getDestinationType()); String destinationName = shell.promptCommon("Destination Name:", PromptType.ANY, "queue/test"); ejb.addImport(ActivationConfigProperty.class); shell.setCurrentResource(resource);
public void cmd(final String cmd) throws Exception { shell.execute(cmd); } }
throws IOException, ClientProtocolException String defaultRepo = getDefaultRepo(shell.getEnvironment()); InputStream repoStream = getCachedRepoStream(getDefaultRepo(shell.getEnvironment()), shell.getEnvironment()); if (repoStream == null) shell.print("Connecting to remote repository [" + defaultRepo + "]... "); DefaultHttpClient client = new DefaultHttpClient(); configureProxy(ProxySettings.fromForgeConfiguration(config), client); shell.println("connected!"); break; shell.println("failed! (plugin index not found: " + defaultRepo + ")"); return null; shell.println("failed! (server returned status code: " + httpResponse.getStatusLine().getStatusCode()); return null; setCachedRepoStream(defaultRepo, shell.getEnvironment(), repoStream); repoStream = getCachedRepoStream(getDefaultRepo(shell.getEnvironment()), shell.getEnvironment());
@Before public void beforeTest() throws Exception { shell.setOutputStream(output); shell.setAnsiSupported(false); shell.setCurrentResource(createTempFolder()); beanManager.fireEvent(new Startup()); beanManager.fireEvent(new PostStartup()); shell.setVerbose(true); shell.setExceptionHandlingEnabled(false); resetInputQueue(); }
bindingDescList.add(binding.getModelConfiguration().toString()); BindingModel binding = bindingList.get(_shell.promptChoice("Which binding to add", bindingDescList)); OperationSelectorType type = _shell.promptChoiceTyped("Type of operation selector", Arrays.asList(OperationSelectorType.values())); switch (type) { case Static: StaticOperationSelectorModel staticSelector = new V1StaticOperationSelectorModel(switchYardNamespace); String op = _shell.promptCommon("Operation name", PromptType.ANY); staticSelector.setOperationName(op); selector = staticSelector; String xpath = _shell.promptCommon("XPath expression", PromptType.ANY); xpathSelector.setExpression(xpath); selector = xpathSelector; String regex = _shell.promptCommon("Regular expression", PromptType.ANY); regexSelector.setExpression(regex); selector = regexSelector; String clazz = _shell.promptCommon("Class name", PromptType.JAVA_CLASS); javaSelector.setClazz(clazz); selector = javaSelector;