From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../slaws/httpserver.php/htdocs/AlertDisplay.php | 274 ++++++++++++++++++++ .../httpserver.php/htdocs/AlertDisplayJson.php | 56 +++++ sandbox/slaws/httpserver.php/htdocs/Alerter.xsd | 74 ++++++ sandbox/slaws/httpserver.php/htdocs/Alerts.wsdl | 88 +++++++ sandbox/slaws/httpserver.php/htdocs/Alerts.xsd | 80 ++++++ .../slaws/httpserver.php/htdocs/AlertsSources.wsdl | 124 +++++++++ .../slaws/httpserver.php/htdocs/Cached_Alerts.xml | 2 + sandbox/slaws/httpserver.php/htdocs/index.html | 280 +++++++++++++++++++++ sandbox/slaws/httpserver.php/htdocs/phpinfo.php | 5 + sandbox/slaws/httpserver.php/htdocs/pop.png | Bin 0 -> 244 bytes sandbox/slaws/httpserver.php/htdocs/rss.png | Bin 0 -> 689 bytes sandbox/slaws/httpserver.php/htdocs/service.smd | 1 + sandbox/slaws/httpserver.php/htdocs/style.css | 166 ++++++++++++ 13 files changed, 1150 insertions(+) create mode 100644 sandbox/slaws/httpserver.php/htdocs/AlertDisplay.php create mode 100644 sandbox/slaws/httpserver.php/htdocs/AlertDisplayJson.php create mode 100644 sandbox/slaws/httpserver.php/htdocs/Alerter.xsd create mode 100644 sandbox/slaws/httpserver.php/htdocs/Alerts.wsdl create mode 100644 sandbox/slaws/httpserver.php/htdocs/Alerts.xsd create mode 100644 sandbox/slaws/httpserver.php/htdocs/AlertsSources.wsdl create mode 100644 sandbox/slaws/httpserver.php/htdocs/Cached_Alerts.xml create mode 100644 sandbox/slaws/httpserver.php/htdocs/index.html create mode 100644 sandbox/slaws/httpserver.php/htdocs/phpinfo.php create mode 100644 sandbox/slaws/httpserver.php/htdocs/pop.png create mode 100644 sandbox/slaws/httpserver.php/htdocs/rss.png create mode 100644 sandbox/slaws/httpserver.php/htdocs/service.smd create mode 100644 sandbox/slaws/httpserver.php/htdocs/style.css (limited to 'sandbox/slaws/httpserver.php/htdocs') diff --git a/sandbox/slaws/httpserver.php/htdocs/AlertDisplay.php b/sandbox/slaws/httpserver.php/htdocs/AlertDisplay.php new file mode 100644 index 0000000000..94b5352818 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/AlertDisplay.php @@ -0,0 +1,274 @@ + +loadFile("./Cached_Alerts.xml"); + $cached_alerts = $doc->getRootDataObject(); + + // Use the alertService reference + $request = $this->alert_service->createDataObject("http://tuscany.apache.org/sca/samples/aggregator/service", + "getAllNewAlerts"); + $request->parm = "AString"; + $new_alerts = $this->alert_service->getAllNewAlerts($request); + + foreach($new_alerts->parm->Alert as $alert){ + $new_alert = $cached_alerts->createDataObject('Alert'); + $new_alert->Title = $alert->Title; + $new_alert->Summary = $alert->Summary; + $new_alert->Address = $alert->Address; + $new_alert->Date = $alert->Date; + $new_alert->SourceId = $alert->SourceId; + $new_alert->Unread = true; + } + + $return_table = ""; + $alert_id_number = 0; + foreach($cached_alerts->Alert as $alert){ + $alert->Id = "alert_" . $alert_id_number; + $title = substr($alert->Title,0,80); + $summary = substr($alert->Summary,0,40); + $unread_string = $alert->Unread ? "unread_title" : "read_title"; + $return_row = << + + + +ALERTROW; + $return_table = $return_table . $return_row; + $alert_id_number += 1; + } + $return_table = $return_table . "
+ $title + - $summary ... + + $alert->Date +
"; + + // as php is one shot we have to save away the alerts we want to cache + $xmldas->saveFile($doc, "./Cached_Alerts.xml"); + + return $return_table; + } + + /** + * @param string $alert_id + * @return string + */ + public function readAlert($alert_id) + { + $xmldas = SDO_DAS_XML::create("./Alerter.xsd"); + $doc = $xmldas->loadFile("./Cached_Alerts.xml"); + $cached_alerts = $doc->getRootDataObject(); + + $return_summary = ""; + + foreach($cached_alerts->alert as $alert){ + if (strcmp($alert->Id,$alert_Id) == 0){ + SCA::$logger->log("Match"); + $alert->Unread = false; + $return_summary = "
" . $alert->Summary . "
"; + } + } + + // as php is one shot we have to save away the alerts we want to cache + $xmldas->saveFile($doc, "./Cached_Alerts.xml"); + + return $return_summary; + } + + /** + * @return string + */ + public function getAlertSourcesHTMLTable() + { + $request = $this->alert_sources_service->createDataObject("http://tuscany.apache.org/sca/samples/aggregator/sources", + "getAlertSources"); + $request->parm = "AString"; + $alert_sources = $this->alert_sources_service->getAlertSources($request); + + $return_table = "\n"; + + $no_of_sources = 0; + + foreach ($alert_sources->parm->Source as $alert_source){ + $source_id = $alert_source->Id; + $return_row = << + + + + + + + +SOURCEROW; + $return_table = $return_table . $return_row; + $no_of_sources = $no_of_sources + 1; + } + + $source_id = $no_of_sources + 1; + + $return_row = << + + + + + +ADDROW; + + $return_table = $return_table . $return_row; + $return_table = $return_table . "
+   $alert_source->Name +
\n"; + return $return_table; + } + + /** + * @param integer $source_id + * @return string + */ + public function deleteAlertSource($source_id){ + $this->alert_sources_service->removeAlertSource($source_id); + } + + /** + * @param SingleSourceType $alert_source http://tuscany.apache.org/sca/samples/aggregator/types + */ + public function addAlertSource($alert_source){ + $request = $this->alert_sources_service->createDataObject("http://tuscany.apache.org/sca/samples/aggregator/sources", + "addAlertSource"); + $source = $request->createDataObject("parm"); + + $source->Name = $alert_source->Name; + $source->Address = $alert_source->Address; + $source->Id = $alert_source->Id; + $source->Type = $alert_source->Type; + + $this->alert_sources_service->addAlertSource($request); + } + + /** + * @param SourceType $alert_source http://tuscany.apache.org/sca/samples/aggregator/types + */ + public function updateAlertSource($alert_source){ + $this->alert_sources_service->updateAlertSource($alert_source); + } +} + +/* Some debugging lines +ob_start(); +print_r( $new_alerts ); +$debug = ob_get_contents(); +ob_end_clean(); +SCA::$logger->log($debug); +*/ +?> + + + diff --git a/sandbox/slaws/httpserver.php/htdocs/AlertDisplayJson.php b/sandbox/slaws/httpserver.php/htdocs/AlertDisplayJson.php new file mode 100644 index 0000000000..5953f02209 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/AlertDisplayJson.php @@ -0,0 +1,56 @@ +alert_service->getAllNewAlerts("SomeString"); + + return $alerts; + + } +} + +?> diff --git a/sandbox/slaws/httpserver.php/htdocs/Alerter.xsd b/sandbox/slaws/httpserver.php/htdocs/Alerter.xsd new file mode 100644 index 0000000000..58b9982d38 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/Alerter.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/slaws/httpserver.php/htdocs/Alerts.wsdl b/sandbox/slaws/httpserver.php/htdocs/Alerts.wsdl new file mode 100644 index 0000000000..9150abbaf4 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/Alerts.wsdl @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/slaws/httpserver.php/htdocs/Alerts.xsd b/sandbox/slaws/httpserver.php/htdocs/Alerts.xsd new file mode 100644 index 0000000000..1e80da0487 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/Alerts.xsd @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/slaws/httpserver.php/htdocs/AlertsSources.wsdl b/sandbox/slaws/httpserver.php/htdocs/AlertsSources.wsdl new file mode 100644 index 0000000000..82422c82ef --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/AlertsSources.wsdl @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/slaws/httpserver.php/htdocs/Cached_Alerts.xml b/sandbox/slaws/httpserver.php/htdocs/Cached_Alerts.xml new file mode 100644 index 0000000000..e208c8d9e4 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/Cached_Alerts.xml @@ -0,0 +1,2 @@ + + diff --git a/sandbox/slaws/httpserver.php/htdocs/index.html b/sandbox/slaws/httpserver.php/htdocs/index.html new file mode 100644 index 0000000000..f952f08bc8 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/index.html @@ -0,0 +1,280 @@ + + + + + Apache Tuscany Feed Aggregator Sample + + + + + +

Apache Tuscany Alert Aggregator Sample

+

Alert Sources:

+
+

Recent Alerts (Refresh):

+
+

Back to top

+
+ + + + diff --git a/sandbox/slaws/httpserver.php/htdocs/phpinfo.php b/sandbox/slaws/httpserver.php/htdocs/phpinfo.php new file mode 100644 index 0000000000..1cf8044fe2 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/phpinfo.php @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/sandbox/slaws/httpserver.php/htdocs/pop.png b/sandbox/slaws/httpserver.php/htdocs/pop.png new file mode 100644 index 0000000000..1cf1df24a7 Binary files /dev/null and b/sandbox/slaws/httpserver.php/htdocs/pop.png differ diff --git a/sandbox/slaws/httpserver.php/htdocs/rss.png b/sandbox/slaws/httpserver.php/htdocs/rss.png new file mode 100644 index 0000000000..b3c949d224 Binary files /dev/null and b/sandbox/slaws/httpserver.php/htdocs/rss.png differ diff --git a/sandbox/slaws/httpserver.php/htdocs/service.smd b/sandbox/slaws/httpserver.php/htdocs/service.smd new file mode 100644 index 0000000000..bc77e39bf9 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/service.smd @@ -0,0 +1 @@ +{"SMDVersion":".1","objectName":"AlertsService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8080/sample-feed-aggregator/services/AlertsServiceJSONRPC","methods":[{"name":"getAllNewAlerts","parameters":[{"name":"param0","type":"STRING"}]}]} diff --git a/sandbox/slaws/httpserver.php/htdocs/style.css b/sandbox/slaws/httpserver.php/htdocs/style.css new file mode 100644 index 0000000000..cd377e90e5 --- /dev/null +++ b/sandbox/slaws/httpserver.php/htdocs/style.css @@ -0,0 +1,166 @@ +/* + * 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; +} + +.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; +} + -- cgit v1.2.3