From f77d19253269af16449e8af0936b944e842e2a4d Mon Sep 17 00:00:00 2001 From: lresende Date: Tue, 12 Aug 2008 23:50:52 +0000 Subject: Refactoring the launcher to follow the same pattern used in other apps (launch.launchxxxx launcher) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685380 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/samples/feed-aggregator/README | 9 ++-- java/sca/samples/feed-aggregator/build.xml | 2 +- .../src/main/java/feed/SampleServer.java | 52 ---------------------- .../src/main/java/launch/LaunchFeedServer.java | 47 +++++++++++++++++++ 4 files changed, 53 insertions(+), 57 deletions(-) delete mode 100644 java/sca/samples/feed-aggregator/src/main/java/feed/SampleServer.java create mode 100644 java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java (limited to 'java/sca/samples/feed-aggregator') diff --git a/java/sca/samples/feed-aggregator/README b/java/sca/samples/feed-aggregator/README index 14f2d94876..f73baec2fd 100644 --- a/java/sca/samples/feed-aggregator/README +++ b/java/sca/samples/feed-aggregator/README @@ -13,11 +13,11 @@ ant run OR if you don't have ant, on Windows do -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-feed-aggregator.jar feed.SampleServer +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-feed-aggregator.jar launch.LaunchFeedServer and on *nix do -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-feed-aggregator.jar feed.SampleServer +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-feed-aggregator.jar launch.LaunchFeedServer You should see the following output on the screen. @@ -56,10 +56,11 @@ web-resource/ feed/ AggregatorImpl.java - implementation of the Feed aggregator component - SampleServer.java - starts the SCA Runtime and - publishes the aggregated feeds Sort.java - utilty interface SortImpl.java - implementation of the Sort component + launch + LaunchFeedServer.java - starts the SCA Runtime and + publishes the aggregated feeds resources/ FeedAggregator.composite - the SCA assembly for this sample feed-aggregator.png - a pictorial representation of the diff --git a/java/sca/samples/feed-aggregator/build.xml b/java/sca/samples/feed-aggregator/build.xml index 2118e13db7..0ab6fed7fc 100644 --- a/java/sca/samples/feed-aggregator/build.xml +++ b/java/sca/samples/feed-aggregator/build.xml @@ -17,7 +17,7 @@ * under the License. --> - + diff --git a/java/sca/samples/feed-aggregator/src/main/java/feed/SampleServer.java b/java/sca/samples/feed-aggregator/src/main/java/feed/SampleServer.java deleted file mode 100644 index 2aace3daf7..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/java/feed/SampleServer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 feed; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class SampleServer { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite"); - - try { - System.out.println("Sample Feed server started (press enter to shutdown)"); - System.out.println(); - System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:"); - System.out.println("http://localhost:8083/atomAggregator"); - System.out.println("http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)"); - System.out.println("http://localhost:8083/rssAggregator"); - System.out.println(); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - // RssFeed feedService = scaDomain.getService(RssFeed.class, - // "RssAggregatorComponent"); - // SyndFeed syndFeed = feedService.get(); - // SyndFeedOutput output = new SyndFeedOutput(); - // output.output(syndFeed,new PrintWriter(System.out)); - - scaDomain.close(); - System.out.println("Sample Feed server stopped"); - } -} diff --git a/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java b/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java new file mode 100644 index 0000000000..1c549f7cd2 --- /dev/null +++ b/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LaunchFeedServer { + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite"); + + try { + System.out.println("Sample Feed server started (press enter to shutdown)"); + System.out.println(); + System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:"); + System.out.println("http://localhost:8083/atomAggregator"); + System.out.println("http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)"); + System.out.println("http://localhost:8083/rssAggregator"); + System.out.println(); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + + scaDomain.close(); + System.out.println("Sample Feed server stopped"); + } +} -- cgit v1.2.3