diff options
Diffstat (limited to 'branches/sca-java-20080910/samples/calculator-implementation-policies/README')
-rw-r--r-- | branches/sca-java-20080910/samples/calculator-implementation-policies/README | 266 |
1 files changed, 0 insertions, 266 deletions
diff --git a/branches/sca-java-20080910/samples/calculator-implementation-policies/README b/branches/sca-java-20080910/samples/calculator-implementation-policies/README deleted file mode 100644 index bd66eee1c9..0000000000 --- a/branches/sca-java-20080910/samples/calculator-implementation-policies/README +++ /dev/null @@ -1,266 +0,0 @@ -Calculator Implementation Policies Sample
-=========================================
-This sample builds over simple calculator sample to demonstrate how Implementation Policies can
-be use in Tuscany SCA Java.
-
-The README in the samples directory (the directory above this) provides
-general instructions about building and running samples. Take a look there
-first.
-
-If you just want to run the sample to see what happens open a command prompt, navigate
-to this sample directory and do:
-
-ant run
-
-OR if you don't have ant, on Windows do
-
-java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
-
-and on *nix do
-
-java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
-
-
-Sample Overview
----------------
-The sample provides the calculator service with a default SCA (java) binding. The 'logging' policy
-which is handled by the Tuscany SCA java policy-logging module is used in this calculator
-composite to specify the need for 'logging'. The MultiplyService Component specifies for 'jassAuthentication'
-which is one way of implemention login authentication, using the Java Authentication and Authorization Service.
-
-The logging intent and policyset that is to be used by this calculator application must be
-defined in the definitions.xml file. Here we use the policyset structure already defined in
-Tuscany for logging under the policy-logging and hence there is no need to specify the policyset processors
-and policy handler classes as part of this application.
-
-Similarly the jaasAuthentication intent and policyset also is defined in the definitions.xml file
-of this sample. This sample uses the calculator.security.JaasLoginModule class for handling the
-authentication functions. Right now there is a simply matching of userid and passwords that happens in this
-class. Applications could implement their own sophisticated authentication mechanisms. For more information
-on how to do this please look up Java Authentication and Authorization Service documentation. The sample
-also use the calculator.security.CalculatorCallbackHandler to fetch the userid and password to be use for the
-login authentication. This handler presently uses hardcoded userids and passwords. Applications could
-typically use this handler to prompt for userid and passwords.
-
-There are two components that provide the calculator service namely 'CalculatorServiceComponent'
-and 'AnotherCalculatorServiceComponent'. The logging intent is specified for the 'subtract' and 'divide'
-operations of the 'CalculatorServiceCompnent' implementation, and on the entire implementation
-(i.e. all operations) for the AddServiceComponent and AnotherCalculatorServiceComponent.
-
-The CalculatorClient first exercises the CalculatorServiceComponent calling add,
-subtract, multiply and divide operations. This results in logging messages appearing on the
-console for 'add', 'subtract' and 'divide' operations. The CalculatorClient then exercises the
-AnotherCalculatorServiceComponent calling all the service methods. This will result in logging messages
-printed on the console for all the operations. For the 'add' operation there will be two sets of messages
-printed - one that has resulted from specifying the 'logging' intent on the implementation element of the
-'AnotherCalculatorServiceComponent' and another from specifying the 'logging' intent on the
-'AddServiceComponent'
-
-The jaasAuthentication intent is specified for the 'MultiplyServiceComponent'. So everytime this component
-is invoke an authentication is attempted and only if it succeeds, is the multiply function is invoked. The
-console prints messages that denote if the authentication has succeeded or failed.
-
-Thus this sample demonstrates how intents could be applied to either implementations as a whole or to some
-selective operations on an implementation.
-
-
-calculator/
- src/
- main/
- java/
- calculator/
- CalculatorService.java - the first component, calls +-/* as
- appropriate
- CalculatorServiceImpl.java
- AddService.java - adds two numbers
- AddServiceImpl.java
- SubtractService.java - subtracts one number from another
- SubtractServiceImpl.java
- MultiplyService.java - multiplies two numbers
- MultiplyServiceImpl.java
- DivideService.java - divides one number by another
- DivideServiceImpl.java
- CalculatorClient.java - starts the SCA Runtime and
- deploys the Calculator.composite.
- It then calls the deployed Calculator
- Components services
- calculator/security
- JaasLoginModule.java JaasLoginModule implementation for this sample
- CalculatorCallbackHandler.java JAAS callbackhandler for fetching userid and password
-
-
- resources/
- Calculator.composite - the SCA assembly for this sample
- definitions.xml - sca definitions file that defines the 'logging' intent
- and policyset
- used by this application
- CalculatorLogMessages.properties - A resource bundle contain the log messages to be
- used.
- CalculatorJaas.config - JAAS Login Configuration file
-
- test/
- java/
- calculator/
- CalculatorTestCase.java - JUnit test case
- calculator.png - a pictorial representation of the sample
- .composite file
- build.xml - the Ant build file
- pom.xml - the Maven build file
-
-
-
-Building And Running The Sample Using Ant
------------------------------------------
-With the binary distribution the sample can be built and run using Ant as
-follows
-
-cd calculator-implementation-policies
-ant compile
-ant run
-
-You should see the following output from the run target.
-
-run:
- [java] Calling CalculatorServiceComponent configured with 'logging' policy for subtract and divide operations...
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - add
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - add
- [java] 3 + 2=5.0
- [java] 3 - 2=1.0
- [java] 3 * 2=6.0
- [java] 3 / 2=1.5
- [java] Calling CalculatorServiceComponent configured with 'logging' for all operations in the implementation...
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - subtract
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - subtract
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - divide
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - divide
- [java] Nov 23, 2007 1:06:10 PM
- [java] 3 + 2=5.0
- [java] 3 - 2=1.0
- [java] 3 * 2=6.0
- [java] INFO: Invoking operation - add
- [java] 3 / 2=1.5
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - add
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - add
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - add
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - subtract
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - subtract
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - multiply
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - multiply
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Invoking operation - divide
- [java] Nov 23, 2007 1:06:10 PM
- [java] INFO: Returned from operation - divide
-
-Building And Running The Sample Using Maven
--------------------------------------------
-With either the binary or source distributions the sample can be built and run
-using Maven as follows.
-
-cd calculator
-mvn
-
-You should see the following output from the test phase. Notice the log messages.
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running calculator.CalculatorTestCase
-Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error
-WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/
-classes/Calculator.composite, line: 28, column: 4
-cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www.
-osoa.org/xmlns/sca/1.0"]}' is expected.
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation add with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation add with return value 5
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - subtract
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation subtract with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - subtract
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation subtract with return value 1
-Successfully AUTHENTICATED!!
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - divide
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation divide with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - divide
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation divide with return value 1.5
-Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error
-WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/
-classes/Calculator.composite, line: 28, column: 4
-cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www.
-osoa.org/xmlns/sca/1.0"]}' is expected.
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation add with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation add with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation add with return value 5
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - add
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation add with return value 5
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - subtract
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation subtract with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - subtract
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation subtract with return value 1
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - multiply
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation multiply with arguments 3.0, 2.0,
-Successfully AUTHENTICATED!!
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - multiply
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation multiply with return value 6
-Dec 18, 2007 12:05:06 PM
-INFO: Invoking operation - divide
-Dec 18, 2007 12:05:06 PM
-FINER: Inovoking operation divide with arguments 3.0, 2.0,
-Dec 18, 2007 12:05:06 PM
-INFO: Returned from operation - divide
-Dec 18, 2007 12:05:06 PM
-FINER: Returning from operation divide with return value 1.5
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.823 sec
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-This shows that the Junit test cases have run successfully.
|