Copy 1.x trunk to branches for start of 1.6 release

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@892786 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2009-12-21 11:58:17 +00:00
parent 1d9d90639d
commit 23d5587f8a
9536 changed files with 740973 additions and 0 deletions

View file

@ -0,0 +1,82 @@
Apache Tuscany Alert Aggregator Demo
====================================
The alert aggregator demo provides an application, implemented using SCA, that
aggregates feeds together and exposes them using the following bindings.
binding.ws
binding.jsonrpc
binding.feed
The easiest way to get going is to build the demo
cd alert-aggregator-webapp
ant package
This will build a war file
demo-alert-aggregator-webapp.war
This war can be deployed to you web application container and tested (the war
has been tested with Tomcat 6.0.10).
The Web Application
-------------------
Once deployed point your browser at
http://localhost:8080/demo-alert-aggregator-webapp
Taking care to ensure the host name and port number match you local
configuration.
This launches a Javascript application in the browser that uses JSONRPC
to contact the server and retrived a list of alert sources and alerts that
these sources are providing.
There default sources that you see are stored in a file in the following
file
demo-alert-aggregator-webapp/WEB-INF/classes/sources.xml
This files has the following contents
<ns0:Config xmlns:ns0="http://tuscany.apache.org/sca/demos/aggregator/types">
<ns0:Source Id="0" FeedType="rss">
<ns0:Name>BBC News</ns0:Name>
<ns0:Address>http://news.bbc.co.uk/</ns0:Address>
<ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
<ns0:FeedAddress>http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml</ns0:FeedAddress>
</ns0:Source>
<ns0:Source Id="1" FeedType="rss">
<ns0:Name>Engadget</ns0:Name>
<ns0:Address>http://www.engadget.com</ns0:Address>
<ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
<ns0:FeedAddress>http://www.engadget.com/rss.xml</ns0:FeedAddress>
</ns0:Source>
</ns0:Config>
You may want to adjust the "LastChecked" values to change the number of
alerts that are displayed in the first instance
Using A Feed Reader
-------------------
As this SCA application also uses the binding.feed binding you can use your
favourite feed reader to read the aggregated alerts. To do this point your
feed reader at
http://localhost:8080/demo-alert-aggregator-webapp/services/AlertsFeedServiceRSS
Again taking care to ensure that the host name and port number match you
local configuration.
Using Web Services
------------------
The SCA application also uses binding.ws to provide a SOAP/HTTP interface.
The demo client that uses this interface is not yet available.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -0,0 +1,627 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1052.3622"
height="744.09448"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.44"
sodipodi:docbase="C:\simon\Projects\Tuscany\java\sandbox\slaws\feed-aggregator"
sodipodi:docname="aggregator.svg"
version="1.0"
inkscape:export-filename="C:\simon\Projects\Tuscany\java\sandbox\slaws\feed-aggregator\aggregator.png"
inkscape:export-xdpi="52.84"
inkscape:export-ydpi="52.84">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="559.53502"
inkscape:cy="380.79143"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="1231"
inkscape:window-height="883"
inkscape:window-x="24"
inkscape:window-y="13" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2997"
transform="matrix(0.493398,0,0,0.868873,32.49726,7.184761)">
<rect
rx="15.307091"
ry="11.608842"
y="192.00241"
x="258.31146"
height="274.39081"
width="495.71429"
id="rect2067"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:3.05459166;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot2954"
xml:space="preserve"
transform="matrix(1.807362,0,0,1,-230.6612,-5.522464)"><flowRegion
id="flowRegion2956"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect2958" /></flowRegion><flowPara
id="flowPara2960">DisplayComposite - PHP</flowPara></flowRoot> </g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2988"
width="115.66247"
height="155.56354"
x="224.91631"
y="240.73917"
rx="6.9961648"
ry="12.905249" />
<flowRoot
xml:space="preserve"
id="flowRoot2966"
transform="translate(-42.67445,34.80051)"><flowRegion
id="flowRegion2968"><rect
id="rect2970"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2972">Display</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 207.76582,260.46421 L 241.10086,260.46421 L 247.16177,273.59619 L 240.09071,285.71803 L 207.76582,285.71803 L 215.34197,273.59619 L 207.76582,260.46421 z "
id="path3017" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 321.01826,362.74776 L 354.3533,362.74776 L 360.41421,375.87974 L 353.34315,388.00158 L 321.01826,388.00158 L 328.59441,375.87974 L 321.01826,362.74776 z "
id="path3019" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 132.44488,252.20297 L 176.05464,252.20297 L 183.98368,272.02067 L 174.73314,290.31394 L 132.44488,290.31394 L 142.35619,272.02067 L 132.44488,252.20297 z "
id="path1883" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 373.8733,354.18185 L 423.52701,354.18185 L 432.55495,376.97097 L 422.02236,398.0071 L 373.8733,398.0071 L 385.15824,376.97097 L 373.8733,354.18185 z "
id="path1885" />
<g
id="g1887"
transform="matrix(0.493398,0,0,1.065504,374.2831,-30.40982)">
<rect
rx="27.634869"
ry="18.594875"
y="192.0024"
x="258.31131"
height="439.5152"
width="894.9447"
id="rect1889"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.75837588;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot1891"
xml:space="preserve"
transform="matrix(1.807362,0,0,1,-224.5192,-5.522463)"><flowRegion
id="flowRegion1893"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect1895" /></flowRegion><flowPara
id="flowPara1897">AlerterComposite - Java</flowPara></flowRoot> </g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000095;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1899"
width="115.66247"
height="190.91896"
x="566.70215"
y="313.4194"
rx="6.9961648"
ry="15.838266" />
<flowRoot
xml:space="preserve"
id="flowRoot1901"
transform="translate(294.0606,125.6634)"><flowRegion
id="flowRegion1903"><rect
id="rect1905"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1907">AlertsService</flowPara><flowPara
id="flowPara2023" /></flowRoot> <rect
style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1909"
width="21.718224"
height="20.708065"
x="611.65393"
y="302.81259"
rx="10.859112"
ry="0" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 548.54148,397.87026 L 581.87652,397.87026 L 587.93743,411.00224 L 580.86637,423.12408 L 548.54148,423.12408 L 556.11763,411.00224 L 548.54148,397.87026 z "
id="path1911" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 662.80407,336.35687 L 696.13911,336.35687 L 702.20002,349.48885 L 695.12896,361.61069 L 662.80407,361.61069 L 670.38022,349.48885 L 662.80407,336.35687 z "
id="path1913" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 474.23069,356.27399 L 517.84045,356.27399 L 525.76949,376.09169 L 516.51895,394.38496 L 474.23069,394.38496 L 484.142,376.09169 L 474.23069,356.27399 z "
id="path1915" />
<flowRoot
xml:space="preserve"
id="flowRoot1919"
transform="translate(-136.1038,52.42486)"><flowRegion
id="flowRegion1921"><rect
id="rect1923"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1925">rest</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot1927"
transform="translate(110.8013,157.3641)"><flowRegion
id="flowRegion1929"><rect
id="rect1931"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1933">soap</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 182.85715,271.25837 L 215,271.25837"
id="path1941" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 359.28572,375.3802 L 385,375.3802"
id="path1943" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 432.14286,376.80877 L 482.85715,376.09448"
id="path1945" />
<flowRoot
xml:space="preserve"
id="flowRoot1921"
transform="translate(206.326,156.4433)"><flowRegion
id="flowRegion1923"><rect
id="rect1925"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1927">soap</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 663.16514,379.93449 L 696.50018,379.93449 L 702.56109,393.06647 L 695.49003,405.18831 L 663.16514,405.18831 L 670.74129,393.06647 L 663.16514,379.93449 z "
id="path1929" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1932"
width="115.66247"
height="79.802025"
x="746.18158"
y="348.62225"
rx="6.9961648"
ry="6.6202211" />
<flowRoot
xml:space="preserve"
id="flowRoot1934"
transform="translate(478.5909,142.6837)"><flowRegion
id="flowRegion1936"><rect
id="rect1938"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1940">RSS</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 723.03101,380.46928 L 756.36605,380.46928 L 762.42696,393.60126 L 755.3559,405.7231 L 723.03101,405.7231 L 730.60716,393.60126 L 723.03101,380.46928 z "
id="path1944" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000119;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1950"
width="115.66247"
height="132.33011"
x="745.13855"
y="195.58192"
rx="6.9961648"
ry="10.977848" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 720.74384,253.66542 L 754.07888,253.66542 L 760.13979,266.7974 L 753.06873,278.91924 L 720.74384,278.91924 L 728.31999,266.7974 L 720.74384,253.66542 z "
id="path1952" />
<flowRoot
xml:space="preserve"
id="flowRoot1954"
transform="translate(486.8998,-9.966938)"><flowRegion
id="flowRegion1956"><rect
id="rect1958"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1960">AlertsSources</flowPara><flowPara
id="flowPara2055">Service</flowPara></flowRoot> <g
id="g1962"
transform="translate(-176.0137,-37.3322)">
<rect
ry="6.2971425"
rx="7.4499478"
y="442.66592"
x="221.42857"
height="44.285713"
width="48.57143"
id="rect1964"
style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path1966"
d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="path1968"
d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 472.97164,431.20643 L 516.5814,431.20643 L 524.51044,451.02413 L 515.2599,469.3174 L 472.97164,469.3174 L 482.88295,451.02413 L 472.97164,431.20643 z "
id="path1973" />
<flowRoot
xml:space="preserve"
id="flowRoot1977"
transform="translate(201.067,231.3759)"><flowRegion
id="flowRegion1979"><rect
id="rect1981"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1983">jsonrpc</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 703.12601,392.5614 C 729.14865,392.5614 730.28007,392.5614 730.28007,392.5614"
id="path2011" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 103.05071,450.26192 C 480.81768,450.26192 480.81768,450.26192 480.81768,450.26192"
id="path2021" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 321.88845,274.15881 L 355.22349,274.15881 L 361.2844,287.29079 L 354.21334,299.41263 L 321.88845,299.41263 L 329.4646,287.29079 L 321.88845,274.15881 z "
id="path2025" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 374.74349,265.5929 L 424.3972,265.5929 L 433.42514,288.38202 L 422.89255,309.41815 L 374.74349,309.41815 L 386.02843,288.38202 L 374.74349,265.5929 z "
id="path2027" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 475.10088,267.68504 L 518.71064,267.68504 L 526.63968,287.50274 L 517.38914,305.79601 L 475.10088,305.79601 L 485.01219,287.50274 L 475.10088,267.68504 z "
id="path2029" />
<flowRoot
xml:space="preserve"
id="flowRoot2031"
transform="translate(111.6715,68.77515)"><flowRegion
id="flowRegion2033"><rect
id="rect2035"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2037">soap</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 360.15591,286.79125 L 385.87019,286.79125"
id="path2039" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 433.01305,288.21982 L 483.72734,287.50553"
id="path2041" />
<flowRoot
xml:space="preserve"
id="flowRoot2043"
transform="translate(207.1962,67.85435)"><flowRegion
id="flowRegion2045"><rect
id="rect2047"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2049">soap</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 472.23581,584.46535 L 515.84557,584.46535 L 523.77461,604.28305 L 514.52407,622.57632 L 472.23581,622.57632 L 482.14712,604.28305 L 472.23581,584.46535 z "
id="path2077" />
<flowRoot
xml:space="preserve"
id="flowRoot2079"
transform="translate(201.2595,384.6873)"><flowRegion
id="flowRegion2081"><rect
id="rect2083"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2085">atom</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 474.05184,212.89166 L 517.6616,212.89166 L 525.59064,232.70936 L 516.3401,251.00263 L 474.05184,251.00263 L 483.96315,232.70936 L 474.05184,212.89166 z "
id="path1995" />
<flowRoot
xml:space="preserve"
id="flowRoot1997"
transform="translate(202.1472,13.06115)"><flowRegion
id="flowRegion1999"><rect
id="rect2001"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2003">jsonrpc</flowPara></flowRoot> <g
id="g2019"
transform="translate(-178.034,112.9369)">
<rect
ry="6.2971425"
rx="7.4499478"
y="442.66592"
x="221.42857"
height="44.285713"
width="48.57143"
id="rect2021"
style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path2023"
d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="path2026"
d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 663.04526,423.36857 L 696.3803,423.36857 L 702.44121,436.50055 L 695.37015,448.62239 L 663.04526,448.62239 L 670.62141,436.50055 L 663.04526,423.36857 z "
id="path2030" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999928, 1.99999976;stroke-dashoffset:0;stroke-opacity:1"
id="rect2032"
width="115.66247"
height="79.802025"
x="747.07184"
y="437.51321"
rx="6.9961648"
ry="6.6202211" />
<flowRoot
xml:space="preserve"
id="flowRoot2034"
transform="translate(482.5116,231.5747)"><flowRegion
id="flowRegion2036"><rect
id="rect2038"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2040">POP - Not done</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 726.95174,469.36022 L 760.28678,469.36022 L 766.34769,482.4922 L 759.27663,494.61404 L 726.95174,494.61404 L 734.52789,482.4922 L 726.95174,469.36022 z "
id="path2042" />
<g
id="g2046"
transform="translate(-173.9935,-197.1597)">
<rect
ry="6.2971425"
rx="7.4499478"
y="442.66592"
x="221.42857"
height="44.285713"
width="48.57143"
id="rect2048"
style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="path2050"
d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="path2052"
d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 103.03556,270.33294 C 140.4112,270.33294 140.4112,270.33294 140.4112,270.33294"
id="path2054" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 102.02541,434.9878 L 449.51788,432.9675 L 450.52804,231.94714 L 482.85292,231.94714"
id="path2056" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 97.984797,603.52083 L 480.83262,601.50053"
id="path2058" />
<flowRoot
xml:space="preserve"
id="flowRoot2060"
transform="translate(-226.8143,99.79398)"><flowRegion
id="flowRegion2062"><rect
id="rect2064"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2066">HTML</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot2068"
transform="translate(-232.7737,258.6113)"><flowRegion
id="flowRegion2070"><rect
id="rect2072"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2074">Web2.0</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot2076"
transform="translate(-248.6574,410.2362)"><flowRegion
id="flowRegion2078"><rect
id="rect2080"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2082">Thunderbird</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 663.10519,467.81527 L 696.44023,467.81527 L 702.50114,480.94725 L 695.43008,493.06909 L 663.10519,493.06909 L 670.68134,480.94725 L 663.10519,467.81527 z "
id="path2088" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999928, 1.99999976;stroke-dashoffset:0;stroke-opacity:1"
id="rect2090"
width="115.66247"
height="79.802025"
x="746.12164"
y="533.47766"
rx="6.9961648"
ry="6.6202211" />
<flowRoot
xml:space="preserve"
id="flowRoot2092"
transform="translate(481.5614,327.5392)"><flowRegion
id="flowRegion2094"><rect
id="rect2096"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2098">NNTP - Not done</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 726.00152,565.3247 L 759.33656,565.3247 L 765.39747,578.45668 L 758.32641,590.57852 L 726.00152,590.57852 L 733.57767,578.45668 L 726.00152,565.3247 z "
id="path2100" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 472.48834,533.95773 L 516.0981,533.95773 L 524.02714,553.77543 L 514.7766,572.0687 L 472.48834,572.0687 L 482.39965,553.77543 L 472.48834,533.95773 z "
id="path2106" />
<flowRoot
xml:space="preserve"
id="flowRoot2108"
transform="translate(201.512,334.1797)"><flowRegion
id="flowRegion2110"><rect
id="rect2112"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2114">rss</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 98.237332,557.01321 L 481.08515,554.99291"
id="path2120" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2022"
width="115.66247"
height="95.964485"
x="565.43286"
y="534.48798"
rx="6.9961648"
ry="7.9610276" />
<flowRoot
xml:space="preserve"
id="flowRoot2024"
transform="translate(304.5289,349.5419)"><flowRegion
id="flowRegion2026"><rect
id="rect2028"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2030">AlertFeed</flowPara><flowPara
id="flowPara2032">Service</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 540.93669,563.74164 L 574.27173,563.74164 L 580.33264,576.87362 L 573.26158,588.99546 L 540.93669,588.99546 L 548.51284,576.87362 L 540.93669,563.74164 z "
id="path2073" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 657.10424,562.7721 L 690.43928,562.7721 L 696.50019,575.90408 L 689.42913,588.02592 L 657.10424,588.02592 L 664.68039,575.90408 L 657.10424,562.7721 z "
id="path2034" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 525.27933,230.93699 L 685.89358,229.92684 L 685.89358,259.22126 L 724.27938,259.22126"
id="path2038" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 525.27933,286.49538 L 671.75144,284.47507 L 671.75144,267.30248 L 726.29968,267.30248"
id="path2040" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 701.04587,349.12484 L 714.17785,348.11468 L 714.17785,275.3837 L 722.25907,275.3837"
id="path2043" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 525.27933,374.37865 L 538.41131,374.37865 L 538.41131,401.65277 L 550.53314,400.64262"
id="path2045" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 701.04587,437.00811 L 721.24892,437.00811 L 721.24892,480.44467 L 732.3606,480.44467"
id="path2049" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 701.04587,481.45482 L 714.17785,481.45482 L 714.17785,579.43962 L 733.37075,579.43962"
id="path2051" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 697.00526,575.39901 L 705.08648,575.39901 L 704.07633,518.83046 L 541.44177,518.83046 L 541.44177,415.7949 L 552.55344,415.7949"
id="path2053" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 522.24887,451.15024 L 533.36055,451.15024 L 533.36055,409.73399 L 554.57375,409.73399"
id="path2055" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 522.24887,552.1655 L 535.38085,552.1655 L 534.3707,574.38885 L 546.49253,574.38885"
id="path2057" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 522.24887,604.69343 L 535.38085,603.68328 L 535.38085,583.48023 L 542.45192,583.48023"
id="path2059" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="DojoZipInstaller">
<property name="dojo.version" value="1.3.0"/>
<property name="dojo.zip" value="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
<property name="unpack.location" value="${basedir}/src/main/resources/dojo"/>
<target name="check-dojo-installed">
<condition property="already.installed" >
<available file="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</condition>
</target>
<target name="check-dojo-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
<fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
<unzip src="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"
dest="${basedir}/target/dojo-unpack-temp/"
overwrite="false"
encoding="native-encoding">
<patternset>
<include name="dojo-${dojo.version}/dojo/**"/>
<exclude name="dojo-${dojo.version}/dojo/tests/**"/>
<exclude name="dojo-${dojo.version}/dijit/**"/>
<exclude name="dojo-${dojo.version}/dojox/**"/>
<exclude name="dojo-${dojo.version}/util/**"/>
</patternset>
</unzip>
<move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}"
tofile="${unpack.location}"
verbose="true"/>
<delete dir="${basedir}/target/dojo-unpack-temp/"/>
</target>
<target name="clean-dojo-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -0,0 +1,148 @@
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<!DOCTYPE project [
<!ENTITY buildDependency SYSTEM "build-dependency.xml">
]>
<project name="alert-aggregator-webapp" default="package">
&buildDependency;
<property name="settings.localRepository" value="./target/repo" />
<property name="artifactId" value="demo-alert-aggregator" />
<target name="init">
<mkdir dir="target/classes"/>
<mkdir dir="target/sdo-source"/>
</target>
<target name="generate" depends="init">
<java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
fork="true">
<arg value="-targetDirectory"/>
<arg value="target/sdo-source"/>
<arg value="-javaPackage"/>
<arg value="org.apache.tuscany.sca.demos.aggregator.service"/>
<arg value="-schemaNamespace"/>
<arg value="http://tuscany.apache.org/sca/demos/aggregator/service"/>
<arg value="-noNotification"/>
<arg value="-noContainment"/>
<arg value="-noUnsettable"/>
<arg value="src/main/resources/Alerts.wsdl"/>
<classpath>
<pathelement path="target/classes"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</java>
<java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
fork="true">
<arg value="-targetDirectory"/>
<arg value="target/sdo-source"/>
<arg value="-javaPackage"/>
<arg value="org.apache.tuscany.sca.demos.aggregator.sources"/>
<arg value="-schemaNamespace"/>
<arg value="http://tuscany.apache.org/sca/demos/aggregator/sources"/>
<arg value="-noNotification"/>
<arg value="-noContainment"/>
<arg value="-noUnsettable"/>
<arg value="src/main/resources/AlertsSources.wsdl"/>
<classpath>
<pathelement path="target/classes"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</java>
<java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
fork="true">
<arg value="-targetDirectory"/>
<arg value="target/sdo-source"/>
<arg value="-javaPackage"/>
<arg value="org.apache.tuscany.sca.demos.aggregator.types"/>
<arg value="-schemaNamespace"/>
<arg value="http://tuscany.apache.org/sca/demos/aggregator/types"/>
<arg value="-noNotification"/>
<arg value="-noContainment"/>
<arg value="-noUnsettable"/>
<arg value="src/main/resources/Alerts.xsd"/>
<classpath>
<pathelement path="target/sdo-source"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</java>
</target>
<target name="compile" depends="generate">
<javac srcdir="target/sdo-source"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement path="target/classes"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</javac>
<javac srcdir="src/main/java"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement path="target/classes"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</javac>
<copy todir="target/classes">
<fileset dir="src/main/resources"/>
</copy>
</target>
<target name="package" depends="compile">
<ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
<property name="localRepository" value="${settings.localRepository}"/>
</ant>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
<war destfile="target/demo-alert-aggregator-webapp.war"
webxml="src/main/webapp/WEB-INF/web.xml">
<fileset dir="src/main/webapp"/>
<lib refid="tuscany.jars"/>
<lib refid="3rdparty.jars"/>
<classes dir="target/classes"/>
</war>
<ant antfile="./build-dojo.xml" target="clean-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</target>
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="target"/>
</delete>
</target>
</project>

View file

@ -0,0 +1,348 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-demos</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>demo-alert-aggregator-webapp</artifactId>
<packaging>war</packaging>
<version>1.6-SNAPSHOT</version>
<name>Apache Tuscany SCA Demo Alert Aggregator</name>
<url>http://cwiki.apache.org/TUSCANY</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-api-r2.1</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-impl</artifactId>
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-axis2</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-core-databinding</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-sdo</artifactId>
<version>${pom.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-axiom</artifactId>
<version>${pom.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
<version>${pom.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>${pom.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-xml</artifactId>
<version>${pom.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-atom-abdera</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rss-rome</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo</artifactId>
<version>1.3.0</version>
<type>zip</type>
</dependency>
</dependencies>
<build>
<finalName>demo-alert-aggregator-webapp</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>target/sdo-source</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tuscany.sdo</groupId>
<artifactId>tuscany-sdo-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>generate-sdo</id>
<phase>generate-sources</phase>
<configuration>
<schemaFiles>
<configuration>
<fileName>${basedir}/src/main/resources/Alerts.wsdl</fileName>
<javaPackage>org.apache.tuscany.sca.demos.aggregator.service</javaPackage>
</configuration>
<configuration>
<fileName>${basedir}/src/main/resources/AlertsSources.wsdl</fileName>
<javaPackage>org.apache.tuscany.sca.demos.aggregator.sources</javaPackage>
</configuration>
<configuration>
<fileName>${basedir}/src/main/resources/Alerts.xsd</fileName>
<javaPackage>org.apache.tuscany.sca.demos.aggregator.types</javaPackage>
</configuration>
</schemaFiles>
<noNotification>true</noNotification>
<noContainment>true</noContainment>
<noUnsettable>true</noUnsettable>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>copy-dojo-files</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>clean-dojo-files</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="clean-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!--
<configuration>
<excludes>
<exclude>**/AlertsTestCase.java</exclude>
</excludes>
</configuration>
-->
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*AlertsIntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
<systemProperties>
<org.apache.commons.logging.Log>org.apache.commons.logging.impl.SimpleLog</org.apache.commons.logging.Log>
</systemProperties>
</container>
<wait>false</wait>
<configuration>
<properties>
<cargo.servlet.port>8085</cargo.servlet.port>
</properties>
<deployables>
<deployable>
<location>
${project.build.directory}/${project.build.finalName}.${project.packaging}
</location>
<pingURL>http://localhost:8085/AlertsSourcesServiceJSONRPC</pingURL>
</deployable>
</deployables>
<home>${project.build.directory}/cargo-jetty</home>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-maven-ant-generator</artifactId>
<version>1.6-SNAPSHOT</version>
<executions>
<execution>
<configuration>
<buildDependencyFileOnly>true</buildDependencyFileOnly>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,339 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
public class AlertTypeNonSDOImpl implements AlertType
{
private static final long serialVersionUID = 670364038865656196L;
/**
* The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected static final String TITLE_DEFAULT_ = null;
/**
* The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected String title = TITLE_DEFAULT_;
/**
* The default value of the '{@link #getSummary() <em>Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSummary()
* @generated
* @ordered
*/
protected static final String SUMMARY_DEFAULT_ = null;
/**
* The cached value of the '{@link #getSummary() <em>Summary</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSummary()
* @generated
* @ordered
*/
protected String summary = SUMMARY_DEFAULT_;
/**
* The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected static final String ADDRESS_DEFAULT_ = null;
/**
* The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected String address = ADDRESS_DEFAULT_;
/**
* The default value of the '{@link #getDate() <em>Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDate()
* @generated
* @ordered
*/
protected static final String DATE_DEFAULT_ = null;
/**
* The cached value of the '{@link #getDate() <em>Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDate()
* @generated
* @ordered
*/
protected String date = DATE_DEFAULT_;
/**
* The default value of the '{@link #getSourceId() <em>Source Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSourceId()
* @generated
* @ordered
*/
protected static final String SOURCE_ID_DEFAULT_ = null;
/**
* The cached value of the '{@link #getSourceId() <em>Source Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSourceId()
* @generated
* @ordered
*/
protected String sourceId = SOURCE_ID_DEFAULT_;
/**
* The default value of the '{@link #isUnread() <em>Unread</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isUnread()
* @generated
* @ordered
*/
protected static final boolean UNREAD_DEFAULT_ = false;
/**
* The cached value of the '{@link #isUnread() <em>Unread</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isUnread()
* @generated
* @ordered
*/
protected boolean unread = UNREAD_DEFAULT_;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_DEFAULT_ = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_DEFAULT_;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AlertTypeNonSDOImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTitle()
{
return title;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTitle(String newTitle)
{
title = newTitle;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSummary()
{
return summary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSummary(String newSummary)
{
summary = newSummary;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAddress()
{
return address;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAddress(String newAddress)
{
address = newAddress;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDate()
{
return date;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDate(String newDate)
{
date = newDate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSourceId()
{
return sourceId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSourceId(String newSourceId)
{
sourceId = newSourceId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isUnread()
{
return unread;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUnread(boolean newUnread)
{
unread = newUnread;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId()
{
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId)
{
id = newId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
StringBuffer result = new StringBuffer(super.toString());
result.append(" (Title: ");
result.append(title);
result.append(", Summary: ");
result.append(summary);
result.append(", Address: ");
result.append(address);
result.append(", Date: ");
result.append(date);
result.append(", SourceId: ");
result.append(sourceId);
result.append(", Unread: ");
result.append(unread);
result.append(", Id: ");
result.append(id);
result.append(')');
return result.toString();
}
} //AlertTypeImpl

View file

@ -0,0 +1,106 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.text.DateFormat;
import org.apache.abdera.Abdera;
import org.apache.abdera.factory.Factory;
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Feed;
import org.apache.tuscany.sca.binding.atom.collection.Collection;
import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
/**
* Read all new alerts from the specified sources
*
* @version $Rev$ $Date$
*/
@Service(Collection.class)
public class AlertsFeedServiceImpl implements Collection {
private AlertsService alerts;
@Reference
public void setAlerts(AlertsService alerts) {
this.alerts = alerts;
}
DateFormat dateFormatter = DateFormat.getDateTimeInstance();
/**
* Return the alerts as a feed.
*
* @return the structure containing alerts
*/
public org.apache.abdera.model.Feed getFeed() {
// Create a new Feed
Factory factory = Abdera.getNewFactory();
Feed feed = factory.newFeed();
feed.setTitle("Apache Tuscany Feed Aggregator");
feed.setSubtitle("A sample showing an SCA application to aggregate various types of feeds");
feed.addAuthor("Apache Tuscany");
feed.addLink("http://tuscany.apache.org");
// Aggregate entries from feed1 and feed2
try {
AlertsType alerts = this.alerts.getAllNewAlerts("");
for( Object alertObject : alerts.getAlert() ){
AlertType alert = ((AlertType)alertObject);
Entry entry = factory.newEntry();
entry.setTitle(alert.getTitle());
//entry.(alert.getSummary());
entry.addLink(alert.getAddress());
entry.setPublished(dateFormatter.parse(alert.getDate()));
feed.addEntry(entry);
}
} catch(Exception ex) {
System.err.println("Exception " + ex.toString());
}
return feed;
}
public Feed query(String queryString) {
return getFeed();
}
public void delete(String id) throws NotFoundException {
}
public Entry get(String id) throws NotFoundException {
return null;
}
public Entry post(Entry entry) {
return null;
}
public void put(String id, Entry entry) throws NotFoundException {
}
}

View file

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
import org.osoa.sca.annotations.Remotable;
/**
* Retrieve and manage alerts
*
* @version $Rev$ $Date$
*/
@Remotable
public interface AlertsService {
/**
* Return a structure holding all of the new alerts that have been found
*
* @return the structure containing alerts
*/
public AlertsType getAllNewAlerts(String id);
}

View file

@ -0,0 +1,126 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
/**
* Read all new alerts from the specified sources
*
* @version $Rev$ $Date$
*/
@Service(AlertsService.class)
public class AlertsServiceImpl implements AlertsService {
private RSSCheckerService rssChecker;
private AlertsSourcesService alertsSources;
@Reference
public void setRssChecker(RSSCheckerService rssChecker) {
this.rssChecker = rssChecker;
}
@Reference
public void setAlertsSources(AlertsSourcesService alertsSources) {
this.alertsSources = alertsSources;
}
DateFormat dateFormatter = DateFormat.getDateTimeInstance();
/**
* Return a structure holding all of the new alerts that have been found
*
* @return the structure containing alerts
*/
public AlertsType getAllNewAlerts(String id)
{
System.err.println("getAllNewAlerts(" + id + ")");
//TypesFactory factory = TypesFactory.INSTANCE;
//AlertsType returnAlerts = factory.createAlertsType();
AlertsType returnAlerts = new AlertsTypeNonSDOImpl();
List returnAlertList = returnAlerts.getAlert();
// get the date/time now so that we can update the
// alert source record so that next time we
// only get the latest alerts
Date now = new Date();
String nowString = dateFormatter.format(now);
try {
ConfigType alertSourceConfig = alertsSources.getAlertSources(id);
for (Object source : alertSourceConfig.getSource()){
SourceType sourceType = (SourceType)source;
AlertsType alerts = null;
if ( sourceType.getFeedType().equals("rss")){
alerts = rssChecker.getNewAlerts(sourceType.getFeedAddress(),
sourceType.getLastChecked());
} else {
}
// extend return list with any alerts we found
for( Object alert : alerts.getAlert() ){
// set the id on the alert so we know which source it
// came from
((AlertType)alert).setSourceId(sourceType.getId());
// convert from SDO to POJO so that the
// JSONRPC binding will work. It can't currently
// handle SDOs
AlertType newAlert = new AlertTypeNonSDOImpl();
newAlert.setSourceId(((AlertType)alert).getSourceId());
newAlert.setTitle(((AlertType)alert).getTitle());
newAlert.setSummary(((AlertType)alert).getSummary());
newAlert.setAddress(((AlertType)alert).getAddress());
newAlert.setDate(((AlertType)alert).getDate());
newAlert.setId(((AlertType)alert).getId());
newAlert.setUnread(((AlertType)alert).isUnread());
returnAlertList.add(newAlert);
}
// update the time last checked for this source
sourceType.setLastChecked(nowString);
//alertsSources.updateAlertSource(sourceType);
}
} catch(Exception ex) {
System.err.println("Exception " + ex.toString());
}
return returnAlerts ;
}
}

View file

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
import org.osoa.sca.annotations.Remotable;
/**
* Retrieve and manage alert sources
*
* @version $Rev$ $Date$
*/
@Remotable
public interface AlertsSourcesService {
/**
* Return all of the configured alert sources.
*
* @return the list of alert sources
*/
public ConfigType getAlertSources (String id);
/**
* Return a single alert source.
* @param id not currently used
* @return the alert source
*/
public SourceType getAlertSource (String id);
/**
* Update an alert source.
*
* @param updatedSource the alert source to update
*/
public void updateAlertSource (SourceType updatedSource);
/**
* Add an alert source.
*
* @param newSource the alert source to add
*/
public String addAlertSource (SourceType newSource);
/**
* Remove an alert source.
*
* @param oldSource the alert source to remove
*/
public void removeAlertSource (String id);
}

View file

@ -0,0 +1,183 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.io.InputStream;
import java.text.DateFormat;
import java.util.Date;
import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory;
import org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLDocument;
import commonj.sdo.impl.HelperProvider;
/**
* Retrieve and manage alert sources
*
* @version $Rev$ $Date$
*/
@Service(AlertsSourcesService.class)
@Scope("COMPOSITE")
public class AlertsSourcesServiceImpl implements AlertsSourcesService {
ConfigType alertSources;
/**
* Constructor reads the configuration to provide
* the initial list of alert sources
*/
public AlertsSourcesServiceImpl(){
System.err.println("AlertsSourcesServiceImpl()");
try {
// read the alerts config from an XML file
InputStream is = this.getClass().getClassLoader().getResourceAsStream("sources.xml");
if (is == null) {
throw new Exception("Can;t find sources.xml");
} else {
HelperContext helperContext = HelperProvider.getDefaultContext();
TypesFactory.INSTANCE.register(helperContext);
XMLDocument xmlDoc = helperContext.getXMLHelper().load(is);
alertSources = (ConfigType)xmlDoc.getRootObject();
}
} catch (Exception ex) {
System.err.println("Exception " + ex.toString());
}
}
/**
* Return all of the configured alert sources.
*
* @return the list of alert sources
*/
public ConfigType getAlertSources (String id)
{
System.err.println("getAlertSources(" + id + ")");
// convert alert sources to POJOs so that
// the JSONRPC binding will work
ConfigTypeNonSDOImpl sources = new ConfigTypeNonSDOImpl();
for (Object source : alertSources.getSource()) {
SourceTypeNonSDOImpl newSource = new SourceTypeNonSDOImpl();
newSource.setAddress(((SourceTypeImpl)source).getAddress());
newSource.setFeedAddress(((SourceTypeImpl)source).getFeedAddress());
newSource.setId(((SourceTypeImpl)source).getId());
newSource.setLastChecked(((SourceTypeImpl)source).getLastChecked());
newSource.setName(((SourceTypeImpl)source).getName());
newSource.setFeedType(((SourceTypeImpl)source).getFeedType());
sources.getSource().add(newSource);
}
return sources;
}
/**
* Return a single alert source.
* @param id the alert source id number
* @return the alert source
*/
public SourceType getAlertSource (String id)
{
System.err.println("getAlertSource(" + id + ")");
SourceType alertSource = null;
for (Object source : alertSources.getSource()) {
if ( ((SourceType)source).getId().equals(id)) {
alertSource = (SourceType)source;
}
}
return alertSource;
}
/**
* Update an alert source.
*
* @param updatedSource the alert source to update
*/
public void updateAlertSource (SourceType updatedSource)
{
System.err.println("updateAlertSource()");
Object originalSource = null;
for (Object source : alertSources.getSource()) {
if ( ((SourceType)source).getId().equals(updatedSource.getId())) {
originalSource = source;
break;
}
}
if (originalSource != null){
alertSources.getSource().add(updatedSource);
alertSources.getSource().remove(originalSource);
}
}
/**
* Add an alert source.
*
* @param newSource the alert source to add
*/
public String addAlertSource (SourceType newSource)
{
System.err.println("addAlertSource()");
// set the date to now less 2 hours so we
// get some alerts straight away
DateFormat dateFormatter = DateFormat.getDateTimeInstance();
Date now = new Date();
now.setHours(now.getHours()-2);
String nowString = dateFormatter.format(now);
newSource.setLastChecked(nowString);
alertSources.getSource().add(newSource);
return "Done";
}
/**
* Remove an alert source.
*
* @param oldSource the alert source to remove
*/
public void removeAlertSource (String id)
{
System.err.println("removeAlertSource()");
Object originalSource = null;
for (Object source : alertSources.getSource()) {
if ( ((SourceType)source).getId().equals(id)) {
originalSource = source;
break;
}
}
if (originalSource != null) {
alertSources.getSource().remove(originalSource);
}
}
}

View file

@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.util.ArrayList;
import java.util.List;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Alerts Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.apache.tuscany.sca.samples.aggregator.types.impl.AlertsTypeImpl#getAlert <em>Alert</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AlertsTypeNonSDOImpl implements AlertsType
{
private static final long serialVersionUID = -3784576466148158776L;
/**
* The cached value of the '{@link #getAlert() <em>Alert</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAlert()
* @generated
* @ordered
*/
protected List alert = new ArrayList();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AlertsTypeNonSDOImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getAlert()
{
return alert;
}
} //AlertsTypeImpl

View file

@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.util.ArrayList;
import java.util.List;
import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
public class ConfigTypeNonSDOImpl implements ConfigType
{
private static final long serialVersionUID = 2522843951360675364L;
protected List source = new ArrayList();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ConfigTypeNonSDOImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getSource()
{
return source;
}
} //ConfigTypeImpl

View file

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
/**
* The interface for the rss checker service
*/
public interface RSSCheckerService {
public AlertsType getNewAlerts(String rssaddress, String lastchecktimestamp);
}

View file

@ -0,0 +1,91 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
/**
* The interface for the rss checker service
*/
public class RSSCheckerServiceImpl implements RSSCheckerService {
public AlertsType getNewAlerts(String rssaddress, String lastchecktimestamp){
// Create the list of alerts to return
TypesFactory factory = TypesFactory.INSTANCE;
AlertsType returnAlerts = factory.createAlertsType();
List returnAlertList = returnAlerts.getAlert();
try {
// lastchecktimestamp comes from sources.xml configuration.
// That origin requires ISO 8601 date input (yyyy-MM-dd hh:mm:ss).
DateFormat configDateFormatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss");
Date timestamp = configDateFormatter.parse(lastchecktimestamp);
// Turn feed dates into something we can process.
DateFormat feedDateFormatter = DateFormat.getDateTimeInstance();
// get the feed data from the supplied address
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(new URL(rssaddress)));
//System.out.println(feed);
// check all the items to see if we have seen them before
List entries = feed.getEntries();
for(Object entry: entries){
SyndEntry syndEntry = (SyndEntry)entry;
// System.err.println( "Entry pubdate=" + syndEntry.getPublishedDate() );
if (syndEntry.getPublishedDate().after(timestamp)){
AlertType newAlert = factory.createAlertType();
newAlert.setTitle(syndEntry.getTitle());
// newAlert.setSummary("<![CDATA[" +
// syndEntry.getDescription().getValue() +
// "]]>");
newAlert.setSummary("");
newAlert.setAddress(syndEntry.getLink());
newAlert.setDate(feedDateFormatter.format(syndEntry.getPublishedDate()));
newAlert.setId(rssaddress);
newAlert.setUnread(true);
returnAlertList.add(newAlert);
}
}
} catch(Exception ex) {
ex.printStackTrace( System.err );
System.err.println("Exception " + ex.toString());
}
return returnAlerts;
}
}

View file

@ -0,0 +1,536 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
import commonj.sdo.Sequence;
public class SourceTypeNonSDOImpl implements SourceType
{
private static final long serialVersionUID = -4986294578888767793L;
public final static int NAME = 0;
public final static int ADDRESS = 1;
public final static int LAST_CHECKED = 2;
public final static int FEED_ADDRESS = 3;
public final static int POP_SERVER = 4;
public final static int POP_USERNAME = 5;
public final static int POP_PASSWORD = 6;
public final static int ANY = -1;
public final static int ID = 7;
public final static int TYPE = 8;
public final static int SDO_PROPERTY_COUNT = 9;
public final static int EXTENDED_PROPERTY_COUNT = -1;
/**
* The internal feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_NAME = 0;
/**
* The internal feature id for the '<em><b>Address</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ADDRESS = 1;
/**
* The internal feature id for the '<em><b>Last Checked</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_LAST_CHECKED = 2;
/**
* The internal feature id for the '<em><b>Feed Address</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_FEED_ADDRESS = 3;
/**
* The internal feature id for the '<em><b>Pop Server</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_POP_SERVER = 4;
/**
* The internal feature id for the '<em><b>Pop Username</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_POP_USERNAME = 5;
/**
* The internal feature id for the '<em><b>Pop Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_POP_PASSWORD = 6;
/**
* The internal feature id for the '<em><b>Any</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ANY = 7;
/**
* The internal feature id for the '<em><b>Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_ID = 8;
/**
* The internal feature id for the '<em><b>Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_TYPE = 9;
/**
* The number of properties for this type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public final static int INTERNAL_PROPERTY_COUNT = 10;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_DEFAULT_ = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_DEFAULT_;
/**
* The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected static final String ADDRESS_DEFAULT_ = null;
/**
* The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected String address = ADDRESS_DEFAULT_;
/**
* The default value of the '{@link #getLastChecked() <em>Last Checked</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastChecked()
* @generated
* @ordered
*/
protected static final String LAST_CHECKED_DEFAULT_ = null;
/**
* The cached value of the '{@link #getLastChecked() <em>Last Checked</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLastChecked()
* @generated
* @ordered
*/
protected String lastChecked = LAST_CHECKED_DEFAULT_;
/**
* The default value of the '{@link #getFeedAddress() <em>Feed Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeedAddress()
* @generated
* @ordered
*/
protected static final String FEED_ADDRESS_DEFAULT_ = null;
/**
* The cached value of the '{@link #getFeedAddress() <em>Feed Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeedAddress()
* @generated
* @ordered
*/
protected String feedAddress = FEED_ADDRESS_DEFAULT_;
/**
* The default value of the '{@link #getPopServer() <em>Pop Server</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopServer()
* @generated
* @ordered
*/
protected static final String POP_SERVER_DEFAULT_ = null;
/**
* The cached value of the '{@link #getPopServer() <em>Pop Server</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopServer()
* @generated
* @ordered
*/
protected String popServer = POP_SERVER_DEFAULT_;
/**
* The default value of the '{@link #getPopUsername() <em>Pop Username</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopUsername()
* @generated
* @ordered
*/
protected static final String POP_USERNAME_DEFAULT_ = null;
/**
* The cached value of the '{@link #getPopUsername() <em>Pop Username</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopUsername()
* @generated
* @ordered
*/
protected String popUsername = POP_USERNAME_DEFAULT_;
/**
* The default value of the '{@link #getPopPassword() <em>Pop Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopPassword()
* @generated
* @ordered
*/
protected static final String POP_PASSWORD_DEFAULT_ = null;
/**
* The cached value of the '{@link #getPopPassword() <em>Pop Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPopPassword()
* @generated
* @ordered
*/
protected String popPassword = POP_PASSWORD_DEFAULT_;
/**
* The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAny()
* @generated
* @ordered
*/
protected Sequence any = null;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_DEFAULT_ = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_DEFAULT_;
/**
* The default value of the '{@link #getFeedType() <em>Feed Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeedType()
* @generated
* @ordered
*/
protected static final String FEED_TYPE_DEFAULT_ = null;
/**
* The cached value of the '{@link #getFeedType() <em>Feed Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeedType()
* @generated
* @ordered
*/
protected String feedType = FEED_TYPE_DEFAULT_;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SourceTypeNonSDOImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName)
{
name = newName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAddress()
{
return address;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAddress(String newAddress)
{
address = newAddress;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLastChecked()
{
return lastChecked;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLastChecked(String newLastChecked)
{
lastChecked = newLastChecked;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFeedAddress()
{
return feedAddress;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFeedAddress(String newFeedAddress)
{
feedAddress = newFeedAddress;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPopServer()
{
return popServer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPopServer(String newPopServer)
{
popServer = newPopServer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPopUsername()
{
return popUsername;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPopUsername(String newPopUsername)
{
popUsername = newPopUsername;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPopPassword()
{
return popPassword;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPopPassword(String newPopPassword)
{
popPassword = newPopPassword;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId()
{
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId)
{
id = newId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFeedType()
{
return feedType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFeedType(String newType)
{
feedType = newType;
}
public Sequence getAny(){
return null;
}
} //SourceTypeImpl

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<wsdl:definitions targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/service"
xmlns:tns="http://tuscany.apache.org/sca/demos/aggregator/service"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Alerter">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/service"
xmlns:alerter="http://tuscany.apache.org/sca/demos/aggregator/types"
elementFormDefault="qualified">
<xsd:import namespace="http://tuscany.apache.org/sca/demos/aggregator/types"
schemaLocation="Alerts.xsd" />
<element name="getAllNewAlerts">
<xsd:complexType>
<sequence>
<element name="parm" type="string" />
</sequence>
</xsd:complexType>
</element>
<element name="getAllNewAlertsResponse">
<complexType>
<sequence>
<element name="parm" type="alerter:AlertsType" />
</sequence>
</complexType>
</element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetAllNewAlertsRequest">
<wsdl:part element="tns:getAllNewAlerts" name="parameters" />
</wsdl:message>
<wsdl:message name="GetAllNewAlertsResponse">
<wsdl:part element="tns:getAllNewAlertsResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="AlertsPortType">
<wsdl:operation name="getAllNewAlerts">
<wsdl:input message="tns:GetAllNewAlertsRequest" name="GetAllNewAlertsRequestMsg" />
<wsdl:output message="tns:GetAllNewAlertsResponse" name="GetAllNewAlertsResponseMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AlertsBinding" type="tns:AlertsPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getAllNewAlerts">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="GetAllNewAlertsRequestMsg">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="GetAllNewAlertsResponseMsg">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AlertsService">
<wsdl:port name="AlertsPort" binding="tns:AlertsBinding">
<wsdlsoap:address location="http://localhost:8085/services/AlertsServiceWebServiceBinding" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<schema targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/types"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://tuscany.apache.org/sca/demos/aggregator/types">
<element name="Alerts" type="ns:AlertsType"/>
<complexType name="AlertType">
<sequence>
<element name="Title" type="string"/>
<element name="Summary" type="string"/>
<element name="Address" type="anyURI" maxOccurs="1" minOccurs="1"/>
<element name="Date" type="string" maxOccurs="1" minOccurs="1"/>
</sequence>
<attribute name="SourceId" type="string" use="optional"/>
<attribute name="Unread" type="boolean" use="optional"/>
<attribute name="Id" type="string" use="optional"/>
</complexType>
<complexType name="AlertsType">
<sequence>
<element name="Alert" type="ns:AlertType" maxOccurs="unbounded" minOccurs="0" />
</sequence>
</complexType>
<complexType name="SourceType">
<sequence>
<element name="Name" type="string" maxOccurs="1" minOccurs="1"/>
<element name="Address" type="anyURI" maxOccurs="1" minOccurs="1"/>
<element name="LastChecked" type="string" maxOccurs="1" minOccurs="0"/>
<element name="FeedAddress" type="string" maxOccurs="1" minOccurs="0"/>
<element name="PopServer" type="string" maxOccurs="1" minOccurs="0"/>
<element name="PopUsername" type="string" maxOccurs="1" minOccurs="0"/>
<element name="PopPassword" type="string" maxOccurs="1" minOccurs="0"/>
<any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="string" use="optional"/>
<attribute name="FeedType" use="required">
<simpleType>
<restriction base="string">
<enumeration value="rss"/>
<enumeration value="pop"/>
<enumeration value="nntp"/>
</restriction>
</simpleType>
</attribute>
</complexType>
<complexType name="ConfigType">
<sequence>
<element name="Source" type="ns:SourceType" maxOccurs="unbounded" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="SingleSourceType">
<sequence>
<element name="Source" type="ns:SourceType"/>
</sequence>
</complexType>
<element name="Config" type="ns:ConfigType"/>
<element name="Source" type="ns:SourceType"/>
</schema>

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<wsdl:definitions targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/sources"
xmlns:tns="http://tuscany.apache.org/sca/demos/aggregator/sources"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Alerter">
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/sources"
xmlns:alerter="http://tuscany.apache.org/sca/demos/aggregator/types"
elementFormDefault="qualified">
<xsd:import namespace="http://tuscany.apache.org/sca/demos/aggregator/types"
schemaLocation="Alerts.xsd" />
<element name="getAlertSources">
<xsd:complexType>
<sequence>
<element name="parm" type="string" />
</sequence>
</xsd:complexType>
</element>
<element name="getAlertSourcesResponse">
<complexType>
<sequence>
<element name="parm" type="alerter:ConfigType" />
</sequence>
</complexType>
</element>
<element name="addAlertSource">
<xsd:complexType>
<sequence>
<element name="parm" type="alerter:SourceType"/>
</sequence>
</xsd:complexType>
</element>
<element name="addAlertSourceResponse">
<complexType>
<sequence>
<element name="parm" type="string" />
</sequence>
</complexType>
</element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetAlertSourcesRequest">
<wsdl:part element="tns:getAlertSources" name="parameters" />
</wsdl:message>
<wsdl:message name="GetAlertSourcesResponse">
<wsdl:part element="tns:getAlertSourcesResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="AddAlertSourceRequest">
<wsdl:part element="tns:addAlertSource" name="parameters" />
</wsdl:message>
<wsdl:message name="AddAlertSourceResponse">
<wsdl:part element="tns:addAlertSourceResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="AlertsSourcesPortType">
<wsdl:operation name="getAlertSources">
<wsdl:input message="tns:GetAlertSourcesRequest" name="GetAlertSourcesRequestMsg" />
<wsdl:output message="tns:GetAlertSourcesResponse" name="GetAlertSourcesResponseMsg" />
</wsdl:operation>
<wsdl:operation name="addAlertSource">
<wsdl:input message="tns:AddAlertSourceRequest" name="AddAlertSourceRequestMsg" />
<wsdl:output message="tns:AddAlertSourceResponse" name="AddAlertSourceResponseMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AlertsSourcesBinding" type="tns:AlertsSourcesPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getAlertSources">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="GetAlertSourcesRequestMsg">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="GetAlertSourcesResponseMsg">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addAlertSource">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="AddAlertSourceRequestMsg">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="AddAlertSourceResponseMsg">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AlertsSourcesService">
<wsdl:port name="AlertsSourcesPort" binding="tns:AlertsSourcesBinding">
<wsdlsoap:address location="http://localhost:8085/services/AlertsSourcesServiceWebServiceBinding" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" targetNamespace="http://sample"
name="FeedAggregatorClient">
<!-- SDO factory classes -->
<!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.service.ServiceFactory"/ -->
<!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.types.TypesFactory"/ -->
<component name="AlertsFeedServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsFeedServiceImpl" />
<reference name="alerts" target="AlertsServiceComponent" />
</component>
<component name="AlertsServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsServiceImpl" />
<reference name="rssChecker" target="RSSCheckerComponent" />
<reference name="alertsSources" target="AlertsSourcesServiceComponent" />
</component>
<component name="AlertsSourcesServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesServiceImpl" />
</component>
<!-- The RSS reader -->
<component name="RSSCheckerComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.RSSCheckerServiceImpl" />
</component>
</composite>

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
targetNamespace="http://sample"
name="FeedAggregator">
<!-- SDO factory classes -->
<!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.service.ServiceFactory"/ -->
<!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.types.TypesFactory"/ -->
<!-- The alerts rss service -->
<service name="AlertsFeedServiceRSS" promote="AlertsFeedServiceComponent/Collection">
<tuscany:binding.rss />
</service>
<!-- The alerts atom service -->
<service name="AlertsFeedServiceAtom" promote="AlertsFeedServiceComponent/Collection">
<tuscany:binding.atom />
</service>
<component name="AlertsFeedServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsFeedServiceImpl" />
<reference name="alerts" target="AlertsServiceComponent"/>
</component>
<!-- The alerts web service -->
<service name="AlertsService" promote="AlertsServiceComponent">
<interface.wsdl interface="http://tuscany.apache.org/sca/demos/aggregator/service#wsdl.interface(AlertsPortType)"/>
<binding.ws wsdlElement="http://tuscany.apache.org/sca/demos/aggregator/service#wsdl.port(AlertsService/AlertsPort)"/>
</service>
<!-- The alerts jsonrpc service -->
<service name="AlertsServiceJSONRPC" promote="AlertsServiceComponent/AlertsService">
<interface.java interface="org.apache.tuscany.sca.demos.aggregator.AlertsService" />
<tuscany:binding.jsonrpc />
</service>
<component name="AlertsServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsServiceImpl" />
<reference name="rssChecker" target="RSSCheckerComponent"/>
<reference name="alertsSources" target="AlertsSourcesServiceComponent"/>
</component>
<!-- The alerts sources web service -->
<service name="AlertsSourcesService" promote="AlertsSourcesServiceComponent">
<interface.wsdl interface="http://tuscany.apache.org/sca/demos/aggregator/sources#wsdl.interface(AlertsSourcesPortType)"/>
<binding.ws wsdlElement="http://tuscany.apache.org/sca/demos/aggregator/sources#wsdl.port(AlertsSourcesService/AlertsSourcesPort)"/>
</service>
<!-- The alerts jsonrpc service -->
<service name="AlertsSourcesServiceJSONRPC" promote="AlertsSourcesServiceComponent/AlertsSourcesService">
<interface.java interface="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesService" />
<tuscany:binding.jsonrpc />
</service>
<component name="AlertsSourcesServiceComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesServiceImpl" />
</component>
<!-- The RSS reader -->
<component name="RSSCheckerComponent">
<implementation.java class="org.apache.tuscany.sca.demos.aggregator.RSSCheckerServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- Note: the demo expects LastChecked date in ISO 8601 format (yyyy-MM-dd hh:mm:ss). -->
<ns0:Config xmlns:ns0="http://tuscany.apache.org/sca/demos/aggregator/types">
<ns0:Source Id="0" FeedType="rss">
<ns0:Name>BBC News</ns0:Name>
<ns0:Address>http://news.bbc.co.uk/</ns0:Address>
<ns0:LastChecked>2008-06-20 12:00:00</ns0:LastChecked>
<ns0:FeedAddress>http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml</ns0:FeedAddress>
</ns0:Source>
<ns0:Source Id="1" FeedType="rss">
<ns0:Name>Engadget</ns0:Name>
<ns0:Address>http://www.engadget.com</ns0:Address>
<ns0:LastChecked>2008-06-20 12:00:00</ns0:LastChecked>
<ns0:FeedAddress>http://www.engadget.com/rss.xml</ns0:FeedAddress>
</ns0:Source>
</ns0:Config>

View file

@ -0,0 +1,330 @@
<html>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<head>
<title>Apache Tuscany Alert Aggregator Sample</TITLE>
<script type="text/javascript">
//var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
//djConfig.debugAtAllCosts = true;
</script>
<script type="text/javascript" src="dojo/dojo/dojo.js">
</script>
<script type="text/javascript" src="dojo/dijit/dijit.js">
</script>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dojo.rpc.JsonService");
</script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body onload="getAlertSources()">
<script type="text/javascript">
// The proxy for the alert and alertsources services running in Tuscany
var alertsService = new dojo.rpc.JsonService("AlertsServiceJSONRPC?smd");
var alertSourcesService = new dojo.rpc.JsonService("AlertsSourcesServiceJSONRPC?smd");
// If you want to put an HTTP sniffer in the way to look at the JSONROPC packets you'll
// need to edit the target address of the service in the smd. The only way to do this easily
// is to read an smd from disc rather than generate one. There are two smds provided for this
//var alertsService = new dojo.rpc.JsonService("service.smd");
//var alertSourcesService = new dojo.rpc.JsonService("sources.smd");
// The global list of alerts sources
var alertSourceList = null;
// The global list of alerts
var alertList = null;
// the constructor for entries on the alert source list
function alertSourceType(name,id,address,feedAddress,feedType,popUsername,popPassword,popServer,lastChecked,javaClass) {
this.name = name;
this.id = id;
this.address = address;
this.feedAddress = feedAddress;
this.feedType = feedType;
this.lastChecked = lastChecked;
this.javaClass = "org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl";
}
function errorCallback(result, error, id) {
var resultsNode = document.getElementById("errors");
// There seems to be a problem somewhere as I should be able to get the error
// details but all I can actually get is the Id from the error message
// resultsNode.innerHTML = "there was an error! message id = " + " error code = " + result.error.code + " error message = " + result.error.msg ;
resultsNode.innerHTML = "An error was returned by the server. Message id = " + result.id;
}
// Generate the alert sources table
function getAlertSources()
{
response = alertSourcesService.getAlertSources("Dojo");
response.addCallbacks(getAlertSourcesCallback, errorCallback);
getAlerts();
}
function getAlertSourcesCallback(result) {
var resultsNode = document.getElementById("alertSourcesTable");
if ( result.error != null ) {
resultsNode.innerHTML = result.error;
} else {
// stash away the source list for when we come to edit it
alertSourceList = result.source.list;
// put out the html
var text = ""
var nextSourceId = 0
for (var i in result.source.list){
var source = result.source.list[i];
text = text + "<table>";
text = text + "<TR CLASS='source_" + source.id + "' >";
text = text + " <TD CLASS='source_name clickable' ONCLICK=\"displayAlert('" + source.address + "')\">";
text = text + " <IMG SRC='rss.png'/>&nbsp;&nbsp;" + source.name;
text = text + " </TD>";
text = text + " <TD CLASS='clickable link' ONCLICK=\"showEditSource('" + source.id + "')\">Edit</TD>";
text = text + " <TD CLASS='clickable link' ONCLICK=\"deleteSource('" + source.id + "')\">Delete</TD>";
text = text + "</TR>";
text = text + "<TR ID='edit_source_" + source.id + "' CLASS='hidden source_" + source.id + "'>";
text = text + " <TD COLSPAN='3'>";
text = text + " <TABLE CLASS='sourceDetailsTable'>";
text = text + " <TR>";
text = text + " <TD>Source name:</TD>";
text = text + " <TD>";
text = text + " <INPUT ID='source_" + source.id + "_name' TYPE='TEXT' SIZE='50' VALUE='" + source.name + "'/>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR>";
text = text + " <TD>Source address:</TD>"
text = text + " <TD>";
text = text + " <INPUT ID='source_" + source.id + "_address' TYPE='TEXT' SIZE='50' VALUE='" + source.address + "'/>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR>";
text = text + " <TD>";
text = text + " <INPUT ID='source_" + source.id + "_type' TYPE='HIDDEN' VALUE='" + source.id + "'/>";
text = text + " <INPUT TYPE='BUTTON' VALUE='Update' ONCLICK=\"updateSource('" + source.id + "')\"/>";
text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideEditSource('" + source.id + "')\"/>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " </TABLE>";
text = text + " </TD>";
text = text + "</TR>";
nextSourceId = eval(source.id);
}
nextSourceId = nextSourceId + 1;
text = text + "<TR CLASS='source_" + nextSourceId + "'>";
text = text + " <TD COLSPAN='4' CLASS='clickable link' ONCLICK=\"showAddNewSource('" + nextSourceId + "')\">Add new Alert Source</TD>";
text = text + "</TR>";
text = text + "<TR ID='add_source_" + nextSourceId + "' CLASS='hidden source_" + nextSourceId + "'>";
text = text + " <TD COLSPAN='4'>";
text = text + " <TABLE CLASS='sourceDetailsTable'>";
text = text + " <TR>";
text = text + " <TD>Source name:</TD>";
text = text + " <TD>";
text = text + " <INPUT ID='source_" + nextSourceId + "_name' TYPE='TEXT' SIZE='50'>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR>";
text = text + " <TD>Source address:</TD>";
text = text + " <TD>";
text = text + " <INPUT ID='source_" + nextSourceId + "_address' TYPE='TEXT' SIZE='50'>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR>";
text = text + " <TD>Source type:</TD>";
text = text + " <TD>";
text = text + " <SELECT ID='source_" + nextSourceId + "_type' ONCHANGE=\"showSourceType('" + nextSourceId + "')\">";
text = text + " <OPTION value='rss' selected='selected'>RSS/Atom feed</OPTION>";
text = text + " </SELECT>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR ID='add_rss_source'>";
text = text + " <TD COLSPAN='2'>";
text = text + " <TABLE CLASS='sourceDetailsTable'>";
text = text + " <TR>";
text = text + " <TD>Feed address:</TD>";
text = text + " <TD>";
text = text + " <INPUT ID='source_" + nextSourceId + "_feedAddress' TYPE='TEXT' SIZE='50'/>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " </TABLE>";
text = text + " </TD>";
text = text + " </TR>";
text = text + " <TR>";
text = text + " <TD>";
text = text + " <INPUT TYPE='BUTTON' VALUE='Add' ONCLICK=\"addSource('" + nextSourceId + "')\">";
text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideAddNewSource('" + nextSourceId + "')\">";
text = text + " </TD>";
text = text + " </TR>";
text = text + " </TABLE>";
text = text + " </TD>";
text = text + "</TR>";
text = text + "</table>";
resultsNode.innerHTML = text;
}
}
function showEditSource(sourceid)
{
document.getElementById("edit_source_"+sourceid).className = "source_"+sourceid;
}
function hideEditSource(sourceid)
{
document.getElementById("edit_source_"+sourceid).className = "hidden source_"+sourceid;
}
function updateSource(sourceid)
{
hideEditSource(sourceid);
var source = getSource(sourceId);
alertSourcesService.updateAlertSource(source);
getAlertSources();
}
function deleteSource(sourceid)
{
alertSourcesService.removeAlertSource(sourceid);
getAlertSources();
}
function showAddNewSource(sourceid)
{
document.getElementById("add_source_"+sourceid).className = "source_"+sourceid;
}
function hideAddNewSource(sourceid)
{
document.getElementById("add_source_"+sourceid).className = "hidden source_"+sourceid;
}
function addSource(sourceid)
{
hideAddNewSource(sourceid);
var source = getSource(sourceid);
alertSourcesService.addAlertSource(source);
// wait a little before getting the list back from the server
setTimeout("getAlertSources()",1250);
}
function getSource(sourceid)
{
var source = alertSourceList[sourceid];
if ( source == null ){
source = new alertSourceType("name","id","address","feedAddress","feedType","popUsername","popPassword","popServer","lastChecked","javaClass");
alertSourceList[sourceid] = source;
}
source.name = document.getElementById("source_"+sourceid+"_name").value;
source.id = sourceid;
source.address = document.getElementById("source_"+sourceid+"_address").value;
var typeElem = document.getElementById("source_"+sourceid+"_type");
source.feedType = typeElem.options[typeElem.selectedIndex].value;
if(source.feedType=="rss")
{
source.feedAddress = document.getElementById("source_"+sourceid+"_feedAddress").value;
}
else if(source.feedType=="pop")
{
source.popServer = document.getElementById("source_"+sourceid+"_popServer").value;
source.popUsername = document.getElementById("source_"+sourceid+"_popUsername").value;
source.popPassword = document.getElementById("source_"+sourceid+"_popPassword").value;
}
return source;
}
// Generate the alerts table
function getAlerts()
{
response = alertsService.getAllNewAlerts("Dojo");
response.addCallbacks(getAlertsCallback, errorCallback);
}
function getAlertsCallback(result) {
var resultsNode = document.getElementById("alertsTable");
if ( result.error != null ) {
resultsNode.innerHTML = result.error;
} else {
alertList = result.alert.list;
var text = ""
for (var i in result.alert.list){
var alert = result.alert.list[i];
text = text + "<table>";
text = text + "<TR class='source_" + alert.sourceId + " clickable' onclick=\"displayAlert('" + alert.address + "')\">";
text = text + " <TD class='alert_text'>";
text = text + " <SPAN id='" + alert.id + "' class='unread_title'>" + alert.title + "</SPAN>";
text = text + " <SPAN class='summary'> - " + alert.summary.substring(0, 80) + "...</SPAN>";
text = text + " </TD>";
text = text + " <TD>";
text = text + alert.date;
text = text + " </TD>"
text = text + "</TR>"
text = text + "</table>";
}
resultsNode.innerHTML = text;
}
}
function displayAlert(url)
{
document.getElementById("alertData").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
window.location="#data";
return;
}
</script>
<h1 id="top">Apache Tuscany Alert Aggregator Demo</h1>
<div id="errors"></div>
<p>Alert Sources<span id="refreshSources"></span>:</p>
<!--input type="button" value="getSources" onclick="getAlertSources()"/-->
<div id="alertSourcesTable">Refreshing...</div>
<p /><input type="button" value="Refresh" onclick="getAlerts()" />
<p />
<div id="alertsTable">Refreshing...</div>
<p><a id="data" HREF="#top">Back to top</a></p>
<div id="alertData"></div>
<p />
<div id="dojoDebug"></div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:sample="http://sample">
<deployable composite="sample:FeedAggregator"/>
</contribution>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
<d:environment>
<d:moduleId>
<d:groupId>org.apache.tuscany.sca</d:groupId>
<d:artifactId>demo-alert-aggregator-webapp</d:artifactId>
<d:version>1.6-SNAPSHOT</d:version>
<d:type>war</d:type>
</d:moduleId>
<!-- TUSCANY-2622 -->
<d:hidden-classes>
<d:filter>org.apache.axiom</d:filter>
<d:filter>org.apache.axis2</d:filter>
<d:filter>org.apache.commons</d:filter>
<d:filter>org.jdom</d:filter>
</d:hidden-classes>
</d:environment>
</web-app>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Apache Tuscany Alert Aggregator Demo</display-name>
<filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>AlertAggregator.html</welcome-file>
</welcome-file-list>
</web-app>

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

View file

@ -0,0 +1 @@
{"SMDVersion":".1","objectName":"AlertsService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8085/sample-feed-aggregator/services/AlertsServiceJSONRPC","methods":[{"name":"getAllNewAlerts","parameters":[{"name":"param0","type":"STRING"}]}]}

View file

@ -0,0 +1 @@
{"SMDVersion":".1","objectName":"AlertsSourcesService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8081/sample-feed-aggregator/services/AlertsSourcesServiceJSONRPC","methods":[{"name":"getAlertSources","parameters":[{"name":"param0","type":"STRING"}]},{"name":"getAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"updateAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"addAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"removeAlertSource","parameters":[{"name":"param0","type":"STRING"}]}]}

View file

@ -0,0 +1,176 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
p,table,li,h1,h2,h3
{
font-family: verdana, arial, 'sans serif';
}
p, h1, h2, h3, table, li, hr
{
margin-left: 10pt;
}
table
{
border-color: black;
border-collapse: separate;
border-spacing: 0px 1px;
margin-right: 10pt;
margin-left: 10pt;
width: 800px;
}
.sourceDetailsTable
{
width: 600px;
}
tr, td
{
margin-left: 0pt;
margin-right: 0pt;
padding-left: 10pt;
font-size: 90%;
}
p,li,th
{
font-size: 90%;
margin-left: 10pt;
}
pre
{
margin-left: 10pt;
}
body
{
#ffffff;
}
h1,h2,h3,hr
{
color: firebrick;
}
a:link {COLOR: firebrick;}
a:visited {COLOR: firebrick;}
a:active {COLOR: navy;}
.link
{
COLOR: firebrick;
text-decoration: underline;
}
.clickable
{
cursor: pointer
}
.unread_title
{
font-weight: bold;
}
.read_title
{
font-weight: normal;
}
.summary
{
color: DimGrey;
}
.hidden
{
display: none;
}
.source_name
{
width: 600px;
}
.alert_text
{
width: 600px;
}
.alert_data
{
margin-left: 10px;
width: 800px;
height: 800px;
}
.source_0
{
background-color: LightGreen;
}
.source_1
{
background-color: LightSkyBlue;
}
.source_2
{
background-color: Khaki;
}
.source_3
{
background-color: LightPink;
}
.source_4
{
background-color: Orange;
}
.source_5
{
background-color: LightCoral;
}
.source_6
{
background-color: Orchid;
}
.source_7
{
background-color: Peru;
}
.source_8
{
background-color: SpringGreen;
}
.source_9
{
background-color: LightGrey;
}

View file

@ -0,0 +1,97 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tuscany.sca.demos.aggregator;
import java.io.ByteArrayInputStream;
import junit.framework.Assert;
import org.json.JSONObject;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
/**
*/
public class AlertsIntegrationTest {
//private static SCADomain scaDomain;
@BeforeClass
public static void setUp() throws Exception {
//scaDomain = SCADomain.newInstance("alerts.composite");
}
/**
* Runs after each test method
*/
@AfterClass
public static void tearDown() {
//scaDomain.close();
}
/* Use this if you want to test locally without deploying to a web container
public void testWait() throws Exception {
System.out.println("Feed aggregator server started (press enter to shutdown)");
System.in.read();
System.out.println("Feed aggregator server stopped");
}
*/
@Test
public void testGetAllNewAlerts() throws Exception {
JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAllNewAlerts\",\"id\":2}");
JSONObject jsonResp = callService ("http://localhost:8085/demo-alert-aggregator-webapp/AlertsServiceJSONRPC",
jsonRequest);
Assert.assertNotNull(jsonResp);
}
@Test
public void testAddAlertSources() throws Exception {
JSONObject jsonRequest = new JSONObject("{\"params\":[{\"name\":\"news\",\"id\":\"2\",\"address\":\"www.news.com\",\"feedAddress\":\"http://news.com.com/2547-1_3-0-20.xml\",\"feedType\":\"rss\",\"lastChecked\":\"lastChecked\",\"javaClass\":\"org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl\"}],\"method\":\"addAlertSource\",\"id\":2}");
JSONObject jsonResp = callService ("http://localhost:8085/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC",
jsonRequest);
Assert.assertNotNull(jsonResp);
}
@Test
public void testGetAlertSources() throws Exception {
JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAlertSources\",\"id\":2}");
JSONObject jsonResp = callService ("http://localhost:8085/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC",
jsonRequest);
Assert.assertEquals("BBC News", jsonResp.getJSONObject("result").getJSONObject("source").optJSONArray("list").getJSONObject(0).getString("name"));
}
public JSONObject callService(String url, JSONObject jsonRequest) throws Exception {
System.out.println("Request = " + jsonRequest.toString());
WebConversation wc = new WebConversation();
WebRequest request = new PostMethodWebRequest( url,
new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
WebResponse response = wc.getResource(request);
System.out.println("Response= " + response.getText());
Assert.assertEquals(200, response.getResponseCode());
return new JSONObject(response.getText());
}
}

View file

@ -0,0 +1,4 @@
bigbank-account is part of a larger demo called bigbank.
Please see the Readme file under bigbank to understand how bigbank-account fits into the overall demo.

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="DojoZipInstaller">
<property name="dojo.version" value="1.3.0"/>
<property name="unpack.location" value="${basedir}/src/main/resources/web/dojo"/>
<target name="check-dojo-installed">
<condition property="already.installed" >
<available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</condition>
<condition property="maven.suffix" value="">
<os family="unix"/>
</condition>
<condition property="maven.suffix" value=".bat">
<os family="windows"/>
</condition>
</target>
<target name="check-dojo-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
</exec>
</target>
<target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</target>
<target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
<fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
<unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
dest="${basedir}/target/dojo-unpack-temp/"
overwrite="false">
<patternset>
<include name="dojo-release-${dojo.version}/dojo/**"/>
<exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
<include name="dojo-release-${dojo.version}/dijit/**"/>
<exclude name="dojo-release-${dojo.version}/dojox/**"/>
<exclude name="dojo-release-${dojo.version}/util/**"/>
</patternset>
</unzip>
<move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
tofile="${unpack.location}"
verbose="true"/>
<delete dir="${basedir}/target/dojo-unpack-temp/"/>
</target>
<target name="clean-dojo-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="bigbank-account" default="compile">
<property name="settings.localRepository" value="./target/repo" />
<property name="artifactId" value="demo-bigbank-account" />
<!--path id="test.classpath">
<pathelement location="target/classes"/>
<pathelement location="../../modules/tuscany-host-jetty-1.6-SNAPSHOT.jar"/>
<pathelement location="../../modules/tuscany-binding-jsonrpc-1.6-SNAPSHOT.jar"/>
<pathelement location="../../modules/tuscany-binding-rmi-1.6-SNAPSHOT.jar"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
<pathelement location="target/demo-bigbank-account.jar"/>
</path-->
<target name="init">
<mkdir dir="target/classes"/>
<mkdir dir="target/classes/web"/>
<mkdir dir="target/repo"/>
</target>
<!--target name="dojo" depends="init">
<ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
<property name="localRepository" value="${settings.localRepository}"/>
</ant>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</target-->
<target name="compile" depends="init">
<javac srcdir="src/main/java"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</javac>
<copy todir="target/classes">
<fileset dir="src/main/resources"/>
</copy>
<jar destfile="target/demo-bigbank-account.jar" basedir="target/classes">
<!--manifest>
<attribute name="Main-Class" value="${test.class}" />
</manifest-->
</jar>
</target>
<!--target name="run" depends="compile">
<java classname="${test.class}"
fork="true">
<classpath>
<path refid="test.classpath"/>
</classpath>
</java>
</target-->
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="target" />
</delete>
</target>
</project>

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-demos</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>demo-bigbank-account</artifactId>
<packaging>jar</packaging>
<name>Apache Tuscany SCA Demo BigBank Account</name>
<repositories>
<repository>
<id>apache.incubator</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-core-spi</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-security</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.3</version>
</dependency>
</dependencies>
<build>
<finalName>demo-bigbank-account</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.checking;
/**
* @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
* 2007) $$
*/
public class CheckingAccountDetails {
private String accountNumber;
private double balance;
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String n) {
this.accountNumber = n;
}
public double getBalance() {
return balance;
}
public void setBalance(double b) {
this.balance = b;
}
@Override
public String toString() {
return accountNumber + ", balance:" + balance;
}
}

View file

@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.checking;
import org.osoa.sca.annotations.Remotable;
import org.osoa.sca.annotations.Service;
/**
* @version $$Rev$$ $$Date$$
*/
@Service
@Remotable
public interface CheckingAccountService {
public CheckingAccountDetails getAccountDetails(String customerID);
public double deposit(String accountNo, double depositAmt);
public double withdraw(String accountNo, double withdrawalAmount);
}

View file

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.checking;
import java.util.HashMap;
import java.util.Map;
import org.osoa.sca.annotations.Service;
/**
*
* */
@Service(CheckingAccountService.class)
public class CheckingAccountServiceImpl implements CheckingAccountService {
private Map<String, String> custAcctMap = new HashMap<String, String>();
private Map<String, Double> checkingAccts = new HashMap<String, Double>();
public CheckingAccountServiceImpl() {
custAcctMap.put("Customer_01", "CHA_Customer_01");
custAcctMap.put("Customer_02", "CHA_Customer_02");
custAcctMap.put("Customer_03", "CHA_Customer_03");
checkingAccts.put("CHA_Customer_01", new Double(1000));
checkingAccts.put("CHA_Customer_02", new Double(1500));
checkingAccts.put("CHA_Customer_03", new Double(2000));
}
public double deposit(String accountNo, double depositAmt) {
checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt));
return checkingAccts.get(accountNo).doubleValue();
}
public CheckingAccountDetails getAccountDetails(String customerID) {
CheckingAccountDetails checkingAccount = new CheckingAccountDetails();
checkingAccount.setAccountNumber(custAcctMap.get(customerID));
checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue());
return checkingAccount;
}
public double withdraw(String accountNo, double withdrawalAmount) {
double balance = checkingAccts.get(accountNo).doubleValue();
if ( balance - withdrawalAmount > 0 ) {
balance = balance - withdrawalAmount;
checkingAccts.put(accountNo, balance);
}
return balance;
}
}

View file

@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.savings;
import java.io.Serializable;
/**
* @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
* 2007) $$
*/
public class SavingsAccountDetails implements Serializable {
private String accountNumber;
private double balance;
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String n) {
this.accountNumber = n;
}
public double getBalance() {
return balance;
}
public void setBalance(double b) {
this.balance = b;
}
@Override
public String toString() {
return accountNumber + ", balance:" + balance;
}
}

View file

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.savings;
import org.osoa.sca.annotations.Remotable;
/**
* @version $$Rev$$ $$Date$$
*/
@Remotable
public interface SavingsAccountService {
public SavingsAccountDetails getAccountDetails(String customerID);
public double deposit(String accountNo, double depositAmt);
public double withdraw(String accountNo, double withdrawalAmount);
}

View file

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.savings;
import java.util.HashMap;
import java.util.Map;
import org.osoa.sca.annotations.Service;
/**
*
* */
@Service(SavingsAccountService.class)
public class SavingsAccountServiceImpl implements SavingsAccountService {
private Map<String, String> custAcctMap = new HashMap<String, String>();
private Map<String, Double> savingsAccts = new HashMap<String, Double>();
public SavingsAccountServiceImpl() {
custAcctMap.put("Customer_01", "SVA_Customer_01");
custAcctMap.put("Customer_02", "SVA_Customer_02");
custAcctMap.put("Customer_03", "SVA_Customer_03");
savingsAccts.put("SVA_Customer_01", new Double(1000));
savingsAccts.put("SVA_Customer_02", new Double(1500));
savingsAccts.put("SVA_Customer_03", new Double(2000));
}
public double deposit(String accountNo, double depositAmt) {
savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt));
return savingsAccts.get(accountNo).doubleValue();
}
public SavingsAccountDetails getAccountDetails(String customerID) {
SavingsAccountDetails savingsAccount = new SavingsAccountDetails();
savingsAccount.setAccountNumber(custAcctMap.get(customerID));
savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue());
return savingsAccount;
}
public double withdraw(String accountNo, double withdrawalAmount) {
double balance = savingsAccts.get(accountNo).doubleValue();
if ( balance - withdrawalAmount > 0 ) {
balance = balance - withdrawalAmount;
savingsAccts.put(accountNo, balance);
}
return balance;
}
}

View file

@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
/**
* Sample userid passwd generation class
*/
public class AccountsDataPasswordCallbackHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
System.out.println(" Usage is SIGNATURE ... ");
pwcb.setPassword("bbservice");
} else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) {
System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = "
+ pwcb.getIdentifer() + " and password = " + pwcb.getPassword() );
if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) {
System.out.println("AUTHENTICATION SUCCESSFUL!");
} else {
System.out.println("AUTHENTICATION FAILED!");
throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!");
}
}
}
}
}

View file

@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import java.security.Principal;
import java.util.Hashtable;
import java.util.Map;
/**
* @version $Rev$ $Date$
*/
public class BigbankCheckingsAcl {
private static Map<String, String>checkingsAcl = new Hashtable<String, String>();
static {
checkingsAcl.put("bbaservice", "Customer_01");
checkingsAcl.put("bbUser01", "Customer_01");
}
public static void authorize(Principal principal, String resource) {
if ( checkingsAcl.get(principal.getName()) == null ||
!checkingsAcl.get(principal.getName()).equals(resource) ) {
throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " +
resource);
} else {
System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource);
}
}
}

View file

@ -0,0 +1,90 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import org.apache.tuscany.sca.assembly.ConfiguredOperation;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.OperationsConfigurator;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
/**
* @version $Rev$ $Date$
*/
public class CheckingsDeptAuthImplementationPolicyProvider implements PolicyProvider {
private RuntimeComponent component;
private Implementation implementation;
public CheckingsDeptAuthImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
super();
this.component = component;
this.implementation = implementation;
}
private String getContext() {
return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
}
private PolicySet findPolicySet(Operation operation) {
for (PolicySet ps : component.getPolicySets()) {
for (Object p : ps.getPolicies()) {
if (CheckingsDeptAuthPolicy.class.isInstance(p)) {
return ps;
}
}
}
if ( component instanceof OperationsConfigurator ) {
for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
if ( confOp.getName().equals(operation.getName())) {
for (PolicySet ps : confOp.getPolicySets()) {
for (Object p : ps.getPolicies()) {
if (CheckingsDeptAuthPolicy.class.isInstance(p)) {
return ps;
}
}
}
}
}
}
return null;
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
*/
public Interceptor createInterceptor(Operation operation) {
PolicySet ps = findPolicySet(operation);
return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps);
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
*/
public String getPhase() {
return Phase.IMPLEMENTATION_POLICY;
}
}

View file

@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.policy.Policy;
/**
* @version $Rev$ $Date$
*/
public class CheckingsDeptAuthPolicy implements Policy {
public QName getSchemaName() {
// TODO Auto-generated method stub
return null;
}
public boolean isUnresolved() {
// TODO Auto-generated method stub
return false;
}
public void setUnresolved(boolean unresolved) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,79 @@
package bigbank.account.security;
import java.security.Principal;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.SecurityUtil;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Policy handler to handle PolicySet related to Logging with the QName
* {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
*/
public class CheckingsDeptAuthPolicyInterceptor implements Interceptor {
private Invoker next;
public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
super();
init();
}
private final void init() {
}
public Message invoke(Message msg) {
Object msgBody = msg.getBody();
if (msgBody instanceof Object[]) {
Object args[] = (Object[])msg.getBody();
Principal principal = SecurityUtil.getPrincipal(msg);
if (principal != null){
BigbankCheckingsAcl.authorize(principal,
(String)args[0]);
}
}
Message responseMsg = null;
try {
responseMsg = getNext().invoke(msg);
return responseMsg;
} catch (RuntimeException e) {
throw e;
}
}
public Invoker getNext() {
return next;
}
public void setNext(Invoker next) {
this.next = next;
}
}

View file

@ -0,0 +1,75 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.provider.PolicyProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
* @version $Rev$ $Date$
*/
public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory<CheckingsDeptAuthPolicy> {
private ExtensionPointRegistry registry;
public CheckingsDeptAuthPolicyProviderFactory(ExtensionPointRegistry registry) {
super();
this.registry = registry;
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
*/
public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
return new CheckingsDeptAuthImplementationPolicyProvider(component, implementation);
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
*/
public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return null;
}
/**
* @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
*/
public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return null;
}
/**
* @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
*/
public Class getModelType() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,67 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import java.security.Principal;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.SecurityUtil;
import org.apache.tuscany.sca.policy.util.PolicyHandler;
/**
* @version $Rev$ $Date$
*/
public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler {
private PolicySet applicablePolicySet = null;
public void afterInvoke(Object... context) {
}
public void beforeInvoke(Object... context) {
for ( int count = 0 ; count < context.length ; ++count ) {
if ( context[count] instanceof Message ) {
Message msg = (Message)context[count];
Object args[] = (Object[])msg.getBody();
Principal principal = SecurityUtil.getPrincipal(msg);
if (principal != null){
BigbankCheckingsAcl.authorize(principal,
(String)args[0]);
}
}
}
}
public void cleanUp(Object... arg0) {
}
public PolicySet getApplicablePolicySet() {
return this.applicablePolicySet;
}
public void setApplicablePolicySet(PolicySet policySet) {
this.applicablePolicySet = policySet;
}
public void setUp(Object... arg0) {
}
}

View file

@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.security;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
/**
* Implementation of a Policy Processor
*
*/
public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor<CheckingsDeptAuthPolicy> {
private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy");
public QName getArtifactType() {
return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME;
}
public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
}
public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy();
return policy;
}
public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
XMLStreamException {
String prefix = "tuscany";
writer.writeStartElement(prefix,
CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(),
CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI());
writer.writeNamespace("chk", "http://bigbank/checkings");
writer.writeEndElement();
}
public Class<CheckingsDeptAuthPolicy> getModelType() {
return CheckingsDeptAuthPolicy.class;
}
public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
}
}

View file

@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.stock;
/**
* @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
* 2007) $$
*/
public class StockAccountDetails {
private String accountNumber;
private String symbol;
private int quantity;
public StockAccountDetails() {
}
public StockAccountDetails(String acNo, String symbol, int qty) {
this.accountNumber = acNo;
this.symbol = symbol;
this.quantity = qty;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String n) {
this.accountNumber = n;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int a) {
this.quantity = a;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String s) {
this.symbol = s;
}
@Override
public String toString() {
return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity;
}
}

View file

@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.stock;
import org.osoa.sca.annotations.Remotable;
/**
*
*/
@Remotable
public interface StockAccountService {
public StockAccountDetails getAccountDetails(String customerID);
public StockAccountDetails buy(String accountNo, String symbol, int quantity);
public StockAccountDetails sell(String accountNo, String symbol, int quantity);
}

View file

@ -0,0 +1,60 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.stock;
import java.util.HashMap;
import java.util.Map;
import org.osoa.sca.annotations.Service;
/**
*
* */
@Service(StockAccountService.class)
public class StockAccountServiceImpl implements StockAccountService {
private Map<String, String> custAcctMap = new HashMap<String, String>();
private Map<String, StockAccountDetails> stockAccts = new HashMap<String, StockAccountDetails>();
public StockAccountServiceImpl() {
custAcctMap.put("Customer_01", "STA_Customer_01");
custAcctMap.put("Customer_02", "STA_Customer_02");
custAcctMap.put("Customer_03", "STA_Customer_03");
stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100));
stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200));
stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125));
}
public StockAccountDetails buy(String accountNo, String symbol, int quantity) {
return null;
}
public StockAccountDetails getAccountDetails(String customerID) {
return stockAccts.get(custAcctMap.get(customerID));
}
public StockAccountDetails sell(String accountNo, String symbol, int quantity) {
return null;
}
}

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bigbank/checkings"
xmlns:bbck="http://bigbank/checkings"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:bba="http://bigbankAccount"
name="CheckingsAccountDept">
<service name="CheckingsAccountService" promote="CheckingAccountServiceComponent" requires="authentication">
<interface.java interface="bigbank.account.checking.CheckingAccountService"/>
<binding.ws uri="http://localhost:8085/services/CheckingAcWebService"/>
</service>
<component name="CheckingAccountServiceComponent">
<implementation.java class="bigbank.account.checking.CheckingAccountServiceImpl" requires="bba:authorization"/>
</component>
</composite>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bigbank"
xmlns:bb="http://bigbank"
xmlns:bbck="http://bigbank/checkings"
xmlns:bbsv="http://bigbank/savings"
xmlns:bbst="http://bigbank/stock">
<deployable composite="bbck:CheckingsAccountDept"/>
<deployable composite="bbsv:SavingsAccountDept"/>
<deployable composite="bbst:StockAccountDept"/>
<export namespace="http://bigbank/checkings"/>
<export namespace="http://bigbank/savings"/>
<export namespace="http://bigbank/stock"/>
<export.java package="bigbank.account.checking"/>
<export.java package="bigbank.account.savings"/>
<export.java package="bigbank.account.stock"/>
<export.java package="bigbank.account.security"/>
<export.resource uri="definitions.xml"/>
</contribution>

View file

@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Implementation class for the artifact processor extension
bigbank.account.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.account.security.CheckingsDeptAuthPolicy

View file

@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
# handler classname;qname=<policy intent addressed>;model=<policy model class>
bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy

View file

@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Implementation class for the policy extension
bigbank.account.security.CheckingsDeptAuthPolicyProviderFactory;model=bigbank.account.security.CheckingsDeptAuthPolicy

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bigbank/savings"
xmlns:bbsv="http://bigbank/savings"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
name="SavingsAccountDept">
<service name="SavingsAccountService" promote="SavingsAccountServiceComponent">
<interface.java interface="bigbank.account.savings.SavingsAccountService"/>
</service>
<component name="SavingsAccountServiceComponent">
<implementation.java class="bigbank.account.savings.SavingsAccountServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bigbank/stock"
xmlns:bbst="http://bigbank/stock"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
name="StockAccountDept">
<service name="StockAccountService" promote="StockAccountServiceComponent">
<interface.java interface="bigbank.account.stock.StockAccountService"/>
</service>
<component name="StockAccountServiceComponent">
<implementation.java class="bigbank.account.stock.StockAccountServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="ASCII"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://bigbankAccount"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:chk="http://bigbank/checkings"
xmlns:bb="http://bigbank"
xmlns:bba="http://bigbankAccount">
<sca:intent name="authorization"
constrains="sca:implementation.java">
<description>
Authorization Intent
</description>
</sca:intent>
<!-- WS Security POLICY SETS -->
<sca:policySet name="wsAuthenticationPolicy"
provides="authentication"
appliesTo="sca:service/sca:binding.ws">
<tuscany:wsConfigParam>
<parameter name="InflowSecurity">
<action>
<items>UsernameToken</items>
<passwordCallbackClass>bigbank.account.security.AccountsDataPasswordCallbackHandler</passwordCallbackClass>
</action>
</parameter>
</tuscany:wsConfigParam>
</sca:policySet>
<sca:policySet name="chkDeptAuthorizationPolicy"
provides="bba:authorization"
appliesTo="sca:implementation.java">
<chk:AuthPolicy>
<!-- need to evolve what should go in here -->
</chk:AuthPolicy>
</sca:policySet>
</sca:definitions>

View file

@ -0,0 +1,92 @@
<html>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<head>
<title>Tuscany JSON-RPC BigBank Client</TITLE>
<script type="text/javascript">
var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
djConfig.usePlainJson=true ;
//djConfig.debugAtAllCosts = true;
</script>
<script type="text/javascript" src="dojo/dojo/dojo.js">
</script>
<script type="text/javascript" src="dojo/dijit/dijit.js">
</script>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dojo.rpc.JsonService");
</script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table>
<tr>
<th colspan="2">Tuscany JSON-RPC BigBank Client</th>
</tr>
<tr>
<td colspan="2">
<p>This example uses the <a href="http://dojotoolkit.org/">Dojo
Toolkit</a> to create a JavaScript object <code>accountService</code> for
the service at <b>http://localhost:8080/AccountJSONService</b> using <a
href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's
RPC classes</a> and providing them with <a href="AccountJSONService?smd">http://localhost:8080/AccountJSONService?smd</a>
for <a href="http://dojo.jot.com/SMD">Simple Method Description
(SMD)</a> input.</p>
<p>It then creates a Dojo button that will envoke the <code>getAccountReport</code>
method of the <code>accountService</code> object.</p>
</tr>
<tr>
<td>Request</td>
<td>Response</td>
</tr>
<tr>
<td><br>
<button id="myaccount" dojoType="dijit.form.Button"
onClick='accountService.getAccountReport("Dojo1234").addCallback(contentCallBack);'>getAccountReport("Dojo1234")</button>
<br>
</td>
<td>
<div id="ReturnedContent">None Yet.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="dojoDebug">Dojo Debug:</div>
</td>
</tr>
</table>
<script type="text/javascript">
function contentCallBack(result) {
var handlerNode = document.getElementById("ReturnedContent");
handlerNode.innerHTML = "<p>" + result + "</p>" ;
}
var accountService = new dojo.rpc.JsonService("AccountJSONService?smd");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
* { font-family: arial; }
table, th, td { border: 2px solid blue; border-collapse: collapse; }
th { color: white; background-color: blue; }

View file

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://bigbank"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://bigbank"
name="AccountService">
<wsdl:types>
<xsd:schema
targetNamespace="http://bigbank"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="getAccountReport">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="customerID" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getAccountReportResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="balance" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getAccountReportRequest">
<wsdl:part element="tns:getAccountReport"
name="getAccountReportRequest" />
</wsdl:message>
<wsdl:message name="getAccountReportResponse">
<wsdl:part element="tns:getAccountReportResponse"
name="getAccountReportResponse" />
</wsdl:message>
<wsdl:portType name="AccountService">
<wsdl:operation name="getAccountReport">
<wsdl:input message="tns:getAccountReportRequest" />
<wsdl:output message="tns:getAccountReportResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AccountServiceSoap" type="tns:AccountService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getAccountReport">
<soap:operation
soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AccountService">
<wsdl:port binding="tns:AccountServiceSoap"
name="AccountServiceSoap">
<soap:address
location="http://localhost:8082/services/AccountWebService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View file

@ -0,0 +1,2 @@
bigbank-calculator is part of a larger demo called bigbank.
Please see the Readme file under bigbank to understand how bigbank-calculator fits into the overall demo.

View file

@ -0,0 +1,68 @@
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="bigbank-calculator" default="run">
<property name="test.class" value="calculator.demo.CalculatorServer" />
<path id="test.classpath">
<!-- pathelement location="../../modules/tuscany-binding-rmi-1.6-SNAPSHOT.jar"/-->
<pathelement path="target/demo-bigbank-calculator.jar"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</path>
<target name="init">
<mkdir dir="target/classes"/>
</target>
<target name="compile" depends="init">
<javac srcdir="src/main/java"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</javac>
<copy todir="target/classes">
<fileset dir="src/main/resources"/>
</copy>
<jar destfile="target/demo-bigbank-calculator.jar" basedir="target/classes">
<manifest>
<attribute name="Main-Class" value="${test.class}" />
</manifest>
</jar>
</target>
<target name="run" depends="compile">
<java classname="${test.class}"
fork="true">
<classpath>
<path refid="test.classpath"/>
</classpath>
</java>
</target>
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="target" />
</delete>
</target>
</project>

View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-demos</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>demo-bigbank-calculator</artifactId>
<name>Apache Tuscany SCA Demo BigBank Calculator</name>
<repositories>
<repository>
<id>apache.incubator</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-script</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rmi-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
</build>
</project>

View file

@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
public interface AddService {
double add(double n1, double n2);
}

View file

@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
/**
* The Calculator service interface.
*/
public interface CalculatorService {
double add(double n1, double n2);
double subtract(double n1, double n2);
double multiply(double n1, double n2);
double divide(double n1, double n2);
}

View file

@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
/**
* An implementation of the Calculator service.
*/
@Service(CalculatorService.class)
public class CalculatorServiceImpl implements CalculatorService {
private AddService addService;
private SubtractService subtractService;
private MultiplyService multiplyService;
private DivideService divideService;
@Reference
public void setAddService(AddService addService) {
this.addService = addService;
}
@Reference
public void setSubtractService(SubtractService subtractService) {
this.subtractService = subtractService;
}
@Reference
public void setDivideService(DivideService divideService) {
this.divideService = divideService;
}
@Reference
public void setMultiplyService(MultiplyService multiplyService) {
this.multiplyService = multiplyService;
}
public double add(double n1, double n2) {
return addService.add(n1, n2);
}
public double subtract(double n1, double n2) {
return subtractService.subtract(n1, n2);
}
public double multiply(double n1, double n2) {
System.err.println("Multiply");
return multiplyService.multiply(n1, n2);
}
public double divide(double n1, double n2) {
return divideService.divide(n1, n2);
}
}

View file

@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
public interface DivideService {
double divide(double n1, double n2);
}

View file

@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
public interface MultiplyService {
double multiply(double n1, double n2);
}

View file

@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator;
public interface SubtractService {
double subtract(double n1, double n2);
}

View file

@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package calculator.demo;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
* @version $Rev$ $Date$
*/
public class CalculatorServer {
public static void main(String[] args) throws Exception {
System.out.println("Starting the Sample SCA Calculator...");
SCADomain domain = SCADomain.newInstance("Calculator.composite");
System.out.println("Press Enter to Exit...");
System.in.read();
domain.close();
System.out.println("Bye");
System.exit(0);
}
}

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
targetNamespace="http://calc"
xmlns:c="http://calc"
name="Calculator">
<component name="CalculatorServiceComponent">
<implementation.java class="calculator.CalculatorServiceImpl"/>
<service name="CalculatorService">
<tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
</service>
<reference name="addService" target="AddServiceComponent" />
<reference name="subtractService" target="SubtractServiceComponent" />
<reference name="multiplyService" target="MultiplyServiceComponent" />
<reference name="divideService" target="DivideServiceComponent" />
</component>
<component name="AddServiceComponent">
<tuscany:implementation.script script="calculator/AddServiceImpl.js"/>
</component>
<component name="SubtractServiceComponent">
<tuscany:implementation.script script="calculator/SubtractServiceImpl.rb"/>
</component>
<component name="MultiplyServiceComponent">
<tuscany:implementation.script script="calculator/MultiplyServiceImpl.py"/>
</component>
<component name="DivideServiceComponent">
<tuscany:implementation.script script="calculator/DivideServiceImpl.groovy"/>
</component>
</composite>

View file

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function add(n1, n2) {
return n1 + n2;
}

View file

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
def divide(n1, n2) {
return n1 / n2
}

View file

@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
def multiply(n1, n2):
print "Python Calculator component: multiply(", n1, ",", n2, ")"
return n1 * n2

View file

@ -0,0 +1,22 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
def subtract(n1, n2)
print "Ruby Calculator subtract(", n1, ",", n2, ")\n"
return n1 - n2
end

View file

@ -0,0 +1,4 @@
bigbank-stockquote is a part of a larger demo called bigbank.
Please see the Readme file under bigbank to understand how bigbank-stockquote fits into the overall demo.

View file

@ -0,0 +1,67 @@
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="bigbank-stockquote" default="run">
<property name="test.class" value="stockquote.demo.StockQuoteServer" />
<path id="test.classpath">
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
<pathelement location="target/demo-bigbank-stockquote.jar"/>
</path>
<target name="init">
<mkdir dir="target/classes"/>
</target>
<target name="compile" depends="init">
<javac srcdir="src/main/java"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
</classpath>
</javac>
<copy todir="target/classes">
<fileset dir="src/main/resources"/>
</copy>
<jar destfile="target/demo-bigbank-stockquote.jar" basedir="target/classes">
<manifest>
<attribute name="Main-Class" value="${test.class}" />
</manifest>
</jar>
</target>
<target name="run" depends="compile">
<java classname="${test.class}"
fork="true">
<classpath>
<path refid="test.classpath"/>
</classpath>
</java>
</target>
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="target" />
</delete>
</target>
</project>

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-demos</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>demo-bigbank-stockquote</artifactId>
<name>Apache Tuscany SCA Demo BigBank StockQuote</name>
<repositories>
<repository>
<id>apache.incubator</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-axis2</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-tomcat</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
</build>
</project>

View file

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package stockquote;
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
/**
* Sample userid passwd generation class
*/
public class PasswordCallbackHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
System.out.println("*** Calling Server User/Passwd Handler...." );
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
System.out.println("*** Getting password for user ...." + pwcb.getIdentifer() + " & " + pwcb.getKey());
if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
System.out.println(" Usage is SIGNATURE ... ");
pwcb.setPassword("sqservice");
}
}
}
}

View file

@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package stockquote;
import org.osoa.sca.annotations.Service;
/**
* This class implements the StockQuote service.
*/
@Service(StockQuoteService.class)
public class StockQuoteImpl implements StockQuoteService {
public double getQuote(String symbol) {
double price = 104.0 + Math.random();
price = ((int)(price * 100)) / 100.0;
System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
return price;
}
}

View file

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package stockquote;
import org.osoa.sca.annotations.Remotable;
/**
* This is the business interface of the StockQuote service.
*/
@Remotable
public interface StockQuoteService {
public double getQuote(String symbol);
}

View file

@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package stockquote.demo;
import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
* This server program shows how to bootstrap SCA from a simple J2SE program
* and start it which activates the StockQuote Web service endpoint.
*/
public class StockQuoteServer {
public static void main(String[] args) throws Exception {
System.out.println("Starting the Sample SCA StockQuote Service...");
SCADomain domain = SCADomain.newInstance("StockQuote.composite");
System.out.println("Press Enter to Exit...");
System.in.read();
domain.close();
System.out.println("Bye");
}
}

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://stockquote"
xmlns:hw="http://stockquote"
name="StockQuote">
<component name="StockQuoteServiceComponent">
<implementation.java class="stockquote.StockQuoteImpl" />
<service name="StockQuoteService" requires="integrity">
<binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/>
</service>
</component>
</composite>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="ASCII"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://stockQuote"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:bb="http://bigbank">
<!-- WS Security POLICY SETS -->
<sca:policySet name="wsIntegrityPolicy"
provides="integrity"
appliesTo="sca:binding.ws">
<tuscany:wsConfigParam>
<parameter name="InflowSecurity">
<action>
<items>Timestamp Signature</items>
<signaturePropFile>security.properties</signaturePropFile>
</action>
</parameter>
<parameter name="OutflowSecurity">
<action>
<items>Timestamp Signature</items>
<user>sqservice</user>
<signaturePropFile>security.properties</signaturePropFile>
<passwordCallbackClass>stockquote.PasswordCallbackHandler</passwordCallbackClass>
<signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
</action>
</parameter>
</tuscany:wsConfigParam>
</sca:policySet>
</sca:definitions>

View file

@ -0,0 +1,20 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=sqkeystore
org.apache.ws.security.crypto.merlin.file=stockQuote.jks

View file

@ -0,0 +1,112 @@
BigBank Demo
============
This application is made of 3 modules that represent the different aspects
of a fictitious banking application. Please see bigbank.png for a diagram of this demo.
To run the bigbank demo you need to first run bigbank-calculator and bigbank-stockquote composites. This will bring up Tuscany runtime and load the two applications and make them available as services. Bigbank-account is dependent on these services.
To run this demo you need to use ant to compile and run the application.
Start Bigbank-calculator composite
----------------------------------
Bigbank-calculator is a calculator application which handles add, subtract, multiply and divide operations. Each of these operations is implemented in a different language, including JavaScript, groovy, Ruby and Python.
To run the bigbank-calculator composite and make it available as a service for this demo do the following:
cd bigbank-calculator
ant run
.. Leave the server running
Start Bigbank-stockquote
------------------------
A very simple web services based stock quote application which returns random
stock quotes on request. Please note that the stockquote service is not live and is implemented instead to allow for this application to always run without dependency on the availability of a webservice.
cd bigbank-stockquote
ant run
.. Leave the server running
Start Bigbank
-------------
The BigBank comprises of two subsystems that are built from two distinct contributions coming from ...
1) bigbank
This contains all artifacts that make up the bigbank application. This is the application that the
end user interacts with
2) bigbank-account
This contains all artifacts that deal with the account management within the bigbank. The services
offered by the bigbank-account module are used by the bigbank. The end user never gets to directly
interact with bigbank account
Besides the bigbank-account the bigbank composite application calls into bigbank-stockquote and
bigbank-calculator services.
Start bigbank application in the following way:
cd bigbank
ant run
.. Leave the server running
Bigbank and the SCA Policies
----------------------------
The Bigbank demo uses the Tuscany PolicyFramework to enforce security in the following ways:
Authentication
--------------
The bigbank-account subsystem enforces authentication as a required security characteristic for
all interactions with its CheckingAccountService. Hence the 'bigbank' application which is a client
to this service authenticates itself for every interaction with the CheckingAccountService. The interaction
between the bigbank and the CheckingAccountService is over the ws binding.
Integrity
---------
All interactions of the bigbank application with the StockQuoteService are guarded with message integrity.
These interactions use the ws binding.
Authorization
-------------
Within the bigbank-account subsystem the CheckingAccountService implementation enforces authorization on
its operations. This is an instance of a custom policy enforcement i.e. the CheckingAccountService
component's implementation has defined its own customized way of authorizing access to its services.
Demonstrated features
---------------------
This demo is to illustrate the following : -
- composition of an application using artifacts belonging to multiple contributions (here two)
- usage of sca policies in composite definitions with specific emphasis on enabling security
Run the demo
-------------
The front end of this demo application is a web app which users Json/RPC to communicate with the backend for retrieving account information.
To try the app out point you browser at:
http://localhost:8085/AccountJSON.html
This should display an interface with a single button that goes and retrieves
a single set of account details exercising services across the three running
SCA applications.
If you press on getAccountReport, you'll see a response posted,
but the detail of the data will be displayed in the console where you started bigbank. Among other
things you will note messages that confirm the enforecement of AUTHENTICATION, AUTHORIZATION and
SIGNING of messages exchaged.
On the console where you have started the StockQuote Service you should again be able to see messages
that confirm the signing of messages exchanged.
Stop the demo
-------------
Go to each of the corresponding command line screens and hit 'enter'.
This will stop each of the applications.

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View file

@ -0,0 +1,537 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1052.3622"
height="744.09448"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.44"
sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account"
sodipodi:docname="bigbank.svg"
version="1.0"
inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account\bigbank.png"
inkscape:export-xdpi="105.68515"
inkscape:export-ydpi="105.68515">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="668.70076"
inkscape:cy="413.94086"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="1138"
inkscape:window-height="772"
inkscape:window-x="94"
inkscape:window-y="129" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2997"
transform="translate(-61.2386,-72.73099)">
<rect
rx="7.8521242"
ry="17.265177"
y="192.00223"
x="258.31161"
height="334.34488"
width="257.31851"
id="rect2067"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot2954"
xml:space="preserve"><flowRegion
id="flowRegion2956"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect2958" /></flowRegion><flowPara
id="flowPara2960">Composite</flowPara><flowPara
id="flowPara1883">BigBank</flowPara></flowRoot> <flowRoot
id="flowRoot2315"
xml:space="preserve"
transform="translate(-185.101,71.92054)"><flowRegion
id="flowRegion2317"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect2319" /></flowRegion><flowPara
id="flowPara2323">WebApp</flowPara></flowRoot> </g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2988"
width="115.66247"
height="126.26909"
x="269.58636"
y="190.53091"
rx="6.9961648"
ry="10.475038" />
<flowRoot
xml:space="preserve"
id="flowRoot2966"
transform="translate(1.99553,-15.40766)"><flowRegion
id="flowRegion2968"><rect
id="rect2970"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2972">Component </flowPara><flowPara
id="flowPara1885">Account</flowPara><flowPara
id="flowPara1887" /><flowPara
id="flowPara1889" /><flowPara
id="flowPara1891">Java</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 252.43583,222.37787 L 285.77087,222.37787 L 291.83178,235.50985 L 284.76072,247.63169 L 252.43583,247.63169 L 260.01198,235.50985 L 252.43583,222.37787 z "
id="path3017" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 365.68827,205.3873 L 399.02331,205.3873 L 405.08422,218.51928 L 398.01316,230.64112 L 365.68827,230.64112 L 373.26442,218.51928 L 365.68827,205.3873 z "
id="path3019" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 152.40866,209.21877 L 214.80502,209.21877 L 226.1498,236.00801 L 212.91422,260.73656 L 152.40866,260.73656 L 166.58966,236.00801 L 152.40866,209.21877 z "
id="path1893" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1895"
width="115.66247"
height="85.862968"
x="272.53705"
y="351.65024"
rx="6.9961648"
ry="7.1230249" />
<flowRoot
xml:space="preserve"
id="flowRoot1897"
transform="translate(4.94623,145.7117)"><flowRegion
id="flowRegion1899"><rect
id="rect1901"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1903">Component </flowPara><flowPara
id="flowPara1905">AccountData</flowPara><flowPara
id="flowPara1907" /><flowPara
id="flowPara1909" /><flowPara
id="flowPara1911">Java</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 255.38654,383.4972 L 288.72158,383.4972 L 294.78249,396.62918 L 287.71143,408.75102 L 255.38654,408.75102 L 262.96269,396.62918 L 255.38654,383.4972 z "
id="path1913" />
<flowRoot
xml:space="preserve"
id="flowRoot1917"
transform="translate(-115.5876,5.278396)"><flowRegion
id="flowRegion1919"><rect
id="rect1921"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1931">binding.</flowPara><flowPara
id="flowPara1941">jsonrpc</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 426.15997,139.5181 L 490.26581,139.5181 L 501.9214,165.78205 L 488.32321,190.02572 L 426.15997,190.02572 L 440.72949,165.78205 L 426.15997,139.5181 z "
id="path1943" />
<flowRoot
xml:space="preserve"
id="flowRoot1945"
transform="translate(161.03,-62.1275)"
inkscape:transform-center-y="51.51778"
inkscape:transform-center-x="-6.0609153"><flowRegion
id="flowRegion1947"><rect
id="rect1949"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1951">binding.</flowPara><flowPara
id="flowPara1953">ws</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 426.16,223.86592 L 490.26584,223.86592 L 501.92143,250.12987 L 488.32324,274.37354 L 426.16,274.37354 L 440.72952,250.12987 L 426.16,223.86592 z "
id="path1955" />
<flowRoot
xml:space="preserve"
id="flowRoot1957"
transform="translate(161.03,22.22032)"
inkscape:transform-center-y="51.51778"
inkscape:transform-center-x="-6.0609153"><flowRegion
id="flowRegion1959"><rect
id="rect1961"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1963">binding.</flowPara><flowPara
id="flowPara1965">rmi</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 366.56099,240.53344 L 399.89603,240.53344 L 405.95694,253.66542 L 398.88588,265.78726 L 366.56099,265.78726 L 374.13714,253.66542 L 366.56099,240.53344 z "
id="path1967" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 365.55084,275.88877 L 398.88588,275.88877 L 404.94679,289.02075 L 397.87573,301.14259 L 365.55084,301.14259 L 373.12699,289.02075 L 365.55084,275.88877 z "
id="path1969" />
<g
id="g1971"
transform="translate(439.292,-139.3494)">
<rect
rx="7.8521242"
ry="7.8236527"
y="220.28642"
x="165.37758"
height="151.50719"
width="257.31851"
id="rect1973"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot1975"
xml:space="preserve"
transform="translate(-109.0965,17.17259)"><flowRegion
id="flowRegion1977"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect1979" /></flowRegion><flowPara
id="flowPara1981">Composite</flowPara><flowPara
id="flowPara1983">StockQuote</flowPara></flowRoot> <g
id="g2067"
transform="translate(-98.99495,207.0814)">
<rect
rx="12.845777"
ry="17.265177"
y="192.00223"
x="258.31168"
height="334.34488"
width="420.96332"
id="rect2069"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot2071"
xml:space="preserve"
transform="translate(-4.04061,-5.050763)"><flowRegion
id="flowRegion2073"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect2075" /></flowRegion><flowPara
id="flowPara2077">Composite</flowPara><flowPara
id="flowPara2079">Calculator</flowPara></flowRoot> </g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2081"
width="115.66247"
height="200.01021"
x="231.82996"
y="470.34314"
rx="6.9961648"
ry="16.592457" />
<flowRoot
xml:space="preserve"
id="flowRoot2083"
transform="translate(-35.76085,264.4047)"><flowRegion
id="flowRegion2085"><rect
id="rect2087"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2089">Component </flowPara><flowPara
id="flowPara2091">Calculator</flowPara><flowPara
id="flowPara2093" /><flowPara
id="flowPara2095" /><flowPara
id="flowPara2097">Java</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 214.67944,502.19018 L 248.01448,502.19018 L 254.07539,515.32216 L 247.00433,527.444 L 214.67944,527.444 L 222.25559,515.32216 L 214.67944,502.19018 z "
id="path2099" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 327.93188,485.19961 L 361.26692,485.19961 L 367.32783,498.33159 L 360.25677,510.45343 L 327.93188,510.45343 L 335.50803,498.33159 L 327.93188,485.19961 z "
id="path2101" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 114.65227,489.03108 L 177.04863,489.03108 L 188.39341,515.82032 L 175.15784,540.54887 L 114.65227,540.54887 L 128.83327,515.82032 L 114.65227,489.03108 z "
id="path2103" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2105"
width="115.66247"
height="72.731003"
x="438.83148"
y="412.3407"
rx="6.9961648"
ry="6.0336223" />
<flowRoot
xml:space="preserve"
id="flowRoot2107"
transform="translate(183.2407,206.4021)"><flowRegion
id="flowRegion2109"><rect
id="rect2111"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2113">Component </flowPara><flowPara
id="flowPara2115">Add</flowPara><flowPara
id="flowPara2119" /><flowPara
id="flowPara2121">Javascript</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 418.6505,435.09626 L 451.98554,435.09626 L 458.04645,448.22824 L 450.97539,460.35008 L 418.6505,460.35008 L 426.22665,448.22824 L 418.6505,435.09626 z "
id="path2123" />
<flowRoot
xml:space="preserve"
id="flowRoot2125"
transform="translate(-153.344,285.0907)"><flowRegion
id="flowRegion2127"><rect
id="rect2129"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2131">binding.</flowPara><flowPara
id="flowPara2133">rmi</flowPara></flowRoot> <path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 328.8046,531.45743 L 362.13964,531.45743 L 368.20055,544.58941 L 361.12949,556.71125 L 328.8046,556.71125 L 336.38075,544.58941 L 328.8046,531.45743 z "
id="path2159" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 329.81476,581.96505 L 363.1498,581.96505 L 369.21071,595.09703 L 362.13965,607.21887 L 329.81476,607.21887 L 337.39091,595.09703 L 329.81476,581.96505 z "
id="path2161" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2225"
width="115.66247"
height="72.731003"
x="438.39767"
y="491.58591"
rx="6.9961648"
ry="6.0336223" />
<flowRoot
xml:space="preserve"
id="flowRoot2227"
transform="translate(182.8068,285.6473)"><flowRegion
id="flowRegion2229"><rect
id="rect2231"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2233">Component </flowPara><flowPara
id="flowPara2235">Subtract</flowPara><flowPara
id="flowPara2237" /><flowPara
id="flowPara2239">Ruby</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 418.21668,514.34147 L 451.55172,514.34147 L 457.61263,527.47345 L 450.54157,539.59529 L 418.21668,539.59529 L 425.79283,527.47345 L 418.21668,514.34147 z "
id="path2241" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2243"
width="115.66247"
height="72.731003"
x="438.39767"
y="569.36768"
rx="6.9961648"
ry="6.0336223" />
<flowRoot
xml:space="preserve"
id="flowRoot2245"
transform="translate(182.8069,363.4291)"><flowRegion
id="flowRegion2247"><rect
id="rect2249"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2251">Component </flowPara><flowPara
id="flowPara2255">Multiply</flowPara><flowPara
id="flowPara2281" /><flowPara
id="flowPara2257">Python</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 418.21667,592.12321 L 451.55171,592.12321 L 457.61262,605.25519 L 450.54156,617.37703 L 418.21667,617.37703 L 425.79282,605.25519 L 418.21667,592.12321 z "
id="path2259" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2261"
width="115.66247"
height="72.731003"
x="439.40784"
y="647.14941"
rx="6.9961648"
ry="6.0336223" />
<flowRoot
xml:space="preserve"
id="flowRoot2263"
transform="translate(183.817,441.2108)"><flowRegion
id="flowRegion2265"><rect
id="rect2267"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2269">Component </flowPara><flowPara
id="flowPara2271">Divide</flowPara><flowPara
id="flowPara2273" /><flowPara
id="flowPara2275">Groovy</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 419.22682,669.90496 L 452.56186,669.90496 L 458.62277,683.03694 L 451.55171,695.15878 L 419.22682,695.15878 L 426.80297,683.03694 L 419.22682,669.90496 z "
id="path2277" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 328.29952,628.38036 L 361.63456,628.38036 L 367.69547,641.51234 L 360.62441,653.63418 L 328.29952,653.63418 L 335.87567,641.51234 L 328.29952,628.38036 z "
id="path2283" />
</g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1985"
width="113.64217"
height="94.954361"
x="677.18286"
y="121.89223"
rx="6.9961648"
ry="10.475038" />
<flowRoot
xml:space="preserve"
id="flowRoot1987"
transform="translate(409.5921,-84.04634)"><flowRegion
id="flowRegion1989"><rect
id="rect1991"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara1993">Component </flowPara><flowPara
id="flowPara1995">StockQuote</flowPara><flowPara
id="flowPara1997" /><flowPara
id="flowPara1999" /><flowPara
id="flowPara2001">Java</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 660.03239,153.73919 L 693.36743,153.73919 L 699.42834,166.87117 L 692.35728,178.99301 L 660.03239,178.99301 L 667.60854,166.87117 L 660.03239,153.73919 z "
id="path2003" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 560.00522,140.58009 L 622.40158,140.58009 L 633.74636,167.36933 L 620.51078,192.09788 L 560.00522,192.09788 L 574.18622,167.36933 L 560.00522,140.58009 z "
id="path2007" />
<flowRoot
xml:space="preserve"
id="flowRoot2029"
transform="translate(292.009,-63.36024)"><flowRegion
id="flowRegion2031"><rect
id="rect2033"
width="171.01015"
height="76.580856"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2035">binding.</flowPara><flowPara
id="flowPara2037">ws</flowPara></flowRoot> <path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 501.41636,164.26692 C 575.1575,165.27707 575.1575,165.27707 575.1575,165.27707"
id="path2285" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 633.74634,167.29737 C 667.08138,167.29737 667.08138,167.29737 667.08138,167.29737"
id="path2287" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 224.63456,235.98775 C 259.9899,235.98775 259.9899,235.98775 259.9899,235.98775"
id="path2289" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 403.43156,218.81515 L 412.52294,218.81515 L 412.52294,164.26692 L 439.79706,165.27707"
id="path2293" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 405.45187,254.17049 L 420.60416,254.17049 L 420.60416,250.12988 L 440.80721,251.14004"
id="path2295" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 404.44172,288.51568 L 419.59401,288.51568 L 419.59401,332.96239 L 225.64471,334.9827 L 226.65486,395.59185 L 262.01021,395.59185"
id="path2297" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 501.41636,249.11973 L 520.60926,249.11973 L 518.58895,377.4091 L 567.07628,377.4091"
id="path2299" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 625.66512,376.39895 L 660.01031,376.39895"
id="path2301" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 806.48243,359.22636 L 834.7667,359.22636 L 835.77685,309.72888 L 864.06112,308.71873"
id="path2303" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 807.49258,404.68322 L 840.82762,404.68322 L 840.82762,388.52078 L 864.06112,388.52078"
id="path2307" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 807.49258,455.19085 L 837.79716,455.19085 L 837.79716,467.31268 L 864.06112,467.31268"
id="path2309" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 805.47228,502.66802 L 833.75655,502.66802 L 833.75655,545.09443 L 865.07128,545.09443"
id="path2311" />
<rect
style="opacity:0.35555558;fill:#9a8787;fill-opacity:1;stroke:#261c1c;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2313"
width="87.14286"
height="77.14286"
x="17.142859"
y="192.66591"
rx="10.859112" />
<path
style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 102.85714,235.52305 L 164.28571,235.52305"
id="path2327" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="DojoZipInstaller">
<property name="dojo.version" value="1.3.0"/>
<property name="dojo.zip" value="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
<property name="unpack.location" value="${basedir}/src/main/resources/dojo"/>
<target name="check-dojo-installed">
<condition property="already.installed" >
<available file="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</condition>
</target>
<target name="check-dojo-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
<fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
<unzip src="${localRepository}/org/dojotoolkit/dojo/${dojo.version}/dojo-${dojo.version}.zip"
dest="${basedir}/target/dojo-unpack-temp/"
overwrite="false"
encoding="native-encoding">
<patternset>
<include name="dojo-${dojo.version}/dojo/**"/>
<exclude name="dojo-${dojo.version}/dojo/tests/**"/>
<exclude name="dojo-${dojo.version}/dijit/**"/>
<exclude name="dojo-${dojo.version}/dojox/**"/>
<exclude name="dojo-${dojo.version}/util/**"/>
</patternset>
</unzip>
<move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}"
tofile="${unpack.location}"
verbose="true"/>
<delete dir="${basedir}/target/dojo-unpack-temp/"/>
</target>
<target name="clean-dojo-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project name="bigbank" default="run">
<property name="settings.localRepository" value="./target/repo" />
<property name="artifactId" value="demo-bigbank" />
<property name="test.class" value="bigbank.demo.BigBankServer" />
<path id="test.classpath">
<pathelement location="target/classes"/>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
<pathelement location="../bigbank-account/target/demo-bigbank-account.jar"/>
</path>
<target name="init">
<mkdir dir="target/classes"/>
<mkdir dir="target/classes/web"/>
<mkdir dir="target/repo"/>
</target>
<target name="dojo" depends="init">
<ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
<property name="localRepository" value="${settings.localRepository}"/>
</ant>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</target>
<target name="compile" depends="dojo">
<javac srcdir="src/main/java"
destdir="target/classes"
debug="on"
source="1.5"
target="1.5">
<classpath>
<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
<pathelement location="../bigbank-account/target/demo-bigbank-account.jar"/>
</classpath>
</javac>
<copy todir="target/classes">
<fileset dir="src/main/resources"/>
</copy>
<jar destfile="target/demo-bigbank.jar" basedir="target/classes">
<manifest>
<attribute name="Main-Class" value="${test.class}" />
</manifest>
</jar>
</target>
<target name="run" depends="compile">
<java classname="${test.class}"
fork="true">
<classpath>
<path refid="test.classpath"/>
</classpath>
</java>
</target>
<target name="clean">
<delete quiet="true" includeemptydirs="true">
<fileset dir="target" />
</delete>
</target>
</project>

View file

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-demos</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>demo-bigbank</artifactId>
<packaging>jar</packaging>
<name>Apache Tuscany SCA Demo BigBank</name>
<repositories>
<repository>
<id>apache.incubator</id>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-embedded</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-data-api</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>demo-bigbank-account</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-atom-abdera</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rss-rome</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-axis2</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rmi-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-resource-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-http-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-jetty</artifactId>
<version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo</artifactId>
<version>1.3.0</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>demo-bigbank</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>copy-dojo-files</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>clean-dojo-files</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="clean-dojo-files">
<property name="localRepository" value="${settings.localRepository}"/>
<property name="artifactId" value="${artifactId}"/>
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account;
import org.osoa.sca.annotations.Remotable;
/**
* @version $$Rev$$ $$Date$$
*/
@Remotable
public interface AccountService {
public double getAccountReport(String customerID);
}

View file

@ -0,0 +1,99 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import stockquote.StockQuoteService;
import bigbank.account.checking.CheckingAccountDetails;
import bigbank.account.checking.CheckingAccountService;
import bigbank.account.savings.SavingsAccountDetails;
import bigbank.account.savings.SavingsAccountService;
import bigbank.account.stock.StockAccountDetails;
import bigbank.account.stock.StockAccountService;
import calculator.CalculatorService;
/**
* @version $$Rev$$ $$Date$$
*/
@Service(AccountService.class)
public class AccountServiceImpl implements AccountService {
@Reference
protected SavingsAccountService savingsAcService;
@Reference
protected CheckingAccountService checkingAcService;
@Reference
protected StockAccountService stockAcService;
@Reference
protected StockQuoteService stockQuoteService;
@Reference
protected CalculatorService calculatorService;
@Property
protected String currency;
public double getAccountReport(String customerID) {
// Get the checking, savings and stock accounts from the AccountData
// service component
CheckingAccountDetails checking = null;
try {
checking = checkingAcService.getAccountDetails(customerID);
System.out.println("Checking account: " + checking);
SavingsAccountDetails savings = savingsAcService.getAccountDetails(customerID);
System.out.println("Savings account: " + savings);
StockAccountDetails stock = stockAcService.getAccountDetails(customerID);
System.out.println("Stock account: " + stock);
// Get the stock price in USD
double price = stockQuoteService.getQuote(stock.getSymbol());
System.out.println("Stock price for " + stock.getSymbol() + ": " + price);
// Convert to the configured currency
if (currency.equals("EURO")) {
// Use our fancy calculator service to convert to the target currency
price = calculatorService.multiply(price, 0.70);
System.out.println("Converted to " + currency + ": " + price);
}
// Calculate the value of the stock account
double stockValue = price * stock.getQuantity();
// Calculate the total balance of all accounts and return it
double balance = checking.getBalance() + savings.getBalance() + stockValue;
return balance;
} catch ( Throwable e ) {
e.printStackTrace();
return 0;
}
}
}

View file

@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package bigbank.account.feed;
import org.apache.tuscany.sca.data.collection.Collection;
import org.apache.tuscany.sca.data.collection.Entry;
import org.apache.tuscany.sca.data.collection.NotFoundException;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import bigbank.account.AccountService;
/**
* @version $$Rev$$ $$Date$$
*/
@Service(Collection.class)
public class AccountFeedImpl implements Collection<String, String> {
@Reference
protected AccountService accountService;
public Entry<String, String>[] getAll() {
// Add the Account report entry
String report = get("1234");
Entry<String, String> entry = new Entry<String, String>("1234", report);
return new Entry[] { entry } ;
}
public String get(String id) {
// Get the account report for the specified customer ID
double balance = accountService.getAccountReport(id);
String report = Double.toString(balance);
return report;
}
public void delete(String key) throws NotFoundException {
}
public String post(String key, String item) {
return null;
}
public void put(String key, String item) throws NotFoundException {
}
public Entry<String, String>[] query(String queryString) {
return null;
}
}

Some files were not shown because too many files have changed in this diff Show more