diff options
Diffstat (limited to 'branches/sca-java-0.91/modules/binding-feed/src')
14 files changed, 0 insertions, 838 deletions
diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java deleted file mode 100644 index a4e2861aba..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/DefaultFeedBindingFactory.java +++ /dev/null @@ -1,32 +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.feed; - -import org.apache.tuscany.sca.binding.feed.impl.FeedBindingImpl; - -/** - * A factory for the Feed binding model. - */ -public class DefaultFeedBindingFactory implements FeedBindingFactory { - - public FeedBinding createFeedBinding() { - return new FeedBindingImpl(); - } -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.java deleted file mode 100644 index 3a0763bd93..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/Feed.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.feed; - -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. - * - * @version $Rev$ $Date$ - */ -@Remotable -public interface Feed { - - /** - * Get an RSS or Atom feed. - * - * @param uri the uri of the feed - * @return the RSS or Atom feed - */ - SyndFeed get(String uri); -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java deleted file mode 100644 index bec56404cd..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBinding.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.feed; - -import org.apache.tuscany.sca.assembly.Binding; - -/** - * A model for the Feed binding. - */ -public interface FeedBinding 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); - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java deleted file mode 100644 index e98aefe2c9..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/FeedBindingFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.feed; - -/** - * A factory for the Feed binding model. - */ -public interface FeedBindingFactory { - - /** - * Creates a new Feed binding. - * - * @return a new Feed binding - */ - FeedBinding createFeedBinding(); -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java deleted file mode 100644 index 5e0dea223c..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/FeedBindingImpl.java +++ /dev/null @@ -1,85 +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.feed.impl; - -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.sca.binding.feed.FeedBinding; -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 { - - private String name; - private String uri; - private String feedType; - - 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 sample 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() { - return false; - } - - public void setUnresolved(boolean unresolved) { - // The binding is always resolved - } - - public String getFeedType() { - return feedType; - } - - public void setFeedType(String value) { - feedType = value; - } - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java deleted file mode 100644 index e91f184339..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/module/FeedModuleActivator.java +++ /dev/null @@ -1,64 +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.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.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.http.ServletHost; -import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; - -/** - * A module activator for the Feed binding extension. - */ -public class FeedModuleActivator implements ModuleActivator { - - public Object[] getExtensionPoints() { - // No extensionPoints being contributed here - return null; - } - - public void start(ExtensionPointRegistry registry) { - - // Create the Feed model factory - FeedBindingFactory factory = new DefaultFeedBindingFactory(); - - // Add the AtomBindingProcessor and RSSBindingProcessor extensions - StAXArtifactProcessorExtensionPoint processors = - registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - AtomBindingProcessor atomBindingProcessor = new AtomBindingProcessor(factory); - processors.addArtifactProcessor(atomBindingProcessor); - RssBindingProcessor rssBindingProcessor = new RssBindingProcessor(factory); - processors.addArtifactProcessor(rssBindingProcessor); - - // Add the Feed binding provider factory extension - ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); - ServletHost servletHost = registry.getExtensionPoint(ServletHost.class); - providerFactories.addProviderFactory(new FeedBindingProviderFactory(servletHost)); - } - - public void stop(ExtensionPointRegistry registry) { - } -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java deleted file mode 100644 index 63bbe7a9fd..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingInvoker.java +++ /dev/null @@ -1,79 +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.feed.provider; - -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.synd.SyndFeed; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedInput; -import com.sun.syndication.io.XmlReader; - -/** - * Invoker for the Feed binding. - */ -public class FeedBindingInvoker implements Invoker { - - private String uri; - - public FeedBindingInvoker(String uri, String feedType) { - this.uri = uri; - } - - 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()); - } - } else { - feedURL = new URL(uri); - } - - // Read the configured feed into a Feed object - SyndFeedInput input = new SyndFeedInput(); - SyndFeed feed = input.build(new XmlReader(feedURL)); - msg.setBody(feed); - - System.out.println(">>> FeedBindingInvoker (" + feed.getFeedType() + ") " + uri); - - } 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; - } - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListener.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListener.java deleted file mode 100644 index 0ceb1f9064..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListener.java +++ /dev/null @@ -1,89 +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.feed.provider; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.tuscany.sca.binding.feed.Feed; - -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedOutput; - -/** - * A Feed binding listener, implemented as a servlet and register in a - * servlet host provided by the SCA hosting runtime. - */ -public class FeedBindingListener extends HttpServlet { - private static final long serialVersionUID = 1L; - - String serviceName; - Class<?> serviceInterface; - Object serviceInstance; - String feedType; - - public FeedBindingListener(String serviceName, Class<?> serviceInterface, Object serviceInstance, String feedType) { - this.serviceName = serviceName; - this.serviceInterface = serviceInterface; - this.serviceInstance = serviceInstance; - this.feedType = feedType; - } - - @Override - public void init(ServletConfig config) { - } - - @Override - public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - - // The feedType parameter is used to override what type of feed is going to - // be produced - String requestFeedType = request.getParameter("feedType"); - if (requestFeedType == null) - requestFeedType = feedType; - - System.out.println(">>> FeedEndPointServlet (" + requestFeedType + ") " + request.getRequestURI()); - - // Assuming that the service provided by this binding implements the Feed - // service interface, get the Feed from the service - String uri = request.getRequestURL().toString(); - SyndFeed syndFeed = ((Feed)serviceInstance).get(uri); - syndFeed.setFeedType(requestFeedType); - - // Write the Feed to the servlet output - OutputStream output = response.getOutputStream(); - SyndFeedOutput syndOutput = new SyndFeedOutput(); - try { - syndOutput.output(syndFeed, new PrintWriter(output)); - } catch (FeedException e) { - throw new ServletException(e); - } - - output.flush(); - output.close(); - } -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java deleted file mode 100644 index 9e855b7b2f..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingProviderFactory.java +++ /dev/null @@ -1,57 +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.feed.provider; - -import org.apache.tuscany.sca.binding.feed.FeedBinding; -import org.apache.tuscany.sca.http.ServletHost; -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 Feed binding provider factory. - */ -public class FeedBindingProviderFactory implements BindingProviderFactory<FeedBinding> { - - ServletHost servletHost; - - public FeedBindingProviderFactory(ServletHost servletHost) { - this.servletHost = servletHost; - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - FeedBinding binding) { - return new FeedReferenceBindingProvider(component, reference, binding); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - FeedBinding binding) { - return new FeedServiceBindingProvider(component, service, binding, servletHost); - } - - public Class<FeedBinding> getModelType() { - return FeedBinding.class; - } -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedReferenceBindingProvider.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedReferenceBindingProvider.java deleted file mode 100644 index 2e14d49e52..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedReferenceBindingProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.feed.provider; - -import org.apache.tuscany.sca.binding.feed.FeedBinding; -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 Feed binding provider. - */ -public class FeedReferenceBindingProvider implements ReferenceBindingProvider { - - private RuntimeComponentReference reference; - private FeedBinding binding; - - public FeedReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - FeedBinding binding) { - this.reference = reference; - this.binding = binding; - } - - public Invoker createInvoker(Operation operation, boolean isCallback) { - if (isCallback) { - throw new UnsupportedOperationException(); - } else { - return new FeedBindingInvoker(binding.getURI(), binding.getFeedType()); - } - } - - public InterfaceContract getBindingInterfaceContract() { - return reference.getInterfaceContract(); - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedServiceBindingProvider.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedServiceBindingProvider.java deleted file mode 100644 index 64b4807998..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedServiceBindingProvider.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.binding.feed.provider; - -import org.apache.tuscany.sca.binding.feed.FeedBinding; -import org.apache.tuscany.sca.http.ServletHost; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * Implementation of the Feed binding provider. - */ -public class FeedServiceBindingProvider implements ServiceBindingProvider { - - private RuntimeComponent component; - private RuntimeComponentService service; - private FeedBinding binding; - private ServletHost servletHost; - private String uri; - - public FeedServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - FeedBinding binding, - ServletHost servletHost) { - this.component = component; - this.service = service; - this.binding = binding; - this.servletHost = servletHost; - uri = binding.getURI(); - if (uri == null) { - uri = "/" + component.getName(); - } - } - - public InterfaceContract getBindingInterfaceContract() { - return service.getInterfaceContract(); - } - - public void start() { - Class<?> aClass = getTargetJavaClass(service.getInterfaceContract().getInterface()); - Object instance = component.createSelfReference(aClass).getService(); - - FeedBindingListener servlet = - new FeedBindingListener(binding.getName(), aClass, instance, binding.getFeedType()); - - servletHost.addServletMapping(uri, servlet); - } - - public void stop() { - servletHost.removeServletMapping(uri); - } - - private Class<?> getTargetJavaClass(Interface targetInterface) { - return ((JavaInterface)targetInterface).getJavaClass(); - } -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/AtomBindingProcessor.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/AtomBindingProcessor.java deleted file mode 100644 index 800acba9ed..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/AtomBindingProcessor.java +++ /dev/null @@ -1,79 +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.feed.xml; - -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.FeedBinding; -import org.apache.tuscany.sca.binding.feed.FeedBindingFactory; -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<FeedBinding> { - - private final static QName BINDING_ATOM = new QName(SCA_NS, "binding.atom"); - - private final FeedBindingFactory factory; - - /** - * Constructs a new binding processor. - * @param factory - */ - public AtomBindingProcessor(FeedBindingFactory factory) { - this.factory = factory; - } - - public QName getArtifactType() { - return BINDING_ATOM; - } - - public Class<FeedBinding> getModelType() { - return FeedBinding.class; - } - - public FeedBinding read(XMLStreamReader reader) throws ContributionReadException { - - // Read a <binding.atom> element - String uri = reader.getAttributeValue(null, "uri"); - FeedBinding binding = factory.createFeedBinding(); - binding.setFeedType("atom_1.0"); - if (uri != null) { - binding.setURI(uri.trim()); - } - return binding; - } - - public void write(FeedBinding binding, XMLStreamWriter writer) throws ContributionWriteException { - } - - public void resolve(FeedBinding binding, ModelResolver resolver) throws ContributionResolveException { - } - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/RssBindingProcessor.java b/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/RssBindingProcessor.java deleted file mode 100644 index abdfcf0bff..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/xml/RssBindingProcessor.java +++ /dev/null @@ -1,79 +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.feed.xml; - -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.FeedBinding; -import org.apache.tuscany.sca.binding.feed.FeedBindingFactory; -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<FeedBinding> { - - private final static QName BINDING_RSS = new QName(SCA_NS, "binding.rss"); - - private final FeedBindingFactory factory; - - /** - * Constructs a new binding processor. - * @param factory - */ - public RssBindingProcessor(FeedBindingFactory factory) { - this.factory = factory; - } - - public QName getArtifactType() { - return BINDING_RSS; - } - - public Class<FeedBinding> getModelType() { - return FeedBinding.class; - } - - public FeedBinding read(XMLStreamReader reader) throws ContributionReadException { - - // Read the <binding.rss> element - String uri = reader.getAttributeValue(null, "uri"); - FeedBinding binding = factory.createFeedBinding(); - binding.setFeedType("rss_2.0"); - if (uri != null) { - binding.setURI(uri.trim()); - } - return binding; - } - - public void write(FeedBinding binding, XMLStreamWriter writer) throws ContributionWriteException { - } - - public void resolve(FeedBinding binding, ModelResolver resolver) throws ContributionResolveException { - } - -} diff --git a/branches/sca-java-0.91/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-0.91/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator deleted file mode 100644 index 49386b6275..0000000000 --- a/branches/sca-java-0.91/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.binding.feed.module.FeedModuleActivator
|