diff options
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime')
21 files changed, 0 insertions, 1697 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF deleted file mode 100644 index c78875e887..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.binding.rss.collection
-SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA RSS Feed Binding Extension
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 2.0.0
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA RSS Feed Binding Extension
-Import-Package: javax.xml.namespace,
- org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.assembly.xml;version="2.0.0",
- org.apache.tuscany.sca.binding.rss;version="2.0.0",
- org.apache.tuscany.sca.core,
- org.apache.tuscany.sca.interfacedef,
- org.apache.tuscany.sca.interfacedef.impl,
- org.apache.tuscany.sca.interfacedef.util,
- org.apache.tuscany.sca.monitor
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.rss.runtime
-Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE deleted file mode 100644 index ad2ba40961..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2010 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml deleted file mode 100644 index ddc90ab7c6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/pom.xml +++ /dev/null @@ -1,170 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>tuscany-binding-rss-runtime</artifactId> - <name>Apache Tuscany SCA RSS Feed Binding Extension</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-rss</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-data-api</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core-spi</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-http</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.1</version> - </dependency> - - <dependency> - <groupId>rome</groupId> - <artifactId>rome</artifactId> - <version>1.0</version> - </dependency> - - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>1.3</version> - <exclusions> - <exclusion> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - <exclusion> - <groupId>avalon-framework</groupId> - <artifactId>avalon-framework</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-jetty</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl</artifactId> - <version>2.0-Beta1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.0.1</version> - <configuration> - <instructions> - <Bundle-Version>${tuscany.version}</Bundle-Version> - <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rss.rome</Bundle-SymbolicName> - <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.binding.rss*</Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java deleted file mode 100644 index 581ae59ae6..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.binding.rss.collection; - -import org.oasisopen.sca.annotation.Remotable; - -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndFeed; - - -/** - * Provides access to a collection of resources using RSS. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Collection { - - /** - * Get an RSS feed for a collection of resources. - * - * @return the RSS feed - */ - SyndFeed getFeed(); - - /** - * Get an RSS feed for a collection of resources resulting from a query. - * - * @param queryString the query string - * @return the RSS feed - */ - SyndFeed query(String queryString); - - /** - * Retrieves an RSS entry. - * - * @param id The entry ID - * @return The requested entry - * @throws NotFoundException No entry found with the given ID - */ - SyndEntry get(String id) throws NotFoundException; -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java deleted file mode 100644 index a2b83465da..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.binding.rss.collection; - -import java.io.InputStream; - -import org.oasisopen.sca.annotation.Remotable; - -import com.sun.syndication.feed.atom.Entry; - -/** - * Provides access to a collection of resources using Atom. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface MediaCollection extends Collection { - - /** - * Creates a new media entry - * - * @param title - * @param slug - * @param contentType - * @param media - */ - Entry postMedia(String title, String slug, String contentType, InputStream media); - - /** - * Update a media entry. - * - * @param id - * @param contentType - * @param media - * @return - */ - void putMedia(String id, String contentType, InputStream media) throws NotFoundException; - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java deleted file mode 100644 index 0912878938..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss.collection; - -/** - * Indicates that a resource could not be found. - * - * @version $Rev$ $Date$ - */ -public class NotFoundException extends Exception { - private static final long serialVersionUID = -5046027674128627383L; - - public NotFoundException() { - } - - public NotFoundException(String message) { - super(message); - } - - public NotFoundException(Throwable cause) { - super(cause); - } - - public NotFoundException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java deleted file mode 100644 index e3a177198c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.binding.rss.provider; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.invocation.DataExchangeSemantics; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedInput; -import com.sun.syndication.io.XmlReader; - -/** - * Invoker for the RSS binding. - * - * @version $Rev$ $Date$ - */ -class RSSBindingInvoker implements Invoker , DataExchangeSemantics { - private static final Logger logger = Logger.getLogger(RSSBindingInvoker.class.getName()); - - private String uri; - - RSSBindingInvoker(String uri, String feedType) { - this.uri = uri; - } - - public Message invoke(Message msg) { - try { - logger.fine("invoke " + uri); - - // Read an RSS feed into a Synd feed - SyndFeedInput input = new SyndFeedInput(); - SyndFeed feed = input.build(new XmlReader(new URL(uri))); - - //FIXME Support conversion to data-api entries - - msg.setBody(feed); - - } catch (MalformedURLException e) { - msg.setFaultBody(e); - } catch (IllegalArgumentException e) { - msg.setFaultBody(e); - } catch (FeedException e) { - msg.setFaultBody(e); - } catch (IOException e) { - msg.setFaultBody(e); - } - return msg; - } - - public boolean allowsPassByReference() { - return true; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java deleted file mode 100644 index 44c84ce5bb..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.binding.rss.provider; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.StringTokenizer; -import java.util.logging.Logger; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.xml.namespace.QName; - -import org.apache.commons.codec.binary.Base64; -import org.apache.tuscany.sca.data.collection.Item; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.runtime.Invocable; - -import com.sun.syndication.feed.synd.SyndContent; -import com.sun.syndication.feed.synd.SyndContentImpl; -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndEntryImpl; -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.feed.synd.SyndFeedImpl; -import com.sun.syndication.feed.synd.SyndLink; -import com.sun.syndication.feed.synd.SyndLinkImpl; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedOutput; - -/** - * An RSS binding listener, implemented as a Servlet and - * registered in a Servlet host provided by the SCA hosting runtime. - * - * @version $Rev$ $Date$ - */ -class RSSBindingListenerServlet extends HttpServlet { - private static final Logger logger = Logger.getLogger(RSSBindingListenerServlet.class.getName()); - private static final long serialVersionUID = 1L; - - private Invocable wire; - private Invoker getFeedInvoker; - private Invoker getAllInvoker; - private Invoker queryInvoker; - private MessageFactory messageFactory; - private Mediator mediator; - private DataType<?> itemClassType; - private DataType<?> itemXMLType; - private boolean supportsFeedEntries; - - /** - * Constructs a new binding listener. - * - * @param wire - * @param messageFactory - */ - RSSBindingListenerServlet(Invocable wire, MessageFactory messageFactory, Mediator mediator) { - this.wire = wire; - this.messageFactory = messageFactory; - this.mediator = mediator; - - // Get the invokers for the supported operations - Operation getOperation = null; - for (InvocationChain invocationChain : this.wire.getInvocationChains()) { - invocationChain.setAllowsPassByReference(true); - Operation operation = invocationChain.getTargetOperation(); - String operationName = operation.getName(); - if (operationName.equals("getFeed")) { - getFeedInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("getAll")) { - getAllInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("query")) { - queryInvoker = invocationChain.getHeadInvoker(); - } else if (operationName.equals("get")) { - getOperation = operation; - } - } - - // Determine the collection item type - if (getOperation != null) { - itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class); - Class<?> itemClass = getOperation.getOutputType().getPhysical(); - if (itemClass == SyndEntry.class) { - supportsFeedEntries = true; - } - DataType<XMLType> outputType = getOperation.getOutputType(); - QName qname = outputType.getLogical().getElementName(); - qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName()); - itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null)); - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - // No authentication required for a get request - - // Get the request path - String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8"); - - logger.fine("get " + request.getRequestURI()); - - // Handle an RSS request - if (path == null || path.length() == 0 || path.equals("/")) { - - // Return an RSS feed containing the entries in the collection - SyndFeed feed = null; - if (supportsFeedEntries) { - - // The service implementation supports feed entries, invoke its getFeed operation - Message requestMessage = messageFactory.createMessage(); - Message responseMessage = getFeedInvoker.invoke(requestMessage); - if (responseMessage.isFault()) { - throw new ServletException((Throwable)responseMessage.getBody()); - } - feed = (SyndFeed)responseMessage.getBody(); - - } else { - - // The service implementation does not support feed entries, invoke its - // getAll operation to get the data item collection. then create feed entries - // from the data items - Message requestMessage = messageFactory.createMessage(); - Message responseMessage; - if (request.getQueryString() != null) { - requestMessage.setBody(new Object[] {request.getQueryString()}); - responseMessage = queryInvoker.invoke(requestMessage); - } else { - responseMessage = getAllInvoker.invoke(requestMessage); - } - if (responseMessage.isFault()) { - throw new ServletException((Throwable)responseMessage.getBody()); - } - org.apache.tuscany.sca.data.collection.Entry<Object, Object>[] collection = - (org.apache.tuscany.sca.data.collection.Entry<Object, Object>[])responseMessage.getBody(); - if (collection != null) { - // Create the feed - feed = new SyndFeedImpl(); - feed.setTitle("Feed"); - feed.setDescription("Feed description"); - - for (org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry: collection) { - SyndEntry feedEntry = createFeedEntry(entry); - feed.getEntries().add(feedEntry); - } - } - } - - // Convert to an RSS feed - if (feed != null) { - response.setContentType("application/rss+xml; charset=utf-8"); - feed.setFeedType("rss_2.0"); - feed.setLink(path); - SyndFeedOutput syndOutput = new SyndFeedOutput(); - try { - syndOutput.output(feed, getWriter(response)); - } catch (FeedException e) { - throw new ServletException(e); - } - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - - } - - /** - * Create an RSS entry from a data collection entry. - * @param entry - * @return - */ - private SyndEntry createFeedEntry(org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry) { - Object key = entry.getKey(); - Object data = entry.getData(); - if (data instanceof Item) { - Item item = (Item)data; - - SyndEntry feedEntry = new SyndEntryImpl(); - feedEntry.setUri(key.toString()); - feedEntry.setTitle(item.getTitle()); - - String value = item.getContents(); - if (value != null) { - SyndContent content = new SyndContentImpl(); - content.setType("text/xml"); - content.setValue(value); - List<SyndContent> contents = new ArrayList<SyndContent>(); - contents.add(content); - feedEntry.setContents(contents); - } - - String href = item.getLink(); - if (href == null) { - href = key.toString(); - } - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref(href); - feedEntry.getLinks().add(link); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref(href); - feedEntry.getLinks().add(link); - feedEntry.setLink(href); - - Date date = item.getDate(); - if (date == null) { - date = new Date(); - } - feedEntry.setPublishedDate(date); - return feedEntry; - - } else if (data != null) { - SyndEntry feedEntry = new SyndEntryImpl(); - feedEntry.setUri(key.toString()); - feedEntry.setTitle("item"); - - // Convert the item to XML - String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString(); - - SyndContent content = new SyndContentImpl(); - content.setType("text/xml"); - content.setValue(value); - List<SyndContent> contents = new ArrayList<SyndContent>(); - contents.add(content); - feedEntry.setContents(contents); - - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref(key.toString()); - feedEntry.getLinks().add(link); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref(key.toString()); - feedEntry.getLinks().add(link); - - feedEntry.setPublishedDate(new Date()); - return feedEntry; - } else { - return null; - } - } - - /** - * Create a data collection entry from an RSS entry. - * @param feedEntry - * @return - */ - private org.apache.tuscany.sca.data.collection.Entry<Object, Object> createEntry(SyndEntry feedEntry) { - if (feedEntry != null) { - if (itemClassType.getPhysical() == Item.class) { - String key = feedEntry.getUri(); - - Item item = new Item(); - item.setTitle(feedEntry.getTitle()); - - List<?> contents = feedEntry.getContents(); - if (!contents.isEmpty()) { - SyndContent content = (SyndContent)contents.get(0); - String value = content.getValue(); - item.setContents(value); - } - - for (Object l : feedEntry.getLinks()) { - SyndLink link = (SyndLink)l; - if (link.getRel() == null || "edit".equals(link.getRel())) { - String href = link.getHref(); - if (href.startsWith("null/")) { - href = href.substring(5); - } - item.setLink(href); - break; - } - } - - item.setDate(feedEntry.getPublishedDate()); - - return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, item); - - } else { - String key = feedEntry.getUri(); - - // Create the item from XML - List<?> contents = feedEntry.getContents(); - if (contents.isEmpty()) { - return null; - } - SyndContent content = (SyndContent)contents.get(0); - String value = content.getValue(); - Object data = mediator.mediate(value, itemXMLType, itemClassType, null); - - return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, data); - } - } else { - return null; - } - } - - - private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException { - Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8"); - return writer; - } - - /** - * Process the authorization header - * - * @param request - * @return - * @throws ServletException - */ - private String processAuthorizationHeader(HttpServletRequest request) throws ServletException { - try { - String authorization = request.getHeader("Authorization"); - if (authorization != null) { - StringTokenizer tokens = new StringTokenizer(authorization); - if (tokens.hasMoreTokens()) { - String basic = tokens.nextToken(); - if (basic.equalsIgnoreCase("Basic")) { - String credentials = tokens.nextToken(); - String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes())); - int colon = userAndPassword.indexOf(":"); - if (colon != -1) { - String user = userAndPassword.substring(0, colon); - String password = userAndPassword.substring(colon + 1); - - // Authenticate the User. - if (authenticate(user, password)) { - return user; - } - } - } - } - } - } catch (Exception e) { - throw new ServletException(e); - } - return null; - } - - /** - * Authenticate a user. - * - * @param user - * @param password - * @return - */ - private boolean authenticate(String user, String password) { - - // TODO Handle this using SCA security policies - //FIXME Why are we using endsWith instead of equals here?? - return ("admin".endsWith(user) && "admin".equals(password)); - } - - /** - * Reject an unauthorized request. - * - * @param response - */ - private void unauthorized(HttpServletResponse response) throws IOException { - response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\""); - response.sendError(HttpServletResponse.SC_UNAUTHORIZED); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java deleted file mode 100644 index e1bafdd3cd..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; - -/** - * Implementation of the RSS binding provider factory. - * - * @version $Rev$ $Date$ - */ -public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> { - - private MessageFactory messageFactory; - private Mediator mediator; - private ServletHost servletHost; - - public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); - this.servletHost = servletHosts.getServletHosts().get(0); - FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - this.messageFactory = modelFactories.getFactory(MessageFactory.class); - this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class); - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { - return new RSSReferenceBindingProvider(endpointReference, mediator); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) { - return new RSSServiceBindingProvider(endpoint, messageFactory, mediator, servletHost); - } - - public Class<RSSBinding> getModelType() { - return RSSBinding.class; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java deleted file mode 100644 index d234a0c92c..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -/** - * Implementation of the RSS binding provider. - * - * @version $Rev$ $Date$ - */ -class RSSReferenceBindingProvider implements ReferenceBindingProvider { - - private EndpointReference endpointReference; - - private RuntimeComponentReference reference; - private RSSBinding binding; - - RSSReferenceBindingProvider(EndpointReference endpointReference, - Mediator mediator) { - this.endpointReference = endpointReference; - this.reference = (RuntimeComponentReference) endpointReference.getReference(); - this.binding = (RSSBinding) endpointReference.getBinding(); - } - - public Invoker createInvoker(Operation operation) { - return new RSSBindingInvoker(binding.getURI(), "rss_2.0"); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public InterfaceContract getBindingInterfaceContract() { - return reference.getInterfaceContract(); - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java deleted file mode 100644 index 25ab939341..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss.provider; - -import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.databinding.Mediator; -import org.apache.tuscany.sca.host.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.Invocable; -import org.apache.tuscany.sca.runtime.RuntimeEndpoint; - -/** - * Implementation of the RSS binding provider. - * - * @version $Rev$ $Date$ - */ -class RSSServiceBindingProvider implements ServiceBindingProvider { - - private RuntimeEndpoint endpoint; - - //private RuntimeComponentService service; - private RSSBinding binding; - - private MessageFactory messageFactory; - private Mediator mediator; - private ServletHost servletHost; - - private String servletMapping; - - RSSServiceBindingProvider(RuntimeEndpoint endpoint, - MessageFactory messageFactory, - Mediator mediator, - ServletHost servletHost) { - this.endpoint = endpoint; - - //this.service = (RuntimeComponentService)endpoint.getService(); - this.binding = (RSSBinding) endpoint.getBinding(); - this.servletHost = servletHost; - this.messageFactory = messageFactory; - this.mediator = mediator; - } - - public InterfaceContract getBindingInterfaceContract() { - return endpoint.getComponentTypeServiceInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - Invocable wire = (RuntimeEndpoint) endpoint; - - RSSBindingListenerServlet servlet = - new RSSBindingListenerServlet(wire, messageFactory, mediator); - - servletMapping = binding.getURI(); - if (!servletMapping.endsWith("/")) { - servletMapping += "/"; - } - if (!servletMapping.endsWith("*")) { - servletMapping += "*"; - } - servletHost.addServletMapping(servletMapping, servlet); - - // Save the actual binding URI in the binding - //binding.setURI(servletHost.getURLMapping(binding.getURI()).toString()); - } - - public void stop() { - servletHost.removeServletMapping(servletMapping); - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index e60dc2855a..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.rss.provider.RSSBindingProviderFactory;model=org.apache.tuscany.sca.binding.rss.RSSBinding
diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java deleted file mode 100644 index 1ae4515e70..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - - -public class Consumer { - - public static void main(String[] args) throws Exception { - - String contribution = ContributionLocationHelper.getContributionLocation(Consumer.class); - Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Consumer.composite", new Contribution("consumer", contribution)); - - node.start(); - - CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient"); - testService.testCustomerCollection(); - - node.stop(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java deleted file mode 100644 index af87155f45..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -public interface CustomerClient { - - void testCustomerCollection() throws Exception; -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java deleted file mode 100644 index a80f721136..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -import org.apache.tuscany.sca.binding.rss.collection.Collection; -import org.oasisopen.sca.annotation.Reference; - -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndFeed; - - -public class CustomerClientImpl implements CustomerClient { - - @Reference - public Collection resourceCollection; - - public void testCustomerCollection() throws Exception { - - System.out.println(">>> get collection"); - SyndFeed feed = resourceCollection.getFeed(); - System.out.println("<<< get collection"); - for (Object o : feed.getEntries()) { - SyndEntry e = (SyndEntry)o; - System.out.println("id = " + e.getUri() + " entry = " + e.getTitle()); - } - } - -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java deleted file mode 100644 index 4b5bf373e7..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.binding.rss.collection.Collection; -import org.apache.tuscany.sca.binding.rss.collection.NotFoundException; -import org.oasisopen.sca.annotation.Scope; - -import com.sun.syndication.feed.synd.SyndContent; -import com.sun.syndication.feed.synd.SyndContentImpl; -import com.sun.syndication.feed.synd.SyndEntry; -import com.sun.syndication.feed.synd.SyndEntryImpl; -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.feed.synd.SyndFeedImpl; -import com.sun.syndication.feed.synd.SyndLink; -import com.sun.syndication.feed.synd.SyndLinkImpl; - -@Scope("COMPOSITE") -public class CustomerCollectionImpl implements Collection { - - private Map<String, SyndEntry> entries = new HashMap<String, SyndEntry>(); - - public CustomerCollectionImpl() { - - for (int i = 0; i < 4; i++) { - String id = "urn:uuid:customer-" + UUID.randomUUID().toString(); - - SyndEntry entry = new SyndEntryImpl(); - entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i)); - entry.setUri(id); - - SyndContent content = new SyndContentImpl(); - content.setValue("Jane Doe_" + String.valueOf(i)); - content.setType("text"); - entry.setContents(Collections.singletonList(content)); - - List<SyndLink> links = new ArrayList<SyndLink>(); - SyndLink link = new SyndLinkImpl(); - link.setRel("edit"); - link.setHref("" + id); - links.add(link); - entry.setLinks(links); - - links = new ArrayList<SyndLink>(); - link = new SyndLinkImpl(); - link.setRel("alternate"); - link.setHref("" + id); - links.add(link); - entry.setLinks(links); - - entry.setPublishedDate(new Date()); - - entries.put(id, entry); - System.out.println(">>> id=" + id); - } - } - - public SyndFeed getFeed() { - System.out.println(">>> CustomerCollectionImpl.getFeed"); - - SyndFeed feed = new SyndFeedImpl(); - feed.setTitle("customers"); - feed.setDescription("This is a sample feed"); - feed.getEntries().addAll(entries.values()); - return feed; - } - - public SyndFeed query(String queryString) { - System.out.println(">>> CustomerCollectionImpl.query"); - - SyndFeed feed = new SyndFeedImpl(); - feed.setTitle("customers"); - feed.setDescription("This is a sample feed"); - feed.getEntries().addAll(entries.values()); - return feed; - } - - /** - * {@inheritDoc} - */ - public SyndEntry get(String id) throws NotFoundException { - final SyndEntry entry = entries.get(id); - if (id == null) { - throw new NotFoundException("No entry found with ID " + id); - } - - return entry; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java deleted file mode 100644 index 6dc23ac503..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -import java.io.IOException; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - -public class Provider { - - public static void main(String[] args) { - - - String contribution = ContributionLocationHelper.getContributionLocation(Provider.class); - Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Provider.composite", new Contribution("provider", contribution)); - - node.start(); - - System.out.println("Provider.composite ready..."); - - try { - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - node.stop(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java deleted file mode 100644 index 5a786f3bd0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.rss; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Basic test case that will get the feed entries from an RSS feed. - */ -public class RSSGetTestCase { - protected static Node scaConsumerNode; - protected static Node scaProviderNode; - protected static CustomerClient testService; - - @BeforeClass - public static void init() throws Exception { - System.out.println(">>>RSSGetTestCase.init entry"); - String contribution = ContributionLocationHelper.getContributionLocation(RSSGetTestCase.class); - - scaProviderNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Provider.composite", new Contribution("provider", contribution)); - scaProviderNode.start(); - - scaConsumerNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Consumer.composite", new Contribution("consumer", contribution)); - scaConsumerNode.start(); - - testService = scaConsumerNode.getService(CustomerClient.class, "CustomerClient"); - } - - @AfterClass - public static void destroy() throws Exception { - // System.out.println(">>>RSSGetTestCase.destroy entry"); - if (scaConsumerNode != null) { - scaConsumerNode.stop(); - } - if (scaProviderNode != null) { - scaProviderNode.stop(); - } - } - - @Test - public void testPrelim() throws Exception { - Assert.assertNotNull(scaProviderNode); - Assert.assertNotNull(scaConsumerNode); - Assert.assertNotNull(testService); - } - - @Test - @Ignore("TUSCANY-3537") - public void testRSSGet() throws Exception { - testService.testCustomerCollection(); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite deleted file mode 100644 index 22141805cd..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace="http://customer" - name="Consumer"> - - <component name="CustomerClient"> - <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerClientImpl"/> - <reference name="resourceCollection"> - <tuscany:binding.rss uri="http://localhost:8084/customer"/> - </reference> - </component> - -</composite> diff --git a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite b/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite deleted file mode 100644 index 181267fa1d..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/unreleased/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - targetNamespace = "http://customer" - name="Provider"> - - <service name="customer" promote="CustomerCollection"> - <tuscany:binding.rss uri = "http://localhost:8084/customer"/> - </service> - - <component name="CustomerCollection"> - <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerCollectionImpl"/> - </component> - -</composite> |