The Tuscany helloworld sample shows using the Tuscany SCA runtime in a J2SE environment loading a component that implements the classic introductory hello world example.
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-helloworld-incubating-M1.jar helloworld.HelloWorldClient
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-helloworld-incubating-M1.jar helloworld.HelloWorldClient
The sample when run should simply display to the standard
output:
Hello World
src +---main +---java ¦ +---helloworld ¦ HelloWorldClient.java ¦ HelloWorldImpl.java ¦ HelloWorldService.java ¦ +---resources sca.module |
sca.module | Defines the SCA module and component. Defines for the HelloWorldServiceComponent component the Java class that implements that component |
HelloWorldService.java | Defines the Java interface implemented by the component. |
HelloWorldImpl.java | Implements the SCA component. Uses the SCA service annotation tag on the class to show what SCA interface is being implemented. |
HelloWorldClient.java | Creates a Tuscany runtime and starts it. Obtains the module context which was defined by the sca.module file. From the module context locates the HelloWorldServiceComponent and then calls the getGreetings method to invoke the component. |