Merge changes from trunk to bring up the distributed osgi samples with Tuscany distribution
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@789466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b4728bc67
commit
1fd0070593
28 changed files with 484 additions and 29 deletions
|
@ -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
|
|
@ -57,12 +57,23 @@
|
|||
<useDistributionName>false</useDistributionName>
|
||||
<generateManifestJar>true</generateManifestJar>
|
||||
<artifactManifests>
|
||||
<artifactManifest>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
<artifactId>axiom-api</artifactId>
|
||||
<version>1.2.7</version>
|
||||
<manifestFile>${basedir}/manifests/axiom-api-1.2.7.MF</manifestFile>
|
||||
</artifactManifest>
|
||||
<artifactManifest>
|
||||
<groupId>org.apache.woden</groupId>
|
||||
<artifactId>woden-impl-dom</artifactId>
|
||||
<version>1.0M8</version>
|
||||
<manifestFile>${basedir}/manifests/woden-impl-dom-1.0M8.MF</manifestFile>
|
||||
</artifactManifest>
|
||||
<artifactManifest>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
<version>*</version>
|
||||
</artifactManifest>
|
||||
</artifactManifests>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -84,10 +84,17 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tuscany.sca</groupId>
|
||||
<artifactId>tuscany-databinding</artifactId>
|
||||
<version>2.0-M3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tuscany.sca</groupId>
|
||||
<artifactId>tuscany-databinding-axiom</artifactId>
|
||||
<version>2.0-M3-SNAPSHOT</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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<String> artifacts = new ArrayList<String>();
|
||||
Set<String> bundleClassPath = new HashSet<String>();
|
||||
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()));
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <equinoxConfiguration>]: The configuration folder for Equinox
|
||||
* [-bundles <osgiBundles>]: A list of bundles to be installed
|
||||
* [-c <compositeURI>]: The composite URI
|
||||
* [-t <ttl>]: 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:
|
||||
* <URL | simple bundle location>[@ [<start-level>] [":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<String> 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<String> contribs = cli.getArgList();
|
||||
|
@ -185,6 +205,7 @@ public class NodeLauncher {
|
|||
formatter.printHelp("java " + NodeLauncher.class.getName()
|
||||
+ " [-config <equinoxConfiguration>]"
|
||||
+ " [-c <compositeURI>]"
|
||||
+ " [-b <bundles>]"
|
||||
+ " [-t <ttl>]"
|
||||
+ " contribution1 ... contributionN", options);
|
||||
return;
|
||||
|
|
|
@ -479,6 +479,13 @@
|
|||
<include>MANIFEST.MF</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${basedir}/OSGI-INF</directory>
|
||||
<targetPath>OSGI-INF</targetPath>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<pluginManagement>
|
||||
|
|
|
@ -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
|
||||
|
155
branches/sca-java-2.0-M3/samples/dosgi-calculator/README
Normal file
155
branches/sca-java-2.0-M3/samples/dosgi-calculator/README
Normal file
|
@ -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
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
Loading…
Add table
Reference in a new issue