diff --git a/branches/sca-java-2.0-M3/distribution/all/manifests/axiom-api-1.2.7.MF b/branches/sca-java-2.0-M3/distribution/all/manifests/axiom-api-1.2.7.MF new file mode 100644 index 0000000000..400fdc58e8 --- /dev/null +++ b/branches/sca-java-2.0-M3/distribution/all/manifests/axiom-api-1.2.7.MF @@ -0,0 +1,48 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Axiom API +Bundle-SymbolicName: org.apache.ws.commons.axiom.axiom-api +Bundle-Version: 1.2.7 +Bundle-ClassPath: axiom-api-1.2.7.jar +Bundle-Vendor: Apache Software Foundation +Export-Package: org.apache.axiom.attachments, + org.apache.axiom.attachments.impl, + org.apache.axiom.attachments.lifecycle, + org.apache.axiom.attachments.lifecycle.impl, + org.apache.axiom.attachments.utils, + org.apache.axiom.om, + org.apache.axiom.om.ds, + org.apache.axiom.om.ds.custombuilder, + org.apache.axiom.om.impl, + org.apache.axiom.om.impl.builder, + org.apache.axiom.om.impl.exception, + org.apache.axiom.om.impl.serialize, + org.apache.axiom.om.impl.traverse, + org.apache.axiom.om.impl.util, + org.apache.axiom.om.util, + org.apache.axiom.om.xpath, + org.apache.axiom.soap, + org.apache.axiom.soap.impl.builder +Archiver-Version: Plexus Archiver +Build-Jdk: 1.5.0_15 +Created-By: Apache Maven +Bundle-DocURL: http://www.apache.org/ +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Built-By: dims +Import-Package: javax.activation, + javax.mail, + javax.mail.internet, + javax.xml.namespace, + javax.xml.stream, + org.apache.axiom.om.impl.dom.factory;resolution:=optional, + org.apache.axiom.om.impl.llom.factory;resolution:=optional, + org.apache.axiom.soap.impl.dom.factory;resolution:=optional, + org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, + org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, + org.apache.commons.logging, + org.jaxen;resolution:=optional, + org.jaxen.saxpath;resolution:=optional, + org.jaxen.util;resolution:=optional, + org.w3c.dom, + org.xml.sax, + org.xml.sax.helpers diff --git a/branches/sca-java-2.0-M3/distribution/all/pom.xml b/branches/sca-java-2.0-M3/distribution/all/pom.xml index 305acc5d44..b3cc21d03c 100644 --- a/branches/sca-java-2.0-M3/distribution/all/pom.xml +++ b/branches/sca-java-2.0-M3/distribution/all/pom.xml @@ -57,12 +57,23 @@ false true + + org.apache.ws.commons.axiom + axiom-api + 1.2.7 + ${basedir}/manifests/axiom-api-1.2.7.MF + org.apache.woden woden-impl-dom 1.0M8 ${basedir}/manifests/woden-impl-dom-1.0M8.MF + + org.apache.axis2 + * + * + diff --git a/branches/sca-java-2.0-M3/modules/binding-ws-axis2-policy/META-INF/MANIFEST.MF b/branches/sca-java-2.0-M3/modules/binding-ws-axis2-policy/META-INF/MANIFEST.MF index 0f0213707a..992af5dd44 100644 --- a/branches/sca-java-2.0-M3/modules/binding-ws-axis2-policy/META-INF/MANIFEST.MF +++ b/branches/sca-java-2.0-M3/modules/binding-ws-axis2-policy/META-INF/MANIFEST.MF @@ -44,7 +44,6 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.contribution.processor;version="2.0.0", org.apache.tuscany.sca.contribution.resolver;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", - org.apache.tuscany.sca.databinding.axiom;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", org.apache.tuscany.sca.invocation;version="2.0.0", org.apache.tuscany.sca.monitor;version="2.0.0", diff --git a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/META-INF/MANIFEST.MF b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/META-INF/MANIFEST.MF index adef101ef7..74869d3c4a 100644 --- a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/META-INF/MANIFEST.MF +++ b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/META-INF/MANIFEST.MF @@ -76,7 +76,14 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Axis2-based WS Binding Extensio n Eclipse-RegisterBuddy: org.apache.axis2.kernel -Import-Package: javax.security.auth.callback;resolution:=optional, +Import-Package: javax.xml.stream, + javax.xml.transform, + javax.xml.transform.dom, + javax.xml.parsers, + org.w3c.dom, + javax.activation;resolution:=optional, + org.xml.sax, + javax.security.auth.callback;resolution:=optional, javax.servlet, javax.servlet.http, javax.wsdl, @@ -86,9 +93,6 @@ Import-Package: javax.security.auth.callback;resolution:=optional, javax.wsdl.factory;resolution:=optional, javax.wsdl.xml;resolution:=optional, javax.xml.namespace, - javax.xml.stream, - javax.xml.transform, - javax.xml.transform.dom, org.apache.axiom.om, org.apache.axiom.om.impl.builder, org.apache.axiom.om.util, @@ -112,6 +116,7 @@ Import-Package: javax.security.auth.callback;resolution:=optional, org.apache.axis2.util.threadpool, org.apache.commons.httpclient, org.apache.commons.httpclient.params, + org.apache.commons.logging;resolution:=optional, org.apache.neethi, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.binding.ws;version="2.0.0", @@ -144,12 +149,8 @@ Import-Package: javax.security.auth.callback;resolution:=optional, org.apache.ws.security, org.apache.ws.security.handler, org.oasisopen.sca;version="2.0.0", - org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional, - org.w3c.dom, - javax.activation;resolution:=optional, - org.xml.sax + org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional Bundle-SymbolicName: org.apache.tuscany.sca.binding.ws.axis2 -Fragment-Host: org.apache.axis2.kernel Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5, JavaSE-1.6 diff --git a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/pom.xml b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/pom.xml index dcc97d3400..116c34e357 100644 --- a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/pom.xml +++ b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/pom.xml @@ -84,10 +84,17 @@ runtime + + org.apache.tuscany.sca + tuscany-databinding + 2.0-M3-SNAPSHOT + + org.apache.tuscany.sca tuscany-databinding-axiom 2.0-M3-SNAPSHOT + runtime diff --git a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java index cd3a6b38b8..1db1d94dee 100644 --- a/branches/sca-java-2.0-M3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java +++ b/branches/sca-java-2.0-M3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java @@ -29,6 +29,7 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -118,8 +119,6 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import edu.emory.mathcs.backport.java.util.Collections; - public class Axis2ServiceProvider { public static final String IMPORT_TAG = "import"; public static final String INCLUDE_TAG = "include"; diff --git a/branches/sca-java-2.0-M3/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java b/branches/sca-java-2.0-M3/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java index 3d20d968a3..a8bec24dab 100644 --- a/branches/sca-java-2.0-M3/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java +++ b/branches/sca-java-2.0-M3/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionScanner.java @@ -37,6 +37,7 @@ import org.apache.tuscany.sca.contribution.processor.ContributionException; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.scanner.ContributionScanner; import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; /** * Bundle Contribution package processor. @@ -123,19 +124,30 @@ public class OSGiBundleContributionScanner implements ContributionScanner { } List artifacts = new ArrayList(); + Set bundleClassPath = new HashSet(); + String cp = (String)bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH); + if (cp != null) { + String[] paths = cp.split(","); + for (String path : paths) { + bundleClassPath.add(path.trim()); + } + } try { Enumeration entries = bundle.findEntries("/", "*", true); while (entries.hasMoreElements()) { URL entry = (URL)entries.nextElement(); String entryName = entry.getPath(); + if (entryName.contains("/.svn/")) { + // Ignore .svn files + continue; + } if (entryName.startsWith("/")) { entryName = entryName.substring(1); } artifacts.add(entryName); - // FIXME: We probably should honor Bundle-ClassPath headers to deal with inner jars - if (entryName.endsWith(".jar")) { + if (entryName.endsWith(".jar") && bundleClassPath.contains(entryName)) { artifacts.addAll(getJarArtifacts(entry, entry.openStream())); } diff --git a/branches/sca-java-2.0-M3/modules/contribution/META-INF/MANIFEST.MF b/branches/sca-java-2.0-M3/modules/contribution/META-INF/MANIFEST.MF index aeda1d66a6..6d2c1e8380 100644 --- a/branches/sca-java-2.0-M3/modules/contribution/META-INF/MANIFEST.MF +++ b/branches/sca-java-2.0-M3/modules/contribution/META-INF/MANIFEST.MF @@ -49,6 +49,7 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.monitor;version="2.0.0", org.apache.tuscany.sca.policy;version="2.0.0", org.w3c.dom, + org.w3c.dom.ls, org.xml.sax, org.xml.sax.helpers Bundle-SymbolicName: org.apache.tuscany.sca.contribution diff --git a/branches/sca-java-2.0-M3/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/branches/sca-java-2.0-M3/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java index cd86fd21aa..b9eb6c117b 100644 --- a/branches/sca-java-2.0-M3/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java +++ b/branches/sca-java-2.0-M3/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java @@ -61,7 +61,7 @@ public class EndpointSerializerImpl implements EndpointSerializer { endpoint.setBinding(result.getBinding()); endpoint.setInterfaceContract(result.getService().getInterfaceContract()); } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage()); } } @@ -75,7 +75,7 @@ public class EndpointSerializerImpl implements EndpointSerializer { writer.close(); return sw.toString(); } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage()); } } @@ -89,7 +89,7 @@ public class EndpointSerializerImpl implements EndpointSerializer { endpointReference.setBinding(result.getBinding()); endpointReference.setInterfaceContract(result.getReference().getInterfaceContract()); } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage()); } } @@ -102,7 +102,7 @@ public class EndpointSerializerImpl implements EndpointSerializer { writer.close(); return sw.toString(); } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage()); } } } \ No newline at end of file diff --git a/branches/sca-java-2.0-M3/modules/databinding-axiom/META-INF/MANIFEST.MF b/branches/sca-java-2.0-M3/modules/databinding-axiom/META-INF/MANIFEST.MF index d1b38bea6c..bc9ebc0bc8 100644 --- a/branches/sca-java-2.0-M3/modules/databinding-axiom/META-INF/MANIFEST.MF +++ b/branches/sca-java-2.0-M3/modules/databinding-axiom/META-INF/MANIFEST.MF @@ -18,9 +18,6 @@ Import-Package: javax.xml.namespace, javax.xml.stream, org.apache.axiom.om, org.apache.axiom.om.impl.builder, - org.apache.axiom.om.impl.llom.factory;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap11;resolution:=optional, - org.apache.axiom.soap.impl.llom.soap12;resolution:=optional, org.apache.tuscany.sca.databinding;version="2.0.0", org.apache.tuscany.sca.databinding.axiom;version="2.0.0", org.apache.tuscany.sca.databinding.impl;version="2.0.0", @@ -30,6 +27,5 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.interfacedef.util;version="1.4", org.apache.tuscany.sca.policy;version="2.0.0" Bundle-SymbolicName: org.apache.tuscany.sca.databinding.axiom -Fragment-Host: org.apache.ws.commons.axiom.axiom-api Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 diff --git a/branches/sca-java-2.0-M3/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java b/branches/sca-java-2.0-M3/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java index fb2e8a8305..3f71117c1a 100644 --- a/branches/sca-java-2.0-M3/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java +++ b/branches/sca-java-2.0-M3/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeManager.java @@ -19,8 +19,8 @@ package org.apache.tuscany.sca.node.osgi.impl; +import java.net.URL; import java.util.Dictionary; -import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; @@ -68,12 +68,27 @@ public class NodeManager implements SynchronousBundleListener, ServiceListener { if (headers.get("SCA-Composite") != null) { return true; } - Enumeration entries = bundle.findEntries("OSGI-INF/sca", "*", false); + + URL bundleComposite = bundle.getResource("OSGI-INF/sca/bundle.composite"); + if (bundleComposite != null) { + return true; + } + + /* FIXME: What if there is a META-INF/sca-contribution.xml? There are two cases: + * 1. The file contains deployable elements + * 2. The file doesn't contain deployable elements + */ + + /* + * FIXME: Do we want to use all of the .composite files under OSGI-INF/sca? + */ + + /* + Enumeration entries = bundle.findEntries("OSGI-INF/sca", "bundle.composite", false); if (entries != null && entries.hasMoreElements()) { return true; } - /* // OSGi Declarative Services if (headers.get("Service-Component") != null) { return true; diff --git a/branches/sca-java-2.0-M3/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java b/branches/sca-java-2.0-M3/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java index 08f962fb0a..79aedc81c4 100644 --- a/branches/sca-java-2.0-M3/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java +++ b/branches/sca-java-2.0-M3/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java @@ -35,15 +35,14 @@ import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.PosixParser; -import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; /** * A launcher for SCA nodes. * * Agruments: * [-config ]: The configuration folder for Equinox + * [-bundles ]: A list of bundles to be installed * [-c ]: The composite URI * [-t ]: Time to live in milliseconds before the node is started * contribution1 ... contributionN: A list of contribution files or URLs @@ -128,6 +127,7 @@ public class NodeLauncher { if (cli.hasOption("config")) { System.setProperty("osgi.configuration.area", cli.getOptionValue("config")); } + while (true) { if (cli.hasOption("node")) { // Create a node from a configuration URI @@ -139,10 +139,28 @@ public class NodeLauncher { equinox = launcher.equinoxHost; node = launcher.createNode(configurationURI); - } else if (cli.hasOption("bundles")) { + } + else if (cli.hasOption("bundles")) { + /** + * osgi.bundles + * The comma-separated list of bundles which are automatically installed and optionally started once the system is up + * and running. Each entry is of the form: + * [@ [] [":start"]] + * If the start-level (>0 integer) is omitted then the framework will use the default start level for the bundle. + * If the "start" tag is added then the bundle will be marked as started after being installed. Simple bundle locations are + * interepreted as relative to the framework's parent directory. The start-level indicates the OSGi start level at which the + * bundle should run. If this value is not set, the system computes an appropriate default. + */ + String bundles = cli.getOptionValue("bundles"); + if (bundles != null) { + System.setProperty("osgi.bundles", cli.getOptionValue("bundles")); + } + // Create a node launcher NodeLauncher launcher = newInstance(); equinox = launcher.equinoxHost; + + /* List bundleFiles = cli.getArgList(); for (String bf : bundleFiles) { File f = new File(bf); @@ -159,8 +177,10 @@ public class NodeLauncher { // logger.log(Level.SEVERE, e.getMessage(), e); } } + */ - } else { + } + else { // Create a node from a composite URI and a contribution location String compositeURI = cli.getOptionValue("composite"); List contribs = cli.getArgList(); @@ -185,6 +205,7 @@ public class NodeLauncher { formatter.printHelp("java " + NodeLauncher.class.getName() + " [-config ]" + " [-c ]" + + " [-b ]" + " [-t ]" + " contribution1 ... contributionN", options); return; diff --git a/branches/sca-java-2.0-M3/pom.xml b/branches/sca-java-2.0-M3/pom.xml index 5fc1616b92..306557b50e 100644 --- a/branches/sca-java-2.0-M3/pom.xml +++ b/branches/sca-java-2.0-M3/pom.xml @@ -479,6 +479,13 @@ MANIFEST.MF + + ${basedir}/OSGI-INF + OSGI-INF + + **/* + + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/add-component.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/add-component.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/blueprint/operations-module.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/blueprint/operations-module.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/divide-component.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/divide-component.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/multiply-component.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/multiply-component.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.componentType rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.componentType diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/sca/bundle.composite rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/sca/bundle.composite diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/src/main/resources/OSGI-INF/subtract-component.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/OSGI-INF/subtract-component.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README new file mode 100644 index 0000000000..9e616c1f50 --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator-operations/README @@ -0,0 +1,183 @@ +Distributed OSGi Calculator Sample +================================== +This sample implements a distributed calculator using Distributed OSGi (RFC 119) over SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +On Windows, run +java -jar ..\..\modules\osgi-3.4.0-v20080605-1900.jar -configuration ..\..\features\configuration -clean -console + +On *Unix, run +java -jar ../../modules/osgi-3.4.0-v20080605-1900.jar -configuration ../../features/configuration -clean -console + +You should see the osgi console: + +osgi> + +osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start +INFO: Equinox-based service discoverer is now configured. + +You can run "ss" command under the osgi> to see the status of the bundles. +osgi> ss + +Then you can install and start the calculator.dosgi bundle: + +osgi> install file:./target/sample-dosgi-calculator-operations.jar +Bundle id is 181 + +osgi> start 181 +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Starting file:./target/sample-dosgi-calculator-operations.jar [181] +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.AddService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.SubtractService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.MultiplyService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator sta +rt +INFO: Registering calculator.dosgi.operations.DivideService +Jun 22, 2009 2:09:21 PM calculator.dosgi.operations.impl.OperationsActivator get +Bundle +INFO: calculator.dosgi.operations.AddService is loaded by bundle: calculator.dos +gi.operations +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.node.impl.NodeImpl start +INFO: Starting node: calculator.dosgi.operations +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.node.impl.NodeFactoryImpl configu +reNode +INFO: Loading contribution: bundleentry://181/ +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(AddService/AddService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/AddService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(SubtractService/SubtractService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/SubtractService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(MultiplyService/MultiplyService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/MultiplyService +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = OperationsComponent#serv +ice-binding(DivideService/DivideService) +Jun 22, 2009 2:09:21 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost registerS +ervice +INFO: RMI service registered: rmi://localhost:8085/DivideService + +osgi> + +To stop the bundle: + +osgi> stop 181 +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: calculator.dosgi.operations +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(AddService/AddService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/AddService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(SubtractService/SubtractService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/SubtractService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(MultiplyService/MultiplyService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/MultiplyService +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = OperationsComponent#s +ervice-binding(DivideService/DivideService) +Jun 22, 2009 2:09:48 PM org.apache.tuscany.sca.host.rmi.DefaultRMIHost unregiste +rService +INFO: RMI service unregistered: rmi://localhost:8085/DivideService +Jun 22, 2009 2:09:48 PM calculator.dosgi.operations.impl.OperationsActivator sto +p +INFO: Stopping file:./target/sample-dosgi-calculator-operations.jar [181] + +osgi> + +To exit the console, run: +osgi> exit + +Sample Overview +--------------- +The application consists of two OSGi bundles: + * The calculator bundle: It provides the calculator service. The service is implemented by a java class that + consumes other services to perform the “add”, “subtract”, “multiply” and “divide” operations. + * The operations bundle: It provides the add/subtract/multiply/divide services. + (See ../samples/dosgi-calculator-operations) + + +dosgi-calculator-operations/ + src/ + main/ + java/ + calculator/ + dosgi/ + operations/ + AddService.java - Interface for Add + SubtractService.java - Interface for Subtract + MultiplyService.java - Interface for Multiply + DivideService.java - Interface for Divide + impl/ + OperationsActivator.java - OSGi bundle activator + AddServiceImpl.java - Implementation for Add + SubtractServiceImpl.java - Implementation for Subtract + MultiplyServiceImpl.java - Implementation for Multiply + DivideServiceImpl.java - Implementation for Divide + resources/ + META-INF/ + sca-contribution.xml + OSGI-INF/ + sca/ + bundle.componentType - The component type for implementation.osgi of this bundle + bundle.composite - The composite file + test/ + java/ + src/ + calculator/ + dosgi/ + operations/ + test/ + OperationsOSGiNodeTestCase.java - The JUNIT test case that tests this bundle using a RMI client + + META-INF/ + MANIFEST.MF - The OSGi manifest for this bundle + pom.xml - the Maven build file + + + +Building And Running The Test Case Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd dosgi-calculator-operations +mvn + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/blueprint/calculator-module.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/blueprint/calculator-module.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/calculator-component.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/calculator-component.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/remote-service/calculator-service-descriptions.xml rename to branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/remote-service/calculator-service-descriptions.xml diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.componentType rename to branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.componentType diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite b/branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite similarity index 100% rename from branches/sca-java-2.0-M3/samples/dosgi-calculator/src/main/resources/OSGI-INF/sca/bundle.composite rename to branches/sca-java-2.0-M3/samples/dosgi-calculator/OSGI-INF/sca/bundle.composite diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/README b/branches/sca-java-2.0-M3/samples/dosgi-calculator/README new file mode 100644 index 0000000000..374c0f0a8b --- /dev/null +++ b/branches/sca-java-2.0-M3/samples/dosgi-calculator/README @@ -0,0 +1,155 @@ +Distributed OSGi Calculator Sample +================================== +This sample implements a distributed calculator using Distributed OSGi (RFC 119) over SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +On Windows, run +java -jar ..\..\modules\osgi-3.4.0-v20080605-1900.jar -configuration ..\..\features\configuration -clean -console + +On *Unix, run +java -jar ../../modules/osgi-3.4.0-v20080605-1900.jar -configuration ../../features/configuration -clean -console + +You should see the osgi console: + +osgi> + +osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start +INFO: Equinox-based service discoverer is now configured. + +You can run "ss" command under the osgi> to see the status of the bundles. +osgi> ss + +Then you can install and start the calculator.dosgi bundle: + +osgi> install file:./target/sample-dosgi-calculator.jar +Bundle id is 181 + +osgi> start 181 +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator start +INFO: Starting file:./target/sample-dosgi-calculator.jar [181] +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator start +INFO: Registering calculator.dosgi.CalculatorService +Jun 22, 2009 1:37:21 PM calculator.dosgi.impl.CalculatorActivator getBundle +INFO: calculator.dosgi.operations.AddService is loaded by bundle: calculator.dos +gi +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.node.impl.NodeImpl start +INFO: Starting node: calculator.dosgi +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.node.impl.NodeFactoryImpl configu +reNode +INFO: Loading contribution: bundleentry://181/ +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpoint +INFO: EndpointRegistry: Add endpoint - Endpoint: URI = CalculatorComponent#serv +ice-binding(CalculatorService/CalculatorService) +2009-06-22 13:37:21.953::INFO: jetty-6.1.x +2009-06-22 13:37:21.953::INFO: Started SelectChannelConnector@0.0.0.0:8086 +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.http.jetty.JettyServer addServlet +Mapping +INFO: Added Servlet mapping: http://rfengt61p:8086/CalculatorService +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(addService/addService) Target = Endpoint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(subtractService/subtractService) Target = Endp +oint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(multiplyService/multiplyService) Target = Endp +oint: +Jun 22, 2009 1:37:21 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry addEndpointReference +INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference: URI = Calc +ulatorComponent#reference-binding(divideService/divideService) Target = Endpoint +: + +osgi> + +You can point your browser to http://localhost:8086/CalculatorService?wsdl to see +the WSDL. + +You can also use the WebService Explorer from Eclipse WTP to test the Web Service. + +To stop the bundle: + +osgi> stop 181 +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: calculator.dosgi +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpoin +tRegistry removeEndpoint +INFO: EndpointRegistry: Remove endpoint - Endpoint: URI = CalculatorComponent#s +ervice-binding(CalculatorService/CalculatorService) +Jun 22, 2009 1:39:09 PM org.apache.tuscany.sca.http.jetty.JettyServer removeServ +letMapping +INFO: Removed Servlet mapping: /CalculatorService +Jun 22, 2009 1:39:09 PM calculator.dosgi.impl.CalculatorActivator stop +INFO: Stopping file:./target/sample-dosgi-calculator.jar [181] + +To exit the console, run: +osgi> exit + +Sample Overview +--------------- +The application consists of two OSGi bundles: + * The calculator bundle: It provides the calculator service. The service is implemented by a java class that + consumes other services to perform the “add”, “subtract”, “multiply” and “divide” operations. + * The operations bundle: It provides the add/subtract/multiply/divide services. + (See ../samples/dosgi-calculator-operations) + + +dosgi-calculator/ + src/ + main/ + java/ + calculator/ + dosgi/ + CalculatorService.java - The interface for Calculator service + impl/ + CalculatorActivator.java - OSGi bundle activator for Calculator bundle + CalculatorServiceDSImpl.java - OSGi declarative service based implementation + CalculatorServiceImpl.java - Basic OSGi implementation + operations/ + AddService.java - Interface for Add + SubtractService.java - Interface for Subtract + MultiplyService.java - Interface for Multiply + DivideService.java - Interface for Divide + rmi/ + OperationsRemote.java - RMI remote interface for operations + OperationsRMIServer_Stub.java - RMI stub + OperationsRMIServer.java - RMI server implementation of the operations + resources/ + META-INF/ + sca-contribution.xml + OSGI-INF/ + sca/ + bundle.componentType - The component type for implementation.osgi of this bundle + bundle.composite - The composite file + test/ + java/ + src/ + calculator/ + dosgi/ + test/ + CalculatorOSGiNodeTestCase.java - The JUNIT test case that tests this bundle against a RMI service + + META-INF/ + MANIFEST.MF - The OSGi manifest for this bundle + dosig-calculator.png - a pictorial representation of the sample + pom.xml - the Maven build file + + + +Building And Running The Test Case Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd dosgi-calculator +mvn + diff --git a/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png b/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png new file mode 100644 index 0000000000..805baa54d2 Binary files /dev/null and b/branches/sca-java-2.0-M3/samples/dosgi-calculator/dosgi-calculator.png differ