summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-27 16:38:16 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-27 16:38:16 +0000
commit52ce7df1c3f1076410836b444d95b9da2eb14c28 (patch)
treee61ddc82957299116f4b02f0fe54be0b379fb695
parentced88ce66721126b9d6e4daf0c3325306284ec7f (diff)
Bring up calculator-osgi using equinox run config
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@708234 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-equinox/distribution/pdetarget/pom.xml371
-rw-r--r--branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory (renamed from branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory)2
-rw-r--r--branches/sca-equinox/modules/extensibility/pom.xml1
-rw-r--r--branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java40
-rw-r--r--branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java19
-rw-r--r--branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java9
-rw-r--r--branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.NodeFactory (renamed from branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory)0
-rw-r--r--branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java16
-rw-r--r--branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/J2SE-1.5.profile150
-rw-r--r--branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/JavaSE-1.6.profile185
-rw-r--r--branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java14
-rw-r--r--branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java2
12 files changed, 606 insertions, 203 deletions
diff --git a/branches/sca-equinox/distribution/pdetarget/pom.xml b/branches/sca-equinox/distribution/pdetarget/pom.xml
index 622b2e2d05..683d2db3b1 100644
--- a/branches/sca-equinox/distribution/pdetarget/pom.xml
+++ b/branches/sca-equinox/distribution/pdetarget/pom.xml
@@ -1,185 +1,186 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-distribution</artifactId>
- <version>1.4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-distribution-pdetarget</artifactId>
- <name>Apache Tuscany SCA PDE Target Platform Distribution</name>
- <packaging>pom</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-distribution-all</artifactId>
- <type>pom</type>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <profiles>
-
- <!-- Build profile that can be used to configure your Eclipse environment -->
- <profile>
- <id>eclipse</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-maven-bundle-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-modules</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>generate-modules</goal>
- </goals>
- <configuration>
- <targetDirectory>target/modules</targetDirectory>
- <excludeGroupIds>
- <excludeGroupId>org.apache.tuscany.sca</excludeGroupId>
- </excludeGroupIds>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- Profile that can be used to build the modules included in the distro -->
- <profile>
- <id>modules</id>
- <modules>
- <module>../../../modules/assembly</module>
- <module>../../../modules/assembly-xml</module>
- <module>../../../modules/assembly-xsd</module>
- <module>../../../modules/binding-atom</module>
- <module>../../../modules/binding-atom-abdera</module>
- <module>../../../modules/binding-corba</module>
- <module>../../../modules/binding-corba-runtime</module>
- <module>../../../modules/binding-ejb</module>
- <module>../../../modules/binding-ejb-runtime</module>
- <module>../../../modules/binding-gdata</module>
- <module>../../../modules/binding-gdata-gsoc</module>
- <module>../../../modules/binding-gdata-runtime</module>
- <module>../../../modules/binding-gdata-runtime-gsoc</module>
- <module>../../../modules/binding-http</module>
- <module>../../../modules/binding-http-runtime</module>
- <module>../../../modules/binding-jms</module>
- <module>../../../modules/binding-jms-runtime</module>
- <module>../../../modules/binding-jsonrpc</module>
- <module>../../../modules/binding-jsonrpc-runtime</module>
- <module>../../../modules/binding-rmi</module>
- <module>../../../modules/binding-rmi-runtime</module>
- <module>../../../modules/binding-rss</module>
- <module>../../../modules/binding-rss-rome</module>
- <module>../../../modules/binding-sca</module>
- <module>../../../modules/binding-sca-axis2</module>
- <module>../../../modules/binding-sca-xml</module>
- <module>../../../modules/binding-ws</module>
- <module>../../../modules/binding-ws-axis2</module>
- <module>../../../modules/binding-ws-axis2-policy</module>
- <module>../../../modules/binding-ws-wsdlgen</module>
- <module>../../../modules/binding-ws-xml</module>
- <module>../../../modules/contribution</module>
- <module>../../../modules/contribution-java</module>
- <module>../../../modules/contribution-namespace</module>
- <module>../../../modules/contribution-resource</module>
- <module>../../../modules/contribution-xml</module>
- <module>../../../modules/core</module>
- <module>../../../modules/core-databinding</module>
- <module>../../../modules/core-spi</module>
- <module>../../../modules/data-api</module>
- <module>../../../modules/databinding</module>
- <module>../../../modules/databinding-axiom</module>
- <module>../../../modules/databinding-fastinfoset</module>
- <module>../../../modules/databinding-jaxb</module>
- <module>../../../modules/databinding-jaxb-axiom</module>
- <module>../../../modules/databinding-json</module>
- <module>../../../modules/databinding-saxon</module>
- <module>../../../modules/databinding-sdo</module>
- <module>../../../modules/databinding-sdo-axiom</module>
- <module>../../../modules/databinding-xmlbeans</module>
- <module>../../../modules/definitions</module>
- <module>../../../modules/definitions-xml</module>
- <module>../../../modules/domain-manager</module>
- <module>../../../modules/endpoint</module>
- <module>../../../modules/extensibility</module>
- <module>../../../modules/extensibility-equinox</module>
- <module>../../../modules/host-corba</module>
- <module>../../../modules/host-corba-jee</module>
- <module>../../../modules/host-corba-jse</module>
- <module>../../../modules/host-http</module>
- <module>../../../modules/host-jetty</module>
- <module>../../../modules/host-rmi</module>
- <module>../../../modules/implementation-bpel</module>
- <module>../../../modules/implementation-bpel-ode</module>
- <module>../../../modules/implementation-ejb</module>
- <module>../../../modules/implementation-java</module>
- <module>../../../modules/implementation-java-runtime</module>
- <module>../../../modules/implementation-java-xml</module>
- <module>../../../modules/implementation-node</module>
- <module>../../../modules/implementation-node-runtime</module>
- <module>../../../modules/implementation-resource</module>
- <module>../../../modules/implementation-resource-runtime</module>
- <module>../../../modules/implementation-script</module>
- <module>../../../modules/implementation-script-runtime</module>
- <module>../../../modules/implementation-spring</module>
- <module>../../../modules/implementation-widget</module>
- <module>../../../modules/implementation-widget-runtime</module>
- <module>../../../modules/implementation-xquery</module>
- <module>../../../modules/interface</module>
- <module>../../../modules/interface-java</module>
- <module>../../../modules/interface-java-jaxws</module>
- <module>../../../modules/interface-java-xml</module>
- <module>../../../modules/interface-wsdl</module>
- <module>../../../modules/interface-wsdl-xml</module>
- <module>../../../modules/monitor</module>
- <module>../../../modules/node-api</module>
- <module>../../../modules/node-impl</module>
- <module>../../../modules/node-launcher</module>
- <module>../../../modules/node-launcher-equinox</module>
- <module>../../../modules/node-launcher-webapp</module>
- <module>../../../modules/node-manager</module>
- <module>../../../modules/policy</module>
- <module>../../../modules/policy-security</module>
- <module>../../../modules/policy-security-jsr250</module>
- <module>../../../modules/policy-security-ws</module>
- <module>../../../modules/policy-transaction</module>
- <module>../../../modules/policy-xml</module>
- <module>../../../modules/policy-xml-ws</module>
- <module>../../../modules/sca-api</module>
- <module>../../../modules/tracing-aspectj</module>
- <module>../../../modules/workspace</module>
- <module>../../../modules/workspace-impl</module>
- <module>../../../modules/workspace-xml</module>
- <module>../../../modules/xsd</module>
- <module>../../../modules/xsd-xml</module>
- </modules>
- </profile>
- </profiles>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution-pdetarget</artifactId>
+ <name>Apache Tuscany SCA PDE Target Platform Distribution</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-all</artifactId>
+ <type>pom</type>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+
+ <!-- Build profile that can be used to configure your Eclipse environment -->
+ <profile>
+ <id>eclipse</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-modules</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>generate-modules</goal>
+ </goals>
+ <configuration>
+ <targetDirectory>target/modules</targetDirectory>
+ <generateTargetPlatform>true</generateTargetPlatform>
+ <excludeGroupIds>
+ <excludeGroupId>org.apache.tuscany.sca</excludeGroupId>
+ </excludeGroupIds>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- Profile that can be used to build the modules included in the distro -->
+ <profile>
+ <id>modules</id>
+ <modules>
+ <module>../../../modules/assembly</module>
+ <module>../../../modules/assembly-xml</module>
+ <module>../../../modules/assembly-xsd</module>
+ <module>../../../modules/binding-atom</module>
+ <module>../../../modules/binding-atom-abdera</module>
+ <module>../../../modules/binding-corba</module>
+ <module>../../../modules/binding-corba-runtime</module>
+ <module>../../../modules/binding-ejb</module>
+ <module>../../../modules/binding-ejb-runtime</module>
+ <module>../../../modules/binding-gdata</module>
+ <module>../../../modules/binding-gdata-gsoc</module>
+ <module>../../../modules/binding-gdata-runtime</module>
+ <module>../../../modules/binding-gdata-runtime-gsoc</module>
+ <module>../../../modules/binding-http</module>
+ <module>../../../modules/binding-http-runtime</module>
+ <module>../../../modules/binding-jms</module>
+ <module>../../../modules/binding-jms-runtime</module>
+ <module>../../../modules/binding-jsonrpc</module>
+ <module>../../../modules/binding-jsonrpc-runtime</module>
+ <module>../../../modules/binding-rmi</module>
+ <module>../../../modules/binding-rmi-runtime</module>
+ <module>../../../modules/binding-rss</module>
+ <module>../../../modules/binding-rss-rome</module>
+ <module>../../../modules/binding-sca</module>
+ <module>../../../modules/binding-sca-axis2</module>
+ <module>../../../modules/binding-sca-xml</module>
+ <module>../../../modules/binding-ws</module>
+ <module>../../../modules/binding-ws-axis2</module>
+ <module>../../../modules/binding-ws-axis2-policy</module>
+ <module>../../../modules/binding-ws-wsdlgen</module>
+ <module>../../../modules/binding-ws-xml</module>
+ <module>../../../modules/contribution</module>
+ <module>../../../modules/contribution-java</module>
+ <module>../../../modules/contribution-namespace</module>
+ <module>../../../modules/contribution-resource</module>
+ <module>../../../modules/contribution-xml</module>
+ <module>../../../modules/core</module>
+ <module>../../../modules/core-databinding</module>
+ <module>../../../modules/core-spi</module>
+ <module>../../../modules/data-api</module>
+ <module>../../../modules/databinding</module>
+ <module>../../../modules/databinding-axiom</module>
+ <module>../../../modules/databinding-fastinfoset</module>
+ <module>../../../modules/databinding-jaxb</module>
+ <module>../../../modules/databinding-jaxb-axiom</module>
+ <module>../../../modules/databinding-json</module>
+ <module>../../../modules/databinding-saxon</module>
+ <module>../../../modules/databinding-sdo</module>
+ <module>../../../modules/databinding-sdo-axiom</module>
+ <module>../../../modules/databinding-xmlbeans</module>
+ <module>../../../modules/definitions</module>
+ <module>../../../modules/definitions-xml</module>
+ <module>../../../modules/domain-manager</module>
+ <module>../../../modules/endpoint</module>
+ <module>../../../modules/extensibility</module>
+ <module>../../../modules/extensibility-equinox</module>
+ <module>../../../modules/host-corba</module>
+ <module>../../../modules/host-corba-jee</module>
+ <module>../../../modules/host-corba-jse</module>
+ <module>../../../modules/host-http</module>
+ <module>../../../modules/host-jetty</module>
+ <module>../../../modules/host-rmi</module>
+ <module>../../../modules/implementation-bpel</module>
+ <module>../../../modules/implementation-bpel-ode</module>
+ <module>../../../modules/implementation-ejb</module>
+ <module>../../../modules/implementation-java</module>
+ <module>../../../modules/implementation-java-runtime</module>
+ <module>../../../modules/implementation-java-xml</module>
+ <module>../../../modules/implementation-node</module>
+ <module>../../../modules/implementation-node-runtime</module>
+ <module>../../../modules/implementation-resource</module>
+ <module>../../../modules/implementation-resource-runtime</module>
+ <module>../../../modules/implementation-script</module>
+ <module>../../../modules/implementation-script-runtime</module>
+ <module>../../../modules/implementation-spring</module>
+ <module>../../../modules/implementation-widget</module>
+ <module>../../../modules/implementation-widget-runtime</module>
+ <module>../../../modules/implementation-xquery</module>
+ <module>../../../modules/interface</module>
+ <module>../../../modules/interface-java</module>
+ <module>../../../modules/interface-java-jaxws</module>
+ <module>../../../modules/interface-java-xml</module>
+ <module>../../../modules/interface-wsdl</module>
+ <module>../../../modules/interface-wsdl-xml</module>
+ <module>../../../modules/monitor</module>
+ <module>../../../modules/node-api</module>
+ <module>../../../modules/node-impl</module>
+ <module>../../../modules/node-launcher</module>
+ <module>../../../modules/node-launcher-equinox</module>
+ <module>../../../modules/node-launcher-webapp</module>
+ <module>../../../modules/node-manager</module>
+ <module>../../../modules/policy</module>
+ <module>../../../modules/policy-security</module>
+ <module>../../../modules/policy-security-jsr250</module>
+ <module>../../../modules/policy-security-ws</module>
+ <module>../../../modules/policy-transaction</module>
+ <module>../../../modules/policy-xml</module>
+ <module>../../../modules/policy-xml-ws</module>
+ <module>../../../modules/sca-api</module>
+ <module>../../../modules/tracing-aspectj</module>
+ <module>../../../modules/workspace</module>
+ <module>../../../modules/workspace-impl</module>
+ <module>../../../modules/workspace-xml</module>
+ <module>../../../modules/xsd</module>
+ <module>../../../modules/xsd-xml</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory b/branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory
index 4215855ac9..f2856cb259 100644
--- a/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory
+++ b/branches/sca-equinox/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory
@@ -14,4 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.node.impl.Node2FactoryImpl \ No newline at end of file
+org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory \ No newline at end of file
diff --git a/branches/sca-equinox/modules/extensibility/pom.xml b/branches/sca-equinox/modules/extensibility/pom.xml
index 93e2694971..991a9f0b02 100644
--- a/branches/sca-equinox/modules/extensibility/pom.xml
+++ b/branches/sca-equinox/modules/extensibility/pom.xml
@@ -44,6 +44,7 @@
org.apache.tuscany.sca.core,
org.apache.tuscany.sca.extensibility
</Export-Package>
+ <DynamicImport-Package>org.apache.tuscany.sca.extensibility.equinox</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
diff --git a/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java b/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java
index c1221aad7a..f5041866ee 100644
--- a/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java
+++ b/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultFactoryExtensionPoint.java
@@ -20,6 +20,10 @@
package org.apache.tuscany.sca.core;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.HashMap;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
@@ -81,6 +85,24 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint {
}
}
+ private ClassLoader getContextClassLoader() {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ private ClassLoader setContextClassLoader(final ClassLoader classLoader) {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return tccl;
+ }
+ });
+ }
+
/**
* Get a factory implementing the given interface.
* @param factoryInterface The lookup key (factory interface)
@@ -96,8 +118,22 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint {
ServiceDiscovery.getInstance().getFirstServiceDeclaration(factoryInterface.getName());
if (factoryDeclaration != null) {
Class<?> factoryClass = factoryDeclaration.loadClass();
-
try {
+ if (!factoryInterface.isInterface() && Modifier.isAbstract(factoryInterface.getModifiers())) {
+ try {
+ Method newInstanceMethod = factoryInterface.getDeclaredMethod("newInstance");
+ ClassLoader tccl = setContextClassLoader(factoryClass.getClassLoader());
+ try {
+ factory = newInstanceMethod.invoke(null);
+ factories.put(factoryInterface, factory);
+ return factoryInterface.cast(factory);
+ } finally {
+ setContextClassLoader(tccl);
+ }
+ } catch (NoSuchMethodException e) {
+ // Ignore
+ }
+ }
// Default empty constructor
Constructor<?> constructor = factoryClass.getConstructor();
factory = constructor.newInstance();
@@ -114,7 +150,7 @@ public class DefaultFactoryExtensionPoint implements FactoryExtensionPoint {
}
// Cache the loaded factory
- addFactory(factory);
+ factories.put(factoryInterface, factory);
}
} catch (Exception e) {
throw new IllegalArgumentException(e);
diff --git a/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
index ff8f2399df..bb4f23a00c 100644
--- a/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
+++ b/branches/sca-equinox/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
@@ -37,7 +37,10 @@ public class ServiceDiscovery implements ServiceDiscoverer {
private final static ServiceDiscovery INSTANCE = new ServiceDiscovery();
private ServiceDiscoverer discoverer;
-
+
+ private ServiceDiscovery() {
+ super();
+ }
/**
* Get an instance of Service discovery, one instance is created per
* ClassLoader that this class is loaded from
@@ -49,9 +52,19 @@ public class ServiceDiscovery implements ServiceDiscoverer {
}
public ServiceDiscoverer getServiceDiscoverer() {
- if (discoverer == null) {
- discoverer = new ContextClassLoaderServiceDiscoverer();
+ if (discoverer != null) {
+ return discoverer;
+ }
+ try {
+ Class<?> cls = Class.forName("org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoverer");
+ System.out.println(cls);
+ if (discoverer != null) {
+ return discoverer;
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
}
+ discoverer = new ContextClassLoaderServiceDiscoverer();
return discoverer;
}
diff --git a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index e1f56e598b..effccd0f4d 100644
--- a/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/branches/sca-equinox/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -263,8 +263,13 @@ public class NodeImpl implements Node, Client {
// Initialize the Tuscany module activators
ModuleActivatorExtensionPoint activators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
for (ModuleActivator moduleActivator: activators.getModuleActivators()) {
- moduleActivator.start(extensionPoints);
- moduleActivators.add(moduleActivator);
+ try {
+ moduleActivator.start(extensionPoints);
+ moduleActivators.add(moduleActivator);
+ } catch (Throwable e) {
+ // Ignore the failing module for now
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
}
// Get XML input/output factories
diff --git a/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory b/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.NodeFactory
index 800bdd84cc..800bdd84cc 100644
--- a/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory
+++ b/branches/sca-equinox/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.NodeFactory
diff --git a/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java b/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
index f16d607a80..6007c0dac2 100644
--- a/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
+++ b/branches/sca-equinox/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -122,12 +123,19 @@ class EquinoxHost {
try {
if (!EclipseStarter.isRunning()) {
+ String version = System.getProperty("java.specification.version");
+ String profile = "J2SE-1.5.profile";
+ if (version.startsWith("1.6")) {
+ profile = "JavaSE-1.6.profile";
+ }
+ Properties props = new Properties();
+ InputStream is = getClass().getResourceAsStream(profile);
+ if (is != null) {
+ props.load(is);
+ is.close();
+ }
// Configure Eclipse properties
- Map<Object, Object> props = new HashMap<Object, Object>();
- // Set system packages
- props.put("org.osgi.framework.system.packages", systemPackages);
-
// Use the boot classloader as the parent classloader
props.put("osgi.contextClassLoaderParent", "boot");
diff --git a/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/J2SE-1.5.profile b/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/J2SE-1.5.profile
new file mode 100644
index 0000000000..3814b42d00
--- /dev/null
+++ b/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/J2SE-1.5.profile
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activity,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.events,\
+ org.w3c.dom.ls,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5
+osgi.java.profile.name = J2SE-1.5
diff --git a/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/JavaSE-1.6.profile b/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/JavaSE-1.6.profile
new file mode 100644
index 0000000000..816e7c44f4
--- /dev/null
+++ b/branches/sca-equinox/modules/node-launcher-equinox/src/main/resources/org/apache/tuscany/sca/node/equinox/launcher/JavaSE-1.6.profile
@@ -0,0 +1,185 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.osgi.framework.system.packages = \
+ javax.accessibility,\
+ javax.activation,\
+ javax.activity,\
+ javax.annotation,\
+ javax.annotation.processing,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.jws,\
+ javax.jws.soap,\
+ javax.lang.model,\
+ javax.lang.model.element,\
+ javax.lang.model.type,\
+ javax.lang.model.util,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.script,\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.tools,\
+ javax.transaction,\
+ javax.transaction.xa,\
+ javax.xml,\
+ javax.xml.bind,\
+ javax.xml.bind.annotation,\
+ javax.xml.bind.annotation.adapters,\
+ javax.xml.bind.attachment,\
+ javax.xml.bind.helpers,\
+ javax.xml.bind.util,\
+ javax.xml.crypto,\
+ javax.xml.crypto.dom,\
+ javax.xml.crypto.dsig,\
+ javax.xml.crypto.dsig.dom,\
+ javax.xml.crypto.dsig.keyinfo,\
+ javax.xml.crypto.dsig.spec,\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.soap,\
+ javax.xml.stream,\
+ javax.xml.stream.events,\
+ javax.xml.stream.util,\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.ws,\
+ javax.xml.ws.handler,\
+ javax.xml.ws.handler.soap,\
+ javax.xml.ws.http,\
+ javax.xml.ws.soap,\
+ javax.xml.ws.spi,\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.events,\
+ org.w3c.dom.ls,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ javax.*,\
+ org.ietf.jgss,\
+ org.omg.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*,\
+ com.sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ JRE-1.1,\
+ J2SE-1.2,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ JavaSE-1.6
+osgi.java.profile.name = JavaSE-1.6
diff --git a/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java b/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java
index 384ae99fff..4408568629 100644
--- a/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java
+++ b/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java
@@ -33,11 +33,15 @@ public class CalculatorActivator implements BundleActivator {
private Node node;
public void start(BundleContext context) throws Exception {
- NodeFactory factory = NodeFactory.newInstance();
- String url = ContributionLocationHelper.getContributionLocation(getClass());
- Contribution contrib = new Contribution("c1", url);
- node = factory.createNode("Calculator.composite", contrib);
- node.start();
+ try {
+ NodeFactory factory = NodeFactory.newInstance();
+ String url = ContributionLocationHelper.getContributionLocation(getClass());
+ Contribution contrib = new Contribution("c1", url);
+ node = factory.createNode("Calculator.composite", contrib);
+ node.start();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
}
public void stop(BundleContext context) throws Exception {
diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java
index f813a2d096..cc25869e5d 100644
--- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java
+++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java
@@ -249,7 +249,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo {
// Generate a PDE target
if (generateTargetPlatform) {
- File target = new File(project.getBasedir(), "tuscany.target");
+ File target = new File(project.getBuild().getDirectory(), "tuscany.target");
FileOutputStream targetFile = new FileOutputStream(target);
writeTarget(new PrintStream(targetFile), bundleSymbolicNames, eclipseFeatures);
targetFile.close();