You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/06/25 04:58:26 UTC
svn commit: r550325 [1/2] - in /incubator/tuscany/java/sca/modules:
binding-feed/ binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/
binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/
binding-feed/src/main/java/org/apache...
Author: jsdelfino
Date: Sun Jun 24 19:58:21 2007
New Revision: 550325
URL: http://svn.apache.org/viewvc?view=rev&rev=550325
Log:
Improvements to the feed binding, separated the processing of RSS and Atom feeds, added support for Atom get/put/post/delete.
Added:
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultRSSBindingFactory.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceCollection.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSReferenceBindingProvider.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedReferenceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedServiceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/ResourceCollectionBindingListener.java
- copied, changed from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListener.java
incubator/tuscany/java/sca/modules/binding-feed/src/test/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Consumer.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClient.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClientImpl.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerCollectionImpl.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Provider.java (with props)
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite
incubator/tuscany/java/sca/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite
Removed:
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListener.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedReferenceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedServiceBindingProvider.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/
Modified:
incubator/tuscany/java/sca/modules/binding-feed/ (props changed)
incubator/tuscany/java/sca/modules/binding-feed/pom.xml
incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java
incubator/tuscany/java/sca/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java
Propchange: incubator/tuscany/java/sca/modules/binding-feed/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jun 24 19:58:21 2007
@@ -11,4 +11,5 @@
.settings
.deployables
.wtpmodules
+work
Modified: incubator/tuscany/java/sca/modules/binding-feed/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/pom.xml?view=diff&rev=550325&r1=550324&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/pom.xml Sun Jun 24 19:58:21 2007
@@ -31,13 +31,6 @@
<dependencies>
<dependency>
- <groupId>rome</groupId>
- <artifactId>rome</artifactId>
- <version>0.9</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-assembly</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
@@ -62,6 +55,18 @@
</dependency>
<dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>0.9</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
@@ -71,6 +76,13 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-http-tomcat</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
<scope>test</scope>
</dependency>
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.feed;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the Atom binding.
+ */
+public interface AtomBinding extends Binding {
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.feed;
+
+/**
+ * A factory for the Atom binding model.
+ */
+public interface AtomBindingFactory {
+
+ /**
+ * Creates a new Atom binding.
+ *
+ * @return a new Atom binding
+ */
+ AtomBinding createAtomBinding();
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.feed;
+
+import org.apache.tuscany.sca.binding.feed.impl.AtomBindingImpl;
+
+/**
+ * A factory for the Atom binding model.
+ */
+public class DefaultAtomBindingFactory implements AtomBindingFactory {
+
+ public AtomBinding createAtomBinding() {
+ return new AtomBindingImpl();
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultAtomBindingFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultRSSBindingFactory.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultRSSBindingFactory.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultRSSBindingFactory.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultRSSBindingFactory.java Sun Jun 24 19:58:21 2007
@@ -19,14 +19,14 @@
package org.apache.tuscany.sca.binding.feed;
-import org.apache.tuscany.sca.binding.feed.impl.FeedBindingImpl;
+import org.apache.tuscany.sca.binding.feed.impl.RSSBindingImpl;
/**
- * A factory for the Feed binding model.
+ * A factory for the RSS binding model.
*/
-public class DefaultFeedBindingFactory implements FeedBindingFactory {
+public class DefaultRSSBindingFactory implements RSSBindingFactory {
- public FeedBinding createFeedBinding() {
- return new FeedBindingImpl();
+ public RSSBinding createRSSBinding() {
+ return new RSSBindingImpl();
}
}
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.feed;
+
+import java.io.InputStream;
+
+import com.sun.syndication.feed.atom.Entry;
+
+/**
+ * Provides access to an editable resource collection using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EditableResourceCollection extends ResourceCollection {
+
+ /**
+ * Creates a new entry.
+ *
+ * @param entry
+ * @return
+ */
+ Entry post(Entry entry);
+
+ /**
+ * Creates a new media entry
+ *
+ * @param title
+ * @param slug
+ * @param contentType
+ * @param media
+ */
+ Entry postMedia(String title, String slug, String contentType, InputStream media);
+
+ /**
+ * Retrieves an entry.
+ *
+ * @param id
+ * @return
+ */
+ Entry get(String id) throws ResourceNotFoundException;
+
+ /**
+ * Update an entry.
+ *
+ * @param id
+ * @param entry
+ * @return
+ */
+ Entry put(String id, Entry entry) throws ResourceNotFoundException;
+
+ /**
+ * Update a media entry.
+ *
+ * @param id
+ * @param contentType
+ * @param media
+ * @return
+ */
+ Entry putMedia(String id, String contentType, InputStream media) throws ResourceNotFoundException;
+
+ /**
+ * Delete an entry.
+ *
+ * @param id
+ */
+ void delete(String id) throws ResourceNotFoundException;
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/EditableResourceCollection.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java Sun Jun 24 19:58:21 2007
@@ -22,20 +22,8 @@
import org.apache.tuscany.sca.assembly.Binding;
/**
- * A model for the Feed binding.
+ * A model for the RSS binding.
*/
-public interface FeedBinding extends Binding {
+public interface RSSBinding extends Binding {
- /**
- * Returns the feed type.
- * @return the feed type
- */
- String getFeedType();
-
- /**
- * Sets the feed type.
- * @param value the feed type
- */
- void setFeedType(String value);
-
}
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java Sun Jun 24 19:58:21 2007
@@ -20,14 +20,14 @@
package org.apache.tuscany.sca.binding.feed;
/**
- * A factory for the Feed binding model.
+ * A factory for the RSS binding model.
*/
-public interface FeedBindingFactory {
+public interface RSSBindingFactory {
/**
- * Creates a new Feed binding.
+ * Creates a new RSS binding.
*
- * @return a new Feed binding
+ * @return a new RSS binding
*/
- FeedBinding createFeedBinding();
+ RSSBinding createRSSBinding();
}
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceCollection.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceCollection.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceCollection.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceCollection.java Sun Jun 24 19:58:21 2007
@@ -21,22 +21,19 @@
import org.osoa.sca.annotations.Remotable;
-import com.sun.syndication.feed.synd.SyndFeed;
-
/**
- * The business interface used on services and references that provide and
- * consume feeds.
+ * Provides access to a resource collection feed.
*
* @version $Rev$ $Date$
*/
@Remotable
-public interface Feed {
+public interface ResourceCollection {
/**
- * Get an RSS or Atom feed.
+ * Get an RSS or Atom feed for a collection of resources.
*
* @param uri the uri of the feed
* @return the RSS or Atom feed
*/
- SyndFeed get(String uri);
+ com.sun.syndication.feed.atom.Feed getCollection();
}
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.feed;
+
+/**
+ * Indicates that a resource could not be found.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceNotFoundException extends Exception {
+ private static final long serialVersionUID = -5046027674128627383L;
+
+ public ResourceNotFoundException() {
+ }
+
+ public ResourceNotFoundException(String message) {
+ super(message);
+ }
+
+ public ResourceNotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public ResourceNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/ResourceNotFoundException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,76 @@
+/*
+ * 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.feed.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Implementation of the Atom binding model.
+ */
+public class AtomBindingImpl implements AtomBinding {
+
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The binding does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.feed.impl;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.binding.feed.AtomBindingFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * A processor for <binding.atom> elements.
+ */
+public class AtomBindingProcessor implements StAXArtifactProcessor<AtomBinding> {
+
+ private QName BINDING_ATOM = new QName(SCA_NS, "binding.atom");
+
+ private final AtomBindingFactory factory;
+
+ public AtomBindingProcessor(AtomBindingFactory factory) {
+ this.factory = factory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ATOM;
+ }
+
+ public Class<AtomBinding> getModelType() {
+ return AtomBinding.class;
+ }
+
+ public AtomBinding read(XMLStreamReader reader) throws ContributionReadException {
+ String uri = reader.getAttributeValue(null, "uri");
+ AtomBinding binding = factory.createAtomBinding();
+ if (uri != null) {
+ binding.setURI(uri.trim());
+ }
+ return binding;
+ }
+
+ public void write(AtomBinding binding, XMLStreamWriter writer) throws ContributionWriteException {
+ }
+
+ public void resolve(AtomBinding binding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java Sun Jun 24 19:58:21 2007
@@ -22,18 +22,17 @@
import java.util.Collections;
import java.util.List;
-import org.apache.tuscany.sca.binding.feed.FeedBinding;
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
/**
* Implementation of the Feed binding model.
*/
-public class FeedBindingImpl implements FeedBinding {
+public class RSSBindingImpl implements RSSBinding {
private String name;
private String uri;
- private String feedType;
public String getName() {
return name;
@@ -72,14 +71,6 @@
public void setUnresolved(boolean unresolved) {
// The binding is always resolved
- }
-
- public String getFeedType() {
- return feedType;
- }
-
- public void setFeedType(String value) {
- feedType = value;
}
}
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.feed.impl;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.binding.feed.RSSBindingFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * A processor for <binding.rss> elements.
+ */
+public class RSSBindingProcessor implements StAXArtifactProcessor<RSSBinding> {
+
+ private final static QName BINDING_RSS = new QName(SCA_NS, "binding.rss");
+
+ private final RSSBindingFactory factory;
+
+ /**
+ * Constructs a new binding processor.
+ *
+ * @param factory
+ */
+ public RSSBindingProcessor(RSSBindingFactory factory) {
+ this.factory = factory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_RSS;
+ }
+
+ public Class<RSSBinding> getModelType() {
+ return RSSBinding.class;
+ }
+
+ public RSSBinding read(XMLStreamReader reader) throws ContributionReadException {
+
+ // Read the <binding.rss> element
+ String uri = reader.getAttributeValue(null, "uri");
+ RSSBinding binding = factory.createRSSBinding();
+ if (uri != null) {
+ binding.setURI(uri.trim());
+ }
+ return binding;
+ }
+
+ public void write(RSSBinding binding, XMLStreamWriter writer) throws ContributionWriteException {
+ }
+
+ public void resolve(RSSBinding binding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java?view=diff&rev=550325&r1=550324&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java Sun Jun 24 19:58:21 2007
@@ -19,11 +19,14 @@
package org.apache.tuscany.sca.binding.feed.module;
-import org.apache.tuscany.sca.binding.feed.DefaultFeedBindingFactory;
-import org.apache.tuscany.sca.binding.feed.FeedBindingFactory;
-import org.apache.tuscany.sca.binding.feed.provider.FeedBindingProviderFactory;
-import org.apache.tuscany.sca.binding.feed.xml.AtomBindingProcessor;
-import org.apache.tuscany.sca.binding.feed.xml.RssBindingProcessor;
+import org.apache.tuscany.sca.binding.feed.AtomBindingFactory;
+import org.apache.tuscany.sca.binding.feed.DefaultAtomBindingFactory;
+import org.apache.tuscany.sca.binding.feed.DefaultRSSBindingFactory;
+import org.apache.tuscany.sca.binding.feed.RSSBindingFactory;
+import org.apache.tuscany.sca.binding.feed.impl.AtomBindingProcessor;
+import org.apache.tuscany.sca.binding.feed.impl.RSSBindingProcessor;
+import org.apache.tuscany.sca.binding.feed.provider.AtomBindingProviderFactory;
+import org.apache.tuscany.sca.binding.feed.provider.RSSBindingProviderFactory;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
@@ -44,23 +47,28 @@
public void start(ExtensionPointRegistry registry) {
- // Create the Feed model factory
+ // Create the model factories
ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- FeedBindingFactory factory = new DefaultFeedBindingFactory();
- factories.addFactory(factory);
+ RSSBindingFactory feedFactory = new DefaultRSSBindingFactory();
+ factories.addFactory(feedFactory);
+ AtomBindingFactory atomFactory = new DefaultAtomBindingFactory();
+ factories.addFactory(atomFactory);
// Add the AtomBindingProcessor and RSSBindingProcessor extensions
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- AtomBindingProcessor atomBindingProcessor = new AtomBindingProcessor(factory);
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ AtomBindingProcessor atomBindingProcessor = new AtomBindingProcessor(atomFactory);
processors.addArtifactProcessor(atomBindingProcessor);
- RssBindingProcessor rssBindingProcessor = new RssBindingProcessor(factory);
+ RSSBindingProcessor rssBindingProcessor = new RSSBindingProcessor(feedFactory);
processors.addArtifactProcessor(rssBindingProcessor);
// Add the Feed binding provider factory extension
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
ServletHost servletHost = registry.getExtensionPoint(ServletHost.class);
MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
- providerFactories.addProviderFactory(new FeedBindingProviderFactory(servletHost, messageFactory));
+ providerFactories.addProviderFactory(new RSSBindingProviderFactory(servletHost, messageFactory));
+ providerFactories.addProviderFactory(new AtomBindingProviderFactory(servletHost, messageFactory));
}
public void stop(ExtensionPointRegistry registry) {
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,350 @@
+/*
+ * 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.feed.provider;
+
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.tuscany.sca.binding.feed.ResourceNotFoundException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ * Invoker for the Atom binding.
+ */
+public class AtomBindingInvoker implements Invoker {
+
+ Operation operation;
+ String uri;
+ HttpClient httpClient;
+ String authorizationHeader;
+
+ public AtomBindingInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ this.operation = operation;
+ this.uri = uri;
+ this.httpClient = httpClient;
+ this.authorizationHeader = authorizationHeader;
+ }
+
+ public Message invoke(Message msg) {
+ // Shouldn't get here, as the only supported methods are
+ // defined in the ResourceCollection interface, and implemented
+ // by specific invoker subclasses
+ throw new UnsupportedOperationException(operation.getName());
+ }
+
+ /**
+ * Get operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class GetInvoker extends AtomBindingInvoker {
+
+ public GetInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri + "/entry/" + id);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200) {
+ Entry entry =
+ AtomEntryUtil.readEntry("atom_1.0", new InputStreamReader(getMethod.getResponseBodyAsStream()));
+ msg.setBody(entry);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new ResourceNotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ getMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Post operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class PostInvoker extends AtomBindingInvoker {
+
+ public PostInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Post an entry
+ Entry entry = (Entry)((Object[])msg.getBody())[0];
+
+ // Send an HTTP POST
+ PostMethod postMethod = new PostMethod(uri);
+ postMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ AtomEntryUtil.writeEntry(entry, "atom_1.0", writer);
+ postMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ postMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(postMethod);
+ int status = postMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200 || status == 201) {
+ Entry createdEntry =
+ AtomEntryUtil
+ .readEntry("atom_1.0", new InputStreamReader(postMethod.getResponseBodyAsStream()));
+ msg.setBody(createdEntry);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new ResourceNotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ postMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Put operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class PutInvoker extends AtomBindingInvoker {
+
+ public PutInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Put an entry
+ Object[] args = (Object[])msg.getBody();
+ String id = (String)args[0];
+ Entry entry = (Entry)args[1];
+
+ // Send an HTTP PUT
+ PutMethod putMethod = new PutMethod(uri + "/entry/" + id);
+ putMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ AtomEntryUtil.writeEntry(entry, "atom_1.0", writer);
+ putMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ putMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(putMethod);
+ int status = putMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200 || status == 201) {
+ try {
+ Entry updatedEntry =
+ AtomEntryUtil.readEntry("atom_1.0", new InputStreamReader(putMethod
+ .getResponseBodyAsStream()));
+ msg.setBody(updatedEntry);
+ } catch (Exception e) {
+ // Returning the updated entry is optional
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new ResourceNotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ putMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Delete operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class DeleteInvoker extends AtomBindingInvoker {
+
+ public DeleteInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Delete an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP DELETE
+ DeleteMethod deleteMethod = new DeleteMethod(uri + "/entry/" + id);
+ deleteMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(deleteMethod);
+ int status = deleteMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200) {
+ msg.setBody(null);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new ResourceNotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ deleteMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * GetCollection operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class GetCollectionInvoker extends AtomBindingInvoker {
+
+ public GetCollectionInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get a feed
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom feed
+ if (status == 200) {
+ WireFeedInput input = new WireFeedInput();
+ Feed feed = (Feed)input.build(new XmlReader(getMethod.getResponseBodyAsStream()));
+ msg.setBody(feed);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new ResourceNotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ getMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * PostMedia operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class PostMediaInvoker extends AtomBindingInvoker {
+
+ public PostMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+ /**
+ * PutMedia operation invoker
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class PutMediaInvoker extends AtomBindingInvoker {
+
+ public PutMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,60 @@
+/*
+ * 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.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.http.ServletHost;
+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.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the Atom binding model.
+ */
+public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBinding> {
+
+ MessageFactory messageFactory;
+ ServletHost servletHost;
+
+ public AtomBindingProviderFactory(ServletHost servletHost, MessageFactory messageFactory) {
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding) {
+ return new AtomReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding) {
+ return new AtomServiceBindingProvider(component, service, binding, servletHost, messageFactory);
+ }
+
+ public Class<AtomBinding> getModelType() {
+ return AtomBinding.class;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.feed.provider;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.WireFeedOutput;
+
+/**
+ * Utility methods to read/write Atom entries.
+ *
+ * @version $Rev$ $Date$
+ */
+class AtomEntryUtil {
+
+ /**
+ * Read an Atom entry
+ *
+ * @param request
+ * @return
+ * @throws IOException
+ * @throws JDOMException
+ * @throws FeedException
+ * @throws IllegalArgumentException
+ */
+ static Entry readEntry(String feedType, Reader reader) throws JDOMException, IOException, IllegalArgumentException,
+ FeedException {
+ SAXBuilder builder = new SAXBuilder();
+ Document document = builder.build(reader);
+ Element root = document.getRootElement();
+ root.detach();
+ Feed feed = new Feed();
+ feed.setFeedType(feedType);
+ WireFeedOutput wireFeedOutput = new WireFeedOutput();
+ document = wireFeedOutput.outputJDom(feed);
+ document.getRootElement().addContent(root);
+ WireFeedInput input = new WireFeedInput();
+ feed = (Feed)input.build(document);
+ Entry entry = (Entry)feed.getEntries().get(0);
+ return entry;
+ }
+
+ /**
+ * Write an Atom entry.
+ *
+ * @param entry
+ * @param response
+ * @throws FeedException
+ * @throws IllegalArgumentException
+ * @throws IOException
+ * @throws ServletException
+ */
+ static void writeEntry(Entry entry, String feedType, Writer writer) throws IllegalArgumentException, FeedException,
+ IOException {
+ Feed feed = new Feed();
+ feed.setFeedType(feedType);
+ List<Entry> entries = new ArrayList<Entry>();
+ entries.add(entry);
+ feed.setEntries(entries);
+
+ WireFeedOutput wireFeedOutput = new WireFeedOutput();
+ Document document = wireFeedOutput.outputJDom(feed);
+ Element root = document.getRootElement();
+ Element element = (Element)root.getChildren().get(0);
+ XMLOutputter outputter = new XMLOutputter();
+ outputter.setFormat(Format.getPrettyFormat());
+ outputter.output(element, writer);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomEntryUtil.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,110 @@
+/*
+ * 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.feed.provider;
+
+import java.net.URI;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+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.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+public class AtomReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private AtomBinding binding;
+ private String authorizationHeader;
+ private HttpClient httpClient;
+
+ public AtomReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+
+ // Prepare authorization header
+ String authorization = "admin" + ":" + "admin";
+ authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
+ ;
+
+ // Create an HTTP client
+ httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
+ httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ if (isCallback) {
+ throw new UnsupportedOperationException();
+ } else {
+ String operationName = operation.getName();
+ if (operationName.equals("get")) {
+ return new AtomBindingInvoker.GetInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("post")) {
+ return new AtomBindingInvoker.PostInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("put")) {
+ return new AtomBindingInvoker.PutInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("delete")) {
+ return new AtomBindingInvoker.DeleteInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("getCollection")) {
+ return new AtomBindingInvoker.GetCollectionInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("postMedia")) {
+ return new AtomBindingInvoker.PostMediaInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("putMedia")) {
+ return new AtomBindingInvoker.PutMediaInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ }
+
+ return new AtomBindingInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+
+ // Configure the HTTP client credentials
+ Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
+ httpClient.getParams().setAuthenticationPreemptive(true);
+ URI uri = URI.create(binding.getURI());
+ httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
+ }
+
+ public void stop() {
+ httpClient = null;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java?view=auto&rev=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java (added)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java Sun Jun 24 19:58:21 2007
@@ -0,0 +1,83 @@
+/*
+ * 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.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.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.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+public class AtomServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private AtomBinding binding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private String uri;
+
+ public AtomServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ uri = binding.getURI();
+ if (uri == null) {
+ uri = "/" + this.component.getName();
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public void start() {
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+
+ ResourceCollectionBindingListener servlet =
+ new ResourceCollectionBindingListener(wire, messageFactory, "atom_1.0");
+
+ String mapping = uri;
+ if (!mapping.endsWith("/")) {
+ mapping += "/";
+ }
+ if (!mapping.endsWith("*")) {
+ mapping += "*";
+ }
+ servletHost.addServletMapping(mapping, servlet);
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(uri);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java Sun Jun 24 19:58:21 2007
@@ -20,50 +20,51 @@
import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URL;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
+import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.WireFeedInput;
import com.sun.syndication.io.XmlReader;
/**
- * Invoker for the Feed binding.
+ * Invoker for the RSS binding.
*/
-public class FeedBindingInvoker implements Invoker {
+public class RSSBindingInvoker implements Invoker {
+ private String feedType;
private String uri;
- public FeedBindingInvoker(String uri, String feedType) {
+ public RSSBindingInvoker(String uri, String feedType) {
this.uri = uri;
+ this.feedType = feedType;
}
public Message invoke(Message msg) {
try {
- URL feedURL;
- Object[] args = msg.getBody();
- if (args[0] != null) {
- URI arg = URI.create((String)args[0]);
- if (arg.isAbsolute()) {
- feedURL = arg.toURL();
- } else {
- feedURL = new URL(uri + "/" + arg.toString());
- }
+ System.out.println(">>> RSSBindingInvoker (" + feedType + ") " + uri);
+
+ // Read the configured feed URI into a Feed object
+ Feed feed;
+ if (feedType.startsWith("atom_")) {
+
+ // Read an Atom feed
+ WireFeedInput input = new WireFeedInput();
+ feed = (Feed)input.build(new XmlReader(new URL(uri)));
} else {
- feedURL = new URL(uri);
- }
- // Read the configured feed into a Feed object
- SyndFeedInput input = new SyndFeedInput();
- SyndFeed feed = input.build(new XmlReader(feedURL));
+ // Read an RSS feed and convert it to an Atom feed
+ SyndFeedInput input = new SyndFeedInput();
+ SyndFeed syndFeed = input.build(new XmlReader(new URL(uri)));
+ feed = (Feed)syndFeed.createWireFeed("atom_1.0");
+ }
msg.setBody(feed);
- System.out.println(">>> FeedBindingInvoker (" + feed.getFeedType() + ") " + uri);
-
} catch (MalformedURLException e) {
msg.setFaultBody(e);
} catch (IllegalArgumentException e) {
Copied: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java (from r549339, incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java?view=diff&rev=550325&p1=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java&r1=549339&p2=incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java&r2=550325
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java Sun Jun 24 19:58:21 2007
@@ -19,7 +19,7 @@
package org.apache.tuscany.sca.binding.feed.provider;
-import org.apache.tuscany.sca.binding.feed.FeedBinding;
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
import org.apache.tuscany.sca.http.ServletHost;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
@@ -30,31 +30,31 @@
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
/**
- * Implementation of the Feed binding provider factory.
+ * Implementation of the RSS binding provider factory.
*/
-public class FeedBindingProviderFactory implements BindingProviderFactory<FeedBinding> {
+public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> {
MessageFactory messageFactory;
ServletHost servletHost;
- public FeedBindingProviderFactory(ServletHost servletHost, MessageFactory messageFactory) {
+ public RSSBindingProviderFactory(ServletHost servletHost, MessageFactory messageFactory) {
this.servletHost = servletHost;
this.messageFactory = messageFactory;
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
RuntimeComponentReference reference,
- FeedBinding binding) {
- return new FeedReferenceBindingProvider(component, reference, binding);
+ RSSBinding binding) {
+ return new RSSReferenceBindingProvider(component, reference, binding);
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
RuntimeComponentService service,
- FeedBinding binding) {
- return new FeedServiceBindingProvider(component, service, binding, servletHost, messageFactory);
+ RSSBinding binding) {
+ return new RSSServiceBindingProvider(component, service, binding, servletHost, messageFactory);
}
- public Class<FeedBinding> getModelType() {
- return FeedBinding.class;
+ public Class<RSSBinding> getModelType() {
+ return RSSBinding.class;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org