diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-26 08:43:01 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-26 08:43:01 +0000 |
commit | 758114996eea515967ae25389b8349c7cf573c19 (patch) | |
tree | c87f3e22d73f6947b1193090fd8b5135765c5917 /sca-java-2.x/branches/2.0-Beta1 | |
parent | 6865c59e74f19ed6057d03583944b47abd6e036e (diff) |
Remove the folder
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1027404 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta1')
96 files changed, 0 insertions, 8336 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF deleted file mode 100644 index c78875e887..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.binding.rss.collection
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA RSS Feed Binding Extension
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA RSS Feed Binding Extension
-Import-Package: javax.xml.namespace,
- org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.assembly.xml;version="2.0.0",
- org.apache.tuscany.sca.binding.rss;version="2.0.0",
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.interfacedef,
- org.apache.tuscany.sca.interfacedef.impl,
- org.apache.tuscany.sca.interfacedef.util,
- org.apache.tuscany.sca.monitor
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.rss.runtime
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE deleted file mode 100644 index ad2ba40961..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2010 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml deleted file mode 100644 index ddc90ab7c6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml +++ /dev/null @@ -1,170 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>tuscany-binding-rss-runtime</artifactId> - <name>Apache Tuscany SCA RSS Feed Binding Extension</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-rss</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-data-api</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-http</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.1</version> - </dependency> - - <dependency> - <groupId>rome</groupId> - <artifactId>rome</artifactId> - <version>1.0</version> - </dependency> - - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>1.3</version> - <exclusions> - <exclusion> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-jetty</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.0.1</version> - <configuration> - <instructions> - <Bundle-Version>${tuscany.version}</Bundle-Version> - <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rss.rome</Bundle-SymbolicName> - <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.binding.rss*</Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java deleted file mode 100644 index 581ae59ae6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java +++ /dev/null @@ -1,58 +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 org.apache.tuscany.sca.binding.rss.collection; - -import org.oasisopen.sca.annotation.Remotable; - -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndFeed; - - -/** - * Provides access to a collection of resources using RSS. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Collection { - - /** - * Get an RSS feed for a collection of resources. - * - * @return the RSS feed - */ - SyndFeed getFeed(); - - /** - * Get an RSS feed for a collection of resources resulting from a query. - * - * @param queryString the query string - * @return the RSS feed - */ - SyndFeed query(String queryString); - - /** - * Retrieves an RSS entry. - * - * @param id The entry ID - * @return The requested entry - * @throws NotFoundException No entry found with the given ID - */ - SyndEntry get(String id) throws NotFoundException; -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java deleted file mode 100644 index a2b83465da..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java +++ /dev/null @@ -1,55 +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 org.apache.tuscany.sca.binding.rss.collection; - -import java.io.InputStream; - -import org.oasisopen.sca.annotation.Remotable; - -import com.sun.syndication.feed.atom.Entry; - -/** - * Provides access to a collection of resources using Atom. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface MediaCollection extends Collection { - - /** - * Creates a new media entry - * - * @param title - * @param slug - * @param contentType - * @param media - */ - Entry postMedia(String title, String slug, String contentType, InputStream media); - - /** - * Update a media entry. - * - * @param id - * @param contentType - * @param media - * @return - */ - void putMedia(String id, String contentType, InputStream media) throws NotFoundException; - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java deleted file mode 100644 index 0912878938..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java +++ /dev/null @@ -1,45 +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 org.apache.tuscany.sca.binding.rss.collection; - -/** - * Indicates that a resource could not be found. - * - * @version $Rev$ $Date$ - */ -public class NotFoundException extends Exception { - private static final long serialVersionUID = -5046027674128627383L; - - public NotFoundException() { - } - - public NotFoundException(String message) { - super(message); - } - - public NotFoundException(Throwable cause) { - super(cause); - } - - public NotFoundException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java deleted file mode 100644 index e3a177198c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java +++ /dev/null @@ -1,76 +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 org.apache.tuscany.sca.binding.rss.provider; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.invocation.DataExchangeSemantics; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedInput; -import com.sun.syndication.io.XmlReader; - -/** - * Invoker for the RSS binding. - * - * @version $Rev$ $Date$ - */ -class RSSBindingInvoker implements Invoker , DataExchangeSemantics { - private static final Logger logger = Logger.getLogger(RSSBindingInvoker.class.getName()); - - private String uri; - - RSSBindingInvoker(String uri, String feedType) { - this.uri = uri; - } - - public Message invoke(Message msg) { - try { - logger.fine("invoke " + uri); - - // Read an RSS feed into a Synd feed - SyndFeedInput input = new SyndFeedInput(); - SyndFeed feed = input.build(new XmlReader(new URL(uri))); - - //FIXME Support conversion to data-api entries - - msg.setBody(feed); - - } catch (MalformedURLException e) { - msg.setFaultBody(e); - } catch (IllegalArgumentException e) { - msg.setFaultBody(e); - } catch (FeedException e) { - msg.setFaultBody(e); - } catch (IOException e) { - msg.setFaultBody(e); - } - return msg; - } - - public boolean allowsPassByReference() { - return true; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java deleted file mode 100644 index 44c84ce5bb..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java +++ /dev/null @@ -1,397 +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 org.apache.tuscany.sca.binding.rss.provider; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.StringTokenizer; -import java.util.logging.Logger; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.xml.namespace.QName; - -import org.apache.commons.codec.binary.Base64; -import org.apache.tuscany.sca.data.collection.Item; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.runtime.Invocable; - -import com.sun.syndication.feed.synd.SyndContent; -import com.sun.syndication.feed.synd.SyndContentImpl; -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndEntryImpl; -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.feed.synd.SyndFeedImpl; -import com.sun.syndication.feed.synd.SyndLink; -import com.sun.syndication.feed.synd.SyndLinkImpl; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedOutput; - -/** - * An RSS binding listener, implemented as a Servlet and - * registered in a Servlet host provided by the SCA hosting runtime. - * - * @version $Rev$ $Date$ - */ -class RSSBindingListenerServlet extends HttpServlet { - private static final Logger logger = Logger.getLogger(RSSBindingListenerServlet.class.getName()); - private static final long serialVersionUID = 1L; - - private Invocable wire; - private Invoker getFeedInvoker; - private Invoker getAllInvoker; - private Invoker queryInvoker; - private MessageFactory messageFactory; - private Mediator mediator; - private DataType<?> itemClassType; - private DataType<?> itemXMLType; - private boolean supportsFeedEntries; - - /** - * Constructs a new binding listener. - * - * @param wire - * @param messageFactory - */ - RSSBindingListenerServlet(Invocable wire, MessageFactory messageFactory, Mediator mediator) { - this.wire = wire; - this.messageFactory = messageFactory; - this.mediator = mediator; - - // Get the invokers for the supported operations - Operation getOperation = null; - for (InvocationChain invocationChain : this.wire.getInvocationChains()) { - invocationChain.setAllowsPassByReference(true); - Operation operation = invocationChain.getTargetOperation(); - String operationName = operation.getName(); - if (operationName.equals("getFeed")) { - getFeedInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("getAll")) { - getAllInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("query")) { - queryInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("get")) { - getOperation = operation; - } - } - - // Determine the collection item type - if (getOperation != null) { - itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class); - Class<?> itemClass = getOperation.getOutputType().getPhysical(); - if (itemClass == SyndEntry.class) { - supportsFeedEntries = true; - } - DataType<XMLType> outputType = getOperation.getOutputType(); - QName qname = outputType.getLogical().getElementName(); - qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName()); - itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null)); - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - // No authentication required for a get request - - // Get the request path - String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8"); - - logger.fine("get " + request.getRequestURI()); - - // Handle an RSS request - if (path == null || path.length() == 0 || path.equals("/")) { - - // Return an RSS feed containing the entries in the collection - SyndFeed feed = null; - if (supportsFeedEntries) { - - // The service implementation supports feed entries, invoke its getFeed operation - Message requestMessage = messageFactory.createMessage(); - Message responseMessage = getFeedInvoker.invoke(requestMessage); - if (responseMessage.isFault()) { - throw new ServletException((Throwable)responseMessage.getBody()); - } - feed = (SyndFeed)responseMessage.getBody(); - - } else { - - // The service implementation does not support feed entries, invoke its - // getAll operation to get the data item collection. then create feed entries - // from the data items - Message requestMessage = messageFactory.createMessage(); - Message responseMessage; - if (request.getQueryString() != null) { - requestMessage.setBody(new Object[] {request.getQueryString()}); - responseMessage = queryInvoker.invoke(requestMessage); - } else { - responseMessage = getAllInvoker.invoke(requestMessage); - } - if (responseMessage.isFault()) { - throw new ServletException((Throwable)responseMessage.getBody()); - } - org.apache.tuscany.sca.data.collection.Entry<Object, Object>[] collection = - (org.apache.tuscany.sca.data.collection.Entry<Object, Object>[])responseMessage.getBody(); - if (collection != null) { - // Create the feed - feed = new SyndFeedImpl(); - feed.setTitle("Feed"); - feed.setDescription("Feed description"); - - for (org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry: collection) { - SyndEntry feedEntry = createFeedEntry(entry); - feed.getEntries().add(feedEntry); - } - } - } - - // Convert to an RSS feed - if (feed != null) { - response.setContentType("application/rss+xml; charset=utf-8"); - feed.setFeedType("rss_2.0"); - feed.setLink(path); - SyndFeedOutput syndOutput = new SyndFeedOutput(); - try { - syndOutput.output(feed, getWriter(response)); - } catch (FeedException e) { - throw new ServletException(e); - } - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - - } - - /** - * Create an RSS entry from a data collection entry. - * @param entry - * @return - */ - private SyndEntry createFeedEntry(org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry) { - Object key = entry.getKey(); - Object data = entry.getData(); - if (data instanceof Item) { - Item item = (Item)data; - - SyndEntry feedEntry = new SyndEntryImpl(); - feedEntry.setUri(key.toString()); - feedEntry.setTitle(item.getTitle()); - - String value = item.getContents(); - if (value != null) { - SyndContent content = new SyndContentImpl(); - content.setType("text/xml"); - content.setValue(value); - List<SyndContent> contents = new ArrayList<SyndContent>(); - contents.add(content); - feedEntry.setContents(contents); - } - - String href = item.getLink(); - if (href == null) { - href = key.toString(); - } - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref(href); - feedEntry.getLinks().add(link); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref(href); - feedEntry.getLinks().add(link); - feedEntry.setLink(href); - - Date date = item.getDate(); - if (date == null) { - date = new Date(); - } - feedEntry.setPublishedDate(date); - return feedEntry; - - } else if (data != null) { - SyndEntry feedEntry = new SyndEntryImpl(); - feedEntry.setUri(key.toString()); - feedEntry.setTitle("item"); - - // Convert the item to XML - String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString(); - - SyndContent content = new SyndContentImpl(); - content.setType("text/xml"); - content.setValue(value); - List<SyndContent> contents = new ArrayList<SyndContent>(); - contents.add(content); - feedEntry.setContents(contents); - - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref(key.toString()); - feedEntry.getLinks().add(link); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref(key.toString()); - feedEntry.getLinks().add(link); - - feedEntry.setPublishedDate(new Date()); - return feedEntry; - } else { - return null; - } - } - - /** - * Create a data collection entry from an RSS entry. - * @param feedEntry - * @return - */ - private org.apache.tuscany.sca.data.collection.Entry<Object, Object> createEntry(SyndEntry feedEntry) { - if (feedEntry != null) { - if (itemClassType.getPhysical() == Item.class) { - String key = feedEntry.getUri(); - - Item item = new Item(); - item.setTitle(feedEntry.getTitle()); - - List<?> contents = feedEntry.getContents(); - if (!contents.isEmpty()) { - SyndContent content = (SyndContent)contents.get(0); - String value = content.getValue(); - item.setContents(value); - } - - for (Object l : feedEntry.getLinks()) { - SyndLink link = (SyndLink)l; - if (link.getRel() == null || "edit".equals(link.getRel())) { - String href = link.getHref(); - if (href.startsWith("null/")) { - href = href.substring(5); - } - item.setLink(href); - break; - } - } - - item.setDate(feedEntry.getPublishedDate()); - - return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, item); - - } else { - String key = feedEntry.getUri(); - - // Create the item from XML - List<?> contents = feedEntry.getContents(); - if (contents.isEmpty()) { - return null; - } - SyndContent content = (SyndContent)contents.get(0); - String value = content.getValue(); - Object data = mediator.mediate(value, itemXMLType, itemClassType, null); - - return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, data); - } - } else { - return null; - } - } - - - private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException { - Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8"); - return writer; - } - - /** - * Process the authorization header - * - * @param request - * @return - * @throws ServletException - */ - private String processAuthorizationHeader(HttpServletRequest request) throws ServletException { - try { - String authorization = request.getHeader("Authorization"); - if (authorization != null) { - StringTokenizer tokens = new StringTokenizer(authorization); - if (tokens.hasMoreTokens()) { - String basic = tokens.nextToken(); - if (basic.equalsIgnoreCase("Basic")) { - String credentials = tokens.nextToken(); - String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes())); - int colon = userAndPassword.indexOf(":"); - if (colon != -1) { - String user = userAndPassword.substring(0, colon); - String password = userAndPassword.substring(colon + 1); - - // Authenticate the User. - if (authenticate(user, password)) { - return user; - } - } - } - } - } - } catch (Exception e) { - throw new ServletException(e); - } - return null; - } - - /** - * Authenticate a user. - * - * @param user - * @param password - * @return - */ - private boolean authenticate(String user, String password) { - - // TODO Handle this using SCA security policies - //FIXME Why are we using endsWith instead of equals here?? - return ("admin".endsWith(user) && "admin".equals(password)); - } - - /** - * Reject an unauthorized request. - * - * @param response - */ - private void unauthorized(HttpServletResponse response) throws IOException { - response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\""); - response.sendError(HttpServletResponse.SC_UNAUTHORIZED); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java deleted file mode 100644 index e1bafdd3cd..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java +++ /dev/null @@ -1,66 +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 org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; - -/** - * Implementation of the RSS binding provider factory. - * - * @version $Rev$ $Date$ - */ -public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> { - - private MessageFactory messageFactory; - private Mediator mediator; - private ServletHost servletHost; - - public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); - this.servletHost = servletHosts.getServletHosts().get(0); - FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - this.messageFactory = modelFactories.getFactory(MessageFactory.class); - this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class); - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { - return new RSSReferenceBindingProvider(endpointReference, mediator); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) { - return new RSSServiceBindingProvider(endpoint, messageFactory, mediator, servletHost); - } - - public Class<RSSBinding> getModelType() { - return RSSBinding.class; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java deleted file mode 100644 index d234a0c92c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java +++ /dev/null @@ -1,68 +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 org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -/** - * Implementation of the RSS binding provider. - * - * @version $Rev$ $Date$ - */ -class RSSReferenceBindingProvider implements ReferenceBindingProvider { - - private EndpointReference endpointReference; - - private RuntimeComponentReference reference; - private RSSBinding binding; - - RSSReferenceBindingProvider(EndpointReference endpointReference, - Mediator mediator) { - this.endpointReference = endpointReference; - this.reference = (RuntimeComponentReference) endpointReference.getReference(); - this.binding = (RSSBinding) endpointReference.getBinding(); - } - - public Invoker createInvoker(Operation operation) { - return new RSSBindingInvoker(binding.getURI(), "rss_2.0"); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public InterfaceContract getBindingInterfaceContract() { - return reference.getInterfaceContract(); - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java deleted file mode 100644 index 25ab939341..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java +++ /dev/null @@ -1,93 +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 org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.Invocable; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; - -/** - * Implementation of the RSS binding provider. - * - * @version $Rev$ $Date$ - */ -class RSSServiceBindingProvider implements ServiceBindingProvider { - - private RuntimeEndpoint endpoint; - - //private RuntimeComponentService service; - private RSSBinding binding; - - private MessageFactory messageFactory; - private Mediator mediator; - private ServletHost servletHost; - - private String servletMapping; - - RSSServiceBindingProvider(RuntimeEndpoint endpoint, - MessageFactory messageFactory, - Mediator mediator, - ServletHost servletHost) { - this.endpoint = endpoint; - - //this.service = (RuntimeComponentService)endpoint.getService(); - this.binding = (RSSBinding) endpoint.getBinding(); - this.servletHost = servletHost; - this.messageFactory = messageFactory; - this.mediator = mediator; - } - - public InterfaceContract getBindingInterfaceContract() { - return endpoint.getComponentTypeServiceInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - Invocable wire = (RuntimeEndpoint) endpoint; - - RSSBindingListenerServlet servlet = - new RSSBindingListenerServlet(wire, messageFactory, mediator); - - servletMapping = binding.getURI(); - if (!servletMapping.endsWith("/")) { - servletMapping += "/"; - } - if (!servletMapping.endsWith("*")) { - servletMapping += "*"; - } - servletHost.addServletMapping(servletMapping, servlet); - - // Save the actual binding URI in the binding - //binding.setURI(servletHost.getURLMapping(binding.getURI()).toString()); - } - - public void stop() { - servletHost.removeServletMapping(servletMapping); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index e60dc2855a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,19 +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.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.rss.provider.RSSBindingProviderFactory;model=org.apache.tuscany.sca.binding.rss.RSSBinding
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java deleted file mode 100644 index 1ae4515e70..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java +++ /dev/null @@ -1,42 +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 org.apache.tuscany.sca.binding.rss; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - - -public class Consumer { - - public static void main(String[] args) throws Exception { - - String contribution = ContributionLocationHelper.getContributionLocation(Consumer.class); - Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Consumer.composite", new Contribution("consumer", contribution)); - - node.start(); - - CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient"); - testService.testCustomerCollection(); - - node.stop(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java deleted file mode 100644 index af87155f45..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java +++ /dev/null @@ -1,25 +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 org.apache.tuscany.sca.binding.rss; - -public interface CustomerClient { - - void testCustomerCollection() throws Exception; -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java deleted file mode 100644 index a80f721136..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java +++ /dev/null @@ -1,45 +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 org.apache.tuscany.sca.binding.rss; - -import org.apache.tuscany.sca.binding.rss.collection.Collection; -import org.oasisopen.sca.annotation.Reference; - -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndFeed; - - -public class CustomerClientImpl implements CustomerClient { - - @Reference - public Collection resourceCollection; - - public void testCustomerCollection() throws Exception { - - System.out.println(">>> get collection"); - SyndFeed feed = resourceCollection.getFeed(); - System.out.println("<<< get collection"); - for (Object o : feed.getEntries()) { - SyndEntry e = (SyndEntry)o; - System.out.println("id = " + e.getUri() + " entry = " + e.getTitle()); - } - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java deleted file mode 100644 index 4b5bf373e7..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java +++ /dev/null @@ -1,114 +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 org.apache.tuscany.sca.binding.rss; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.binding.rss.collection.Collection; -import org.apache.tuscany.sca.binding.rss.collection.NotFoundException; -import org.oasisopen.sca.annotation.Scope; - -import com.sun.syndication.feed.synd.SyndContent; -import com.sun.syndication.feed.synd.SyndContentImpl; -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndEntryImpl; -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.feed.synd.SyndFeedImpl; -import com.sun.syndication.feed.synd.SyndLink; -import com.sun.syndication.feed.synd.SyndLinkImpl; - -@Scope("COMPOSITE") -public class CustomerCollectionImpl implements Collection { - - private Map<String, SyndEntry> entries = new HashMap<String, SyndEntry>(); - - public CustomerCollectionImpl() { - - for (int i = 0; i < 4; i++) { - String id = "urn:uuid:customer-" + UUID.randomUUID().toString(); - - SyndEntry entry = new SyndEntryImpl(); - entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i)); - entry.setUri(id); - - SyndContent content = new SyndContentImpl(); - content.setValue("Jane Doe_" + String.valueOf(i)); - content.setType("text"); - entry.setContents(Collections.singletonList(content)); - - List<SyndLink> links = new ArrayList<SyndLink>(); - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref("" + id); - links.add(link); - entry.setLinks(links); - - links = new ArrayList<SyndLink>(); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref("" + id); - links.add(link); - entry.setLinks(links); - - entry.setPublishedDate(new Date()); - - entries.put(id, entry); - System.out.println(">>> id=" + id); - } - } - - public SyndFeed getFeed() { - System.out.println(">>> CustomerCollectionImpl.getFeed"); - - SyndFeed feed = new SyndFeedImpl(); - feed.setTitle("customers"); - feed.setDescription("This is a sample feed"); - feed.getEntries().addAll(entries.values()); - return feed; - } - - public SyndFeed query(String queryString) { - System.out.println(">>> CustomerCollectionImpl.query"); - - SyndFeed feed = new SyndFeedImpl(); - feed.setTitle("customers"); - feed.setDescription("This is a sample feed"); - feed.getEntries().addAll(entries.values()); - return feed; - } - - /** - * {@inheritDoc} - */ - public SyndEntry get(String id) throws NotFoundException { - final SyndEntry entry = entries.get(id); - if (id == null) { - throw new NotFoundException("No entry found with ID " + id); - } - - return entry; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java deleted file mode 100644 index 6dc23ac503..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java +++ /dev/null @@ -1,49 +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 org.apache.tuscany.sca.binding.rss; - -import java.io.IOException; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - -public class Provider { - - public static void main(String[] args) { - - - String contribution = ContributionLocationHelper.getContributionLocation(Provider.class); - Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Provider.composite", new Contribution("provider", contribution)); - - node.start(); - - System.out.println("Provider.composite ready..."); - - try { - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - node.stop(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java deleted file mode 100644 index 5a786f3bd0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java +++ /dev/null @@ -1,78 +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 org.apache.tuscany.sca.binding.rss; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Basic test case that will get the feed entries from an RSS feed. - */ -public class RSSGetTestCase { - protected static Node scaConsumerNode; - protected static Node scaProviderNode; - protected static CustomerClient testService; - - @BeforeClass - public static void init() throws Exception { - System.out.println(">>>RSSGetTestCase.init entry"); - String contribution = ContributionLocationHelper.getContributionLocation(RSSGetTestCase.class); - - scaProviderNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Provider.composite", new Contribution("provider", contribution)); - scaProviderNode.start(); - - scaConsumerNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Consumer.composite", new Contribution("consumer", contribution)); - scaConsumerNode.start(); - - testService = scaConsumerNode.getService(CustomerClient.class, "CustomerClient"); - } - - @AfterClass - public static void destroy() throws Exception { - // System.out.println(">>>RSSGetTestCase.destroy entry"); - if (scaConsumerNode != null) { - scaConsumerNode.stop(); - } - if (scaProviderNode != null) { - scaProviderNode.stop(); - } - } - - @Test - public void testPrelim() throws Exception { - Assert.assertNotNull(scaProviderNode); - Assert.assertNotNull(scaConsumerNode); - Assert.assertNotNull(testService); - } - - @Test - @Ignore("TUSCANY-3537") - public void testRSSGet() throws Exception { - testService.testCustomerCollection(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite deleted file mode 100644 index 22141805cd..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite +++ /dev/null @@ -1,32 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://customer" - name="Consumer"> - - <component name="CustomerClient"> - <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerClientImpl"/> - <reference name="resourceCollection"> - <tuscany:binding.rss uri="http://localhost:8084/customer"/> - </reference> - </component> - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite deleted file mode 100644 index 181267fa1d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite +++ /dev/null @@ -1,33 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace = "http://customer" - name="Provider"> - - <service name="customer" promote="CustomerCollection"> - <tuscany:binding.rss uri = "http://localhost:8084/customer"/> - </service> - - <component name="CustomerCollection"> - <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerCollectionImpl"/> - </component> - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/LICENSE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/META-INF/MANIFEST.MF deleted file mode 100644 index a0886018d3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.binding.rss;
- uses:="org.apache.tuscany.sca.assembly";version="2.0.0"
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA RSS Feed Binding Extension
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA RSS Feed Binding Extension
-Import-Package: javax.xml.namespace,
- org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.assembly.xml;version="2.0.0",
- org.apache.tuscany.sca.binding.rss;version="2.0.0",
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.monitor
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.rss
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/NOTICE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/NOTICE deleted file mode 100644 index ad2ba40961..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2010 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/pom.xml deleted file mode 100644 index 517f07099c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>tuscany-binding-rss</artifactId> - <name>Apache Tuscany SCA RSS Feed Binding Extension</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-data-api</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java deleted file mode 100644 index bda3210e73..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java +++ /dev/null @@ -1,33 +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 org.apache.tuscany.sca.binding.rss; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Binding; - -/** - * RSS Feed binding model. - * - * @version $Rev$ $Date$ - */ -public interface RSSBinding extends Binding { - QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.rss"); -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java deleted file mode 100644 index 3e691e636e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java +++ /dev/null @@ -1,35 +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 org.apache.tuscany.sca.binding.rss; - -/** - * Factory for the RSS binding - * - * @version $Rev$ $Date$ - */ -public interface RSSBindingFactory { - - /** - * Creates a new RSS binding. - * @return the new RSS binding - */ - RSSBinding createRSSBinding(); - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java deleted file mode 100644 index a4e6a8283d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java +++ /dev/null @@ -1,36 +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 org.apache.tuscany.sca.binding.rss.impl; - -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.binding.rss.RSSBindingFactory; - -/** - * Factory for the RSS binding model. - * - * @version $Rev$ $Date$ - */ -public class RSSBindingFactoryImpl implements RSSBindingFactory { - - public RSSBinding createRSSBinding() { - return new RSSBindingImpl(); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java deleted file mode 100644 index 00abffafb5..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java +++ /dev/null @@ -1,91 +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 org.apache.tuscany.sca.binding.rss.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.OperationSelector; -import org.apache.tuscany.sca.assembly.WireFormat; -import org.apache.tuscany.sca.binding.rss.RSSBinding; - -/** - * Implementation of the RSS Feed binding model. - * - * @version $Rev$ $Date$ - */ -class RSSBindingImpl implements RSSBinding { - - private String name; - private String uri; - - public QName getType() { - return RSSBinding.TYPE; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public boolean isUnresolved() { - return false; - } - - public void setUnresolved(boolean unresolved) { - // The binding is always resolved - } - - public WireFormat getRequestWireFormat() { - return null; - } - - public void setRequestWireFormat(WireFormat wireFormat) { - } - - public WireFormat getResponseWireFormat() { - return null; - } - - public void setResponseWireFormat(WireFormat wireFormat) { - } - - public OperationSelector getOperationSelector() { - return null; - } - - public void setOperationSelector(OperationSelector operationSelector) { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory deleted file mode 100644 index 73c47a3f41..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory +++ /dev/null @@ -1,19 +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. - -# Implementation class for the model factory -org.apache.tuscany.sca.binding.rss.impl.RSSBindingFactoryImpl
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index d298c16673..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.rss,model=org.apache.tuscany.sca.binding.rss.RSSBinding,factory=org.apache.tuscany.sca.binding.rss.RSSBindingFactory diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/META-INF/MANIFEST.MF deleted file mode 100644 index d6aa1a741f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -SCA-Version: 1.1 -Bundle-Name: Apache Tuscany SCA Data Binding for Google ProtocolBuffers -Bundle-Vendor: The Apache Software Foundation -Bundle-Version: 2.0.0 -Bundle-ManifestVersion: 2 -Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt -Bundle-Description: Apache Tuscany SCA Data Binding for JSON -Import-Package: javax.xml.namespace, - javax.xml.stream, - org.apache.tuscany.sca.common.xml.stax;version="2.0.0", - org.apache.tuscany.sca.core;version="2.0.0", - org.apache.tuscany.sca.databinding;version="2.0.0", - org.apache.tuscany.sca.databinding.impl;version="2.0.0", - org.apache.tuscany.sca.interfacedef;version="2.0.0", - org.apache.tuscany.sca.interfacedef.impl;version="2.0.0";resolution:=optional, - org.apache.tuscany.sca.interfacedef.util;version="2.0.0", - org.oasisopen.sca.annotation;version="2.0.0" -Bundle-SymbolicName: org.apache.tuscany.sca.databinding.protobuf -Bundle-DocURL: http://www.apache.org/ - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/pom.xml deleted file mode 100644 index e1f0c11344..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>tuscany-databinding-protobuf</artifactId> - <name>Apache Tuscany SCA Data Binding for Google ProtocolBuffers</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-common-xml</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>2.3.0</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - - </dependencies> -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/InputStream2Protobuf.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/InputStream2Protobuf.java deleted file mode 100644 index 7953e4e5b3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/InputStream2Protobuf.java +++ /dev/null @@ -1,65 +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 org.apache.tuscany.sca.databinding.protobuf; - -import java.io.InputStream; -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.databinding.PullTransformer; -import org.apache.tuscany.sca.databinding.TransformationContext; -import org.apache.tuscany.sca.databinding.TransformationException; - -import com.google.protobuf.Message; - -/** - * - */ -public class InputStream2Protobuf implements PullTransformer<InputStream, Message> { - - @Override - public String getSourceDataBinding() { - return "application/x-protobuf" + "#" + InputStream.class.getName(); - } - - @Override - public String getTargetDataBinding() { - // TODO Auto-generated method stub - return ProtobufDatabinding.NAME; - } - - @Override - public int getWeight() { - // TODO Auto-generated method stub - return 10; - } - - @Override - public Message transform(InputStream source, TransformationContext context) { - try { - Class<?> type = context.getTargetDataType().getPhysical(); - Method method = type.getMethod("parseFrom", InputStream.class); - Object result = method.invoke(null, source); - return (Message)result; - } catch (Throwable e) { - throw new TransformationException(e); - } - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/Protobuf2OutputStream.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/Protobuf2OutputStream.java deleted file mode 100644 index 6892287f67..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/Protobuf2OutputStream.java +++ /dev/null @@ -1,60 +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 org.apache.tuscany.sca.databinding.protobuf; - -import java.io.IOException; -import java.io.OutputStream; - -import org.apache.tuscany.sca.databinding.PushTransformer; -import org.apache.tuscany.sca.databinding.TransformationContext; -import org.apache.tuscany.sca.databinding.TransformationException; - -import com.google.protobuf.Message; - -/** - * - */ -public class Protobuf2OutputStream implements PushTransformer<Message, OutputStream> { - @Override - public String getSourceDataBinding() { - return ProtobufDatabinding.NAME; - } - - @Override - public String getTargetDataBinding() { - return "application/x-protobuf" + "#" + OutputStream.class.getName(); - } - - @Override - public int getWeight() { - return 10; - } - - @Override - public void transform(Message source, OutputStream sink, TransformationContext context) { - try { - if (source != null) { - source.writeTo(sink); - } - } catch (IOException e) { - throw new TransformationException(e); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufDatabinding.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufDatabinding.java deleted file mode 100644 index ad148c7499..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufDatabinding.java +++ /dev/null @@ -1,107 +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 org.apache.tuscany.sca.databinding.protobuf; - -import org.apache.tuscany.sca.databinding.DataBinding; -import org.apache.tuscany.sca.databinding.WrapperHandler; -import org.apache.tuscany.sca.databinding.XMLTypeHelper; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; - -import com.google.protobuf.Message; - -/** - * Google ProtocolBuffers databinding - */ -public class ProtobufDatabinding implements DataBinding { - - public static final String NAME = "ProtocolBuffers"; - - /** - * - */ - public ProtobufDatabinding() { - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#getName() - */ - @Override - public String getName() { - return NAME; - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#introspect(org.apache.tuscany.sca.interfacedef.DataType, org.apache.tuscany.sca.interfacedef.Operation) - */ - @Override - public boolean introspect(DataType dataType, Operation operation) { - if (Message.class.isAssignableFrom(dataType.getPhysical())) { - dataType.setDataBinding(NAME); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#introspect(java.lang.Object, org.apache.tuscany.sca.interfacedef.Operation) - */ - @Override - public DataType introspect(Object value, Operation operation) { - if (value instanceof Message) { - DataType dt = new DataTypeImpl(value.getClass(), null); - dt.setDataBinding(NAME); - return dt; - } else { - return null; - } - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#getWrapperHandler() - */ - @Override - public WrapperHandler getWrapperHandler() { - return null; - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#copy(java.lang.Object, org.apache.tuscany.sca.interfacedef.DataType, org.apache.tuscany.sca.interfacedef.DataType, org.apache.tuscany.sca.interfacedef.Operation, org.apache.tuscany.sca.interfacedef.Operation) - */ - @Override - public Object copy(Object object, - DataType sourceDataType, - DataType targetDataType, - Operation sourceOperation, - Operation targetOperation) { - Message msg = (Message)object; - return ((Message.Builder)msg.toBuilder().clone()).build(); - } - - /* (non-Javadoc) - * @see org.apache.tuscany.sca.databinding.DataBinding#getXMLTypeHelper() - */ - @Override - public XMLTypeHelper getXMLTypeHelper() { - return null; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding deleted file mode 100644 index 35f7932ff9..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding +++ /dev/null @@ -1,20 +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. - -# implementation classes for the databindings -org.apache.tuscany.sca.databinding.protobuf.ProtobufDatabinding;name=ProtocolBuffers -
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer deleted file mode 100644 index 0f60373c30..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer +++ /dev/null @@ -1,20 +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. - -# Implementation classes for the transformers -org.apache.tuscany.sca.databinding.protobuf.InputStream2Protobuf;source=application/x-protobuf#java.io.InputStream;target=ProtocolBuffers,weight=10,public=true -
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer deleted file mode 100644 index cc1989eb7b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer +++ /dev/null @@ -1,17 +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. -org.apache.tuscany.sca.databinding.protobuf.Protobuf2OutputStream;source=ProtocolBuffers;target=application/x-protobuf#java.io.OutputStream,weight=10,public=true diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/com/example/tutorial/AddressBookProtos.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/com/example/tutorial/AddressBookProtos.java deleted file mode 100644 index 8219fe1099..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/com/example/tutorial/AddressBookProtos.java +++ /dev/null @@ -1,1375 +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. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto - -package com.example.tutorial; - -public final class AddressBookProtos { - private AddressBookProtos() { - } - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - } - - public static final class Person extends com.google.protobuf.GeneratedMessage { - // Use Person.newBuilder() to construct. - private Person() { - initFields(); - } - - private Person(boolean noInit) { - } - - private static final Person defaultInstance; - - public static Person getDefaultInstance() { - return defaultInstance; - } - - public Person getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable; - } - - public enum PhoneType implements com.google.protobuf.ProtocolMessageEnum { - MOBILE(0, 0), HOME(1, 1), WORK(2, 2), ; - - public final int getNumber() { - return value; - } - - public static PhoneType valueOf(int value) { - switch (value) { - case 0: - return MOBILE; - case 1: - return HOME; - case 2: - return WORK; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap<PhoneType> internalGetValueMap() { - return internalValueMap; - } - - private static com.google.protobuf.Internal.EnumLiteMap<PhoneType> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap<PhoneType>() { - public PhoneType findValueByNumber(int number) { - return PhoneType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.example.tutorial.AddressBookProtos.Person.getDescriptor().getEnumTypes().get(0); - } - - private static final PhoneType[] VALUES = {MOBILE, HOME, WORK,}; - - public static PhoneType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private PhoneType(int index, int value) { - this.index = index; - this.value = value; - } - - static { - com.example.tutorial.AddressBookProtos.getDescriptor(); - } - - // @@protoc_insertion_point(enum_scope:tutorial.Person.PhoneType) - } - - public static final class PhoneNumber extends com.google.protobuf.GeneratedMessage { - // Use PhoneNumber.newBuilder() to construct. - private PhoneNumber() { - initFields(); - } - - private PhoneNumber(boolean noInit) { - } - - private static final PhoneNumber defaultInstance; - - public static PhoneNumber getDefaultInstance() { - return defaultInstance; - } - - public PhoneNumber getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable; - } - - // required string number = 1; - public static final int NUMBER_FIELD_NUMBER = 1; - private boolean hasNumber; - private java.lang.String number_ = ""; - - public boolean hasNumber() { - return hasNumber; - } - - public java.lang.String getNumber() { - return number_; - } - - // optional .tutorial.Person.PhoneType type = 2 [default = HOME]; - public static final int TYPE_FIELD_NUMBER = 2; - private boolean hasType; - private com.example.tutorial.AddressBookProtos.Person.PhoneType type_; - - public boolean hasType() { - return hasType; - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneType getType() { - return type_; - } - - private void initFields() { - type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME; - } - - public final boolean isInitialized() { - if (!hasNumber) - return false; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (hasNumber()) { - output.writeString(1, getNumber()); - } - if (hasType()) { - output.writeEnum(2, getType().getNumber()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) - return size; - - size = 0; - if (hasNumber()) { - size += com.google.protobuf.CodedOutputStream.computeStringSize(1, getNumber()); - } - if (hasType()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, getType().getNumber()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.example.tutorial.AddressBookProtos.Person.PhoneNumber prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> { - private com.example.tutorial.AddressBookProtos.Person.PhoneNumber result; - - // Construct using com.example.tutorial.AddressBookProtos.Person.PhoneNumber.newBuilder() - private Builder() { - } - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new com.example.tutorial.AddressBookProtos.Person.PhoneNumber(); - return builder; - } - - protected com.example.tutorial.AddressBookProtos.Person.PhoneNumber internalGetResult() { - return result; - } - - public Builder clear() { - if (result == null) { - throw new IllegalStateException("Cannot call clear() after build()."); - } - result = new com.example.tutorial.AddressBookProtos.Person.PhoneNumber(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDescriptor(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getDefaultInstanceForType() { - return com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneNumber build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private com.example.tutorial.AddressBookProtos.Person.PhoneNumber buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneNumber buildPartial() { - if (result == null) { - throw new IllegalStateException("build() has already been called on this Builder."); - } - com.example.tutorial.AddressBookProtos.Person.PhoneNumber returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.example.tutorial.AddressBookProtos.Person.PhoneNumber) { - return mergeFrom((com.example.tutorial.AddressBookProtos.Person.PhoneNumber)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.example.tutorial.AddressBookProtos.Person.PhoneNumber other) { - if (other == com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance()) - return this; - if (other.hasNumber()) { - setNumber(other.getNumber()); - } - if (other.hasType()) { - setType(other.getType()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - return this; - } - break; - } - case 10: { - setNumber(input.readString()); - break; - } - case 16: { - int rawValue = input.readEnum(); - com.example.tutorial.AddressBookProtos.Person.PhoneType value = - com.example.tutorial.AddressBookProtos.Person.PhoneType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - setType(value); - } - break; - } - } - } - } - - // required string number = 1; - public boolean hasNumber() { - return result.hasNumber(); - } - - public java.lang.String getNumber() { - return result.getNumber(); - } - - public Builder setNumber(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasNumber = true; - result.number_ = value; - return this; - } - - public Builder clearNumber() { - result.hasNumber = false; - result.number_ = getDefaultInstance().getNumber(); - return this; - } - - // optional .tutorial.Person.PhoneType type = 2 [default = HOME]; - public boolean hasType() { - return result.hasType(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneType getType() { - return result.getType(); - } - - public Builder setType(com.example.tutorial.AddressBookProtos.Person.PhoneType value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasType = true; - result.type_ = value; - return this; - } - - public Builder clearType() { - result.hasType = false; - result.type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME; - return this; - } - - // @@protoc_insertion_point(builder_scope:tutorial.Person.PhoneNumber) - } - - static { - defaultInstance = new PhoneNumber(true); - com.example.tutorial.AddressBookProtos.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tutorial.Person.PhoneNumber) - } - - // required string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private boolean hasName; - private java.lang.String name_ = ""; - - public boolean hasName() { - return hasName; - } - - public java.lang.String getName() { - return name_; - } - - // required int32 id = 2; - public static final int ID_FIELD_NUMBER = 2; - private boolean hasId; - private int id_ = 0; - - public boolean hasId() { - return hasId; - } - - public int getId() { - return id_; - } - - // optional string email = 3; - public static final int EMAIL_FIELD_NUMBER = 3; - private boolean hasEmail; - private java.lang.String email_ = ""; - - public boolean hasEmail() { - return hasEmail; - } - - public java.lang.String getEmail() { - return email_; - } - - // repeated .tutorial.Person.PhoneNumber phone = 4; - public static final int PHONE_FIELD_NUMBER = 4; - private java.util.List<com.example.tutorial.AddressBookProtos.Person.PhoneNumber> phone_ = - java.util.Collections.emptyList(); - - public java.util.List<com.example.tutorial.AddressBookProtos.Person.PhoneNumber> getPhoneList() { - return phone_; - } - - public int getPhoneCount() { - return phone_.size(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getPhone(int index) { - return phone_.get(index); - } - - private void initFields() { - } - - public final boolean isInitialized() { - if (!hasName) - return false; - if (!hasId) - return false; - for (com.example.tutorial.AddressBookProtos.Person.PhoneNumber element : getPhoneList()) { - if (!element.isInitialized()) - return false; - } - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (hasName()) { - output.writeString(1, getName()); - } - if (hasId()) { - output.writeInt32(2, getId()); - } - if (hasEmail()) { - output.writeString(3, getEmail()); - } - for (com.example.tutorial.AddressBookProtos.Person.PhoneNumber element : getPhoneList()) { - output.writeMessage(4, element); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) - return size; - - size = 0; - if (hasName()) { - size += com.google.protobuf.CodedOutputStream.computeStringSize(1, getName()); - } - if (hasId()) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, getId()); - } - if (hasEmail()) { - size += com.google.protobuf.CodedOutputStream.computeStringSize(3, getEmail()); - } - for (com.example.tutorial.AddressBookProtos.Person.PhoneNumber element : getPhoneList()) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, element); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.Person parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.Person parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.example.tutorial.AddressBookProtos.Person prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> { - private com.example.tutorial.AddressBookProtos.Person result; - - // Construct using com.example.tutorial.AddressBookProtos.Person.newBuilder() - private Builder() { - } - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new com.example.tutorial.AddressBookProtos.Person(); - return builder; - } - - protected com.example.tutorial.AddressBookProtos.Person internalGetResult() { - return result; - } - - public Builder clear() { - if (result == null) { - throw new IllegalStateException("Cannot call clear() after build()."); - } - result = new com.example.tutorial.AddressBookProtos.Person(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.example.tutorial.AddressBookProtos.Person.getDescriptor(); - } - - public com.example.tutorial.AddressBookProtos.Person getDefaultInstanceForType() { - return com.example.tutorial.AddressBookProtos.Person.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - - public com.example.tutorial.AddressBookProtos.Person build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private com.example.tutorial.AddressBookProtos.Person buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public com.example.tutorial.AddressBookProtos.Person buildPartial() { - if (result == null) { - throw new IllegalStateException("build() has already been called on this Builder."); - } - if (result.phone_ != java.util.Collections.EMPTY_LIST) { - result.phone_ = java.util.Collections.unmodifiableList(result.phone_); - } - com.example.tutorial.AddressBookProtos.Person returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.example.tutorial.AddressBookProtos.Person) { - return mergeFrom((com.example.tutorial.AddressBookProtos.Person)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.example.tutorial.AddressBookProtos.Person other) { - if (other == com.example.tutorial.AddressBookProtos.Person.getDefaultInstance()) - return this; - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasEmail()) { - setEmail(other.getEmail()); - } - if (!other.phone_.isEmpty()) { - if (result.phone_.isEmpty()) { - result.phone_ = - new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person.PhoneNumber>(); - } - result.phone_.addAll(other.phone_); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - return this; - } - break; - } - case 10: { - setName(input.readString()); - break; - } - case 16: { - setId(input.readInt32()); - break; - } - case 26: { - setEmail(input.readString()); - break; - } - case 34: { - com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder subBuilder = - com.example.tutorial.AddressBookProtos.Person.PhoneNumber.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPhone(subBuilder.buildPartial()); - break; - } - } - } - } - - // required string name = 1; - public boolean hasName() { - return result.hasName(); - } - - public java.lang.String getName() { - return result.getName(); - } - - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasName = true; - result.name_ = value; - return this; - } - - public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); - return this; - } - - // required int32 id = 2; - public boolean hasId() { - return result.hasId(); - } - - public int getId() { - return result.getId(); - } - - public Builder setId(int value) { - result.hasId = true; - result.id_ = value; - return this; - } - - public Builder clearId() { - result.hasId = false; - result.id_ = 0; - return this; - } - - // optional string email = 3; - public boolean hasEmail() { - return result.hasEmail(); - } - - public java.lang.String getEmail() { - return result.getEmail(); - } - - public Builder setEmail(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasEmail = true; - result.email_ = value; - return this; - } - - public Builder clearEmail() { - result.hasEmail = false; - result.email_ = getDefaultInstance().getEmail(); - return this; - } - - // repeated .tutorial.Person.PhoneNumber phone = 4; - public java.util.List<com.example.tutorial.AddressBookProtos.Person.PhoneNumber> getPhoneList() { - return java.util.Collections.unmodifiableList(result.phone_); - } - - public int getPhoneCount() { - return result.getPhoneCount(); - } - - public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getPhone(int index) { - return result.getPhone(index); - } - - public Builder setPhone(int index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber value) { - if (value == null) { - throw new NullPointerException(); - } - result.phone_.set(index, value); - return this; - } - - public Builder setPhone(int index, - com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) { - result.phone_.set(index, builderForValue.build()); - return this; - } - - public Builder addPhone(com.example.tutorial.AddressBookProtos.Person.PhoneNumber value) { - if (value == null) { - throw new NullPointerException(); - } - if (result.phone_.isEmpty()) { - result.phone_ = - new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person.PhoneNumber>(); - } - result.phone_.add(value); - return this; - } - - public Builder addPhone(com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) { - if (result.phone_.isEmpty()) { - result.phone_ = - new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person.PhoneNumber>(); - } - result.phone_.add(builderForValue.build()); - return this; - } - - public Builder addAllPhone(java.lang.Iterable<? extends com.example.tutorial.AddressBookProtos.Person.PhoneNumber> values) { - if (result.phone_.isEmpty()) { - result.phone_ = - new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person.PhoneNumber>(); - } - super.addAll(values, result.phone_); - return this; - } - - public Builder clearPhone() { - result.phone_ = java.util.Collections.emptyList(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tutorial.Person) - } - - static { - defaultInstance = new Person(true); - com.example.tutorial.AddressBookProtos.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tutorial.Person) - } - - public static final class AddressBook extends com.google.protobuf.GeneratedMessage { - // Use AddressBook.newBuilder() to construct. - private AddressBook() { - initFields(); - } - - private AddressBook(boolean noInit) { - } - - private static final AddressBook defaultInstance; - - public static AddressBook getDefaultInstance() { - return defaultInstance; - } - - public AddressBook getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable; - } - - // repeated .tutorial.Person person = 1; - public static final int PERSON_FIELD_NUMBER = 1; - private java.util.List<com.example.tutorial.AddressBookProtos.Person> person_ = java.util.Collections - .emptyList(); - - public java.util.List<com.example.tutorial.AddressBookProtos.Person> getPersonList() { - return person_; - } - - public int getPersonCount() { - return person_.size(); - } - - public com.example.tutorial.AddressBookProtos.Person getPerson(int index) { - return person_.get(index); - } - - private void initFields() { - } - - public final boolean isInitialized() { - for (com.example.tutorial.AddressBookProtos.Person element : getPersonList()) { - if (!element.isInitialized()) - return false; - } - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - for (com.example.tutorial.AddressBookProtos.Person element : getPersonList()) { - output.writeMessage(1, element); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) - return size; - - size = 0; - for (com.example.tutorial.AddressBookProtos.Person element : getPersonList()) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, element); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.example.tutorial.AddressBookProtos.AddressBook prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> { - private com.example.tutorial.AddressBookProtos.AddressBook result; - - // Construct using com.example.tutorial.AddressBookProtos.AddressBook.newBuilder() - private Builder() { - } - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new com.example.tutorial.AddressBookProtos.AddressBook(); - return builder; - } - - protected com.example.tutorial.AddressBookProtos.AddressBook internalGetResult() { - return result; - } - - public Builder clear() { - if (result == null) { - throw new IllegalStateException("Cannot call clear() after build()."); - } - result = new com.example.tutorial.AddressBookProtos.AddressBook(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.example.tutorial.AddressBookProtos.AddressBook.getDescriptor(); - } - - public com.example.tutorial.AddressBookProtos.AddressBook getDefaultInstanceForType() { - return com.example.tutorial.AddressBookProtos.AddressBook.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - - public com.example.tutorial.AddressBookProtos.AddressBook build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private com.example.tutorial.AddressBookProtos.AddressBook buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public com.example.tutorial.AddressBookProtos.AddressBook buildPartial() { - if (result == null) { - throw new IllegalStateException("build() has already been called on this Builder."); - } - if (result.person_ != java.util.Collections.EMPTY_LIST) { - result.person_ = java.util.Collections.unmodifiableList(result.person_); - } - com.example.tutorial.AddressBookProtos.AddressBook returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.example.tutorial.AddressBookProtos.AddressBook) { - return mergeFrom((com.example.tutorial.AddressBookProtos.AddressBook)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.example.tutorial.AddressBookProtos.AddressBook other) { - if (other == com.example.tutorial.AddressBookProtos.AddressBook.getDefaultInstance()) - return this; - if (!other.person_.isEmpty()) { - if (result.person_.isEmpty()) { - result.person_ = new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person>(); - } - result.person_.addAll(other.person_); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - return this; - } - break; - } - case 10: { - com.example.tutorial.AddressBookProtos.Person.Builder subBuilder = - com.example.tutorial.AddressBookProtos.Person.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPerson(subBuilder.buildPartial()); - break; - } - } - } - } - - // repeated .tutorial.Person person = 1; - public java.util.List<com.example.tutorial.AddressBookProtos.Person> getPersonList() { - return java.util.Collections.unmodifiableList(result.person_); - } - - public int getPersonCount() { - return result.getPersonCount(); - } - - public com.example.tutorial.AddressBookProtos.Person getPerson(int index) { - return result.getPerson(index); - } - - public Builder setPerson(int index, com.example.tutorial.AddressBookProtos.Person value) { - if (value == null) { - throw new NullPointerException(); - } - result.person_.set(index, value); - return this; - } - - public Builder setPerson(int index, com.example.tutorial.AddressBookProtos.Person.Builder builderForValue) { - result.person_.set(index, builderForValue.build()); - return this; - } - - public Builder addPerson(com.example.tutorial.AddressBookProtos.Person value) { - if (value == null) { - throw new NullPointerException(); - } - if (result.person_.isEmpty()) { - result.person_ = new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person>(); - } - result.person_.add(value); - return this; - } - - public Builder addPerson(com.example.tutorial.AddressBookProtos.Person.Builder builderForValue) { - if (result.person_.isEmpty()) { - result.person_ = new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person>(); - } - result.person_.add(builderForValue.build()); - return this; - } - - public Builder addAllPerson(java.lang.Iterable<? extends com.example.tutorial.AddressBookProtos.Person> values) { - if (result.person_.isEmpty()) { - result.person_ = new java.util.ArrayList<com.example.tutorial.AddressBookProtos.Person>(); - } - super.addAll(values, result.person_); - return this; - } - - public Builder clearPerson() { - result.person_ = java.util.Collections.emptyList(); - return this; - } - - // @@protoc_insertion_point(builder_scope:tutorial.AddressBook) - } - - static { - defaultInstance = new AddressBook(true); - com.example.tutorial.AddressBookProtos.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:tutorial.AddressBook) - } - - private static com.google.protobuf.Descriptors.Descriptor internal_static_tutorial_Person_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_tutorial_Person_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_tutorial_Person_PhoneNumber_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_tutorial_AddressBook_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_tutorial_AddressBook_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; - } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; - static { - java.lang.String[] descriptorData = - {"\n\021addressbook.proto\022\010tutorial\"\332\001\n\006Person" + "\022\014\n\004name\030\001 \002(\t\022\n\n\002id\030\002 \002(\005\022\r\n\005email\030\003 \001(" - + "\t\022+\n\005phone\030\004 \003(\0132\034.tutorial.Person.Phone" - + "Number\032M\n\013PhoneNumber\022\016\n\006number\030\001 \002(\t\022.\n" - + "\004type\030\002 \001(\0162\032.tutorial.Person.PhoneType:" - + "\004HOME\"+\n\tPhoneType\022\n\n\006MOBILE\020\000\022\010\n\004HOME\020\001" - + "\022\010\n\004WORK\020\002\"/\n\013AddressBook\022 \n\006person\030\001 \003(" - + "\0132\020.tutorial.PersonB)\n\024com.example.tutor" - + "ialB\021AddressBookProtos"}; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors(com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_tutorial_Person_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_tutorial_Person_fieldAccessorTable = - new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tutorial_Person_descriptor, - new java.lang.String[] {"Name", - "Id", - "Email", - "Phone",}, - com.example.tutorial.AddressBookProtos.Person.class, - com.example.tutorial.AddressBookProtos.Person.Builder.class); - internal_static_tutorial_Person_PhoneNumber_descriptor = - internal_static_tutorial_Person_descriptor.getNestedTypes().get(0); - internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable = - new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tutorial_Person_PhoneNumber_descriptor, - new java.lang.String[] {"Number", - "Type",}, - com.example.tutorial.AddressBookProtos.Person.PhoneNumber.class, - com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder.class); - internal_static_tutorial_AddressBook_descriptor = getDescriptor().getMessageTypes().get(1); - internal_static_tutorial_AddressBook_fieldAccessorTable = - new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_tutorial_AddressBook_descriptor, - new java.lang.String[] {"Person",}, - com.example.tutorial.AddressBookProtos.AddressBook.class, - com.example.tutorial.AddressBookProtos.AddressBook.Builder.class); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] {}, - assigner); - } - - public static void internalForceInit() { - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufTransformationTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufTransformationTestCase.java deleted file mode 100644 index 9fc6f30794..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufTransformationTestCase.java +++ /dev/null @@ -1,63 +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 org.apache.tuscany.sca.databinding.protobuf; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.databinding.TransformationContext; -import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; -import org.junit.Test; - -import com.example.tutorial.AddressBookProtos.AddressBook; -import com.example.tutorial.AddressBookProtos.Person; - -/** - * - */ -public class ProtobufTransformationTestCase { - @Test - public void testTransform() throws Exception { - Protobuf2OutputStream t1 = new Protobuf2OutputStream(); - TransformationContext context = new TransformationContextImpl(); - DataType dt1 = new DataTypeImpl(AddressBook.class, null); - context.setSourceDataType(dt1); - - AddressBook addressBook = - AddressBook.newBuilder() - .addPerson(Person.newBuilder().setId(1).setEmail("abc@example.com").setName("John Smith").build()) - .build(); - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - t1.transform(addressBook, bos, context); - - InputStream2Protobuf t2 = new InputStream2Protobuf(); - context.setSourceDataType(null); - context.setTargetDataType(dt1); - - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - AddressBook addressBook2 = (AddressBook)t2.transform(bis, context); - Assert.assertEquals(addressBook, addressBook2); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/resources/addressbook.proto b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/resources/addressbook.proto deleted file mode 100644 index 395320fb22..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/databinding-protobuf/src/test/resources/addressbook.proto +++ /dev/null @@ -1,48 +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. -// -// See README.txt for information and build instructions. - -package tutorial; - -option java_package = "com.example.tutorial"; -option java_outer_classname = "AddressBookProtos"; - -message Person { - required string name = 1; - required int32 id = 2; // Unique ID number for this person. - optional string email = 3; - - enum PhoneType { - MOBILE = 0; - HOME = 1; - WORK = 2; - } - - message PhoneNumber { - required string number = 1; - optional PhoneType type = 2 [default = HOME]; - } - - repeated PhoneNumber phone = 4; -} - -// Our address book file is just one of these. -message AddressBook { - repeated Person person = 1; -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/LICENSE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/META-INF/MANIFEST.MF deleted file mode 100644 index cab6b5057e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/META-INF/MANIFEST.MF +++ /dev/null @@ -1,33 +0,0 @@ -Manifest-Version: 1.0
-Private-Package: org.apache.tuscany.sca.http.tomcat;version="2.0.0",org.
- apache.tuscany.sca.http.tomcat.module;version="2.0.0"
-Tool: Bnd-0.0.255
-Bundle-Name: Apache Tuscany SCA Tomcat Servlet Host Extension
-Created-By: 1.6.0_07 (Sun Microsystems Inc.)
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bnd-LastModified: 1222833663765
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA Tomcat Servlet Host Extension
-Import-Package: javax.naming,
- javax.naming.directory,
- javax.servlet,
- javax.servlet.http,
- org.apache.catalina,
- org.apache.catalina.connector,
- org.apache.catalina.core,
- org.apache.catalina.servlets,
- org.apache.catalina.startup,
- org.apache.coyote,
- org.apache.coyote.http11,
- org.apache.naming.resources,
- org.apache.tomcat.util.buf,
- org.apache.tomcat.util.http.mapper,
- org.apache.tomcat.util.net,
- org.apache.tuscany.sca.core;version="2.0.0",
- org.apache.tuscany.sca.host.http;version="2.0.0",
- org.apache.tuscany.sca.work;version="2.0.0"
-Bundle-SymbolicName: org.apache.tuscany.sca.host.tomcat
-Bundle-DocURL: http://www.apache.org/
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/NOTICE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/NOTICE deleted file mode 100644 index 25bb89c9b2..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2009 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/pom.xml deleted file mode 100644 index a94154e793..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>tuscany-host-tomcat</artifactId> - <name>Apache Tuscany SCA Tomcat Servlet Host Extension</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-http</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - </dependency> - - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>catalina</artifactId> - <version>6.0.26</version> - <exclusions> - <exclusion> - <groupId>org.apache.tomcat</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>coyote</artifactId> - <version>6.0.26</version> - <exclusions> - <exclusion> - <groupId>org.apache.tomcat</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java deleted file mode 100644 index a0b384d554..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java +++ /dev/null @@ -1,58 +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 org.apache.tuscany.sca.http.tomcat; - -import javax.servlet.Servlet; -import javax.servlet.ServletException; - -import org.apache.catalina.core.StandardWrapper; - -/** - * A Servlet wrapper. - * - * @version $Rev$ $Date$ - */ -public class ServletWrapper extends StandardWrapper { - private static final long serialVersionUID = 1L; - - private final Servlet servlet; - - public ServletWrapper(Servlet servlet) { - this.servlet = servlet; - } - - @Override - public synchronized Servlet loadServlet() { - return servlet; - } - - @Override - public Servlet getServlet() { - return servlet; - } - - public void initServlet() throws ServletException { - servlet.init(facade); - } - - public void destroyServlet() { - servlet.destroy(); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java deleted file mode 100644 index 5d9b65503a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java +++ /dev/null @@ -1,114 +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 org.apache.tuscany.sca.http.tomcat; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; -import java.util.Hashtable; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; - -import org.apache.catalina.servlets.DefaultServlet; -import org.apache.naming.resources.FileDirContext; -import org.apache.naming.resources.ProxyDirContext; -import org.apache.naming.resources.Resource; - -/** - * DefaultServlet implementation for Tomcat. - * - * @version $Rev$ $Date$ - */ -public class TomcatDefaultServlet extends DefaultServlet { - private static final long serialVersionUID = -7503581551326796573L; - - private String documentRoot; - private ProxyDirContext proxyDirContext; - - public TomcatDefaultServlet(String servletPath, String documentRoot) { - this.documentRoot = documentRoot; - - DirContext dirContext; - URI uri = URI.create(documentRoot); - if (!"file".equals(uri.getScheme())) { - - dirContext = new FileDirContext() { - @Override - public Attributes getAttributes(String name) throws NamingException { - return new BasicAttributes(); - } - - @Override - public Object lookup(String name) throws NamingException { - - try { - final URL url = new URL(TomcatDefaultServlet.this.documentRoot + name); - return new Resource() { - @Override - public InputStream streamContent() throws IOException { - URLConnection connection = url.openConnection(); - connection.setUseCaches(false); - return connection.getInputStream(); - } - }; - } catch (MalformedURLException e) { - throw new NamingException(e.toString()); - } - } - }; - - } else { - dirContext = new FileDirContext(); - ((FileDirContext)dirContext).setDocBase(uri.getPath()); - } - proxyDirContext = new ProxyDirContext(new Hashtable(), dirContext); - resources = proxyDirContext; - } - - @Override - public void init() throws ServletException { - super.init(); - resources = proxyDirContext; - } - - @Override - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - resources = proxyDirContext; - } - - @Override - protected String getRelativePath(HttpServletRequest request) { - String path = request.getPathInfo(); - if (path == null || path.length() == 0) { - path = "/"; - } - return path; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java deleted file mode 100644 index d1a2e5d283..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java +++ /dev/null @@ -1,701 +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 org.apache.tuscany.sca.http.tomcat; - -import java.beans.PropertyChangeListener; -import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.net.UnknownHostException; -import java.security.AccessController; -import java.security.KeyStore; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - -import org.apache.catalina.Container; -import org.apache.catalina.Context; -import org.apache.catalina.Engine; -import org.apache.catalina.Host; -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.Loader; -import org.apache.catalina.connector.Connector; -import org.apache.catalina.core.StandardEngine; -import org.apache.catalina.startup.ContextConfig; -import org.apache.catalina.startup.Embedded; -import org.apache.coyote.http11.Http11Protocol; -import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.mapper.MappingData; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.LifeCycleListener; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.host.http.DefaultResourceServlet; -import org.apache.tuscany.sca.host.http.SecurityContext; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.host.http.ServletMappingException; -import org.apache.tuscany.sca.work.WorkScheduler; - -/** - * A Tomcat based implementation of ServletHost. - * - * @version $Rev$ $Date$ - */ -public class TomcatServer implements ServletHost, LifeCycleListener { - private static final Logger logger = Logger.getLogger(TomcatServer.class.getName()); - - private WorkScheduler workScheduler; - private Embedded embedded; - private Map<Integer, Port> ports = new HashMap<Integer, Port>(); - private String contextPath = "/"; - private int defaultPort = 8080; - private int defaultSSLPort = 8443; - - private final class TuscanyLoader implements Loader { - private final ClassLoader tccl; - private boolean delegate; - private boolean reloadable; - private Container container; - private List<String> repos = new ArrayList<String>(); - private List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>(); - - private TuscanyLoader(ClassLoader tccl) { - this.tccl = tccl; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void addRepository(String repository) { - repos.add(repository); - } - - public void backgroundProcess() { - } - - public String[] findRepositories() { - return repos.toArray(new String[repos.size()]); - } - - public Container getContainer() { - return container; - } - - public boolean getDelegate() { - return delegate; - } - - public String getInfo() { - return "Tuscany Loader for Embedded Tomcat"; - } - - public boolean getReloadable() { - return reloadable; - } - - public boolean modified() { - return false; - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - public void setContainer(Container container) { - this.container = container; - } - - public void setDelegate(boolean delegate) { - this.delegate = delegate; - } - - public void setReloadable(boolean reloadable) { - this.reloadable = reloadable; - } - - public ClassLoader getClassLoader() { - return tccl; - } - } - - /** - * Represents a port and the server that serves it. - */ - private class Port { - private Engine engine; - private Host host; - private Connector connector; - - private Port(Engine engine, Host host, Connector connector) { - this.engine = engine; - this.host = host; - this.connector = connector; - } - - public Engine getEngine() { - return engine; - } - - public Host getHost() { - return host; - } - - public Connector getConnector() { - return connector; - } - } - - /** - * Constructs a new embedded Tomcat server. - * - */ - public TomcatServer(ExtensionPointRegistry registry, Map<String, String> attributes) { - UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); - this.workScheduler = utilities.getUtility(WorkScheduler.class); - String port = attributes.get("defaultPort"); - if (port != null) { - defaultPort = Integer.parseInt(port); - } - String sslPort = attributes.get("defaultSSLPort"); - if (sslPort != null) { - defaultPort = Integer.parseInt(sslPort); - } - if (attributes.containsKey("contextPath")) { - contextPath = attributes.get("contextPath"); - } - } - - protected TomcatServer(WorkScheduler workScheduler) { - this.workScheduler = workScheduler; - } - - public void setDefaultPort(int port) { - defaultPort = port; - } - - public int getDefaultPort() { - return defaultPort; - } - - /** - * Stop all the started servers. - */ - public void stop() { - if (embedded != null) { - try { - // embedded.stop(); - embedded.destroy(); - for (Port port : ports.values()) { - port.connector.stop(); - } - } catch (LifecycleException e) { - throw new IllegalStateException(e); - } - } - } - - public synchronized String addServletMapping(String suri, Servlet servlet) { - init(); - URI uri = URI.create(suri); - - // Get the URI scheme and port - String scheme = uri.getScheme(); - if (scheme == null) { - scheme = "http"; - } - final int portNumber = (uri.getPort() == -1 ? defaultPort : uri.getPort()); - - // Get the port object associated with the given port number - Port port = ports.get(portNumber); - if (port == null) { - - port = createInstance(scheme, portNumber); - ports.put(portNumber, port); - } - - // Register the Servlet mapping - String path = uri.getPath(); - - if (!path.startsWith("/")) { - path = '/' + path; - } - - if (!path.startsWith(contextPath)) { - path = contextPath + path; - } - - ServletWrapper wrapper; - if (servlet instanceof DefaultResourceServlet) { - String defaultServletPath = path; - - // Optimize the handling of resource requests, use the Tomcat default Servlet - // instead of our default resource Servlet - if (defaultServletPath.endsWith("*")) { - defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1); - } - if (defaultServletPath.endsWith("/")) { - defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1); - } - DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet; - TomcatDefaultServlet defaultServlet = - new TomcatDefaultServlet(defaultServletPath, resourceServlet.getDocumentRoot()); - wrapper = new ServletWrapper(defaultServlet); - - } else { - wrapper = new ServletWrapper(servlet); - } - Context context = port.getHost().map(path); - wrapper.setName(path); - wrapper.addMapping(path); - context.addChild(wrapper); - context.addServletMapping(path, path); - port.getConnector().getMapper().addWrapper("localhost", "", path, wrapper); - - // Initialize the Servlet - try { - wrapper.initServlet(); - } catch (ServletException e) { - throw new ServletMappingException(e); - } - - // Compute the complete URL - String host; - try { - host = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - host = "localhost"; - } - URL addedURL; - try { - addedURL = new URL(scheme, host, portNumber, path); - } catch (MalformedURLException e) { - throw new ServletMappingException(e); - } - logger.info("Added Servlet mapping: " + addedURL); - return addedURL.toString(); - } - - private Port createInstance(String scheme, final int portNumber) { - Port port; - // Create an engine - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - final Engine engine = AccessController.doPrivileged(new PrivilegedAction<Engine>() { - public Engine run() { - return embedded.createEngine(); - } - }); - - ((StandardEngine)engine).setBaseDir(""); - engine.setDefaultHost("localhost"); - engine.setName("engine/" + portNumber); - - // Create a host - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - final Host host = AccessController.doPrivileged(new PrivilegedAction<Host>() { - public Host run() { - Host host = embedded.createHost("localhost", ""); - engine.addChild(host); - return host; - } - }); - - // Create the root context - Context context = embedded.createContext("", ""); - final ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - context.setLoader(new TuscanyLoader(tccl)); - // context.setParentClassLoader(tccl.getParent()); - ContextConfig config = new ContextConfig(); - ((Lifecycle)context).addLifecycleListener(config); - host.addChild(context); - - embedded.addEngine(engine); - - // Install an HTTP connector - - Connector connector; - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - try { - final String protocol = scheme; - connector = AccessController.doPrivileged(new PrivilegedExceptionAction<Connector>() { - public Connector run() throws Exception { - Connector customConnector = new Connector(); - customConnector.setPort(portNumber); - - if ("https".equalsIgnoreCase(protocol)) { - configureSSL(customConnector); - ((Http11Protocol)customConnector.getProtocolHandler()).setSSLEnabled(true); - } - return customConnector; - } - - private void configureSSL(Connector customConnector) { - String trustStore = System.getProperty("javax.net.ssl.trustStore"); - String trustStorePass = System.getProperty("javax.net.ssl.trustStorePassword"); - String keyStore = System.getProperty("javax.net.ssl.keyStore"); - String keyStorePass = System.getProperty("javax.net.ssl.keyStorePassword"); - - customConnector.setProperty("protocol", "TLS"); - - customConnector.setProperty("keystore", keyStore); - customConnector.setProperty("keypass", keyStorePass); - String keyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType()); - String trustStoreType = - System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType()); - customConnector.setProperty("keytype", keyStoreType); - customConnector.setProperty("trusttype", trustStoreType); - customConnector.setProperty("truststore", trustStore); - customConnector.setProperty("trustpass", trustStorePass); - - customConnector.setProperty("clientauth", "false"); - customConnector.setProtocol("HTTP/1.1"); - customConnector.setScheme(protocol); - customConnector.setProperty("backlog", "10"); - customConnector.setSecure(true); - } - }); - } catch (Exception e) { - throw new ServletMappingException(e); - } - - embedded.addConnector(connector); - try { - connector.start(); - } catch (LifecycleException e) { - throw new ServletMappingException(e); - } - - // Keep track of the running server - port = new Port(engine, host, connector); - return port; - } - - private synchronized void init() { - if (embedded != null) { - return; - } - embedded = new Embedded(); - embedded.setAwait(true); - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws LifecycleException { - embedded.start(); - return null; - } - }); - } catch (PrivilegedActionException e) { - // throw (LifecycleException)e.getException(); - throw new ServletMappingException(e); - } - } - - public URL getURLMapping(String suri) throws ServletMappingException { - URI uri = URI.create(suri); - - // Get the URI scheme and port - String scheme = uri.getScheme(); - if (scheme == null) { - scheme = "http"; - } - int portNumber = uri.getPort(); - if (portNumber == -1) { - portNumber = defaultPort; - } - - // Get the host - String host; - try { - host = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - host = "localhost"; - } - - // Construct the URL - String path = uri.getPath(); - - if (!path.startsWith("/")) { - path = '/' + path; - } - - if (!path.startsWith(contextPath)) { - path = contextPath + path; - } - URL url; - try { - url = new URL(scheme, host, portNumber, path); - } catch (MalformedURLException e) { - throw new ServletMappingException(e); - } - return url; - } - - public Servlet getServletMapping(String suri) throws ServletMappingException { - - if (suri == null) { - return null; - } - - URI uri = URI.create(suri); - - // Get the URI port - int portNumber = uri.getPort(); - if (portNumber == -1) { - portNumber = defaultPort; - } - - // Get the port object associated with the given port number - Port port = ports.get(portNumber); - if (port == null) { - return null; - } - - String mapping = uri.getPath(); - - if (!mapping.startsWith("/")) { - mapping = '/' + mapping; - } - - if (!mapping.startsWith(contextPath)) { - mapping = contextPath + mapping; - } - - final Context context = port.getHost().map(mapping); - final MappingData md = new MappingData(); - final MessageBytes mb = MessageBytes.newInstance(); - mb.setString(mapping); - try { - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws Exception { - context.getMapper().map(mb, md); - return null; - } - }); - } catch (Exception e) { - return null; - } - if (md.wrapper instanceof ServletWrapper) { - ServletWrapper servletWrapper = (ServletWrapper)md.wrapper; - return servletWrapper.getServlet(); - } else { - return null; - } - } - - public synchronized Servlet removeServletMapping(String suri) { - URI uri = URI.create(suri); - - // Get the URI port - int portNumber = uri.getPort(); - if (portNumber == -1) { - portNumber = defaultPort; - } - - // Get the port object associated with the given port number - Port port = ports.get(portNumber); - if (port == null) { - throw new IllegalStateException("No servlet registered at this URI: " + suri); - } - - String mapping = uri.getPath(); - - if (!mapping.startsWith("/")) { - mapping = '/' + mapping; - } - - if (!mapping.startsWith(contextPath)) { - mapping = contextPath + mapping; - } - - final Context context = port.getHost().map(mapping); - final MappingData md = new MappingData(); - final MessageBytes mb = MessageBytes.newInstance(); - mb.setString(mapping); - try { - // Allow privileged access to read properties. Requires PropertiesPermission read in - // security policy. - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws Exception { - context.getMapper().map(mb, md); - return null; - } - }); - } catch (Exception e) { - return null; - } - if (md.wrapper instanceof ServletWrapper) { - ServletWrapper servletWrapper = (ServletWrapper)md.wrapper; - - port.getConnector().getMapper().removeWrapper("localhost", "", mapping); - - try { - context.removeServletMapping(mapping); - } catch (NegativeArraySizeException e) { - // JIRA TUSCANY-1599 - // FIXME Looks like a bug in Tomcat when removing the last - // Servlet in the list, catch the exception for now as it doesn't - // seem harmful, will find a better solution for the next release - } - context.removeChild(servletWrapper); - try { - servletWrapper.destroyServlet(); - } catch (Exception ex) { - // Hack to handle destruction of Servlets without Servlet context - } - - logger.info("Removed Servlet mapping: " + suri); - - // Stop the port if there's no servlets on it anymore - String[] contextNames = port.getConnector().getMapper().getContextNames(); - if (contextNames == null || contextNames.length == 0) { - try { - port.getConnector().stop(); - ((StandardEngine)port.getEngine()).stop(); - embedded.removeEngine(port.getEngine()); - embedded.removeConnector(port.getConnector()); - ports.remove(portNumber); - } catch (LifecycleException e) { - throw new IllegalStateException(e); - } - } - - return servletWrapper.getServlet(); - } else { - logger.warning("Trying to Remove servlet mapping: " + mapping + " where mapping is not registered"); - return null; - } - } - - public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException { - //FIXME implement this later - return null; - } - - public String getContextPath() { - return contextPath; - } - - public void setContextPath(String path) { - this.contextPath = path; - } - - public void start() { - - } - - public String addServletMapping(String uri, Servlet servlet, SecurityContext securityContext) - throws ServletMappingException { - return addServletMapping(uri, servlet); - } - - public String getName() { - return "tomcat"; - } - - public URL getURLMapping(String arg0, SecurityContext arg1) { - return null; - } - - public void setAttribute(String arg0, Object arg1) { - } - - private URL map(String suri, SecurityContext securityContext, boolean resolve) throws ServletMappingException { - URI uri = URI.create(suri); - - // Get the URI scheme and port - String scheme = null; - if (securityContext != null && securityContext.isSSLEnabled()) { - scheme = "https"; - } else { - scheme = uri.getScheme(); - if (scheme == null) { - scheme = "http"; - } - } - - int portNumber = uri.getPort(); - if (portNumber == -1) { - if ("http".equals(scheme)) { - portNumber = defaultPort; - } else { - portNumber = defaultSSLPort; - } - } - - // Get the host - String host = uri.getHost(); - if (host == null) { - host = "0.0.0.0"; - if (resolve) { - try { - host = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e) { - host = "localhost"; - } - } - } - - // Construct the URL - String path = uri.getPath(); - - if (!path.startsWith("/")) { - path = '/' + path; - } - - if (!path.startsWith(contextPath)) { - path = contextPath + path; - } - - URL url; - try { - url = new URL(scheme, host, portNumber, path); - } catch (MalformedURLException e) { - throw new ServletMappingException(e); - } - return url; - } - - @Override - public ServletContext getServletContext() { - if (ports.isEmpty()) { - return null; - } else { - Port port = ports.values().iterator().next(); - return port.getHost().map(getContextPath()).getServletContext(); - } - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost deleted file mode 100644 index 00350bbf6b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHost +++ /dev/null @@ -1,18 +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.
-# Implementation class for the ServletHost
-org.apache.tuscany.sca.http.tomcat.TomcatServer;name=tomcat,ranking=50,defaultPort=8085
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java deleted file mode 100644 index 7e2f4e1614..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java +++ /dev/null @@ -1,375 +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 org.apache.tuscany.sca.http.tomcat; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.net.URL; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.host.http.DefaultResourceServlet; -import org.apache.tuscany.sca.host.http.ExtensibleServletHost; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.work.NotificationListener; -import org.apache.tuscany.sca.work.WorkScheduler; -import org.junit.Assert; -import org.junit.Test; - -/** - * @version $Rev$ $Date$ - */ -public class TomcatServerTestCase extends TestCase { - - private static final String REQUEST1_HEADER = - "GET /foo HTTP/1.0\n" + "Host: localhost\n" - + "Content-Type: text/xml\n" - + "Connection: close\n" - + "Content-Length: "; - private static final String REQUEST1_CONTENT = ""; - private static final String REQUEST1 = - REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT; - - private static final String REQUEST2_HEADER = - "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n" - + "Content-Type: text/xml\n" - + "Connection: close\n" - + "Content-Length: "; - private static final String REQUEST2_CONTENT = ""; - private static final String REQUEST2 = - REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT; - - private static final int HTTP_PORT = 8085; - - private WorkScheduler workScheduler = new WorkScheduler() { - private ExecutorService executorService = Executors.newCachedThreadPool(); - - public <T extends Runnable> void scheduleWork(T work) { - executorService.submit(work); - } - - public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) { - scheduleWork(work); - } - - public ExecutorService getExecutorService() { - return executorService; - } - }; - - /** - * Verifies requests are properly routed according to the Servlet mapping - */ - public void testRegisterServletMapping() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - ServletContext servletContext = service.getServletContext(); - Assert.assertNotNull(servletContext); - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - service.stop(); - assertTrue(servlet.invoked); - } - - /** - * Verifies requests are properly routed according to the Servlet mapping - */ - public void testRegisterServletMappingSSL() throws Exception { - System.setProperty("javax.net.ssl.keyStore", "target/test-classes/tuscany.keyStore"); - System.setProperty("javax.net.ssl.keyStorePassword", "apache"); - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - try { - service.addServletMapping("https://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - } finally { - System.clearProperty("javax.net.ssl.keyStore"); - System.clearProperty("javax.net.ssl.keyStorePassword"); - } - System.setProperty("javax.net.ssl.trustStore", "target/test-classes/tuscany.keyStore"); - System.setProperty("javax.net.ssl.trustStorePassword", "apache"); - URL url = new URL("https://127.0.0.1:8085/foo"); - HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); - conn.setHostnameVerifier(new HostnameVerifier() { - public boolean verify(String hostname, SSLSession session) { - return true; - }} - ); - - conn.connect(); - read(conn.getInputStream()); - - service.stop(); - assertTrue(servlet.invoked); - - } - /** - * Verifies that Servlets can be registered with multiple ports - */ - public void testRegisterMultiplePorts() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet); - TestServlet servlet2 = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + (HTTP_PORT + 1) + "/", servlet2); - { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - } - { - Socket client = new Socket("127.0.0.1", HTTP_PORT + 1); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - } - - service.stop(); - assertTrue(servlet.invoked); - assertTrue(servlet2.invoked); - } - - public void testUnregisterMapping() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo"); - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - service.stop(); - assertFalse(servlet.invoked); - - } - - public void testRegisterUnregisterMapping() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - } - assertTrue(servlet.invoked); - service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo"); - { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - } - servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - } - assertTrue(servlet.invoked); - service.stop(); - } - - public void testRequestSession() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - TestServlet servlet = new TestServlet(); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet); - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - read(client); - service.stop(); - assertTrue(servlet.invoked); - assertNotNull(servlet.sessionId); - } - - public void testRestart() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - service.stop(); - service.stop(); - } - - public void testNoMappings() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - Exception ex = null; - try { - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST1.getBytes()); - os.flush(); - } catch (Exception e) { - ex = e; - } - assertNotNull(ex); - service.stop(); - } - - public void testResourceServlet() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - - String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString(); - documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/')); - DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot); - TestResourceServlet servlet = new TestResourceServlet(resourceServlet); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", servlet); - - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST2.getBytes()); - os.flush(); - - String document = read(client); - assertTrue(document.indexOf("<body><p>hello</body>") != -1); - - service.stop(); - } - - public void testDefaultServlet() throws Exception { - TomcatServer service = new TomcatServer(workScheduler); - - String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString(); - documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/')); - DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot); - service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", resourceServlet); - - Socket client = new Socket("127.0.0.1", HTTP_PORT); - OutputStream os = client.getOutputStream(); - os.write(REQUEST2.getBytes()); - os.flush(); - - String document = read(client); - assertTrue(document.indexOf("<body><p>hello</body>") != -1); - - service.stop(); - } - - private static String read(Socket socket) throws IOException { - InputStream is = socket.getInputStream(); - return read(is); - } - - private static String read(InputStream is) throws IOException { - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(is)); - StringBuffer sb = new StringBuffer(); - String str; - while ((str = reader.readLine()) != null) { - sb.append(str); - } - return sb.toString(); - } finally { - if (reader != null) { - reader.close(); - } - } - } - private class TestServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - boolean invoked; - String sessionId; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - invoked = true; - sessionId = req.getSession().getId(); - OutputStream writer = resp.getOutputStream(); - try { - writer.write("result".getBytes()); - } finally { - writer.close(); - } - } - - } - - private class TestResourceServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - private HttpServlet delegate; - - public TestResourceServlet(HttpServlet delegate) { - this.delegate = delegate; - } - - @Override - public void init() throws ServletException { - super.init(); - delegate.init(); - } - - @Override - public void init(ServletConfig config) throws ServletException { - super.init(); - delegate.init(config); - } - - @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - delegate.service(req, resp); - } - - @Override - public void destroy() { - super.destroy(); - delegate.destroy(); - } - } - - @Test - public void testDiscovery() { - ExtensionPointRegistry registry = new DefaultExtensionPointRegistry(); - ExtensibleServletHost host = ExtensibleServletHost.getInstance(registry); - ServletHost me = host.getDefaultServletHost(); - Assert.assertEquals("tomcat", me.getName()); - Assert.assertEquals(8085, me.getDefaultPort()); - registry.stop(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/content/test.html b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/content/test.html deleted file mode 100644 index f4b79d7f01..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/content/test.html +++ /dev/null @@ -1,21 +0,0 @@ -<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. ---> -<body><p>hello</body> -</html>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/tuscany.keyStore b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/tuscany.keyStore Binary files differdeleted file mode 100644 index 7ea23f7ff4..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/host-tomcat/src/test/resources/tuscany.keyStore +++ /dev/null diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/pom.xml deleted file mode 100644 index b519d22fd3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/pom.xml +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - <artifactId>tuscany-contrib-modules</artifactId> - <packaging>pom</packaging> - <name>Apache Tuscany SCA Contributed Modules</name> - - <modules> - <module>binding-comet</module> - <module>binding-comet-runtime</module> - <module>databinding-protobuf</module> - <module>host-tomcat</module> - </modules> - - <profiles> - <profile> - <id>eclipse</id> - <build> - <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal> - <!-- - <plugins> - <plugin> - <groupId>org.apache.tuscany.maven.plugins</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>1.0.6</version> - <extensions>true</extensions> - <executions> - <execution> - <id>generate-pde</id> - <phase>generate-resources</phase> - <goals> - <goal>eclipse</goal> - </goals> - <configuration> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - --> - </build> - </profile> - </profiles> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile> - </archive> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/pom.xml deleted file mode 100644 index 2e3cd2d78e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sample-domain-distributed-calculator</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>sample-domain-distributed-calculator-contribution-add</artifactId>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator Contribution Add</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.maven.plugins</groupId>
- <artifactId>maven-tuscany-plugin</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The interface for the add service
- */
-@Remotable
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- return n1 + n2;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite deleted file mode 100644 index a452c24141..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite +++ /dev/null @@ -1,30 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Add">
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
-</composite>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 37e304ac4d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:sample="http://sample">
- <deployable composite="sample:Add"/>
-</contribution>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java deleted file mode 100644 index b7baf9b64b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java +++ /dev/null @@ -1,56 +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 calculator;
-
-import static org.junit.Assert.assertEquals;
-
-import java.rmi.Naming;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.ContributionLocationHelper;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class AddTestCase {
-
- private static Node node;
- private static AddService addService;
-
- @BeforeClass
- public static void setUp() throws Exception {
- addService = new AddServiceImpl();
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
-
- }
-
- @Test
- public void testCalculator() throws Exception {
- // Calculate
- assertEquals(addService.add(3, 2), 5.0, 0.0);
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/pom.xml deleted file mode 100644 index a178f8319c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sample-domain-distributed-calculator</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>sample-domain-distributed-calculator-contribution-calculator</artifactId>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator Contribution Calculator</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.maven.plugins</groupId>
- <artifactId>maven-tuscany-plugin</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The interface for the add service
- */
-@Remotable
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 0bac3da45c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,39 +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 calculator;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-public interface CalculatorService extends Remote {
-
- double add(double n1, double n2) throws RemoteException;
-
- double subtract(double n1, double n2) throws RemoteException;
-
- double multiply(double n1, double n2) throws RemoteException;
-
- double divide(double n1, double n2) throws RemoteException;
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 389ecb5f82..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,68 +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 calculator;
-
-import org.oasisopen.sca.annotation.Reference;
-
-/**
- * An implementation of the Calculator service.
- */
-public class CalculatorServiceImpl implements CalculatorService {
-
- private AddService addService;
- private SubtractService subtractService;
- private MultiplyService multiplyService;
- private DivideService divideService;
-
- @Reference
- public void setAddService(AddService addService) {
- this.addService = addService;
- }
-
- // @Reference
- public void setSubtractService(SubtractService subtractService) {
- this.subtractService = subtractService;
- }
-
- // @Reference
- public void setDivideService(DivideService divideService) {
- this.divideService = divideService;
- }
-
- // @Reference
- public void setMultiplyService(MultiplyService multiplyService) {
- this.multiplyService = multiplyService;
- }
-
- public double add(double n1, double n2) {
- return addService.add(n1, n2);
- }
-
- public double subtract(double n1, double n2) {
- return subtractService.subtract(n1, n2);
- }
-
- public double multiply(double n1, double n2) {
- return multiplyService.multiply(n1, n2);
- }
-
- public double divide(double n1, double n2) {
- return divideService.divide(n1, n2);
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +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 calculator;
-
-/**
- * The interface for the divide service
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +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 calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +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 calculator;
-
-/**
- * The interface for the subtract service
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite deleted file mode 100644 index 32b748d5ab..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite +++ /dev/null @@ -1,31 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Calculator">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent/AddService"/>
- </component>
-
-</composite>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +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 calculator;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- return n1 + n2;
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 6cccf83fbb..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,59 +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 calculator;
-
-import static org.junit.Assert.assertEquals;
-
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.ContributionLocationHelper;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class CalculatorTestCase {
-
- private static Node node;
- private static CalculatorService calculatorService;
-
- @BeforeClass
- public static void setUp() throws Exception {
- calculatorService = new CalculatorServiceImpl();
- ((CalculatorServiceImpl)calculatorService).setAddService(new AddServiceImpl());
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
-
- }
-
- @Test
- public void testCalculator() throws Exception {
- // Calculate
- assertEquals(calculatorService.add(3, 2), 5.0, 0.0);
- }
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/pom.xml deleted file mode 100644 index 7a5916489f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/distributed-calculator/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sample-domain</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-sample-domain-distributed-calculator</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Sample Domain Distributed Calculator</name>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>contribution-calculator</module>
- <module>contribution-add</module>
- </modules>
- </profile>
- </profiles>
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/pom.xml deleted file mode 100644 index 28b02c43c8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/domain/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-samples</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </parent>
- <artifactId>tuscany-sample-domain</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Sample Domain</name>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>distributed-calculator</module>
- </modules>
- </profile>
- </profiles>
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/pom.xml deleted file mode 100644 index 9edf85daf6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?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-sca</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sample-jsonp-webapp</artifactId>
- <packaging>war</packaging>
- <version>1.0</version>
- <name>jsonp-webapp</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-base-runtime-nodep</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonp-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>jsonp-webapp</finalName>
- </build>
-</project>
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/Location.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/Location.java deleted file mode 100644 index 1a47edf73c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/Location.java +++ /dev/null @@ -1,33 +0,0 @@ -package sample; - -public class Location { - - private String city; - private String country; - private int altitude; - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public int getAltitude() { - return altitude; - } - - public void setAltitude(int altitude) { - this.altitude = altitude; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareService.java deleted file mode 100644 index 3c79c6c2e9..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareService.java +++ /dev/null @@ -1,14 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface ShareService { - - String shareName(String firstName, String lastName); - - int shareAge(int age); - - Location shareLocation(Location location); - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java deleted file mode 100644 index 13bae36eb9..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Service; - -@Service(ShareService.class) -public class ShareServiceImpl implements ShareService { - - @Override - public String shareName(String firstName, String lastName) { - return firstName + " " + lastName; - } - - @Override - public int shareAge(int age) { - return age; - } - - @Override - public Location shareLocation(Location location) { - return location; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 58630c02ef..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite deleted file mode 100644 index 515c2dba09..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite +++ /dev/null @@ -1,33 +0,0 @@ -<?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://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://samples" - name="Stock"> - - <component name="c"> - <implementation.java class="sample.ShareServiceImpl"/> - <service name="ShareService"> - <interface.java interface="sample.ShareService"/> - <tuscany:binding.jsonp/> - </service> - </component> - -</composite>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 0deec29fcc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:j2ee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3.0.xsd" version="3.0"> - <display-name>Apache Tuscany JSONP Sample</display-name> - <filter> - <filter-name>tuscany</filter-name> - <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class> - <async-supported>true</async-supported> - </filter> - <filter-mapping> - <filter-name>tuscany</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - <welcome-file-list> - <welcome-file>index.html</welcome-file> - </welcome-file-list> -</web-app>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/index.html b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/index.html deleted file mode 100644 index 2a754e494e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/jsonp-webapp/src/main/webapp/index.html +++ /dev/null @@ -1,104 +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. ---> -<html> - <head> - <title>Apache Tuscany Comet Sample</title> - <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> - <script type="text/javascript" src="http://jquery-json.googlecode.com/svn/trunk/jquery.json.min.js"></script> - <script type="text/javascript"> - $(document).ready(function() { - document.getElementById("shareLocationButton").onclick = function(event) { - var location = { - city: document.getElementById("city").value, - country: document.getElementById("country").value, - altitude: document.getElementById("altitude").value - }; - $.getJSON("c/ShareService/shareLocation", "location=" + $.toJSON(location), shareLocationCallback); - } - }); - - function shareNameCallback(response) { - alert("Your name, " + response + ", has been shared."); - } - - function shareAge() { - document.getElementById("shareAgeForm").submit(); - } - - function shareAgeCallback(response) { - alert("Your age, " + response + ", has been shared."); - } - - function shareLocationCallback(response) { - alert("Your location, " + response.city + " - " + response.country + " - " + response.altitude + ", has been shared."); - } - </script> - </head> - <body> - <h2>Apache Tuscany JSONP Sample</h2> - <h3>Share Personal Information Webapp</h3> - - <form method="GET" action="c/ShareService/shareName"> - <b><label>Share Full Name</label></b> - <table> - <tr> - <td>First Name</td> - <td><input type="text" name="firstName" value="John"/> - </tr> - <tr> - <td>Last Name</td> - <td><input type="text" name="lastName" value="Locke"/> - </tr> - </table> - <input type="hidden" name="callback" value="shareNameCallback"/> - <input type="submit" value="Share"/> - </form> - - <form method="GET" id="shareAgeForm" action="c/ShareService/shareAge"> - <b><label>Share Age</label></b> - <table> - <tr> - <td>Age</td> - <td><input type="text" name="age" value="54"/> - </tr> - </table> - <input type="hidden" name="callback" value="shareAgeCallback"/> - <input type="submit" value="Share" onclick="shareAge()"/> - </form> - - <form method="GET" > - <b><label>Share Location</label></b> - <table> - <tr> - <td>City</td> - <td><input type="text" name="city" id="city" value="Los Angeles" /> - </tr> - <tr> - <td>Country</td> - <td><input type="text" name="country" id="country" value="USA" /> - </tr> - <tr> - <td>Altitude</td> - <td><input type="text" name="altitude" id="altitude" value="560" /> - </tr> - </table> - <input type="button" id="shareLocationButton" value="Share"/> - </form> - </body> -</html> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/README b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/README deleted file mode 100644 index 7108333efa..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/README +++ /dev/null @@ -1,20 +0,0 @@ -JSE Sample Launcher
-===================
-
-This directory contains a sample java launcher for the
-tuscany sample contributions.
-
-The README file in the <distribution-unpack-dir>/samples directory provides
-general instructions about building and running sample contributions using the
-tuscany sample launchers ( where distribution-unpack-dir is the directory in which you
-unpacked the tuscany binary distribution archive)
-
-To use this sample JSE launcher with ant excute the command
-
-ant run-<contributionname>
-
-where run-<contributionname> is one of the targets in the build.xml file
-
-To use this sample launcher to run all of the contributions as junit test cases,
-execute the command "mvn" in the launcher directory.
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/build.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/build.xml deleted file mode 100644 index 64bad00b76..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/build.xml +++ /dev/null @@ -1,118 +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.
--->
-<project name="launcher-embedded-jse" default="run">
- <property name="tuscany.home" value="../.."/>
- <property name="jar.name" value="sample-launcher-embedded-jse.jar" />
- <property name="main.class" value="launcher.SampleJSELauncher" />
- <property name="wait.before.stopping" value="dontWaitBeforeStopping" />
-
- <echo>${tuscany.home}</echo>
-
- <target name="init">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5"
- failonerror="true">
- <classpath>
- <fileset dir="${tuscany.home}/lib">
- <include name="tuscany-base-*.jar" />
- </fileset>
- </classpath>
- </javac>
- <jar destfile="target/${jar.name}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${main.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="run" depends="compile">
- <echo>Please use 'ant run-name-of-sample-contribution-to-run' for example, try one of</echo>
- <echo> 'ant run-contribution-binding-sca-calculator' </echo>
- <echo> 'ant run-contribution-binding-ws-calculator' </echo>
- <echo> 'ant run-contribution-binding-rmi-calculator' </echo>
- <echo> 'ant run-contribution-implementation-java-calculator' </echo>
- </target>
-
- <target name="run-contribution-binding-sca-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-binding-sca-calculator"/>
- <arg value="${wait.before.stopping}"/>
- </java>
- </target>
-
- <target name="run-contribution-binding-ws-calculator" depends="compile">
- <java classname="launcher.JSELauncherBindingWSCalculator"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- </java>
- </target>
-
- <target name="run-contribution-binding-rmi-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-binding-rmi-calculator"/>
- </java>
- </target>
-
- <target name="run-contribution-implementation-java-calculator" depends="compile">
- <java classname="${main.class}"
- fork="true"
- failonerror="true">
- <classpath>
- <pathelement location="target/${jar.name}"/>
- <fileset dir="${tuscany.home}/features">
- <include name="tuscany-sca-manifest.jar" />
- </fileset>
- </classpath>
- <arg value="contribution-implementaton-java-calculator"/>
- </java>
- </target>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/pom.xml deleted file mode 100644 index b4b3344b0d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
- <artifactId>sample-launcher-embedded-jse-spec</artifactId>
- <name>Apache Tuscany SCA Sample Launcher Embedded JSE Spec</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-api</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-domain-node</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
-
- </plugins>
- </build>
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 12d80ffd1c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,38 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java deleted file mode 100644 index 2f48e273bd..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java +++ /dev/null @@ -1,75 +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 launcher;
-
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node2.Node;
-import org.apache.tuscany.sca.node2.NodeFactory;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to create an embedded SCA runtime, load a contribution,
- * start it and locate and invoke an SCA component
- */
-public class JSELauncherBindingWSCalculator {
-
- public static void main(String[] args) throws Exception {
- JSELauncherBindingWSCalculator launcher = new JSELauncherBindingWSCalculator();
- launcher.launchBindingWSCalculator();
- }
-
- /*
- * Using the Tuscany Node API to load a contribution.
- * Using the Tuscany Node API to get a local service proxy
- */
- public void launchBindingWSCalculator(){
- NodeFactory nodeFactory = NodeFactory.newInstance();
- Node node = nodeFactory.createNode("MyDomain");
-
- try {
- node.installContribution("../../../samples/contribution-binding-ws-calculator/target/sample-contribution-binding-ws-calculator.jar");
- } catch(Exception ex){
- System.out.println("Exception on installContribution");
- ex.printStackTrace();
- }
-
- //node.start();
-
- CalculatorService calculator = null;
-
- try {
- calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
- } catch(Exception ex){
- System.out.println("Exception on getService");
- ex.printStackTrace();
- }
-
- // TODO - could use JUnit assertions but don't want to have to handle JUnit dependency from Ant script
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- if (result != 5.0){
- throw new SampleLauncherException();
- }
-
- node.stop();
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java deleted file mode 100644 index f2ed3d421d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java +++ /dev/null @@ -1,42 +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 launcher;
-
-/**
- * This exception signals problems in the management of SCA component execution.
- */
-public class SampleLauncherException extends RuntimeException {
- /**
- * Constructs a SampleLauncherException with no detail message.
- */
- public SampleLauncherException() {
- super();
- }
-
- /**
- * Constructs a SampleLauncherException with the specified detail
- * message.
- *
- * @param message the detail message
- */
- public SampleLauncherException(String message) {
- super(message);
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java deleted file mode 100644 index 04521d326b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java +++ /dev/null @@ -1,33 +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 launcher;
-
-import org.junit.Test;
-
-/**
- * Test sample contributions.
- */
-public class LauncherTestCase {
-
- @Test
- public void testContributionBindingWSCalculator() throws Exception {
- JSELauncherBindingWSCalculator.main(null);
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/pom.xml deleted file mode 100644 index 5e577ac809..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - <artifactId>tuscany-contrib-samples</artifactId> - <packaging>pom</packaging> - <name>Apache Tuscany SCA Contributed Samples</name> - - <modules> - <module>comet-webapp</module> - </modules> - - <profiles> - <profile> - <id>eclipse</id> - <build> - <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal> - <!-- - <plugins> - <plugin> - <groupId>org.apache.tuscany.maven.plugins</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>1.0.6</version> - <extensions>true</extensions> - <executions> - <execution> - <id>generate-pde</id> - <phase>generate-resources</phase> - <goals> - <goal>eclipse</goal> - </goals> - <configuration> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - --> - </build> - </profile> - </profiles> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile> - </archive> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/README b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/README deleted file mode 100644 index b33446cde8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/README +++ /dev/null @@ -1,6 +0,0 @@ -Reporting Sample
-================
-
-A simple sample to motivate the implementation of some mechanisms for
-retiriving information about an active domain and it's nodes.
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/pom.xml deleted file mode 100644 index f02dd38b24..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-samples</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>sample-reporting</artifactId>
- <name>Apache Tuscany SCA Sample Reporting</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-api</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-script-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-json</artifactId>
- <version>2.0-Beta1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
-
- </plugins>
- </build>
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 12d80ffd1c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,38 +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 calculator;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-
-/**
- * The Calculator service interface.
- */
-@Remotable
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java deleted file mode 100644 index 25729ea1ea..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java +++ /dev/null @@ -1,333 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncheCalculator {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncheCalculator launcher = new JSELauncheCalculator();
- launcher.setUp();
-
- launcher.callCalulator();
- launcher.listExtensions();
- launcher.listNodes();
- launcher.listNodeConfigurations();
- launcher.listContributions();
- launcher.listDomainComposite();
- launcher.listDomainDefinitions();
- launcher.listEndpoints();
- launcher.listWires();
-
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
-
- org.apache.tuscany.sca.node2.Node node2New = nodeFactoryNew.createNode();
- node2New.installContribution("../domain/distributed-calculator/contribution-calculator/target/classes");
-
- calculator = node2New.getService(CalculatorService.class, "CalculatorServiceComponent");
-*/
-
-/* old */
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- Properties properties = new Properties();
- properties.setProperty("bind", "192.168.0.2");
- nodeFactory = NodeFactory.newInstance(properties);
-
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- //node2 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-calculator/target/classes"));
- //node2 = nodeFactory.createNode(URI.create("tuscany:default?listen=127.0.0.1:14820"), "../domain/distributed-calculator/contribution-calculator/target/classes");
- //node2 = nodeFactory.createNode(URI.create("tuscany:default"), "../domain/distributed-calculator/contribution-calculator/target/classes");
- node2 = nodeFactory.createNode(new File("./target/classes/node-calculator.xml").toURL());
-
- node2.start();
-
- calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node2.stop();
- }
-
- @Test
- public void callCalulator(){
- printTestName("callCalulator");
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- }
-
- @Test
- public void listExtensions(){
- printTestName("listExtensions");
- // TODO
- }
-
- @Test
- public void listNodes(){
- printTestName("listNodes");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Object nodeKey : nodes.keySet()){
- System.out.println(nodeKey);
- }
- }
-
- @Test
- public void listNodeConfigurations(){
- printTestName("listNodeConfigurations");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getConfiguration());
- }
- }
-
- @Test
- public void listContributions(){
- printTestName("listContributions");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- NodeConfiguration nodeConfiguration = ((NodeImpl)node).getConfiguration();
- for (org.apache.tuscany.sca.contribution.Contribution contribution : ((NodeImpl)node).getContributions()){
- System.out.println("Contribution: " + contribution.getURI() + " location " + contribution.getLocation());
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact: " + artifact.getURI() + " location " + artifact.getLocation());
- }
- }
- }
- }
-
- @Test
- public void listDomainComposite(){
- printTestName("listDomainComposite");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getDomainComposite());
- }
- }
-
- @Test
- public void listDomainDefinitions(){
- printTestName("listDomainDefinitions");
- Deployer deployer = ((NodeFactoryImpl)nodeFactory).getDeployer();
- Definitions systemDefinitions = deployer.getSystemDefinitions();
- printXML(systemDefinitions);
- }
-
- @Test
- public void listEndpoints(){
- printTestName("listEndpoints");
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- Node firstNode = nodes.values().iterator().next();
- NodeConfiguration firstNodeConfig = ((NodeImpl)firstNode).getConfiguration();
-
- DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry);
- // TODO - I don't understand where the scheme gets set/used
- EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry("vm:" + firstNodeConfig.getDomainRegistryURI(), firstNodeConfig.getDomainURI());
-
- for (Endpoint endpoint : endpointRegistry.getEndpoints()){
- System.out.println(endpoint);
- printEndpointXML(endpoint);
- }
- }
-
- @Test
- public void listWires(){
- printTestName("listWires");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- listComponentWires(((NodeImpl)node).getDomainComposite());
- }
- }
-
- // utils
-
- private void listComponentWires(Composite composite){
- for(Component component : composite.getComponents()){
- if (component.getImplementation() instanceof Composite){
- listComponentWires((Composite)component.getImplementation());
- }
- System.out.println(" Component: " + component.getName());
-
- for(ComponentService service : component.getServices()){
- System.out.println(" Service: " + service.getName());
- for(Endpoint endpoint : service.getEndpoints()){
- System.out.println(" Endpoint: " + endpoint);
- System.out.println(" Binding: " + endpoint.getBinding().getType());
- printInvocationChains(((RuntimeEndpointImpl)endpoint).getInvocationChains());
- }
- }
- for(ComponentReference reference : component.getReferences()){
- System.out.println(" Reference: " + reference.getName());
- for(EndpointReference endpointReference : reference.getEndpointReferences()){
- System.out.println(" EndpointReference: " + endpointReference);
- Binding binding = endpointReference.getBinding();
- if (binding != null){
- System.out.println(" Binding: " + binding.getType());
- printInvocationChains(((RuntimeEndpointReferenceImpl)endpointReference).getInvocationChains());
- }
- }
- }
- }
- }
-
- private void printInvocationChains(List<InvocationChain> chains){
- for(InvocationChain chain : chains){
- System.out.println(" Operation: " + chain.getTargetOperation().getName());
- Invoker invoker = chain.getHeadInvoker();
- while(invoker != null){
- System.out.println(" Invoker: " + invoker.getClass().getName());
- if (invoker instanceof Interceptor){
- invoker = ((Interceptor)invoker).getNext();
- } else {
- invoker = null;
- }
- }
- }
- }
-
- private void printTestName(String name){
- System.out.println("=====================================================================");
- System.out.println(name);
- System.out.println("=====================================================================");
- }
-
- private void printXML(Object model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Object> xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessors, inputFactory, null);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // TODO - we don't have a processor registered for RuntimeEndpointImpl?
- private void printEndpointXML(Endpoint model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Endpoint> xmlProcessor = xmlProcessors.getProcessor(Endpoint.class);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncherAdd.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncherAdd.java deleted file mode 100644 index 5351ed263b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/java/reporting/JSELauncherAdd.java +++ /dev/null @@ -1,144 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.RuntimeProperties;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncherAdd {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncherAdd launcher = new JSELauncherAdd ();
- launcher.setUp();
-
- launcher.waitForInput();
-
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
- org.apache.tuscany.sca.node2.Node node1New = nodeFactoryNew.createNode();
- node1New.installContribution("../domain/distributed-calculator/contribution-add/target/classes");
-
-*/
-
-/* old */
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- Properties properties = new Properties();
- properties.setProperty("bind", "192.168.0.2");
- nodeFactory = NodeFactory.newInstance(properties);
-
- // TUSCANY-3675 - push hazelcast config into factory as adding it to URI doesn't work
- //node1 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-add/target/classes"));
- //node1 = nodeFactory.createNode(URI.create("tuscany:default?listen=127.0.0.1:14820"), "../domain/distributed-calculator/contribution-add/target/classes");
- //node1 = nodeFactory.createNode(URI.create("tuscany:default"), "../domain/distributed-calculator/contribution-add/target/classes");
- node1 = nodeFactory.createNode(new File("./target/classes/node-add.xml").toURL());
-
- node1.start();
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node1.stop();
- }
-
- @Test
- @Ignore
- public void waitForInput(){
- System.out.println("Press key to end");
- try {
- System.in.read();
- } catch(Exception ex){
- // do nothing
- }
- }
-
-}
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-add.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-add.xml deleted file mode 100644 index 7a4a6d5695..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-add.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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.
--->
-<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- uri="node-add"
- domain="default"
- domainRegistry="tuscany:default">
-
- <!-- Configure the base URIs for a given binding -->
- <binding name="sca:binding.sca" baseURIs="http://localhost:8081/sca"/>
- <binding name="sca:binding.ws" baseURIs="http://localhost:8082/ws"/>
-
- <!-- Configure a list of contributions -->
- <contribution uri="contribution-add" location="../../../domain/distributed-calculator/contribution-add/target/classes"/>
-
-</node>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-calculator.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-calculator.xml deleted file mode 100644 index 31098b129d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/main/resources/node-calculator.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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.
--->
-<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- uri="node-calculator"
- domain="default"
- domainRegistry="tuscany:default">
-
- <!-- Configure the base URIs for a given binding -->
- <binding name="sca:binding.sca" baseURIs="http://localhost:8083/sca"/>
- <binding name="sca:binding.ws" baseURIs="http://localhost:8084/ws"/>
-
- <!-- Configure a list of contributions -->
- <contribution uri="contribution-calculator" location="../../../domain/distributed-calculator/contribution-calculator/target/classes"/>
-
-</node>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java deleted file mode 100644 index b4cc8fa3ee..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java +++ /dev/null @@ -1,320 +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 reporting;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl;
-import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.sun.jmx.remote.util.Service;
-import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
-
-import calculator.CalculatorService;
-
-/**
- * This client program shows how to extract useful(?) information from the Tuscany SCA runtime
- */
-public class JSELauncherReportingTestCase {
-
- private static NodeFactory nodeFactory;
- private static Node node1;
- private static Node node2;
- private static CalculatorService calculator;
-
-
- public static void main(String[] args) throws Exception {
- JSELauncherReportingTestCase launcher = new JSELauncherReportingTestCase();
- launcher.setUp();
-
- launcher.callCalulator();
-/*
- launcher.listNodes();
- launcher.listNodeConfigurations();
- launcher.listContributions();
- launcher.listDomainDefinitions();
- launcher.listEndpoints();
-*/
- launcher.listWires();
- launcher.tearDown();
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- try {
-/* new
- org.apache.tuscany.sca.node2.NodeFactory nodeFactoryNew = org.apache.tuscany.sca.node2.NodeFactory.newInstance();
- org.apache.tuscany.sca.node2.Node node1New = nodeFactoryNew.createNode();
- node1New.installContribution("../domain/distributed-calculator/contribution-add/target/classes");
-
- org.apache.tuscany.sca.node2.Node node2New = nodeFactoryNew.createNode();
- node2New.installContribution("../domain/distributed-calculator/contribution-calculator/target/classes");
-
- calculator = node2New.getService(CalculatorService.class, "CalculatorServiceComponent");
-*/
-
-/* old */
- nodeFactory = NodeFactory.newInstance();
- node1 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-add/target/classes"));
- node1.start();
-
- node2 = nodeFactory.createNode(new Contribution("c1", "../domain/distributed-calculator/contribution-calculator/target/classes"));
- node2.start();
-
- calculator = node2.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() throws Exception {
- node1.stop();
- node2.stop();
- }
-
- @Test
- public void callCalulator(){
- printTestName("callCalulator");
- double result = calculator.add(3, 2);
- System.out.println("3 + 2 = " + result);
- }
-
- @Test
- public void listNodes(){
- printTestName("listNodes");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Object nodeKey : nodes.keySet()){
- System.out.println(nodeKey);
- }
- }
-
- @Test
- public void listNodeConfigurations(){
- printTestName("listNodeConfigurations");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getConfiguration());
- }
- }
-
- @Test
- public void listContributions(){
- printTestName("listContributions");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- NodeConfiguration nodeConfiguration = ((NodeImpl)node).getConfiguration();
- for (org.apache.tuscany.sca.contribution.Contribution contribution : ((NodeImpl)node).getContributions()){
- System.out.println("Contribution: " + contribution.getURI() + " location " + contribution.getLocation());
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact: " + artifact.getURI() + " location " + artifact.getLocation());
- }
- }
- }
- }
-
- @Test
- public void listDomainComposite(){
- printTestName("listDomainComposite");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- printXML(((NodeImpl)node).getDomainComposite());
- }
- }
-
- @Test
- public void listDomainDefinitions(){
- printTestName("listDomainDefinitions");
- Deployer deployer = ((NodeFactoryImpl)nodeFactory).getDeployer();
- Definitions systemDefinitions = deployer.getSystemDefinitions();
- printXML(systemDefinitions);
- }
-
- @Test
- public void listEndpoints(){
- printTestName("listEndpoints");
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- Node firstNode = nodes.values().iterator().next();
- NodeConfiguration firstNodeConfig = ((NodeImpl)firstNode).getConfiguration();
-
- DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry);
- // TODO - I don't understand where the scheme gets set/used
- EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry("vm:" + firstNodeConfig.getDomainRegistryURI(), firstNodeConfig.getDomainURI());
-
- for (Endpoint endpoint : endpointRegistry.getEndpoints()){
- System.out.println(endpoint);
- printEndpointXML(endpoint);
- }
- }
-
- @Test
- public void listWires(){
- printTestName("listWires");
- Map<Object, Node> nodes = ((NodeFactoryImpl)nodeFactory).getNodes();
- for (Node node : nodes.values()){
- System.out.println("Node: " + ((NodeImpl)node).getURI());
- listComponentWires(((NodeImpl)node).getDomainComposite());
- }
- }
-
- // utils
-
- private void listComponentWires(Composite composite){
- for(Component component : composite.getComponents()){
- if (component.getImplementation() instanceof Composite){
- listComponentWires((Composite)component.getImplementation());
- }
- System.out.println(" Component: " + component.getName());
-
- for(ComponentService service : component.getServices()){
- System.out.println(" Service: " + service.getName());
- for(Endpoint endpoint : service.getEndpoints()){
- System.out.println(" Endpoint: " + endpoint);
- System.out.println(" Binding: " + endpoint.getBinding().getType());
- printInvocationChains(((RuntimeEndpointImpl)endpoint).getInvocationChains());
- }
- }
- for(ComponentReference reference : component.getReferences()){
- System.out.println(" Reference: " + reference.getName());
- for(EndpointReference endpointReference : reference.getEndpointReferences()){
- System.out.println(" EndpointReference: " + endpointReference);
- Binding binding = endpointReference.getBinding();
- if (binding != null){
- System.out.println(" Binding: " + binding.getType());
- printInvocationChains(((RuntimeEndpointReferenceImpl)endpointReference).getInvocationChains());
- }
- }
- }
- }
- }
-
- private void printInvocationChains(List<InvocationChain> chains){
- for(InvocationChain chain : chains){
- System.out.println(" Operation: " + chain.getTargetOperation().getName());
- Invoker invoker = chain.getHeadInvoker();
- while(invoker != null){
- System.out.println(" Invoker: " + invoker.getClass().getName());
- if (invoker instanceof Interceptor){
- invoker = ((Interceptor)invoker).getNext();
- } else {
- invoker = null;
- }
- }
- }
- }
-
- private void printTestName(String name){
- System.out.println("=====================================================================");
- System.out.println(name);
- System.out.println("=====================================================================");
- }
-
- private void printXML(Object model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Object> xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessors, inputFactory, null);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // TODO - we don't have a processor registered for RuntimeEndpointImpl?
- private void printEndpointXML(Endpoint model){
- try {
- ExtensionPointRegistry registry = ((NodeFactoryImpl)nodeFactory).getExtensionPointRegistry();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Endpoint> xmlProcessor = xmlProcessors.getProcessor(Endpoint.class);
-
- ProcessorContext context = new ProcessorContext(registry);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
- XMLStreamWriter writer = new IndentingXMLStreamWriter(outputFactory.createXMLStreamWriter(bos));
-
- xmlProcessor.write(model, writer, context);
- writer.flush();
-
- System.out.println(bos.toString());
- } catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-
-}
|