Search in sources :

Example 6 with CliCommand

use of org.springframework.roo.shell.CliCommand in project spring-roo by spring-projects.

the class PgpCommands method keyView.

@CliCommand(value = "pgp key view", help = "Downloads a remote key and displays it to the user (does not change any trusts)")
public String keyView(@CliOption(key = "keyId", mandatory = true, help = "The key ID to view (eg 00B5050F or 0x00B5050F)") final PgpKeyId keyId) {
    final PGPPublicKeyRing keyRing = pgpService.getPublicKey(keyId);
    final StringBuilder sb = new StringBuilder();
    formatKeyRing(sb, keyRing);
    return sb.toString();
}
Also used : PGPPublicKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing) CliCommand(org.springframework.roo.shell.CliCommand)

Example 7 with CliCommand

use of org.springframework.roo.shell.CliCommand in project spring-roo by spring-projects.

the class PgpCommands method listTrustedKeys.

@CliCommand(value = "pgp list trusted keys", help = "Lists the keys you currently trust and have not been revoked at the time last downloaded from a public key server")
public String listTrustedKeys() {
    final List<PGPPublicKeyRing> keyRings = pgpService.getTrustedKeys();
    if (keyRings.isEmpty()) {
        final StringBuilder sb = new StringBuilder();
        appendLine(sb, "No keys trusted; use 'pgp trust' to add a key or 'pgp automatic trust' for automatic key addition");
        return sb.toString();
    }
    final StringBuilder sb = new StringBuilder();
    for (final PGPPublicKeyRing keyRing : keyRings) {
        formatKeyRing(sb, keyRing);
    }
    return sb.toString();
}
Also used : PGPPublicKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing) CliCommand(org.springframework.roo.shell.CliCommand)

Example 8 with CliCommand

use of org.springframework.roo.shell.CliCommand in project spring-roo by spring-projects.

the class MetadataCommands method metadataForType.

@CliCommand(value = METADATA_FOR_TYPE_COMMAND, help = "Shows detailed metadata for the indicated type.")
public String metadataForType(@CliOption(key = { "", "type" }, mandatory = true, help = "The Java type for which to display metadata. When working on a single module " + "project, simply specify the name of the class. If you consider it necessary, you can " + "also specify the package. Ex.: `--type ~.domain.MyClass` (where `~` is the base package). " + "When working with multiple modules, you should specify the name of the class and the " + "module where it is. Ex.: `--type model:~.domain.MyClass`. If the module is not " + "specified, it is assumed that the class is in the module which has the focus.") final JavaType javaType) {
    final String id = typeLocationService.getPhysicalTypeIdentifier(javaType);
    if (id == null) {
        return "Cannot locate source for " + javaType.getFullyQualifiedTypeName();
    }
    final StringBuilder sb = new StringBuilder();
    sb.append("Java Type  : ").append(javaType.getFullyQualifiedTypeName()).append(System.getProperty("line.separator"));
    final ClassOrInterfaceTypeDetails javaTypeDetails = typeLocationService.getTypeDetails(javaType);
    if (javaTypeDetails == null) {
        sb.append("Java type details unavailable").append(System.getProperty("line.separator"));
    } else {
        for (final MemberHoldingTypeDetails holder : memberDetailsScanner.getMemberDetails(getClass().getName(), javaTypeDetails).getDetails()) {
            sb.append("Member scan: ").append(holder.getDeclaredByMetadataId()).append(System.getProperty("line.separator"));
        }
    }
    sb.append(metadataForId(id));
    return sb.toString();
}
Also used : MemberHoldingTypeDetails(org.springframework.roo.classpath.details.MemberHoldingTypeDetails) ClassOrInterfaceTypeDetails(org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails) CliCommand(org.springframework.roo.shell.CliCommand)

Example 9 with CliCommand

use of org.springframework.roo.shell.CliCommand in project spring-roo by spring-projects.

the class MetadataCommands method metadataTimings.

@CliCommand(value = METADATA_STATUS_COMMAND, help = "Shows metadata statistics of the current project.")
public String metadataTimings() {
    final StringBuilder sb = new StringBuilder();
    for (final MetadataTimingStatistic stat : metadataLogger.getTimings()) {
        sb.append(stat.toString()).append(LINE_SEPARATOR);
    }
    sb.append(metadataService.toString());
    return sb.toString();
}
Also used : MetadataTimingStatistic(org.springframework.roo.metadata.MetadataTimingStatistic) CliCommand(org.springframework.roo.shell.CliCommand)

Example 10 with CliCommand

use of org.springframework.roo.shell.CliCommand in project spring-roo by spring-projects.

the class CacheCommands method cacheSetup.

/**
 * Method that register "cache setup" command on Spring Roo Shell.
 *
 * Installs support for intermediate memory. Users can specify different providers
 * to use for managing it.
 *
 * @param provider
 *            the String with the name of a provider to use for intermediate memory managing.
 * @param shellContext
 *            ShellContext used to know if --force parameter has been used by developer
 */
@CliCommand(value = "cache setup", help = "Installs support for using intermediate memory in generated project by using Spring Cache abstraction. Users can specify different providers to use for managing it.")
public void cacheSetup(@CliOption(key = "provider", mandatory = false, help = "Parameter that indicates the provider to use for managing intermediate memory. " + "Possible values are: `GUAVA`.") String provider, ShellContext shellContext) {
    // Check for provider value
    CacheProvider selectedCacheProvider = null;
    if (StringUtils.isNotBlank(provider)) {
        for (CacheProvider cacheProvider : getCacheProviders()) {
            if (provider.equals(cacheProvider.getName())) {
                selectedCacheProvider = cacheProvider;
            }
        }
    }
    cacheOperations.setupCache(selectedCacheProvider, shellContext.getProfile());
}
Also used : CacheProvider(org.springframework.roo.addon.cache.providers.CacheProvider) CliCommand(org.springframework.roo.shell.CliCommand)

Aggregations

CliCommand (org.springframework.roo.shell.CliCommand)26 ClassOrInterfaceTypeDetails (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails)12 ArrayList (java.util.ArrayList)4 PGPPublicKeyRing (org.bouncycastle.openpgp.PGPPublicKeyRing)4 IOException (java.io.IOException)3 Pom (org.springframework.roo.project.maven.Pom)3 TemplateException (freemarker.template.TemplateException)2 Annotation (java.lang.annotation.Annotation)2 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 TreeMap (java.util.TreeMap)2 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)2 ServiceReference (org.osgi.framework.ServiceReference)2 JavaPackage (org.springframework.roo.model.JavaPackage)2 CliOption (org.springframework.roo.shell.CliOption)2 CommandMarker (org.springframework.roo.shell.CommandMarker)2 MethodTarget (org.springframework.roo.shell.MethodTarget)2 Configuration (freemarker.template.Configuration)1 Template (freemarker.template.Template)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1