Pulling together notes on what has been build to support federation in the tunk as it stands (just after TSS demo - March 07)
References
Raymond's architecture guide http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+Architecture+Guide
Some discussions from the dev list about contributio, discovery, federation and the TSS demo:
- First talk of contribution and assembly service http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3cE38CFB43-CEB5-456F-BDDD-C25BFFC3C238@apache.org%3e
- Mangament service intro http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3cBAY105-F38054BAB691DCF4F15BA77DDB80@phx.gbl%3e
- First talk of distributed/federated assemblies http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3c90B6915C-ED14-484A-873F-F26894C63DB2@apache.org%3e
- Resolve and verify phases of deployment http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3c2F2C595B-CCDA-4AB0-8BF9-A20CB4012F88@apache.org%3e
- JMX and standalone runtime http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/raw/%3c53EC6802E2BF4643BBD5BC34D2C3A38301B6C3F2@SPR3V4.office.local%3e/
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/raw/%3cBAY105-F20D5A6A881D4A9A3ED3D45DDBD0@phx.gbl%3e/ - Federated deployment
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3cE6925252-9922-4A65-8867-2B0E2B2BFA67@apache.org%3e
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200701.mbox/%3cBAY105-F33CE29B9024EDBB20FCA09DDA70@phx.gbl%3e
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200702.mbox/%3c53EC6802E2BF4643BBD5BC34D2C3A38301E41C94@SPR3V4.office.local%3e - Federation demo startup
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200703.mbox/%3cBAY105-F14D60CFBA31DA296B772EADD770@phx.gbl%3e - Meeraj code description
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200703.mbox/%3cBAY105-F7123B0C05FE260B65B8D3DD750@phx.gbl%3e - Meeraj note on running the demo
http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/200703.mbox/%3c53EC6802E2BF4643BBD5BC34D2C3A3830279C142@SPR3V4.office.local%3e
Building The Demo
From The TSS Tag
Follow instructions in README.txt here http://svn.apache.org/repos/asf/incubator/tuscany/java/distribution/sca/tsss-demo/
Unzip the resulting demo zip file
Meeraj's discussion of switching from JXTA to JSM http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg15731.html
I had problems in that some of the required dependency JARs were missing. I copied:
- tuscany-jms-discovery-0.1-incubating-SNAPSHOT.jar
- apache-activemq-4.1.0-incubator.jar
- tuscany-http-jetty-0.1-incubating-SNAPSHOT.jar
- jetty-6.1.0.jar
- jetty-util-6.1.0.jar
- tuscany-sca-console-0.1-incubating-SNAPSHOT.jar
- geronimo-j2ee-connector_1.5_spec-1.0.jar
into each of the profiles boot directories
Manually From Head
I couldn't get this to work as the core tests now fail
Debugging The Demo
When run originally the demo complained about missing dependencies. In particular when reading the system components (root.system) I got the error:
org.apache.tuscany.host.runtime.InitializationException: org.apache.tuscany.spi.
component.GroupInitializationException: sca://root.system/main
at org.apache.tuscany.core.runtime.AbstractRuntime.initialize(AbstractRu
ntime.java)
at org.apache.tuscany.standalone.server.TuscanyServer.startRuntime(Tusca
nyServer.java:134)
What this actually means is that Tuscany failed to load one of the system components successfully but, by default, doesn't tell what the issue is. I wanted to use Eclipse to debug it so I played about a bit but couldn't get the java -jar command line to come up in the Eclipse debugger. As a fall back I started a remote debugging session. There were three steps to this.
Add a trap to the code to give me a chance to attach the debugger. I added the following lines to the mainline of the:
System.out.println("press a key"); java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); String line = stdin.readLine();
Start java app with remote debugging enabled. There are plenty of references on the web on how to do this. Here is the comman line I used to start the master profile.
java -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n -Dtuscany.adminPort=2000 -jar server.start.jar ma ster
When the app comes up and stops at the trap connect the Eclipse debugger by selecting the remote debugging profile and specifying localhost:4142 as the connection details. The port number (4142) just comes from that specified on the application command line.
Turning Logging On
Its not clear how to do this just yet. Meeraj suggests that the missing nested exception detail can be printed out by specifying a log formatter. TODO.
Running The Demo
(From Meeraj's post on the subject)
This is how you start the servers (Please make sure you start ActiveMQ
before you start the servers) .
Master: java -Dtuscany.adminPort=2000 -jar server.start.jar master
Slave1: java -Dtuscany.adminPort=3000 -jar server.start.jar slave1
Slave2: java -Dtuscany.adminPort=4000 -jar server.start.jar slave2
You can access the admin console from http://localhost:7000/scdlForm and
if you target the deployed SCDL to slave1, access the demo appilcation
from http://localhsot:8000/calculatorForm. The test scdl is as follows
(this is what you submit from the admin console to target a deployment
to a slave),
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/2.0-alpha" name="CalculatorComposite"> <component runtimeId="slave1" name="CalculatorServiceComponent"> <implementation.java class="calculator.CalculatorServiceImpl"/> <reference name="addService" target="AddServiceComponent"/> <reference name="subtractService" target="SubtractServiceComponent"/> <reference name="multiplyService" target="MultiplyServiceComponent"/> <reference name="divideService" target="DivideServiceComponent"/> </component> <component runtimeId="slave1" name="AddServiceComponent"> <implementation.java class="calculator.AddServiceImpl"/> </component> <component runtimeId="slave1" name="SubtractServiceComponent"> <implementation.java class="calculator.SubtractServiceImpl"/> </component> <component runtimeId="slave1" name="MultiplyServiceComponent"> <implementation.java class="calculator.MultiplyServiceImpl"/> </component> <component runtimeId="slave1" name="DivideServiceComponent"> <implementation.java class="calculator.DivideServiceImpl"/> </component> </composite>
Here is the actual sequence of events:
Start ActiveMQ
java -Dtuscany.adminPort=2000 -jar server.start.jar master java -Dtuscany.adminPort=3000 -jar server.start.jar slave1 java -Dtuscany.adminPort=4000 -jar server.start.jar slave2
Each of these just reports "Started" on the command line
Go to http://localhost:7000/scdlForm in a browser and paste in the SCDL from above to configure slave1 to create and wire the calculator components.
Go to http://localhsot:8000/calculatorForm in a browser and see the form that drives the calculator sample. Type in a couple of numbers and press Add.