From 6059c887cf7e4880a2de03959cf574a3d1f193cd Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Fri, 5 Sep 2008 00:14:49 +0000 Subject: Added a BundleFileWrapperFactory hook as it'll help provide the required Bundle manifest information when not present in the original JARs. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@692308 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/modules/extensibility-equinox/pom.xml | 5 ++- .../equinox/BundleFileWrapperFactory.java | 49 ++++++++++++++++++++++ .../equinox/EquinoxHookConfigurator.java | 33 +++++++++++++++ .../main/resources/hookconfigurators.properties | 16 +++++++ java/sca/modules/node-launcher-equinox/pom.xml | 7 ---- .../sca/node/equinox/launcher/EquinoxOSGiHost.java | 2 +- 6 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/BundleFileWrapperFactory.java create mode 100644 java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxHookConfigurator.java create mode 100644 java/sca/modules/extensibility-equinox/src/main/resources/hookconfigurators.properties (limited to 'java/sca/modules') diff --git a/java/sca/modules/extensibility-equinox/pom.xml b/java/sca/modules/extensibility-equinox/pom.xml index 915f3bd91f..25f78760b2 100644 --- a/java/sca/modules/extensibility-equinox/pom.xml +++ b/java/sca/modules/extensibility-equinox/pom.xml @@ -72,8 +72,9 @@ ${tuscany.version} - org.apache.tuscany.sca.extensibility.equinox - + org.apache.tuscany.sca.extensibility.equinox + org.eclipse.osgi + ${pom.name} org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator diff --git a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/BundleFileWrapperFactory.java b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/BundleFileWrapperFactory.java new file mode 100644 index 0000000000..3b369bb54b --- /dev/null +++ b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/BundleFileWrapperFactory.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.extensibility.equinox; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.osgi.baseadaptor.BaseData; +import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile; +import org.eclipse.osgi.baseadaptor.hooks.BundleFileFactoryHook; +import org.eclipse.osgi.baseadaptor.hooks.BundleFileWrapperFactoryHook; + +/** + * Bundle file wrapper factory that converts plain jars into OSGi bundles + */ +public class BundleFileWrapperFactory implements BundleFileWrapperFactoryHook, BundleFileFactoryHook { + + public BundleFile createBundleFile(Object content, BaseData data, boolean base) throws IOException { + return null; + } + + public BundleFile wrapBundleFile(BundleFile file, Object content, BaseData data, boolean base) throws IOException { + if (data.getBundleID() == 0) { + return null; + } + if (!(content instanceof File)) { + return null; + } + return null; + } + +} diff --git a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxHookConfigurator.java b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxHookConfigurator.java new file mode 100644 index 0000000000..d5027805c1 --- /dev/null +++ b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/EquinoxHookConfigurator.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.extensibility.equinox; + +import org.eclipse.osgi.baseadaptor.HookConfigurator; +import org.eclipse.osgi.baseadaptor.HookRegistry; + +/** + * Hook Configurator for Equinox + */ +public class EquinoxHookConfigurator implements HookConfigurator { + public void addHooks(HookRegistry registry) { + registry.addBundleFileWrapperFactoryHook(new BundleFileWrapperFactory()); + } + +} diff --git a/java/sca/modules/extensibility-equinox/src/main/resources/hookconfigurators.properties b/java/sca/modules/extensibility-equinox/src/main/resources/hookconfigurators.properties new file mode 100644 index 0000000000..cec706c9c3 --- /dev/null +++ b/java/sca/modules/extensibility-equinox/src/main/resources/hookconfigurators.properties @@ -0,0 +1,16 @@ +# 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. +hook.configurators=org.apache.tuscany.sca.extensibility.equinox.EquinoxHookConfigurator \ No newline at end of file diff --git a/java/sca/modules/node-launcher-equinox/pom.xml b/java/sca/modules/node-launcher-equinox/pom.xml index f118501508..0356d142d6 100644 --- a/java/sca/modules/node-launcher-equinox/pom.xml +++ b/java/sca/modules/node-launcher-equinox/pom.xml @@ -62,13 +62,6 @@ test - - org.apache.tuscany.sca - tuscany-contribution-osgi - 1.4-SNAPSHOT - test - - org.apache.tuscany.sca tuscany-domain-manager diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java index effe9b298d..f94dd8e166 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java @@ -95,7 +95,7 @@ public class EquinoxOSGiHost implements OSGiHost { Map props = new HashMap(); props.put("org.osgi.framework.system.packages", systemPackages); // Set the extension bundle - // props.put("osgi.framework.extensions", "org.apache.tuscany.sca.extensibility.equinox"); + props.put("osgi.framework.extensions", "org.apache.tuscany.sca.extensibility.equinox"); props.put(EclipseStarter.PROP_CLEAN, "true"); props.put(LocationManager.PROP_INSTANCE_AREA, new File("target/workspace").toURI().toString()); props.put(LocationManager.PROP_INSTALL_AREA, new File("target/eclipse/install").toURI().toString()); -- cgit v1.2.3