diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-24 21:41:17 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-24 21:41:17 +0000 |
commit | 4abe8b6a78e80783baa3b87aa87da49d1d338567 (patch) | |
tree | 24e280dff749c2006a0b2eaf3dc3523fd242ce72 /sca-java-2.x/trunk/modules | |
parent | fd6518e7e98dbb5964e39958c578b3013476af5d (diff) |
Porting Binding.RSS for 2.x runtime SPIs
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@927191 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
19 files changed, 201 insertions, 176 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/pom.xml b/sca-java-2.x/trunk/modules/binding-rss-runtime/pom.xml index 4588d71540..a6bb39de01 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/pom.xml +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/pom.xml @@ -22,54 +22,54 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-modules</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> - <artifactId>tuscany-binding-rss-rome</artifactId> + <artifactId>tuscany-binding-rss-runtime</artifactId> <name>Apache Tuscany SCA RSS Feed Binding Extension</name> <dependencies> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-assembly</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-binding-rss</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-interface-java</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-data-api</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core-spi</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-databinding</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-host-http</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> @@ -81,42 +81,7 @@ <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> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-jetty</artifactId> - <version>1.7-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>1.7-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.7-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.5</version> - <scope>test</scope> + <version>1.0</version> </dependency> <dependency> @@ -146,7 +111,41 @@ </exclusion> </exclusions> </dependency> - + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.1</version> + <scope>test</scope> + </dependency> </dependencies> @@ -155,7 +154,7 @@ <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> - + <version>2.0.1</version> <configuration> <instructions> <Bundle-Version>${tuscany.version}</Bundle-Version> diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java index ed86dc4848..581ae59ae6 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.binding.rss.collection; -import org.osoa.sca.annotations.Remotable; +import org.oasisopen.sca.annotation.Remotable; import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.feed.synd.SyndFeed; diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java index 2213b50b53..a2b83465da 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java @@ -20,7 +20,7 @@ package org.apache.tuscany.sca.binding.rss.collection; import java.io.InputStream; -import org.osoa.sca.annotations.Remotable; +import org.oasisopen.sca.annotation.Remotable; import com.sun.syndication.feed.atom.Entry; diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java index 96493a5150..44c84ce5bb 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java @@ -46,7 +46,7 @@ import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.apache.tuscany.sca.runtime.Invocable; import com.sun.syndication.feed.synd.SyndContent; import com.sun.syndication.feed.synd.SyndContentImpl; @@ -69,7 +69,7 @@ class RSSBindingListenerServlet extends HttpServlet { private static final Logger logger = Logger.getLogger(RSSBindingListenerServlet.class.getName()); private static final long serialVersionUID = 1L; - private RuntimeWire wire; + private Invocable wire; private Invoker getFeedInvoker; private Invoker getAllInvoker; private Invoker queryInvoker; @@ -85,7 +85,7 @@ class RSSBindingListenerServlet extends HttpServlet { * @param wire * @param messageFactory */ - RSSBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator) { + RSSBindingListenerServlet(Invocable wire, MessageFactory messageFactory, Mediator mediator) { this.wire = wire; this.messageFactory = messageFactory; this.mediator = mediator; diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java index d588f041db..e1bafdd3cd 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java @@ -20,8 +20,8 @@ package org.apache.tuscany.sca.binding.rss.provider; import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.host.http.ServletHost; @@ -30,9 +30,8 @@ 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; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; /** * Implementation of the RSS binding provider factory. @@ -48,21 +47,17 @@ public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBind public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) { ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); this.servletHost = servletHosts.getServletHosts().get(0); - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.messageFactory = modelFactories.getFactory(MessageFactory.class); this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class); } - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - RSSBinding binding) { - return new RSSReferenceBindingProvider(component, reference, binding); + public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) { + return new RSSReferenceBindingProvider(endpointReference, mediator); } - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - RSSBinding binding) { - return new RSSServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator); + public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) { + return new RSSServiceBindingProvider(endpoint, messageFactory, mediator, servletHost); } public Class<RSSBinding> getModelType() { diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java index 8a30e9d3fb..d234a0c92c 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java @@ -19,12 +19,13 @@ package org.apache.tuscany.sca.binding.rss.provider; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.rss.RSSBinding; +import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; /** @@ -34,14 +35,16 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentReference; */ class RSSReferenceBindingProvider implements ReferenceBindingProvider { + private EndpointReference endpointReference; + private RuntimeComponentReference reference; private RSSBinding binding; - RSSReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - RSSBinding binding) { - this.reference = reference; - this.binding = binding; + RSSReferenceBindingProvider(EndpointReference endpointReference, + Mediator mediator) { + this.endpointReference = endpointReference; + this.reference = (RuntimeComponentReference) endpointReference.getReference(); + this.binding = (RSSBinding) endpointReference.getBinding(); } public Invoker createInvoker(Operation operation) { diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java index 4e5429ac83..25ab939341 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java @@ -25,9 +25,8 @@ import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.apache.tuscany.sca.runtime.Invocable; +import org.apache.tuscany.sca.runtime.RuntimeEndpoint; /** * Implementation of the RSS binding provider. @@ -36,28 +35,32 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; */ class RSSServiceBindingProvider implements ServiceBindingProvider { - private RuntimeComponentService service; + private RuntimeEndpoint endpoint; + + //private RuntimeComponentService service; private RSSBinding binding; - private ServletHost servletHost; + private MessageFactory messageFactory; - private String servletMapping; private Mediator mediator; - - RSSServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - RSSBinding binding, - ServletHost servletHost, + private ServletHost servletHost; + + private String servletMapping; + + RSSServiceBindingProvider(RuntimeEndpoint endpoint, MessageFactory messageFactory, - Mediator mediator) { - this.service = service; - this.binding = binding; + Mediator mediator, + ServletHost servletHost) { + this.endpoint = endpoint; + + //this.service = (RuntimeComponentService)endpoint.getService(); + this.binding = (RSSBinding) endpoint.getBinding(); this.servletHost = servletHost; this.messageFactory = messageFactory; this.mediator = mediator; } public InterfaceContract getBindingInterfaceContract() { - return service.getInterfaceContract(); + return endpoint.getComponentTypeServiceInterfaceContract(); } public boolean supportsOneWayInvocation() { @@ -65,17 +68,22 @@ class RSSServiceBindingProvider implements ServiceBindingProvider { } public void start() { - RuntimeComponentService componentService = (RuntimeComponentService)service; - RuntimeWire wire = componentService.getRuntimeWire(binding); + Invocable wire = (RuntimeEndpoint) endpoint; RSSBindingListenerServlet servlet = new RSSBindingListenerServlet(wire, messageFactory, mediator); servletMapping = binding.getURI(); + if (!servletMapping.endsWith("/")) { + servletMapping += "/"; + } + if (!servletMapping.endsWith("*")) { + servletMapping += "*"; + } servletHost.addServletMapping(servletMapping, servlet); - + // Save the actual binding URI in the binding - binding.setURI(servletHost.getURLMapping(binding.getURI()).toString()); + //binding.setURI(servletHost.getURLMapping(binding.getURI()).toString()); } public void stop() { diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java index 19370285f5..1ae4515e70 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java @@ -19,17 +19,24 @@ package org.apache.tuscany.sca.binding.rss; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + public class Consumer { public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite"); + String contribution = ContributionLocationHelper.getContributionLocation(Consumer.class); + Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Consumer.composite", new Contribution("consumer", contribution)); + + node.start(); - CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient"); + CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient"); testService.testCustomerCollection(); - scaDomain.close(); + node.stop(); } } diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java index e71156c379..a80f721136 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java @@ -20,7 +20,7 @@ package org.apache.tuscany.sca.binding.rss; import org.apache.tuscany.sca.binding.rss.collection.Collection; -import org.osoa.sca.annotations.Reference; +import org.oasisopen.sca.annotation.Reference; import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.feed.synd.SyndFeed; diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java index 02d73ab3ae..4b5bf373e7 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java @@ -29,7 +29,7 @@ import java.util.UUID; import org.apache.tuscany.sca.binding.rss.collection.Collection; import org.apache.tuscany.sca.binding.rss.collection.NotFoundException; -import org.osoa.sca.annotations.Scope; +import org.oasisopen.sca.annotation.Scope; import com.sun.syndication.feed.synd.SyndContent; import com.sun.syndication.feed.synd.SyndContentImpl; diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java index ae7b72834e..6dc23ac503 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java @@ -21,13 +21,21 @@ package org.apache.tuscany.sca.binding.rss; import java.io.IOException; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; public class Provider { public static void main(String[] args) { + + + String contribution = ContributionLocationHelper.getContributionLocation(Provider.class); + Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/feed/Provider.composite", new Contribution("provider", contribution)); + + node.start(); - SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite"); System.out.println("Provider.composite ready..."); try { @@ -36,6 +44,6 @@ public class Provider { e.printStackTrace(); } - scaDomain.close(); + node.stop(); } } diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java index cb5c280211..8eb007d75c 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java @@ -21,7 +21,10 @@ package org.apache.tuscany.sca.binding.rss; import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -30,33 +33,39 @@ import org.junit.Test; * Basic test case that will get the feed entries from an RSS feed. */ public class RSSGetTestCase { - protected static SCADomain scaConsumerDomain; - protected static SCADomain scaProviderDomain; + protected static Node scaConsumerNode; + protected static Node scaProviderNode; protected static CustomerClient testService; @BeforeClass public static void init() throws Exception { System.out.println(">>>RSSGetTestCase.init entry"); - scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/rss/Provider.composite"); - scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/rss/Consumer.composite"); - testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient"); + String contribution = ContributionLocationHelper.getContributionLocation(RSSGetTestCase.class); + + scaProviderNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Provider.composite", new Contribution("provider", contribution)); + scaProviderNode.start(); + + scaConsumerNode = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/rss/Consumer.composite", new Contribution("consumer", contribution)); + scaConsumerNode.start(); + + testService = scaConsumerNode.getService(CustomerClient.class, "CustomerClient"); } @AfterClass public static void destroy() throws Exception { // System.out.println(">>>RSSGetTestCase.destroy entry"); - if (scaConsumerDomain != null) { - scaConsumerDomain.close(); + if (scaConsumerNode != null) { + scaConsumerNode.stop(); } - if (scaProviderDomain != null) { - scaProviderDomain.close(); + if (scaProviderNode != null) { + scaProviderNode.stop(); } } @Test public void testPrelim() throws Exception { - Assert.assertNotNull(scaProviderDomain); - Assert.assertNotNull(scaConsumerDomain); + Assert.assertNotNull(scaProviderNode); + Assert.assertNotNull(scaConsumerNode); Assert.assertNotNull(testService); } diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite index 48ab6b94b2..22141805cd 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. --> -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://customer" name="Consumer"> diff --git a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite index 45718dfedb..b2b1f3d776 100644 --- a/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite +++ b/sca-java-2.x/trunk/modules/binding-rss-runtime/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. --> -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace = "http://customer" name="Provider">
diff --git a/sca-java-2.x/trunk/modules/binding-rss/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-rss/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..1e38fa53a5 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rss/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0
+Export-Package: org.apache.tuscany.sca.binding.rss;
+ uses:="org.apache.tuscany.sca.assembly";version="2.0.0"
+SCA-Version: 1.1
+Bundle-Name: Apache Tuscany SCA RSS Feed Binding Extension
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA RSS Feed Binding Extension
+Import-Package: javax.xml.namespace,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.binding.rss;version="2.0.0",
+ org.apache.tuscany.sca.core,
+ org.apache.tuscany.sca.monitor
+Bundle-SymbolicName: org.apache.tuscany.sca.binding.rss
+Bundle-DocURL: http://www.apache.org/
+
diff --git a/sca-java-2.x/trunk/modules/binding-rss/pom.xml b/sca-java-2.x/trunk/modules/binding-rss/pom.xml index a59b5eb0b6..a52b183471 100644 --- a/sca-java-2.x/trunk/modules/binding-rss/pom.xml +++ b/sca-java-2.x/trunk/modules/binding-rss/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-modules</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> @@ -33,66 +33,46 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-assembly</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-interface-java</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-data-api</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core-spi</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>1.7-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.7-SNAPSHOT</version> + <artifactId>tuscany-node-impl</artifactId> + <version>2.0-SNAPSHOT</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.5</version> + <version>4.8.1</version> <scope>test</scope> </dependency> </dependencies> - - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - - <configuration> - <instructions> - <Bundle-Version>${tuscany.version}</Bundle-Version> - <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rss</Bundle-SymbolicName> - <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.binding.rss*</Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> diff --git a/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java b/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java index 2b4989264c..bda3210e73 100644 --- a/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java +++ b/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java @@ -19,10 +19,15 @@ package org.apache.tuscany.sca.binding.rss; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Binding; /** * RSS Feed binding model. + * + * @version $Rev$ $Date$ */ public interface RSSBinding extends Binding { + QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.rss"); } diff --git a/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java b/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java index 6158752e7c..00abffafb5 100644 --- a/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java +++ b/sca-java-2.x/trunk/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java @@ -19,43 +19,38 @@ package org.apache.tuscany.sca.binding.rss.impl; -import java.util.ArrayList; -import java.util.List; +import javax.xml.namespace.QName; +import org.apache.tuscany.sca.assembly.OperationSelector; +import org.apache.tuscany.sca.assembly.WireFormat; import org.apache.tuscany.sca.binding.rss.RSSBinding; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; /** * Implementation of the RSS Feed binding model. + * + * @version $Rev$ $Date$ */ -class RSSBindingImpl implements RSSBinding, PolicySetAttachPoint { +class RSSBindingImpl implements RSSBinding { private String name; private String uri; - private List<Intent> requiredIntents = new ArrayList<Intent>(); - private List<PolicySet> policySets = new ArrayList<PolicySet>(); - private IntentAttachPointType intentAttachPointType; - private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>(); - public List<PolicySet> getApplicablePolicySets() { - return applicablePolicySets; + public QName getType() { + return RSSBinding.TYPE; } public String getName() { return name; } - public String getURI() { - return uri; - } - public void setName(String name) { this.name = name; } + public String getURI() { + return uri; + } + public void setURI(String uri) { this.uri = uri; } @@ -68,28 +63,25 @@ class RSSBindingImpl implements RSSBinding, PolicySetAttachPoint { // The binding is always resolved } - public List<PolicySet> getPolicySets() { - return policySets; + public WireFormat getRequestWireFormat() { + return null; } - public List<Intent> getRequiredIntents() { - return requiredIntents; + public void setRequestWireFormat(WireFormat wireFormat) { } - - public IntentAttachPointType getType() { - return intentAttachPointType; + + public WireFormat getResponseWireFormat() { + return null; } - public void setType(IntentAttachPointType intentAttachPointType) { - this.intentAttachPointType = intentAttachPointType; + public void setResponseWireFormat(WireFormat wireFormat) { } - public void setPolicySets(List<PolicySet> policySets) { - this.policySets = policySets; + public OperationSelector getOperationSelector() { + return null; } - - public void setRequiredIntents(List<Intent> intents) { - this.requiredIntents = intents; + + public void setOperationSelector(OperationSelector operationSelector) { } @Override diff --git a/sca-java-2.x/trunk/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/trunk/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor index 2d0597ff01..d298c16673 100644 --- a/sca-java-2.x/trunk/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ b/sca-java-2.x/trunk/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -16,4 +16,4 @@ # under the License. # Implementation class for the artifact processor extension -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.rss,model=org.apache.tuscany.sca.binding.rss.RSSBinding,factory=org.apache.tuscany.sca.binding.rss.RSSBindingFactory +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.rss,model=org.apache.tuscany.sca.binding.rss.RSSBinding,factory=org.apache.tuscany.sca.binding.rss.RSSBindingFactory |