diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:25:44 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:25:44 +0000 |
commit | b5c0d648cf147d3709eb78d98011f38e07aee723 (patch) | |
tree | e82891caaa5b04b3551ef59d1c790fddd99d5131 /sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp | |
parent | 539451c7e13d98504e6f3368d892406494ca711d (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835694 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp')
33 files changed, 4122 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/README b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/README new file mode 100644 index 0000000000..3ec27ef65f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/README @@ -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. + + + + diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.png b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.png Binary files differnew file mode 100644 index 0000000000..ae429cca94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.png diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.svg b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.svg new file mode 100644 index 0000000000..807416135e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/alert-aggregator.svg @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build-dojo.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build-dojo.xml new file mode 100644 index 0000000000..5c5a7dfe58 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build-dojo.xml @@ -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/webapp/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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build.xml new file mode 100644 index 0000000000..793aa05c06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/build.xml @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/pom.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/pom.xml new file mode 100644 index 0000000000..2530b5f411 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/pom.xml @@ -0,0 +1,356 @@ +<?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.5.2-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>demo-alert-aggregator-webapp</artifactId> + <packaging>war</packaging> + <version>1.5.2-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.5.2-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>1.5.2-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>1.5.2-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-rss-rome</artifactId> + <version>1.5.2-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>3.2.1</version> + <scope>runtime</scope> + </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>install-dojo</id> + <phase>validate</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <ant antfile="./build-dojo.xml" target="install-dojo"> + <property name="localRepository" value="${settings.localRepository}" /> + </ant> + </tasks> + </configuration> + </execution> + <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.5.2-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <buildDependencyFileOnly>true</buildDependencyFileOnly> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java new file mode 100644 index 0000000000..808374030c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java @@ -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 diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java new file mode 100644 index 0000000000..e070e0b8f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java @@ -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 { + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java new file mode 100644 index 0000000000..c4bf13ce7a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java @@ -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); + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java new file mode 100644 index 0000000000..28e27a9978 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java @@ -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 ; + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java new file mode 100644 index 0000000000..7b943b1b45 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java @@ -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); + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java new file mode 100644 index 0000000000..ca2fc95b4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java @@ -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); + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java new file mode 100644 index 0000000000..2962defb25 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java @@ -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 diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java new file mode 100644 index 0000000000..75544294ce --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java @@ -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 diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java new file mode 100644 index 0000000000..2a5775e9a9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java @@ -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); + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java new file mode 100644 index 0000000000..549abbf602 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java @@ -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; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java new file mode 100644 index 0000000000..10575bf0dc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java @@ -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 diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl new file mode 100644 index 0000000000..8b376240c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd new file mode 100644 index 0000000000..f0ec561ad8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd @@ -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>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl new file mode 100644 index 0000000000..d5642a32d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite new file mode 100644 index 0000000000..49f44f9da8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite @@ -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>
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite new file mode 100644 index 0000000000..c359b275be --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite @@ -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>
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml new file mode 100644 index 0000000000..e45250eddb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html new file mode 100644 index 0000000000..8b472fd0fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html @@ -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'/> " + 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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..09b7cce2b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -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> + diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..da3d662574 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -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.5.2-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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..a81165e1b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml @@ -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> diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png Binary files differnew file mode 100644 index 0000000000..1cf1df24a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png Binary files differnew file mode 100644 index 0000000000..b3c949d224 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd new file mode 100644 index 0000000000..3c6b6c9b12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd @@ -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"}]}]} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd new file mode 100644 index 0000000000..b5f1824363 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd @@ -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"}]}]} diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/style.css b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/style.css new file mode 100644 index 0000000000..f5bbf23379 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/main/webapp/style.css @@ -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; +} + diff --git a/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java new file mode 100644 index 0000000000..f0cb9ecfcb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java @@ -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()); + } +} |