summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.4/samples/domain-management/README
blob: 540cbc3bc0044978935cc7b516e91e6dad0685bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
Domain Management Sample Tasks
==============================
This sample shows how to use a subset of Tuscany to read contribution metadata, 
analyze and resolve contribution dependencies given a set of available contributions.

The README in the samples directory (the directory above this) provides 
general instructions about building and running samples. Take a look there first.

Sample Overview
---------------

This sample demonstrates how to use some of the APIs for processing the contributions.
These APIs are currently used under the cover in the domain manager.

domain-management/
  src/
    main/
      java/
        manager/
	  DistributeAndRunComponents.java
	  DistributeComponents.java
	  ListComponents.java
	  ListDependencies.java
	  ListDeployables.java
  	  WireComponents.java
      resources/
    test/
      java/
	services/
	  Cart.java
	  Item.java
	  ShoppingCartClientImpl.java
	  ShoppingCartImpl.java
	resources/
	  assembly/
	    assets.xml
	    client.xml
            store.xml
	  assets/
	    META-INF/
	      sca-contribution.xml
	  client/
	    META-INF/
	      client.composite
	  store/
	    META-INF/
	      sca-contribution.xml
	    store.composite
    build.xml
    pom.xml
    README

Building the Sample Using Maven 
-------------------------------------------

cd domain-management
mvn

** Please note that the mvn command will just build the sample and will install the required jar files into the Maven repository.
** In order to run the sample, please see the instructions - "Running the Sample"

Running the Sample
------------------

** Please make sure that sample is built using above build command(s).

This sample implements following sample domain management tasks:

1. List deployables in a contribution:
  ------------------------------------

   - This sample reads the SCA metadata for two sample contributions and prints the names of their deployable composites.

   - Use the following command to run the sample:
	
	On windows do:
	java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-domain-management.jar manager.ListDeployables	

	On *nix do: 		
	java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-domain-management.jar manager.ListDeployables

   - You should see the following output:
	
	Deployable: {http://store}store

2. List contribution dependencies:
  --------------------------------

   - The sample reads the SCA metadata for two sample contributions and prints their dependencies.

   - Use the following command to run the sample:

	On windows do:
	java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-domain-management.jar manager.ListDependencies
	
	On *nix do:	
	java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-domain-management.jar manager.ListDependencies

   - You should see the following output:

	Contribution: store
	dependency: assets
	dependency: store
	Contribution: assets
	dependency: assets

3. Add deployables to a domain composite and wire them:
  -----------------------------------------------------

   - The sample first reads the SCA metadata for three sample contributions, and resolve the artifacts contained in the contributions,  
     includes all their deployable composites in a composite model representing an SCA domain, and then
     uses several composite builder utilities to configure and assemble and wire them together.
     Finally it prints the resulting domain composite model, showing service bindings
     configured with the URIs from the nodes hosting them.

   - Use the following command to run the sample:

	On windows do:
	java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-domain-management.jar manager.WireComponents		

	On *nix do:	
	java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-domain-management.jar manager.WireComponents

   - You should see the following output:
	
	<?xml version="1.0" encoding="UTF-8"?>
	  <composite name="domain" targetNamespace="http://sample"
			xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
		<component name="ShoppingCart" uri="ShoppingCart">
		    <implementation.java class="services.ShoppingCartImpl"/>
		    <service name="Cart">
		      <ns2:binding.atom name="Cart" uri="/ShoppingCart/Cart" xmlns:ns2="http://tuscany.apache.org/xmlns/sca/1.0"/>
		    </service>
		</component>
		<component name="ShoppingCartClient" uri="ShoppingCartClient">
		    <implementation.java class="services.ShoppingCartClientImpl"/>
		    <service name="Cart">
		      <ns2:binding.atom name="Cart" uri="/ShoppingCartClient/Cart" xmlns:ns2="http://tuscany.apache.org/xmlns/sca/1.0"/>
		    </service>
		    <reference name="cart">
		      <ns2:binding.atom name="cart#ShoppingCart/Cart"
		        uri="/ShoppingCart/Cart" xmlns:ns2="http://tuscany.apache.org/xmlns/sca/1.0"/>
		    </reference>
		</component>
	</composite>

4. List Components:
  -----------------
	
   - This sample reads the SCA metadata for two sample contributions, and displays their dependencies, reads and resolve 
     the artifacts contained in the contributions, and finally prints the deployables composites and the components
     they declare as well as their main characteristics (showing that their interfaces and implementations are actually resolved).

   - Use the following command to run the sample:

	On windows do:	
	java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-domain-management.jar manager.ListComponents

	On *nix do:		
	java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-domain-management.jar manager.ListComponents

   - You should see the following output:

	Deployable: {http://store}store
	  component: ShoppingCart
	    componentService: Cart
	      binding: class org.apache.tuscany.sca.binding.atom.impl.AtomBindingImpl - /ShoppingCart/Cart
	    implementation: services.ShoppingCartImpl
	      service: Cart
	        interface: services.Cart