diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-05 00:14:49 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-05 00:14:49 +0000 |
commit | 6059c887cf7e4880a2de03959cf574a3d1f193cd (patch) | |
tree | 7ec89c5be2f16e8191325d598c7f9f29260a365c /java/sca/modules/extensibility-equinox/src | |
parent | 5b3b1e9d04c1ff27f495a54502105135ea83835b (diff) |
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
Diffstat (limited to 'java/sca/modules/extensibility-equinox/src')
3 files changed, 98 insertions, 0 deletions
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 |