From b353e3e307655d9375a12fd5760b40bf2a710db2 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Wed, 18 Jul 2012 13:55:13 +0300 Subject: [PATCH] update sample --- samples/helloworld/build.gradle | 5 ++--- .../commands/HelloWorldCommands.java | 19 +++++++------------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/samples/helloworld/build.gradle b/samples/helloworld/build.gradle index 52b7e949..3548045d 100644 --- a/samples/helloworld/build.gradle +++ b/samples/helloworld/build.gradle @@ -5,9 +5,8 @@ apply plugin: 'eclipse' apply plugin: 'application' repositories { - mavenCentral() maven { url "http://repo.springsource.org/snapshot" } - maven { url "http://repo.springsource.org/release" } + maven { url "http://repo.springsource.org/libs-snapshot" } maven { url "http://repo.springsource.org/milestone" } maven { url "http://spring-roo-repository.springsource.org/release" } } @@ -19,4 +18,4 @@ dependencies { mainClassName = "org.springframework.shell.Bootstrap" -defaultTasks 'clean', 'build', 'copyDependency' +defaultTasks 'installApp' diff --git a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java index cd83f124..56cdb583 100644 --- a/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java +++ b/samples/helloworld/src/main/java/org/springframework/shell/samples/helloworld/commands/HelloWorldCommands.java @@ -1,8 +1,5 @@ package org.springframework.shell.samples.helloworld.commands; - -import java.util.logging.Logger; - import org.springframework.shell.core.CommandMarker; import org.springframework.shell.core.annotation.CliAvailabilityIndicator; import org.springframework.shell.core.annotation.CliCommand; @@ -12,8 +9,6 @@ import org.springframework.stereotype.Component; @Component public class HelloWorldCommands implements CommandMarker { - protected final Logger LOG = Logger.getLogger(getClass().getName()); - private boolean simpleCommandExecuted = false; @CliAvailabilityIndicator({"hw simple"}) @@ -32,27 +27,27 @@ public class HelloWorldCommands implements CommandMarker { } @CliCommand(value = "hw simple", help = "Print a simple hello world message") - public void simple( + public String simple( @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message, @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello", specifiedDefaultValue="At work") final String location) { - LOG.info("Message = [" + message + "] Location = [" + location + "]"); simpleCommandExecuted = true; + return "Message = [" + message + "] Location = [" + location + "]"; } @CliCommand(value = "hw complex", help = "Print a complex hello world message") - public void hello( + public String hello( @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final String message, @CliOption(key = { "name1"}, mandatory = true, help = "Say hello to the first name") final String name1, @CliOption(key = { "name2" }, mandatory = true, help = "Say hello to a second name") final String name2, @CliOption(key = { "time" }, mandatory = false, specifiedDefaultValue="now", help = "When you are saying hello") final String time, @CliOption(key = { "location" }, mandatory = false, help = "Where you are saying hello") final String location) { - LOG.info("Hello " + name1 + " and " + name2 + ". Your special message is " + message + ". time=[" + time + "] location=[" + location + "]"); + return "Hello " + name1 + " and " + name2 + ". Your special message is " + message + ". time=[" + time + "] location=[" + location + "]"; } @CliCommand(value = "hw enum", help = "Print a simple hello world message from an enumerated value") - public void eenum( + public String eenum( @CliOption(key = { "message" }, mandatory = true, help = "The hello world message") final MessageType message){ - LOG.info("Hello. You special enumerated message is " + message); + return "Hello. Your special enumerated message is " + message; } enum MessageType { @@ -70,4 +65,4 @@ public class HelloWorldCommands implements CommandMarker { return type; } } -} +} \ No newline at end of file