X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2Fa2%2FProvisioningManager.java;h=289870abc3ef945b7a2bb5f9b122027beb1af6cd;hb=6c0d4c9eb9673fd893f8ef3e6d0ecb5f53a832c6;hp=a237fdf48aecaa79349df7f0999c183c0e05a8e6;hpb=c66685995c1bf2c59bdf6d68753470c85828310a;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.init/src/org/argeo/init/a2/ProvisioningManager.java b/org.argeo.init/src/org/argeo/init/a2/ProvisioningManager.java index a237fdf48..289870abc 100644 --- a/org.argeo.init/src/org/argeo/init/a2/ProvisioningManager.java +++ b/org.argeo.init/src/org/argeo/init/a2/ProvisioningManager.java @@ -55,8 +55,8 @@ public class ProvisioningManager { updatedBundles.add(bundle); } } - FrameworkWiring frameworkWiring = bc.getBundle(0).adapt(FrameworkWiring.class); - frameworkWiring.refreshBundles(updatedBundles); +// FrameworkWiring frameworkWiring = bc.getBundle(0).adapt(FrameworkWiring.class); +// frameworkWiring.refreshBundles(updatedBundles); } public void registerSource(String uri) { @@ -85,6 +85,17 @@ public class ProvisioningManager { source.load(); addSource(source); OsgiBootUtils.info("Registered " + uri + " as source"); + + // OS specific / native + String localRelPath = A2Contribution.localOsArchRelativePath(); + Path localLibBase = base.resolve(A2Contribution.LIB).resolve(localRelPath); + if (Files.exists(localLibBase)) { + FsA2Source libSource = new FsA2Source(localLibBase, xOr, + SCHEME_A2_REFERENCE.equals(u.getScheme())); + libSource.load(); + addSource(libSource); + OsgiBootUtils.info("Registered OS-specific " + uri + " as source (" + localRelPath + ")"); + } } else { OsgiBootUtils.debug("Source " + base + " does not exist, ignoring."); } @@ -138,21 +149,30 @@ public class ProvisioningManager { Version moduleVersion = module.getVersion(); A2Branch osgiBranch = osgiContext.findBranch(module.getBranch().getComponent().getId(), moduleVersion); if (osgiBranch == null) { -// Bundle bundle = bc.installBundle(module.getBranch().getCoordinates(), -// moduleSource.newInputStream(module.getLocator())); Bundle bundle = moduleSource.install(bc, module); - if (OsgiBootUtils.isDebug()) - OsgiBootUtils.debug("Installed bundle " + bundle.getLocation() + " with version " + moduleVersion); + // TODO make it more dynamic, based on OSGi APIs + osgiContext.registerBundle(bundle); +// if (OsgiBootUtils.isDebug()) +// OsgiBootUtils.debug("Installed bundle " + bundle.getLocation() + " with version " + moduleVersion); return bundle; } else { A2Module lastOsgiModule = osgiBranch.last(); int compare = moduleVersion.compareTo(lastOsgiModule.getVersion()); - if (compare > 0) {// update + if (compare >= 0) {// update (also if same version) Bundle bundle = (Bundle) lastOsgiModule.getLocator(); -// bundle.update(moduleSource.newInputStream(module.getLocator())); + if (bundle.getBundleId() == 0)// ignore framework bundle + return null; moduleSource.update(bundle, module); + // TODO make it more dynamic, based on OSGi APIs + // TODO remove old module? Or keep update history? + osgiContext.registerBundle(bundle); OsgiBootUtils.info("Updated bundle " + bundle.getLocation() + " to version " + moduleVersion); return bundle; + } else { + if (OsgiBootUtils.isDebug()) + OsgiBootUtils.debug("Did not install as bundle module " + module + + " since a module with higher version " + lastOsgiModule.getVersion() + + " is already installed for branch " + osgiBranch); } } } catch (Exception e) {