summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
211d7f2)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
</arguments>
</buildCommand>
<buildCommand>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
</natures>
</projectDescription>
<packaging>jar</packaging>
<properties />
<build>
<packaging>jar</packaging>
<properties />
<build>
+ <outputDirectory>bin</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>META-INF/**</include>
+ </includes>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<configuration>
+ <manifestLocation>META-INF</manifestLocation>
<instructions>
<Export-Package>
org.argeo.slc.*
<instructions>
<Export-Package>
org.argeo.slc.*
import org.springframework.osgi.context.event.OsgiBundleContextClosedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextFailedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextRefreshedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextClosedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextFailedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextRefreshedEvent;
+import org.springframework.osgi.util.OsgiBundleUtils;
import org.springframework.osgi.util.OsgiFilterUtils;
import org.springframework.util.Assert;
import org.springframework.osgi.util.OsgiFilterUtils;
import org.springframework.util.Assert;
Assert.isTrue(osgiBundle.getVersion().equals(
bundle.getHeaders().get(Constants.BUNDLE_VERSION)),
"version consistent");
Assert.isTrue(osgiBundle.getVersion().equals(
bundle.getHeaders().get(Constants.BUNDLE_VERSION)),
"version consistent");
+ } else if (osgiBundle.getVersion() == null) {
+ bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
+ osgiBundle.getName());
+ } else {// scan all bundles
bundles: for (Bundle b : bundleContext.getBundles()) {
if (b.getSymbolicName() == null) {
log.warn("Bundle " + b + " has no symbolic name defined.");
bundles: for (Bundle b : bundleContext.getBundles()) {
if (b.getSymbolicName() == null) {
log.warn("Bundle " + b + " has no symbolic name defined.");
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
+import org.springframework.osgi.util.OsgiBundleUtils;
public class OsgiRuntimeModularDistribution extends
AbstractOsgiModularDistribution implements ResourceLoaderAware {
public class OsgiRuntimeModularDistribution extends
AbstractOsgiModularDistribution implements ResourceLoaderAware {
SortedMap<NameVersion, Distribution> distributions)
throws Exception {
SortedMap<NameVersion, Distribution> distributions)
throws Exception {
- for (Bundle bundle : getBundleContext().getBundles()) {
+ String frameworkUrl = System.getProperty("osgi.framework");
+ String frameworkBaseUrl = null;
+ if (frameworkUrl != null)
+ frameworkBaseUrl = frameworkUrl.substring(0, frameworkUrl
+ .lastIndexOf('/'));
+ bundles: for (Bundle bundle : getBundleContext().getBundles()) {
OsgiBundle osgiBundle = new OsgiBundle(bundle);
String originalLocation = bundle.getLocation();
OsgiBundle osgiBundle = new OsgiBundle(bundle);
String originalLocation = bundle.getLocation();
+
+ if (OsgiBundleUtils.isSystemBundle(bundle)) {
+ continue bundles;
+ }
+
String location = originalLocation;
if (originalLocation.startsWith("reference:file:"))
location = originalLocation.substring("reference:".length());
String location = originalLocation;
if (originalLocation.startsWith("reference:file:"))
location = originalLocation.substring("reference:".length());
+ if (frameworkBaseUrl != null
+ && originalLocation.startsWith("initial@reference:file:")) {
+ location = frameworkBaseUrl
+ + '/'
+ + originalLocation.substring("initial@reference:file:"
+ .length());
+ }
+
try {
URL url = new URL(location);
Resource res = resourceLoader.getResource(url.toString());
try {
URL url = new URL(location);
Resource res = resourceLoader.getResource(url.toString());
package org.argeo.slc.osgi.deploy;
package org.argeo.slc.osgi.deploy;
-import org.argeo.slc.core.deploy.RelativeResourceSet;
+import org.argeo.slc.core.deploy.DefaultResourceSet;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleContext;
+import org.springframework.core.io.ResourceLoader;
import org.springframework.osgi.context.BundleContextAware;
import org.springframework.osgi.context.BundleContextAware;
+import org.springframework.osgi.io.OsgiBundleResourceLoader;
import org.springframework.osgi.io.OsgiBundleResourcePatternResolver;
import org.springframework.osgi.io.OsgiBundleResourcePatternResolver;
+import org.springframework.osgi.util.OsgiBundleUtils;
-public class OsgiResourceSet extends RelativeResourceSet implements
+public class OsgiResourceSet extends DefaultResourceSet implements
BundleContextAware {
private BundleContext bundleContext;
BundleContextAware {
private BundleContext bundleContext;
+ private Bundle bundle = null;
+ private String bundleSymbolicName = null;
+
+ private OsgiBundleResourceLoader osgiBundleResourceLoader = null;
@Override
public void afterPropertiesSet() throws Exception {
@Override
public void afterPropertiesSet() throws Exception {
+ osgiBundleResourceLoader = new OsgiBundleResourceLoader(getBundle());
if (getResourcePatternResolver() == null)
setResourcePatternResolver(new OsgiBundleResourcePatternResolver(
if (getResourcePatternResolver() == null)
setResourcePatternResolver(new OsgiBundleResourcePatternResolver(
- bundleContext.getBundle()));
+ osgiBundleResourceLoader));
super.afterPropertiesSet();
}
super.afterPropertiesSet();
}
+ public Bundle getBundle() {
+ if (bundle != null)
+ return bundle;
+ else if (bundleSymbolicName != null)// do not cache
+ return OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
+ bundleSymbolicName);
+ else
+ // containing bundle
+ return bundleContext.getBundle();
+ }
+
public void setBundleContext(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
public void setBundleContext(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
+ @Override
+ public ResourceLoader getResourceLoaderToUse() {
+ return osgiBundleResourceLoader;
+ }
+
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public void setBundleSymbolicName(String bundleSymbolicName) {
+ this.bundleSymbolicName = bundleSymbolicName;
+ }
+