diff options
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta2/unreleased')
151 files changed, 0 insertions, 12220 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss-runtime/LICENSE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss-runtime/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF deleted file mode 100644 index c78875e887..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/NOTICE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss-runtime/NOTICE deleted file mode 100644 index ad2ba40961..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss-runtime/pom.xml deleted file mode 100644 index b7048e9cdc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-rss</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-data-api</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-http</artifactId> - <version>2.0-Beta2-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-Beta2-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl</artifactId> - <version>2.0-Beta2-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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss/LICENSE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss/META-INF/MANIFEST.MF deleted file mode 100644 index a0886018d3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss/NOTICE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss/NOTICE deleted file mode 100644 index ad2ba40961..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/binding-rss/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/binding-rss/pom.xml deleted file mode 100644 index 69292f4215..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-data-api</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl</artifactId> - <version>2.0-Beta2-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-Beta2/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/databinding-protobuf/META-INF/MANIFEST.MF deleted file mode 100644 index d6aa1a741f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/databinding-protobuf/pom.xml deleted file mode 100644 index 30828c1ad0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-common-xml</artifactId> - <version>2.0-Beta2-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-Beta2-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-Beta2/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/InputStream2Protobuf.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/Protobuf2OutputStream.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/main/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufDatabinding.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/test/java/com/example/tutorial/AddressBookProtos.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/test/java/org/apache/tuscany/sca/databinding/protobuf/ProtobufTransformationTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/databinding-protobuf/src/test/resources/addressbook.proto b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/databinding-protobuf/src/test/resources/addressbook.proto deleted file mode 100644 index 395320fb22..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/host-tomcat/LICENSE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/host-tomcat/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/host-tomcat/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/host-tomcat/META-INF/MANIFEST.MF deleted file mode 100644 index cab6b5057e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/host-tomcat/NOTICE b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/host-tomcat/NOTICE deleted file mode 100644 index 25bb89c9b2..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/host-tomcat/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/host-tomcat/pom.xml deleted file mode 100644 index 7110f22db1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-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-Beta2/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/test/resources/content/test.html b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/test/resources/tuscany.keyStore b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/modules/host-tomcat/src/test/resources/tuscany.keyStore +++ /dev/null diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/modules/pom.xml deleted file mode 100644 index 4e43fcb54d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/pom.xml deleted file mode 100644 index 02819c5396..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-Beta2-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-Beta2-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/java/calculator/AddServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/Add.composite b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-add/src/test/java/calculator/AddTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/pom.xml deleted file mode 100644 index 3e2718405c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <version>2.0-Beta2-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-Beta2-SNAPSHOT</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/AddService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/DivideService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/MultiplyService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/java/calculator/SubtractService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/main/resources/Calculator.composite b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/AddServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/contribution-calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/domain/distributed-calculator/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/distributed-calculator/pom.xml deleted file mode 100644 index 33cd76a4b9..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2/unreleased/samples/domain/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/domain/pom.xml deleted file mode 100644 index bf20a0cce1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2/unreleased/samples/implementation-sample-async/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/pom.xml deleted file mode 100644 index c0f6689468..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/pom.xml +++ /dev/null @@ -1,70 +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-Beta2-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
- <artifactId>sample-implementation-async-extension</artifactId>
- <name>Apache Tuscany SCA Sample Implementation Extension With Async</name>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-base-runtime-pom</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.19</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
- </build>
-</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/Java.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/Java.java deleted file mode 100644 index 6c9240005f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/Java.java +++ /dev/null @@ -1,34 +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 sample.api; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -@Target( {TYPE, FIELD}) -@Retention(RUNTIME) -public @interface Java { - - Class<?> value(); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDL.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDL.java deleted file mode 100644 index 655770ec32..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDL.java +++ /dev/null @@ -1,34 +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 sample.api; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -@Target( {TYPE, FIELD}) -@Retention(RUNTIME) -public @interface WSDL { - - String value(); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDLReference.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDLReference.java deleted file mode 100644 index 185383d3b3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/api/WSDLReference.java +++ /dev/null @@ -1,29 +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 sample.api; - -import org.w3c.dom.Element; - -public interface WSDLReference { - - Element call(String op, Element e); - void callAsync(String op, Element e); - -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/EmbedUtil.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/EmbedUtil.java deleted file mode 100644 index 0ccbcc9e36..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/EmbedUtil.java +++ /dev/null @@ -1,311 +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 sample.impl; - -import java.net.URI; -import java.net.URL; -import java.util.Arrays; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -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.Contract; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.contribution.Artifact; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; - -/** - * A few utility functions to help embed a Tuscany runtime, and a simple DSL - * to help assemble and run SCDL. - */ -public class EmbedUtil { - - /** - * A runtime embedder context, which conveniently initializes a Node factory - * and gets the various registries, factories and extension points we need. - */ - static class Context { - final NodeFactory nf; - final ExtensionPointRegistry epr; - final FactoryExtensionPoint fep; - final ContributionFactory cf; - final AssemblyFactory af; - final JavaInterfaceFactory jif; - final WSDLFactory wif; - final URLArtifactProcessorExtensionPoint apep; - final ExtensibleURLArtifactProcessor aproc; - final ModelResolverExtensionPoint mrep; - final ProviderFactoryExtensionPoint pfep; - - Context(final NodeFactory nf) { - this.nf = nf; - epr = nf.getExtensionPointRegistry(); - fep = epr.getExtensionPoint(FactoryExtensionPoint.class); - cf = fep.getFactory(ContributionFactory.class); - af = fep.getFactory(AssemblyFactory.class); - jif = fep.getFactory(JavaInterfaceFactory.class); - wif = fep.getFactory(WSDLFactory.class); - apep = epr.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - aproc = new ExtensibleURLArtifactProcessor(apep); - mrep = epr.getExtensionPoint(ModelResolverExtensionPoint.class); - pfep = epr.getExtensionPoint(ProviderFactoryExtensionPoint.class); - } - } - - static Context embedContext(NodeFactory nf) { - return new Context(nf); - } - - /** - * A mini DSL to help build and assemble contributions and SCDL composites. - */ - interface Builder<T> { - T build(Context ec); - } - - static <T> T build(final Builder<T> builder, final Context ec) { - return builder.build(ec); - } - - /** - * Return a contribution builder. - */ - static Builder<Contribution> contrib(final String uri, final String loc, final Builder<Artifact>... artifacts) { - return new Builder<Contribution>() { - public Contribution build(final Context ec) { - final Contribution c = ec.cf.createContribution(); - c.setURI(uri); - c.setLocation(loc); - c.setModelResolver(new ExtensibleModelResolver(c, ec.mrep, ec.fep)); - for(Builder<Artifact> a: artifacts) - c.getArtifacts().add(a.build(ec)); - return c; - } - }; - } - - /** - * Return an artifact builder. - */ - static Builder<Artifact> artifact(final String uri, final Object model) { - return new Builder<Artifact>() { - public Artifact build(final Context ec) { - final Artifact a = ec.cf.createArtifact(); - a.setURI(uri); - a.setModel(model); - return a; - } - }; - } - - /** - * Return a composite builder. - */ - static Builder<Composite> composite(final String ns, final String name, final Builder<Component>... components) { - return new Builder<Composite>() { - public Composite build(final Context ec) { - final Composite compos = ec.af.createComposite(); - compos.setName(new QName(ns, name)); - for(final Builder<Component> c: components) - compos.getComponents().add(c.build(ec)); - return compos; - } - }; - } - - /** - * Return a component builder. - */ - static Builder<Component> component(final String name, final Builder<Implementation> impl, final Builder<ComponentReference>... references) { - return new Builder<Component>() { - public Component build(final Context ec) { - final Component c = ec.af.createComponent(); - c.setName(name); - c.setImplementation(impl.build(ec)); - for(Builder<ComponentReference> r: references) - c.getReferences().add(r.build(ec)); - return c; - } - }; - } - - /** - * Return an implementation builder. - */ - static Builder<Implementation> implementation(final Class<?> clazz, final Builder<Contract>... contracts) { - return new Builder<Implementation>() { - public SampleImplementation build(final Context ec) { - final SampleImplementation impl = ImplUtil.implementation(clazz.getName()); - impl.clazz = clazz; - impl.setUnresolved(false); - for(final Builder<Contract> b: contracts) { - Contract c = b.build(ec); - if(c instanceof Service) - impl.getServices().add((Service)c); - else - impl.getReferences().add((Reference)c); - } - return impl; - } - }; - } - - /** - * Return a reference builder. - */ - static Builder<Contract> reference(final String name, final Class<?> c) { - return new Builder<Contract>() { - public Reference build(final Context ec) { - try { - return ImplUtil.reference(name, c, ec.jif, ec.af); - } catch(InvalidInterfaceException e) { - throw new RuntimeException(e); - } - } - }; - } - - static Builder<Contract> reference(final String name, final WSDLInterface c) { - return new Builder<Contract>() { - public Reference build(final Context ec) { - return ImplUtil.reference(name, c, ec.wif, ec.af); - } - }; - } - - static Builder<ComponentReference> reference(final String name, final String target) { - return new Builder<ComponentReference>() { - public ComponentReference build(final Context ec) { - final ComponentReference r = ec.af.createComponentReference(); - r.setName(name); - final ComponentService s = ec.af.createComponentService(); - s.setUnresolved(true); - s.setName(target); - r.getTargets().add(s); - return r; - } - }; - } - - /** - * Return a service builder. - */ - static Builder<Contract> service(final Class<?> c) { - return new Builder<Contract>() { - public Service build(final Context ec) { - try { - return ImplUtil.service(c, ec.jif, ec.af); - } catch(InvalidInterfaceException e) { - throw new RuntimeException(e); - } - } - }; - } - - static Builder<Contract> service(final WSDLInterface c) { - return new Builder<Contract>() { - public Service build(final Context ec) { - return ImplUtil.service(c, ec.wif, ec.af); - } - }; - } - - /** - * Return a WSDLInterface builder which loads a WSDL into a contribution. - */ - static Builder<WSDLInterface> wsdli(final String uri, final String ns, final String name, final Contribution c) { - return new Builder<WSDLInterface>() { - public WSDLInterface build(final Context ec) { - try { - final ProcessorContext ctx = new ProcessorContext(); - final WSDLDefinition wd = ec.aproc.read(null, new URI(uri), new URL(new URL(c.getLocation()), uri), ctx, WSDLDefinition.class); - c.getModelResolver().addModel(wd, ctx); - c.getModelResolver().resolveModel(WSDLDefinition.class, wd, ctx); - final WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, new QName(ns, name)); - if(pt == null) - throw new ContributionResolveException("Couldn't find " + name); - final WSDLInterface nwi = ec.wif.createWSDLInterface(pt.getElement(), wd, c.getModelResolver(), null); - nwi.setWsdlDefinition(wd); - nwi.resetDataBinding(DOMDataBinding.NAME); - return nwi; - } catch(Exception e) { - throw new RuntimeException(e); - } - } - }; - } - - /** - * Return the extension point registry used by our nodes. - */ - static ExtensionPointRegistry extensionPoints(final Context ec) { - return ec.epr; - } - - /** - * Return the provider factory extension point used by our nodes. - */ - static ProviderFactoryExtensionPoint providerFactories(final Context ec) { - return ec.pfep; - } - - /** - * Add a deployable composite to a contribution. - */ - static Contribution deploy(final Contribution contrib, final Composite... comps) { - for(Composite c: comps) - contrib.getDeployables().add(c); - return contrib; - } - - /** - * Configure a node with a list of contributions. - */ - static Node node(final NodeFactory nf, final Contribution... contributions) { - return nf.createNode(Arrays.asList(contributions)); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/ImplUtil.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/ImplUtil.java deleted file mode 100644 index abd4cd7ab0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/ImplUtil.java +++ /dev/null @@ -1,148 +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 sample.impl; - -import java.lang.annotation.Annotation; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; - -import sample.api.Java; -import sample.api.WSDL; - -/** - * Utility functions to help develop a component implementation extension. - */ -class ImplUtil { - - /** - * Return a Sample implementation with the given name. - */ - static SampleImplementation implementation(String name) { - final SampleImplementation impl = new SampleImplementation(name); - impl.setUnresolved(true); - return impl; - } - - /** - * Return the Java class configured on an annotation. - */ - static Class<?> clazz(final Annotation a) { - return ((Java)a).value(); - } - - /** - * Return the WSDL QName configured on an annotation. - */ - static QName qname(final Annotation a) { - final String uri = ((WSDL)a).value(); - final int h = uri.indexOf('#'); - return new QName(uri.substring(0, h), uri.substring(h + 1)); - } - - /** - * Convert a Java class to an interface contract. - */ - static JavaInterfaceContract contract(final Class<?> c, final JavaInterfaceFactory jif) throws InvalidInterfaceException { - final JavaInterfaceContract ic = jif.createJavaInterfaceContract(); - ic.setInterface(jif.createJavaInterface(c)); - return ic; - } - - /** - * Convert a WSDL interface to an interface contract. - */ - static WSDLInterfaceContract contract(final WSDLInterface wi, final WSDLFactory wf) { - final WSDLInterfaceContract ic = wf.createWSDLInterfaceContract(); - ic.setInterface(wi); - return ic; - } - - /** - * Convert a Java class to a service. - */ - static Service service(final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException { - Service s = af.createService(); - s.setName(c.getSimpleName()); - s.setInterfaceContract(contract(c, jif)); - return s; - } - - /** - * Convert a WSDL interface to a service. - */ - static Service service(final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) { - Service s = af.createService(); - s.setName(wi.getName().getLocalPart()); - s.setInterfaceContract(contract(wi, wf)); - return s; - } - - /** - * Convert a name and Java class to a reference. - */ - static Reference reference(final String name, final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException { - final Reference r = af.createReference(); - r.setName(name); - r.setInterfaceContract(contract(c, jif)); - return r; - } - - /** - * Convert a name and WSDL interface to a reference. - */ - static Reference reference(final String name, final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) { - final Reference r = af.createReference(); - r.setName(name); - r.setInterfaceContract(contract(wi, wf)); - return r; - } - - /** - * Convert a WSDL qname to a WSDL interface. - */ - static WSDLInterface interfaze(final QName name, final WSDLFactory wif) { - final WSDLInterface wir = wif.createWSDLInterface(); - wir.setUnresolved(true); - wir.setName(name); - return wir; - } - - /** - * Convert a WSDL qname to a WSDL definition. - */ - static WSDLDefinition definition(final QName name, final WSDLFactory wif) { - final WSDLDefinition wdr = wif.createWSDLDefinition(); - wdr.setUnresolved(true); - wdr.setNamespace(name.getNamespaceURI()); - wdr.setNameOfPortTypeToResolve(name); - return wdr; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementation.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementation.java deleted file mode 100644 index 41ce71a732..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementation.java +++ /dev/null @@ -1,41 +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 sample.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - -/** - * Model representing a Sample implementation in an SCA assembly. - * - * @version $Rev$ $Date$ - */ -public class SampleImplementation extends ImplementationImpl { - static final QName QN = new QName(SCA11_TUSCANY_NS, "implementation.sample"); - - final String name; - Class<?> clazz; - - SampleImplementation(final String name) { - super(QN); - this.name = name; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementationProcessor.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementationProcessor.java deleted file mode 100644 index 6017030d35..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleImplementationProcessor.java +++ /dev/null @@ -1,174 +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 sample.impl; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static sample.impl.SampleImplementation.QN; -import static sample.impl.ImplUtil.clazz; -import static sample.impl.ImplUtil.definition; -import static sample.impl.ImplUtil.implementation; -import static sample.impl.ImplUtil.interfaze; -import static sample.impl.ImplUtil.qname; -import static sample.impl.ImplUtil.reference; -import static sample.impl.ImplUtil.service; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; - -import sample.api.Java; -import sample.api.WSDL; - -/** - * StAX artifact processor for Sample implementations. - * - * @version $Rev$ $Date$ - */ -public class SampleImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SampleImplementation> { - final AssemblyFactory af; - final JavaInterfaceFactory jif; - final WSDLFactory wf; - - public SampleImplementationProcessor(final ExtensionPointRegistry ep) { - final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class); - this.af = fep.getFactory(AssemblyFactory.class); - this.jif = fep.getFactory(JavaInterfaceFactory.class); - this.wf = fep.getFactory(WSDLFactory.class); - } - - public QName getArtifactType() { - return QN; - } - - public Class<SampleImplementation> getModelType() { - return SampleImplementation.class; - } - - public SampleImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException { - // Read the component implementation element - final SampleImplementation impl = implementation(r.getAttributeValue(null, "class")); - while(r.hasNext() && !(r.next() == END_ELEMENT && QN.equals(r.getName()))) - ; - return impl; - } - - public void resolve(final SampleImplementation impl, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException { - try { - // Resolve and introspect the implementation class - impl.clazz = resolve(impl.name, res, ctx); - - for(final Annotation a: impl.clazz.getAnnotations()) { - if(a instanceof Java) - impl.getServices().add(service(clazz(a), jif, af)); - else if(a instanceof WSDL) - impl.getServices().add(service(resolve(qname(a), res, ctx, wf), wf, af)); - } - - for(Field f: impl.clazz.getDeclaredFields()) { - for(final Annotation a: f.getAnnotations()) { - if(a instanceof Java) - impl.getReferences().add(reference(f.getName(), clazz(a), jif, af)); - else if(a instanceof WSDL) - impl.getReferences().add(reference(f.getName(), resolve(qname(a), res, ctx, wf), wf, af)); - } - } - - impl.setUnresolved(false); - } catch(InvalidInterfaceException e) { - throw new ContributionResolveException(e); - } - } - - public void write(final SampleImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException { - writeStart(w, QN.getNamespaceURI(), QN.getLocalPart(), new XAttr("class", impl.name)); - writeEnd(w); - } - - /** - * Resolve a Java class. - */ - static Class<?> resolve(final String name, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException { - final ClassReference cr = res.resolveModel(ClassReference.class, new ClassReference(name), ctx); - if(cr.getJavaClass() != null) - return cr.getJavaClass(); - throw new ContributionResolveException(new ClassNotFoundException(name)); - } - - /** - * Resolve a WSDL interface. - */ - static WSDLInterface resolve(final QName name, final ModelResolver res, final ProcessorContext ctx, final WSDLFactory wif) throws ContributionResolveException { - final WSDLInterface wi = res.resolveModel(WSDLInterface.class, interfaze(name, wif), ctx); - if(!wi.isUnresolved()) - return domBound(wi); - - final WSDLDefinition wd = res.resolveModel(WSDLDefinition.class, definition(wi.getName(), wif), ctx); - if(wd.isUnresolved()) - throw new ContributionResolveException("Couldn't find " + name.getNamespaceURI()); - - WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, name); - if(pt == null) - throw new ContributionResolveException("Couldn't find " + name); - try { - final WSDLInterface nwi = wif.createWSDLInterface(pt.getElement(), wd, res, ctx.getMonitor()); - nwi.setWsdlDefinition(wd); - res.addModel(nwi, ctx); - return domBound(nwi); - } catch(InvalidInterfaceException e) { - throw new ContributionResolveException(e); - } - } - - /** - * Return a WSDL interface configured to use a DOM databinding. - */ - static WSDLInterface domBound(WSDLInterface wi) throws ContributionResolveException { - try { - final WSDLInterface domwi = (WSDLInterface)wi.clone(); - domwi.resetDataBinding(DOMDataBinding.NAME); - return domwi; - } catch(CloneNotSupportedException e) { - throw new ContributionResolveException(e); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleJavaInvoker.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleJavaInvoker.java deleted file mode 100644 index 244251c4c9..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleJavaInvoker.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample.impl; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -/** - * Invoker for Sample components that implement a Java interface. - * - * @version $Rev$ $Date$ - */ -class SampleJavaInvoker implements Invoker { - final Object instance; - final Method method; - - SampleJavaInvoker(final JavaOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.instance = instance; - this.method = clazz.getMethod(op.getJavaMethod().getName(), op.getJavaMethod().getParameterTypes()); - } - - public Message invoke(final Message msg) { - try { - // Call the method that implements the operation - msg.setBody(method.invoke(instance, (Object[])msg.getBody())); - } catch(Exception e) { - e.printStackTrace(); - msg.setFaultBody(e.getCause()); - } - return msg; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProvider.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProvider.java deleted file mode 100644 index 5d946b037b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProvider.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 sample.impl; - -import java.lang.reflect.Field; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * Implementation provider for Sample component implementations. - * - * @version $Rev$ $Date$ - */ -class SampleProvider implements ImplementationProvider { - final RuntimeComponent comp; - final SampleImplementation impl; - final ProxyFactory pxf; - Object instance; - - SampleProvider(final RuntimeComponent comp, final SampleImplementation impl, ProxyFactory pf) { - this.comp = comp; - this.impl = impl; - this.pxf = pf; - } - - public void start() { - // Construct implementation instance and inject reference proxies - try { - instance = impl.clazz.newInstance(); - - for(ComponentReference r: comp.getReferences()) { - final Field f = impl.clazz.getDeclaredField(r.getName()); - f.setAccessible(true); - // Inject a Java or WSDLReference proxy - final Interface i = r.getInterfaceContract().getInterface(); - if(i instanceof JavaInterface) - f.set(instance, pxf.createProxy(comp.getComponentContext().getServiceReference(f.getType(), r.getName()))); - else - f.set(instance, new SampleWSDLProxy(r.getEndpointReferences().get(0), i)); - } - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public void stop() { - instance = null; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { - try { - // Creating an invoker for a Java or WSDL-typed implementation - if(op instanceof JavaOperation) - return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance); - return new SampleWSDLInvoker((WSDLOperation)op, impl.clazz, instance); - } catch(Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProviderFactory.java deleted file mode 100644 index 4ad24d33ff..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleProviderFactory.java +++ /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. - */ - -package sample.impl; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Factory for Sample implementation providers. - * - * @version $Rev$ $Date$ - */ -public class SampleProviderFactory implements ImplementationProviderFactory<SampleImplementation> { - final ProxyFactory pxf; - - public SampleProviderFactory(final ExtensionPointRegistry ep) { - pxf = ExtensibleProxyFactory.getInstance(ep); - } - - public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final SampleImplementation impl) { - return new SampleProvider(comp, impl, pxf); - } - - public Class<SampleImplementation> getModelType() { - return SampleImplementation.class; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLInvoker.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLInvoker.java deleted file mode 100644 index 6c5317274f..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLInvoker.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 sample.impl; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.w3c.dom.Element; - -/** - * Invoker for Sample components that implement a WSDL interface using a generic - * call method. - * - * @version $Rev$ $Date$ - */ -class SampleWSDLInvoker implements Invoker { - final String name; - final Object instance; - final Method method; - - SampleWSDLInvoker(final WSDLOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.name = op.getName(); - this.instance = instance; - this.method = clazz.getMethod("call", String.class, Element.class); - } - - public Message invoke(final Message msg) { - try { - // Invoke the generic call method - msg.setBody(method.invoke(instance, name, ((Object[])msg.getBody())[0])); - } catch(Exception e) { - e.printStackTrace(); - msg.setFaultBody(e.getCause()); - } - return msg; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLProxy.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLProxy.java deleted file mode 100644 index 0d000ae071..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sample/impl/SampleWSDLProxy.java +++ /dev/null @@ -1,62 +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 sample.impl; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; -import org.w3c.dom.Element; - -import sample.api.WSDLReference; - -/** - * Proxy used to call operations on WSDL references. - */ -class SampleWSDLProxy implements WSDLReference { - final RuntimeEndpointReference repr; - final Map<String, Operation> ops; - - SampleWSDLProxy(EndpointReference epr, Interface wi) { - repr = (RuntimeEndpointReference)epr; - ops = new HashMap<String, Operation>(); - for(Operation o: wi.getOperations()) - ops.put(o.getName(), o); - } - - @Override - public Element call(String op, Element e) { - try { - // Invoke the named operation on the endpoint reference - return (Element)repr.invoke(ops.get(op), new Object[] {e}); - } catch(InvocationTargetException ex) { - throw new RuntimeException(ex); - } - } - - @Override - public void callAsync(String op, Element e) { - return; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/ImplUtil.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/ImplUtil.java deleted file mode 100644 index c30c784d64..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/ImplUtil.java +++ /dev/null @@ -1,148 +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 sampleasync.impl; - -import java.lang.annotation.Annotation; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; - -import sample.api.Java; -import sample.api.WSDL; - -/** - * Utility functions to help develop a component implementation extension. - */ -class ImplUtil { - - /** - * Return a Sample implementation with the given name. - */ - static SampleAsyncImplementation implementation(String name) { - final SampleAsyncImplementation impl = new SampleAsyncImplementation(name); - impl.setUnresolved(true); - return impl; - } - - /** - * Return the Java class configured on an annotation. - */ - static Class<?> clazz(final Annotation a) { - return ((Java)a).value(); - } - - /** - * Return the WSDL QName configured on an annotation. - */ - static QName qname(final Annotation a) { - final String uri = ((WSDL)a).value(); - final int h = uri.indexOf('#'); - return new QName(uri.substring(0, h), uri.substring(h + 1)); - } - - /** - * Convert a Java class to an interface contract. - */ - static JavaInterfaceContract contract(final Class<?> c, final JavaInterfaceFactory jif) throws InvalidInterfaceException { - final JavaInterfaceContract ic = jif.createJavaInterfaceContract(); - ic.setInterface(jif.createJavaInterface(c)); - return ic; - } - - /** - * Convert a WSDL interface to an interface contract. - */ - static WSDLInterfaceContract contract(final WSDLInterface wi, final WSDLFactory wf) { - final WSDLInterfaceContract ic = wf.createWSDLInterfaceContract(); - ic.setInterface(wi); - return ic; - } - - /** - * Convert a Java class to a service. - */ - static Service service(final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException { - Service s = af.createService(); - s.setName(c.getSimpleName()); - s.setInterfaceContract(contract(c, jif)); - return s; - } - - /** - * Convert a WSDL interface to a service. - */ - static Service service(final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) { - Service s = af.createService(); - s.setName(wi.getName().getLocalPart()); - s.setInterfaceContract(contract(wi, wf)); - return s; - } - - /** - * Convert a name and Java class to a reference. - */ - static Reference reference(final String name, final Class<?> c, final JavaInterfaceFactory jif, final AssemblyFactory af) throws InvalidInterfaceException { - final Reference r = af.createReference(); - r.setName(name); - r.setInterfaceContract(contract(c, jif)); - return r; - } - - /** - * Convert a name and WSDL interface to a reference. - */ - static Reference reference(final String name, final WSDLInterface wi, final WSDLFactory wf, final AssemblyFactory af) { - final Reference r = af.createReference(); - r.setName(name); - r.setInterfaceContract(contract(wi, wf)); - return r; - } - - /** - * Convert a WSDL qname to a WSDL interface. - */ - static WSDLInterface interfaze(final QName name, final WSDLFactory wif) { - final WSDLInterface wir = wif.createWSDLInterface(); - wir.setUnresolved(true); - wir.setName(name); - return wir; - } - - /** - * Convert a WSDL qname to a WSDL definition. - */ - static WSDLDefinition definition(final QName name, final WSDLFactory wif) { - final WSDLDefinition wdr = wif.createWSDLDefinition(); - wdr.setUnresolved(true); - wdr.setNamespace(name.getNamespaceURI()); - wdr.setNameOfPortTypeToResolve(name); - return wdr; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementation.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementation.java deleted file mode 100644 index e0abd72b84..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementation.java +++ /dev/null @@ -1,41 +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 sampleasync.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - -/** - * Model representing a Sample implementation in an SCA assembly. - * - * @version $Rev$ $Date$ - */ -public class SampleAsyncImplementation extends ImplementationImpl { - static final QName QN = new QName(SCA11_TUSCANY_NS, "implementation.sampleasync"); - - final String name; - Class<?> clazz; - - SampleAsyncImplementation(final String name) { - super(QN); - this.name = name; - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementationProcessor.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementationProcessor.java deleted file mode 100644 index 03fe3da178..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncImplementationProcessor.java +++ /dev/null @@ -1,174 +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 sampleasync.impl; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static sampleasync.impl.SampleAsyncImplementation.QN; -import static sampleasync.impl.ImplUtil.clazz; -import static sampleasync.impl.ImplUtil.definition; -import static sampleasync.impl.ImplUtil.implementation; -import static sampleasync.impl.ImplUtil.interfaze; -import static sampleasync.impl.ImplUtil.qname; -import static sampleasync.impl.ImplUtil.reference; -import static sampleasync.impl.ImplUtil.service; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; - -import sample.api.Java; -import sample.api.WSDL; - -/** - * StAX artifact processor for Sample implementations. - * - * @version $Rev$ $Date$ - */ -public class SampleAsyncImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SampleAsyncImplementation> { - final AssemblyFactory af; - final JavaInterfaceFactory jif; - final WSDLFactory wf; - - public SampleAsyncImplementationProcessor(final ExtensionPointRegistry ep) { - final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class); - this.af = fep.getFactory(AssemblyFactory.class); - this.jif = fep.getFactory(JavaInterfaceFactory.class); - this.wf = fep.getFactory(WSDLFactory.class); - } - - public QName getArtifactType() { - return QN; - } - - public Class<SampleAsyncImplementation> getModelType() { - return SampleAsyncImplementation.class; - } - - public SampleAsyncImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException { - // Read the component implementation element - final SampleAsyncImplementation impl = implementation(r.getAttributeValue(null, "class")); - while(r.hasNext() && !(r.next() == END_ELEMENT && QN.equals(r.getName()))) - ; - return impl; - } - - public void resolve(final SampleAsyncImplementation impl, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException { - try { - // Resolve and introspect the implementation class - impl.clazz = resolve(impl.name, res, ctx); - - for(final Annotation a: impl.clazz.getAnnotations()) { - if(a instanceof Java) - impl.getServices().add(service(clazz(a), jif, af)); - else if(a instanceof WSDL) - impl.getServices().add(service(resolve(qname(a), res, ctx, wf), wf, af)); - } - - for(Field f: impl.clazz.getDeclaredFields()) { - for(final Annotation a: f.getAnnotations()) { - if(a instanceof Java) - impl.getReferences().add(reference(f.getName(), clazz(a), jif, af)); - else if(a instanceof WSDL) - impl.getReferences().add(reference(f.getName(), resolve(qname(a), res, ctx, wf), wf, af)); - } - } - - impl.setUnresolved(false); - } catch(InvalidInterfaceException e) { - throw new ContributionResolveException(e); - } - } - - public void write(final SampleAsyncImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException { - writeStart(w, QN.getNamespaceURI(), QN.getLocalPart(), new XAttr("class", impl.name)); - writeEnd(w); - } - - /** - * Resolve a Java class. - */ - static Class<?> resolve(final String name, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException { - final ClassReference cr = res.resolveModel(ClassReference.class, new ClassReference(name), ctx); - if(cr.getJavaClass() != null) - return cr.getJavaClass(); - throw new ContributionResolveException(new ClassNotFoundException(name)); - } - - /** - * Resolve a WSDL interface. - */ - static WSDLInterface resolve(final QName name, final ModelResolver res, final ProcessorContext ctx, final WSDLFactory wif) throws ContributionResolveException { - final WSDLInterface wi = res.resolveModel(WSDLInterface.class, interfaze(name, wif), ctx); - if(!wi.isUnresolved()) - return domBound(wi); - - final WSDLDefinition wd = res.resolveModel(WSDLDefinition.class, definition(wi.getName(), wif), ctx); - if(wd.isUnresolved()) - throw new ContributionResolveException("Couldn't find " + name.getNamespaceURI()); - - WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, name); - if(pt == null) - throw new ContributionResolveException("Couldn't find " + name); - try { - final WSDLInterface nwi = wif.createWSDLInterface(pt.getElement(), wd, res, ctx.getMonitor()); - nwi.setWsdlDefinition(wd); - res.addModel(nwi, ctx); - return domBound(nwi); - } catch(InvalidInterfaceException e) { - throw new ContributionResolveException(e); - } - } - - /** - * Return a WSDL interface configured to use a DOM databinding. - */ - static WSDLInterface domBound(WSDLInterface wi) throws ContributionResolveException { - try { - final WSDLInterface domwi = (WSDLInterface)wi.clone(); - domwi.resetDataBinding(DOMDataBinding.NAME); - return domwi; - } catch(CloneNotSupportedException e) { - throw new ContributionResolveException(e); - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.java deleted file mode 100644 index 10eb78f6c8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProvider.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 sampleasync.impl; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; -import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; -import org.apache.tuscany.sca.provider.ImplementationAsyncProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * Implementation provider for Sample component implementations. - * - * @version $Rev$ $Date$ - */ -class SampleAsyncProvider implements ImplementationAsyncProvider { - final RuntimeComponent comp; - final SampleAsyncImplementation impl; - final ProxyFactory pxf; - final ExtensionPointRegistry ep; - Object instance; - Map<String, Object> asyncMessageMap = new HashMap<String, Object>(); - - SampleAsyncProvider(final RuntimeComponent comp, final SampleAsyncImplementation impl, ProxyFactory pf, ExtensionPointRegistry ep) { - this.comp = comp; - this.impl = impl; - this.pxf = pf; - this.ep = ep; - } - - public void start() { - // Construct implementation instance and inject reference proxies - try { - instance = impl.clazz.newInstance(); - - for(ComponentReference r: comp.getReferences()) { - final Field f = impl.clazz.getDeclaredField(r.getName()); - f.setAccessible(true); - // Inject a Java or WSDLReference proxy - final Interface i = r.getInterfaceContract().getInterface(); - if(i instanceof JavaInterface) - f.set(instance, pxf.createProxy(comp.getComponentContext().getServiceReference(f.getType(), r.getName()))); - else - f.set(instance, new SampleWSDLProxy(asyncMessageMap, r.getEndpointReferences().get(0), i, ep)); - } - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public void stop() { - instance = null; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { - return (Invoker)createAsyncInvoker(s, op); - } - - public InvokerAsyncRequest createAsyncInvoker(final RuntimeComponentService s, final Operation op) { - try { - // Creating an invoker for a Java or WSDL-typed implementation - if(op instanceof JavaOperation) - return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance); - return new SampleWSDLInvoker((WSDLOperation)op, impl.clazz, instance); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public InvokerAsyncResponse createAsyncResponseInvoker(Operation operation) { - return new SampleAsyncResponseInvoker(asyncMessageMap, operation, impl.clazz, instance); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProviderFactory.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProviderFactory.java deleted file mode 100644 index 2170313eec..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncProviderFactory.java +++ /dev/null @@ -1,50 +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 sampleasync.impl; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Factory for Sample implementation providers. - * - * @version $Rev$ $Date$ - */ -public class SampleAsyncProviderFactory implements ImplementationProviderFactory<SampleAsyncImplementation> { - final ProxyFactory pxf; - final ExtensionPointRegistry ep; - - public SampleAsyncProviderFactory(final ExtensionPointRegistry ep) { - this.ep = ep; - pxf = ExtensibleProxyFactory.getInstance(ep); - } - - public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final SampleAsyncImplementation impl) { - return new SampleAsyncProvider(comp, impl, pxf, ep); - } - - public Class<SampleAsyncImplementation> getModelType() { - return SampleAsyncImplementation.class; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.java deleted file mode 100644 index 2a7ad3f5bc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleAsyncResponseInvoker.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 sampleasync.impl; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.tuscany.sca.core.invocation.Constants; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; -import org.apache.tuscany.sca.invocation.Message; -import org.w3c.dom.Element; - -/** - * Invoker for Sample components that implement a WSDL interface using a generic - * call method. - * - * @version $Rev$ $Date$ - */ -class SampleAsyncResponseInvoker implements InvokerAsyncResponse { - final String name; - final Object instance; - final Operation op; - Map<String, Object> asyncMessageMap; - - SampleAsyncResponseInvoker(Map<String, Object> asyncMessageMap, final Operation op, final Class<?> clazz, final Object instance) { - this.asyncMessageMap = asyncMessageMap; - this.name = op.getName(); - this.instance = instance; - this.op = op; - } - - public void invokeAsyncResponse(final Message msg) { - try { - String messageID = (String) msg.getHeaders().get(Constants.MESSAGE_ID); - String forwardOpName = (String)asyncMessageMap.get(messageID); - - // process the async response - //Object response = ((Object[])msg.getBody())[0]; - Object response = msg.getBody(); - - Method method = instance.getClass().getMethod(forwardOpName + "Callback", Element.class); - method.invoke(instance, response); - } catch(Exception e) { - e.printStackTrace(); - // TODO - need to throw this to somewhere? - } - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.java deleted file mode 100644 index 063fe166eb..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleJavaInvoker.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 sampleasync.impl; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.InvokerAsyncRequest; -import org.apache.tuscany.sca.invocation.InvokerAsyncResponse; -import org.apache.tuscany.sca.invocation.Message; - -/** - * Invoker for Sample components that implement a Java interface. - * - * @version $Rev$ $Date$ - */ -class SampleJavaInvoker implements Invoker, InvokerAsyncRequest { - final Object instance; - final Method method; - - SampleJavaInvoker(final JavaOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.instance = instance; - this.method = clazz.getMethod(op.getJavaMethod().getName(), op.getJavaMethod().getParameterTypes()); - } - - public Message invoke(final Message msg) { - return processRequest(msg); - } - - public void invokeAsyncRequest(Message msg) { - processRequest(msg); - // TODO - need to do something about exceptions - } - - public Message processRequest(Message msg) { - try { - // Call the method that implements the operation - msg.setBody(method.invoke(instance, (Object[])msg.getBody())); - } catch(Exception e) { - e.printStackTrace(); - msg.setFaultBody(e.getCause()); - } - return msg; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java deleted file mode 100644 index 26412ab281..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLInvoker.java +++ /dev/null @@ -1,88 +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 sampleasync.impl; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.w3c.dom.Element; - -/** - * Invoker for Sample components that implement a WSDL interface using a generic - * call method. - * - * @version $Rev$ $Date$ - */ -class SampleWSDLInvoker extends InterceptorAsyncImpl { - final String name; - final Object instance; - final Method method; - - SampleWSDLInvoker(final WSDLOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.name = op.getName(); - this.instance = instance; - this.method = clazz.getMethod("call", String.class, Element.class); - } - - public Invoker getNext() { - // Can't get next for an implementation invoker - return null; - } - - public Message invoke(final Message msg) { - return processRequest(msg); - } - - public void invokeAsyncRequest(Message msg) { - Message responseMsg = processRequest(msg); - - // in this sample programming model we make the async - // response from the implementation provider. The - // component implementation itself doesn't get a chance to - // do async responses. - - // At this point we could serialize the ??? and pick it up again - // later to send the async response - - ((RuntimeEndpoint)msg.getTo()).invokeAsyncResponse(responseMsg); - } - - public Message processRequest(Message msg) { - try { - //AsyncHeader asyncHeader = (String) message.getHeaders().get("ASYNC-HEADER"); - // Invoke the generic call method - Object response = method.invoke(instance, name, ((Object[])msg.getBody())[0]); - msg.setBody(response); - } catch(Exception e) { - e.printStackTrace(); - msg.setFaultBody(e.getCause()); - } - return msg; - } - - public Message processResponse(Message msg) { - return msg; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java deleted file mode 100644 index a02132ac9e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java +++ /dev/null @@ -1,98 +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 sampleasync.impl; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.Constants; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; -import org.w3c.dom.Element; - -import sample.api.WSDLReference; - -/** - * Proxy used to call operations on WSDL references. - */ -class SampleWSDLProxy implements WSDLReference { - final RuntimeEndpointReference repr; - final Map<String, Operation> ops; - final ExtensionPointRegistry ep; - final MessageFactory mf; - Map<String, Object> asyncMessageMap; - - SampleWSDLProxy(Map<String, Object> asyncMessageMap, EndpointReference epr, Interface wi, ExtensionPointRegistry ep) { - this.asyncMessageMap = asyncMessageMap; - this.ep = ep; - mf = ep.getExtensionPoint(MessageFactory.class); - - repr = (RuntimeEndpointReference)epr; - ops = new HashMap<String, Operation>(); - for(Operation o: wi.getOperations()) - ops.put(o.getName(), o); - } - - @Override - public Element call(String op, Element e) { - try { - // Invoke the named operation on the endpoint reference - return (Element)repr.invoke(ops.get(op), new Object[] {e}); - } catch(InvocationTargetException ex) { - throw new RuntimeException(ex); - } - } - - @Override - public void callAsync(String op, Element e) { - // Asynchronously invoke the named operation on the endpoint reference - Message message = mf.createMessage(); - message.setBody(new Object[]{e}); - - // We could MESSAGE_ID here if required. If not the infrastructure - // will generate a UUID - String messageID = "myuniqueid"; - message.getHeaders().put(Constants.MESSAGE_ID, messageID); - - // save the message id ready for when we process the response - asyncMessageMap.put(messageID, op); - - // We could add implementation specific headers here if required - //message.getHeaders().put(Constants.???, ???); - - try { - repr.invokeAsync(ops.get(op), message); - } catch (Throwable ex) { - ex.printStackTrace(); - } - - // if we don't provide a message id we can get the one the - // infrastructure generates - //String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); - //asyncMessageMap.put(messageID, op); - - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 00d0306d92..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,21 +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 -sample.impl.SampleImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementation.sample,model=sample.impl.SampleImplementation -sampleasync.impl.SampleAsyncImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementation.sampleasync,model=sampleasync.impl.SampleAsyncImplementation - diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema deleted file mode 100644 index 42e61c9d89..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ /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.
-#
-sample/impl/sample.xsd
-sampleasync/impl/sampleasync.xsd
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index 4eeecb7ba2..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,21 +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 provider for Sample components
-sample.impl.SampleProviderFactory;model=sample.impl.SampleImplementation
-sampleasync.impl.SampleAsyncProviderFactory;model=sampleasync.impl.SampleAsyncImplementation
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sample/impl/sample.xsd b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sample/impl/sample.xsd deleted file mode 100644 index c057aef1c1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sample/impl/sample.xsd +++ /dev/null @@ -1,38 +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. ---> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1" - xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" - elementFormDefault="qualified"> - - <import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"/> - - <element name="implementation.sample" type="t:SampleImplementation" substitutionGroup="sca:implementation"/> - - <complexType name="SampleImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <attribute name="class" type="string" use="required"/> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/definitions.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/definitions.xml deleted file mode 100644 index 96a1a6f574..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/definitions.xml +++ /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.
--->
-
-<!-- $Rev: 889531 $ $Date: 2009-12-11 08:26:48 +0000 (Fri, 11 Dec 2009) $ -->
-
-<sca:definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
-
- <sca:implementationType type="tuscany:implementation.sampleasync" mayProvide="sca:asyncInvocation" alwaysProvides=""/>
-
- </sca:definitions>
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/sampleasync.xsd b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/sampleasync.xsd deleted file mode 100644 index ff70fd6020..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/main/resources/sampleasync/impl/sampleasync.xsd +++ /dev/null @@ -1,38 +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. ---> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1" - xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" - elementFormDefault="qualified"> - - <import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"/> - - <element name="implementation.sampleasync" type="t:SampleAsyncImplementation" substitutionGroup="sca:implementation"/> - - <complexType name="SampleAsyncImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <attribute name="class" type="string" use="required"/> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Client.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Client.java deleted file mode 100644 index 1b7e11c786..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Client.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 sample; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Client { - - String jello(String s); - - String wello(String s); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/ClientTest.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/ClientTest.java deleted file mode 100644 index 92291c98a1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/ClientTest.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 sample; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.elems; -import static sample.Xutil.print; -import static sample.Xutil.select; -import static sample.Xutil.text; -import static sample.Xutil.xdom; -import static sample.Xutil.xfilter; -import static sample.Xutil.xreduce; - -import org.w3c.dom.Element; - -import sample.api.Java; -import sample.api.WSDL; -import sample.api.WSDLReference; - -/** - * Sample component implementation that uses a mix of Java and WSDL interfaces. - * - * @version $Rev$ $Date$ - */ -@Java(Client.class) -public class ClientTest { - - @Java(Hello.class) - Hello jello; - - @WSDL("http://sample/hello#Hello") - WSDLReference wello; - - public String jello(String s) { - out.println("ClientTest.jello(" + s + ")"); - return jello.hello(s); - } - - public String wello(String s) { - out.println("ClientTest.wello(" + s + ")"); - final Element hreq = xdom("http://sample/hello", "hello", elem("name", text(s))); - - final Element hres = wello.call("hello", hreq); - - return xreduce(print, "", xfilter(select("result"), elems(hres))); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Hello.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Hello.java deleted file mode 100644 index 247fc8aa78..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Hello.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 sample; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Hello { - - String hello(String s); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/JelloTest.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/JelloTest.java deleted file mode 100644 index 5c999a6c80..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/JelloTest.java +++ /dev/null @@ -1,40 +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 sample; - -import static java.lang.System.out; -import sample.api.Java; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@Java(Hello.class) -public class JelloTest { - - @Java(Upper.class) - Upper upper; - - public String hello(String s) { - out.println("JelloTest.hello(" + s + ")"); - return upper.upper("Hello " + s); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Upper.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Upper.java deleted file mode 100644 index 9c772b3487..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Upper.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 sample; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Upper { - - String upper(String s); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/UpperTest.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/UpperTest.java deleted file mode 100644 index 5399e4410d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/UpperTest.java +++ /dev/null @@ -1,37 +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 sample; - -import static java.lang.System.out; -import sample.api.Java; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@Java(Upper.class) -public class UpperTest { - - public String upper(String s) { - out.println("UpperTest.upper(" + s + ")"); - return s.toUpperCase(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/WelloTest.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/WelloTest.java deleted file mode 100644 index 1bb9fc11ce..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/WelloTest.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 sample; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.elems; -import static sample.Xutil.print; -import static sample.Xutil.select; -import static sample.Xutil.text; -import static sample.Xutil.xdom; -import static sample.Xutil.xfilter; -import static sample.Xutil.xml; -import static sample.Xutil.xreduce; - -import org.w3c.dom.Element; - -import sample.api.WSDL; -import sample.api.WSDLReference; - -/** - * Sample component implementation that uses WSDL interfaces. - * - * @version $Rev$ $Date$ - */ -@WSDL("http://sample/hello#Hello") -public class WelloTest { - - @WSDL("http://sample/upper#Upper") - WSDLReference upper; - - public Element call(String op, Element e) { - out.println("WelloTest." + op + "(" + xml(e) + ")"); - final String name = xreduce(print, "", xfilter(select("name"), elems(e))); - - final Element ureq = xdom("http://sample/upper", "upper", elem("s", text("Hello " + name))); - final Element ures = upper.call("upper", ureq); - - final String s = xreduce(print, "", xfilter(select("result"), elems(ures))); - return xdom("http://sample/hello", "helloResponse", elem("result", text(s))); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java deleted file mode 100644 index 264ce7fc85..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/Xutil.java +++ /dev/null @@ -1,225 +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 sample; - -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Just for fun, a little bit of magic code and utility functions to help work with XML DOM. - */ -public class Xutil { - public interface NodeBuilder { - Node build(Document doc); - } - - /** - * Convert a name and a list of children to a document element. - */ - public static Element xdom(String ns, String name, final NodeBuilder... nodes) { - return (Element)elem(ns, name, nodes).build(db.newDocument()); - } - - /** - * Convert a name and children to an element. - */ - public static NodeBuilder elem(final String uri, final String n, final NodeBuilder... nodes) { - return new NodeBuilder() { - public Node build(Document doc) { - final Element e = doc.createElementNS(uri, n); - for(final NodeBuilder n: nodes) - e.appendChild(n.build(doc)); - return e; - } - }; - } - - public static NodeBuilder elem(final String n, final NodeBuilder... nodes) { - return elem(null, n, nodes); - } - - /** - * Convert a string to a text element. - */ - public static NodeBuilder text(final String t) { - return new NodeBuilder() { - public Node build(final Document doc) { - return doc.createTextNode(t); - } - }; - } - - private final static DocumentBuilder db = db(); - - private static DocumentBuilder db() { - try { - return DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } catch(ParserConfigurationException e) { - throw new RuntimeException(e); - } - } - - /** - * Convert an element to XML. - */ - static TransformerFactory trf = TransformerFactory.newInstance(); - - public static String xml(final Node node) { - try { - final StreamResult r = new StreamResult(new StringWriter()); - trf.newTransformer().transform(new DOMSource(node), r); - return r.getWriter().toString(); - } catch(TransformerException e) { - throw new RuntimeException(e); - } - } - - /** - * Evaluate an xpath expression. - */ - private static XPathFactory xpf = XPathFactory.newInstance(); - - public static String xpath(final String expr, final Node node) { - final XPath xp = xpf.newXPath(); - try { - return (String)xp.evaluate(expr, node, XPathConstants.STRING); - } catch(XPathExpressionException e) { - throw new RuntimeException(e); - } - } - - /** - * A pure Java FP-style alternative to xpath for DOM. - */ - interface Mapper<T> { - T map(final Element e); - } - - static Mapper<Element> identity = new Mapper<Element>() { - public Element map(Element e) { - return e; - }; - }; - - interface Reducer<T> { - T reduce(final T accum, final Element e); - } - - public static Reducer<String> print = new Reducer<String>() { - public String reduce(String accum, Element e) { - return accum + e.getTextContent(); - } - }; - - /** - * Apply a mapper to a list of elements. - */ - public static <T> List<T> xmap(final Mapper<T> f, final Iterable<Element> l) { - final List<T> v = new ArrayList<T>(); - for(Element e: l) - v.add(f.map(e)); - return v; - } - - /** - * Apply a filter to a list of elements. - */ - public static List<Element> xfilter(final Mapper<Boolean> f, final Iterable<Element> l) { - final List<Element> v = new ArrayList<Element>(); - for(Element e: l) - if(f.map(e)) - v.add(e); - return v; - } - - /** - * Perform a reduction over a list of elements. - */ - public static <T> T xreduce(final Reducer<T> f, final T initial, final Iterable<Element> l) { - T accum = initial; - for(Element e: l) - accum = f.reduce(accum, e); - return accum; - } - - /** - * Return a filter that selects elements by name. - */ - public static Mapper<Boolean> select(final String name) { - return new Mapper<Boolean>() { - public Boolean map(Element e) { - return name.equals(e.getLocalName()); - } - }; - } - - /** - * Return the child elements of a node. - */ - public static Iterable<Element> elems(final Node parent) { - final List<Element> l = new ArrayList<Element>(); - for (Node n: children(parent)) - if (n instanceof Element) - l.add((Element)n); - return l; - } - - /** - * An iterable over the children of a node. - */ - private static Iterable<Node> children(Node parent) { - final NodeList l = parent.getChildNodes(); - final int n = l.getLength(); - return new Iterable<Node>() { - public Iterator<Node> iterator() { - return new Iterator<Node>() { - int i = 0; - public boolean hasNext() { - return i < n; - } - public Node next() { - return l.item(i++); - } - public void remove() { - } - }; - } - }; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/EmbedTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/EmbedTestCase.java deleted file mode 100644 index 292aa9c8f7..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/EmbedTestCase.java +++ /dev/null @@ -1,153 +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 sample.impl; - -import static java.lang.System.out; -import static org.junit.Assert.assertEquals; -import static sample.impl.EmbedUtil.build; -import static sample.impl.EmbedUtil.component; -import static sample.impl.EmbedUtil.composite; -import static sample.impl.EmbedUtil.contrib; -import static sample.impl.EmbedUtil.deploy; -import static sample.impl.EmbedUtil.embedContext; -import static sample.impl.EmbedUtil.extensionPoints; -import static sample.impl.EmbedUtil.implementation; -import static sample.impl.EmbedUtil.node; -import static sample.impl.EmbedUtil.providerFactories; -import static sample.impl.EmbedUtil.reference; -import static sample.impl.EmbedUtil.service; -import static sample.impl.EmbedUtil.wsdli; -import static sample.impl.TestUtil.here; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -import sample.Client; -import sample.ClientTest; -import sample.Hello; -import sample.JelloTest; -import sample.Upper; -import sample.UpperTest; -import sample.WelloTest; - -/** - * Test how to assemble a contribution, a SCDL composite and run it on an embedded - * Tuscany runtime node. Also shows how pass in a ProviderFactory instead of having - * it loaded and constructed by the runtime node. - * - * @version $Rev$ $Date$ - */ -@Ignore -public class EmbedTestCase { - static NodeFactory nf; - static EmbedUtil.Context ec; - static Node node; - - @SuppressWarnings("unchecked") - @BeforeClass - public static void setUp() throws Exception { - nf = NodeFactory.newInstance(); - ec = embedContext(nf); - - // Load the test WSDL definitions (could also construct the WSDL - // and XSD models in code but that'd be quite painful, so just - // load them from XML for now) - final Contribution contrib = build(contrib("test", here()), ec); - WSDLInterface Hello_wsdl = build(wsdli("Hello.wsdl", "http://sample/hello", "Hello", contrib), ec); - WSDLInterface Upper_wsdl = build(wsdli("Upper.wsdl", "http://sample/upper", "Upper", contrib), ec); - - // Assemble a test composite model (see EmbedUtil - // for the little DSL used here, much more concise - // than using the assembly model interfaces) - final Composite comp = - build(composite("http://sample", "test", - component("client-test", - implementation(ClientTest.class, - service(Client.class), - reference("jello", Hello.class), - reference("wello", Hello_wsdl)), - reference("jello", "jello-test"), - reference("wello", "wello-test")), - component("wello-test", - implementation(WelloTest.class, - service(Hello_wsdl), - reference("upper", Upper_wsdl)), - reference("upper", "upper-test")), - component("jello-test", - implementation(JelloTest.class, - service(Hello.class), - reference("upper", Upper.class)), - reference("upper", "upper-test")), - component("upper-test", - implementation(UpperTest.class, - service(Upper.class)))), ec); - - // Register a test instance of our sample implementation ProviderFactory - providerFactories(ec).addProviderFactory(testProviderFactory()); - - // Run with it - node = node(nf, deploy(contrib, comp)); - node.start(); - } - - static ProviderFactory<SampleImplementation> testProviderFactory() { - // This shows how to get called when a provider is created - return new SampleProviderFactory(extensionPoints(ec)) { - public ImplementationProvider createImplementationProvider(RuntimeComponent comp, SampleImplementation impl) { - out.println("Creating a provider for component " + comp.getName()); - return super.createImplementationProvider(comp, impl); - }}; - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - @Test - public void jello() { - out.println("RunTestCase.jello"); - final String r = client().jello("Java"); - out.println(r); - assertEquals("HELLO JAVA", r); - } - - @Test - public void wello() { - out.println("RunTestCase.wello"); - final String r = client().wello("WSDL"); - out.println(r); - assertEquals("HELLO WSDL", r); - } - - static Client client() { - return node.getService(Client.class, "client-test/Client"); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/ReadWriteTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/ReadWriteTestCase.java deleted file mode 100644 index 115ceff069..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/ReadWriteTestCase.java +++ /dev/null @@ -1,86 +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 sample.impl; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static sample.impl.TestUtil.here; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.DefaultContributionFactory; -import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; -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.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Test read/write Sample SCDL implementation elements. - * - * @version $Rev$ $Date$ - */ -@Ignore -public class ReadWriteTestCase { - static XMLInputFactory xif; - static XMLOutputFactory xof; - static StAXArtifactProcessor<Object> xproc; - static ProcessorContext ctx; - - @BeforeClass - public static void setUp() throws Exception { - final DefaultExtensionPointRegistry ep = new DefaultExtensionPointRegistry(); - final Contribution contrib = new DefaultContributionFactory().createContribution(); - contrib.setLocation(here()); - ctx = new ProcessorContext(contrib, null); - xif = XMLInputFactory.newInstance(); - xof = XMLOutputFactory.newInstance(); - final StAXArtifactProcessorExtensionPoint xpep = new DefaultStAXArtifactProcessorExtensionPoint(ep); - xproc = new ExtensibleStAXArtifactProcessor(xpep, xif, xof); - } - - @Test - public void testRead() throws Exception { - final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite"); - final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx); - assertNotNull(c); - assertEquals("sample.ClientTest", ((SampleImplementation)c.getComponents().get(0).getImplementation()).name); - } - - @Test - public void testReadWrite() throws Exception { - final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite"); - final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx); - final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - xproc.write(c, xof.createXMLStreamWriter(bos), ctx); - assertTrue(bos.toString().contains("class=\"sample.WelloTest\"")); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunTestCase.java deleted file mode 100644 index 38cc558c14..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunTestCase.java +++ /dev/null @@ -1,77 +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 sample.impl; - -import static java.lang.System.out; -import static org.junit.Assert.assertEquals; -import static sample.impl.TestUtil.here; - -import org.apache.tuscany.sca.node.Contribution; -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; - -import sample.Client; - -/** - * Test how to run an SCA contribution containing a test composite on a - * Tuscany runtime node. - * - * @version $Rev$ $Date$ - */ -@Ignore -public class RunTestCase { - static Node node; - - @BeforeClass - public static void setUp() throws Exception { - final NodeFactory nf = NodeFactory.newInstance(); - node = nf.createNode(new Contribution("test", here())); - node.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - @Test - public void jello() { - out.println("RunTestCase.jello"); - final String r = client().jello("Java"); - out.println(r); - assertEquals("HELLO JAVA", r); - } - - @Test - public void wello() { - out.println("RunTestCase.wello"); - final String r = client().wello("WSDL"); - out.println(r); - assertEquals("HELLO WSDL", r); - } - - static Client client() { - return node.getService(Client.class, "client-test/Client"); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunWSTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunWSTestCase.java deleted file mode 100644 index 9eef998655..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/RunWSTestCase.java +++ /dev/null @@ -1,122 +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 sample.impl; - -import static java.lang.System.out; -import static org.junit.Assert.assertTrue; -import static sample.impl.TestUtil.here; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.net.Socket; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.http.jetty.JettyServer; -import org.apache.tuscany.sca.node.Contribution; -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; - -/** - * Test a component that provides and consumes SOAP Web services. - * - * @version $Rev$ $Date$ - */ -@Ignore -public class RunWSTestCase { - static Node node; - static JettyServer jetty; - - @BeforeClass - public static void setUp() throws Exception { - // Start test composite on a Tuscany node - final NodeFactory nf = NodeFactory.newInstance(); - node = nf.createNode(new Contribution("test", here())); - node.start(); - - // Mock up a test Web service on http://localhost:8086/wsupper - jetty = new JettyServer((ExtensionPointRegistry)nf.getExtensionPointRegistry()); - jetty.start(); - jetty.addServletMapping("http://localhost:8086/wsupper", new HttpServlet() { - private static final long serialVersionUID = 1L; - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - assertTrue(read(req.getInputStream()).contains("Hello SOAP")); - final String soapresp = - "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + - "<soapenv:Body><upperResponse xmlns=\"http://sample/upper\">" + - "<result xmlns=\"\">HELLO SOAP</result>" + - "</upperResponse></soapenv:Body></soapenv:Envelope>"; - - write(soapresp, resp.getOutputStream()); - } - }); - } - - @AfterClass - public static void tearDown() throws Exception { - jetty.stop(); - node.stop(); - } - - @Test - public void wsello() throws Exception { - out.println("RunWSTestCase.wsello"); - // Send a SOAP request to the Web service provided by SCA component wsello-test - // on http://localhost:8085/wsello - final Socket s = new Socket("localhost", 8085); - final String soapreq = - "POST /wsello HTTP/1.0\r\n" + - "Content-Type: text/xml; charset=UTF-8\r\n" + - "Content-length: 231\r\n\r\n" + - "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + - "<soapenv:Body><hello xmlns=\"http://sample/hello\">" + - "<name xmlns=\"\">SOAP</name>" + - "</hello></soapenv:Body></soapenv:Envelope>"; - write(soapreq, s.getOutputStream()); - assertTrue(read(s.getInputStream()).contains("HELLO SOAP")); - } - - static void write(final String s, final OutputStream o) throws IOException { - final OutputStreamWriter w = new OutputStreamWriter(o); - w.write(s); - w.flush(); - } - - static String read(final InputStream i) throws IOException { - return read(new BufferedReader(new InputStreamReader(i))); - } - - static String read(final BufferedReader r) throws IOException { - final String s = r.readLine(); - return s == null? "" : s + read(r); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/TestUtil.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/TestUtil.java deleted file mode 100644 index 6dcfb33912..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sample/impl/TestUtil.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 sample.impl; - -/** - * A hack to determine the test contribution location. - */ -public class TestUtil { - - static String here() { - return TestUtil.class.getProtectionDomain().getCodeSource().getLocation().toString(); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/Upper.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/Upper.java deleted file mode 100644 index 0c29cea1dc..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/Upper.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 sampleasync; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Upper { - - String upper(String s); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncReference.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncReference.java deleted file mode 100644 index ad2e62f85d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncReference.java +++ /dev/null @@ -1,47 +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 sampleasync; - -import java.util.concurrent.Future; - -import javax.xml.ws.AsyncHandler; -import javax.xml.ws.Response; - -import org.oasisopen.sca.annotation.AsyncInvocation; -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -@AsyncInvocation -public interface UpperAsyncReference { - - // Sync - String upper(String s); - - // Aysnc Poll - public Response<String> upperAsync(String s); - - // Async Callback - public Future<String> upperAsync(String s, AsyncHandler<String> handler); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncService.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncService.java deleted file mode 100644 index cb4a1c0b42..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/UpperAsyncService.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 sampleasync; - -import org.oasisopen.sca.ResponseDispatch; -import org.oasisopen.sca.annotation.AsyncInvocation; -import org.oasisopen.sca.annotation.Remotable; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -@Remotable -@AsyncInvocation -public interface UpperAsyncService { - - void upperAsync(String s,ResponseDispatch<String> response); -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java deleted file mode 100644 index 36fdb76424..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.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 sampleasync.impl; - -import static org.junit.Assert.assertEquals; - -import org.apache.tuscany.sca.node.Contribution; -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; - -import sampleasync.Upper; - -/** - * Test how to run an SCA contribution containing a test composite on a - * Tuscany runtime node. - * - * @version $Rev$ $Date$ - */ -public class SampleGenericAsyncTestCase { - static Node node; - - @BeforeClass - public static void setUp() throws Exception { - final NodeFactory nf = NodeFactory.newInstance(); - String here = SampleGenericAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); - node = nf.createNode(new Contribution("test", here)); - node.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - @Test - public void testReference() { - System.out.println("SampleAsyncReferenceTestCase.testReference"); - Upper upper = node.getService(Upper.class, "SampleAsyncReference"); - final String r = upper.upper("async"); - System.out.println(r); - assertEquals("ASYNC", r); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java deleted file mode 100644 index bc35a637d1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.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 sampleasync.impl; - -import static org.junit.Assert.assertEquals; - -import org.apache.tuscany.sca.node.Contribution; -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; - -import sampleasync.Upper; - -/** - * Test how to run an SCA contribution containing a test composite on a - * Tuscany runtime node. - * - * @version $Rev$ $Date$ - */ -public class SampleNativeAsyncTestCase { - static Node node; - - @BeforeClass - public static void setUp() throws Exception { - final NodeFactory nf = NodeFactory.newInstance(); - String here = SampleNativeAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); - node = nf.createNode(new Contribution("test", here)); - node.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - @Test - public void testReference() { - System.out.println("SampleNaiveAsyncTestCase.testReference"); - Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference"); - final String r = upper.upper("async"); - System.out.println(r); - assertEquals("ASYNC", r); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java deleted file mode 100644 index 9cf7ff9883..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java +++ /dev/null @@ -1,70 +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 sampleasync.impl; - -import static java.lang.System.out; - -import java.util.concurrent.ExecutionException; - -import javax.xml.ws.Response; - -import org.oasisopen.sca.annotation.Reference; - -import sampleasync.Upper; -import sampleasync.UpperAsyncReference; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -public class UpperJavaAsyncReferenceImpl implements Upper { - - @Reference - UpperAsyncReference upper; - - public String upper(String s) { - out.println("UpperAsyncReferenceImpl.upper(" + s + ")"); - - // async poll - Response<String> response = upper.upperAsync(s); - - while (!response.isDone()){ - System.out.println("Waiting for poll"); - try { - Thread.sleep(500); - } catch (Exception ex) { - // do nothing - } - } - - String result = null; - - try { - result = response.get(); - System.out.println("Async client poll patern: result = " + result); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } - return result; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.java deleted file mode 100644 index fb9ad065ad..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.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 sampleasync.impl; - -import static java.lang.System.out; - -import org.oasisopen.sca.ResponseDispatch; - -import sampleasync.UpperAsyncService; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -public class UpperJavaAsyncServiceImpl implements UpperAsyncService { - - public void upperAsync(String s,ResponseDispatch<String> response) { - out.println("UpperJavaAsyncServiceImpl.upperAsync(" + s + ")"); - response.sendResponse(s.toUpperCase()); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java deleted file mode 100644 index 101c6a4399..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java +++ /dev/null @@ -1,74 +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 sampleasync.impl; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.text; -import static sample.Xutil.xdom; - -import org.w3c.dom.Element; - -import sample.api.Java; -import sample.api.WSDL; -import sample.api.WSDLReference; -import sampleasync.Upper; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@Java(Upper.class) -public class UpperSampleAsyncReferenceImpl { - - @WSDL("http://sample/upper#Upper") - WSDLReference upper; - Element response; - - public String upper(String s) { - out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); - - // TODO - I'm passing in the non-wrapped version of the parameter - // here which doesn't seem right. If I pass in the wrapped - // version then the databinding won't unwrap on the reference - // side as it thinks the target Java interface is bare? - final Element ureq = xdom("http://sample/upper", "s", text(s)); - upper.callAsync("upper", ureq); - - try { - Thread.sleep(500); - } catch (Exception ex) { - // do nothing - } - - return response.getTextContent(); - } - - /** - * In this implementation the convention is that the - * async callback arrives at an operation named - * operationName + Callback - */ - public void upperCallback(Element response) { - out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")"); - this.response = response; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java deleted file mode 100644 index 41a85e44a0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.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 sampleasync.impl; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.text; -import static sample.Xutil.xdom; - -import org.w3c.dom.Element; - -import sample.api.WSDL; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@WSDL("http://sample/upper#Upper") -public class UpperSampleAsyncServiceImpl { - - public Element call(String op, Element e) { - String input = e.getTextContent(); - out.println("UpperSampleAsyncServiceImpl.upper(" + input + ")"); - String output = input.toUpperCase(); - return xdom("http://sample/upper", "upperResponse", elem("result", text(output))); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Hello.wsdl b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Hello.wsdl deleted file mode 100644 index 360cea5ff3..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Hello.wsdl +++ /dev/null @@ -1,62 +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. ---> -<wsdl:definitions targetNamespace="http://sample/hello" xmlns:tns="http://sample/hello" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - name="Hello"> - - <wsdl:types> - <schema elementFormDefault="qualified" targetNamespace="http://sample/hello" - xmlns="http://www.w3.org/2001/XMLSchema"> - <element name="hello"> - <complexType> - <sequence> - <element name="name" type="xsd:string" /> - </sequence> - </complexType> - </element> - - <element name="helloResponse"> - <complexType> - <sequence> - <element name="result" type="xsd:string" /> - </sequence> - </complexType> - </element> - - </schema> - </wsdl:types> - - <wsdl:message name="helloRequest"> - <wsdl:part element="tns:hello" name="parameters" /> - </wsdl:message> - - <wsdl:message name="helloResponse"> - <wsdl:part element="tns:helloResponse" name="parameters" /> - </wsdl:message> - - <wsdl:portType name="Hello"> - <wsdl:operation name="hello"> - <wsdl:input message="tns:helloRequest" name="helloRequest" /> - <wsdl:output message="tns:helloResponse" name="helloResponse" /> - </wsdl:operation> - </wsdl:portType> - -</wsdl:definitions> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Upper.wsdl b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Upper.wsdl deleted file mode 100644 index dc236073ca..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/Upper.wsdl +++ /dev/null @@ -1,63 +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. ---> -<wsdl:definitions targetNamespace="http://sample/upper" xmlns:tns="http://sample/upper" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" - name="Upper"> - - <wsdl:types> - <schema elementFormDefault="qualified" targetNamespace="http://sample/upper" - xmlns="http://www.w3.org/2001/XMLSchema"> - <element name="upper"> - <complexType> - <sequence> - <element name="s" type="xsd:string" /> - </sequence> - </complexType> - </element> - - <element name="upperResponse"> - <complexType> - <sequence> - <element name="result" type="xsd:string" /> - </sequence> - </complexType> - </element> - - </schema> - </wsdl:types> - - <wsdl:message name="upperRequest"> - <wsdl:part element="tns:upper" name="parameters" /> - </wsdl:message> - - <wsdl:message name="upperResponse"> - <wsdl:part element="tns:upperResponse" name="parameters" /> - </wsdl:message> - - <wsdl:portType name="Upper" sca:requires="sca:asyncInvocation"> - <wsdl:operation name="upper"> - <wsdl:input message="tns:upperRequest" name="upperRequest" /> - <wsdl:output message="tns:upperResponse" name="upperResponse" /> - </wsdl:operation> - </wsdl:portType> - -</wsdl:definitions> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/test.composite.off b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/test.composite.off deleted file mode 100644 index 1f5b98c00b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/test.composite.off +++ /dev/null @@ -1,61 +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:t="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://test" - name="wstest"> - - <!-- Client test component used by the JUnit tests --> - <component name="client-test"> - <t:implementation.sample class="sample.ClientTest"/> - <reference name="wello" target="wello-test"/> - <reference name="jello" target="jello-test"/> - </component> - - <!-- HelloWorld test component that uses WSDL interfaces --> - <component name="wello-test"> - <t:implementation.sample class="sample.WelloTest"/> - <reference name="upper" target="upper-test"/> - </component> - - <!-- HelloWorld test component that uses Java interfaces --> - <component name="jello-test"> - <t:implementation.sample class="sample.JelloTest"/> - <reference name="upper" target="upper-test"/> - </component> - - <!-- HelloWorld test component that uses WSDL interfaces and SOAP Web Services --> - <component name="Wsello-test"> - <t:implementation.sample class="sample.WelloTest"/> - <service name="Hello"> - <binding.ws uri="http://localhost:8085/wsello"/> - </service> - <reference name="upper"> - <binding.ws uri="http://localhost:8086/wsupper"/> - </reference> - </component> - - <!-- Test component converts a string to uppercase --> - <component name="upper-test"> - <t:implementation.sample class="sample.UpperTest"/> - </component> - - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testgenericasync.composite b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testgenericasync.composite deleted file mode 100644 index c289a1ab32..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testgenericasync.composite +++ /dev/null @@ -1,45 +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:t="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://test" - name="testasync"> - - <!-- SampleAsync implementation at reference with Java async at service --> - <component name="SampleAsyncReference"> - <t:implementation.sampleasync class="sampleasync.impl.UpperSampleAsyncReferenceImpl"/> - <reference name="upper" target="JavaAsyncService"/> - </component> - - <component name="JavaAsyncService"> - <implementation.java class="sampleasync.impl.UpperJavaAsyncServiceImpl"/> - </component> - - <!-- SampleAsync implementation at service with Java async at reference --> - <component name="JavaAsyncReference"> - <implementation.java class="sampleasync.impl.UpperJavaAsyncReferenceImpl"/> - <reference name="upper" target="SampleAsyncService"/> - </component> - - <component name="SampleAsyncService"> - <t:implementation.sampleasync class="sampleasync.impl.UpperSampleAsyncServiceImpl"/> - </component> - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite deleted file mode 100644 index f9c077e272..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/resources/testnativeasync.composite +++ /dev/null @@ -1,35 +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:t="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://test" - name="testnativeasync"> - - <!-- SampleAsync implementation at reference with Java async at service --> - <component name="SampleNativeAsyncReference"> - <t:implementation.sampleasync class="sampleasync.impl.UpperSampleAsyncReferenceImpl"/> - <reference name="upper" target="SampleAsyncService"/> - </component> - - <component name="SampleNativeAsyncService"> - <t:implementation.sampleasync class="sampleasync.impl.UpperSampleAsyncServiceImpl"/> - </component> - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/jsonp-webapp/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/jsonp-webapp/pom.xml deleted file mode 100644 index 68218cfb2c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonp-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>jsonp-webapp</finalName>
- </build>
-</project>
-
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/jsonp-webapp/src/main/java/sample/Location.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/java/sample/ShareServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/webapp/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/jsonp-webapp/src/main/webapp/index.html b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/jsonp-webapp/src/main/webapp/index.html deleted file mode 100644 index 2a754e494e..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/README b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/launcher-embedded-jse-spec/README deleted file mode 100644 index 7108333efa..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/build.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/launcher-embedded-jse-spec/build.xml deleted file mode 100644 index 64bad00b76..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/launcher-embedded-jse-spec/pom.xml deleted file mode 100644 index 18b4f8f11d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-domain-node</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-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-Beta2/unreleased/samples/launcher-embedded-jse-spec/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/JSELauncherBindingWSCalculator.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/src/main/java/launcher/SampleLauncherException.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/launcher-embedded-jse-spec/src/test/java/launcher/LauncherTestCase.java b/sca-java-2.x/branches/2.0-Beta2/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-Beta2/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-Beta2/unreleased/samples/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/pom.xml deleted file mode 100644 index cf570e0f5d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2/unreleased/samples/reporting/README b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/README deleted file mode 100644 index b33446cde8..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/pom.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/pom.xml deleted file mode 100644 index dedbd56b53..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2-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-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-core</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-webservice</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-feature-ejava</artifactId>
- <type>pom</type>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-script-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <version>2.0-Beta2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-json</artifactId>
- <version>2.0-Beta2-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-Beta2/unreleased/samples/reporting/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 12d80ffd1c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/main/java/reporting/JSELauncheCalculator.java deleted file mode 100644 index 25729ea1ea..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/src/main/java/reporting/JSELauncherAdd.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/main/java/reporting/JSELauncherAdd.java deleted file mode 100644 index 5351ed263b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/src/main/resources/node-add.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/main/resources/node-add.xml deleted file mode 100644 index 7a4a6d5695..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/src/main/resources/node-calculator.xml b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/main/resources/node-calculator.xml deleted file mode 100644 index 31098b129d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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-Beta2/unreleased/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/reporting/src/test/java/reporting/JSELauncherReportingTestCase.java deleted file mode 100644 index b4cc8fa3ee..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/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();
- }
- }
-
-}
|