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();
}
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();
}
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();
}
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();
}
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());
}
Aggregations