diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 2170875bd..2c2bde723 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -20,6 +20,7 @@ import org.eclipse.osgi.container.*; import org.eclipse.osgi.container.ModuleRevisionBuilder.GenericInfo; import org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory; import org.eclipse.osgi.container.namespaces.EclipsePlatformNamespace; +import org.eclipse.osgi.container.namespaces.EquinoxPersistentUUIDNamespace; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.framework.util.*; import org.eclipse.osgi.internal.container.LockSet; @@ -300,6 +301,8 @@ public class Storage { } } } + // set the persistent UUID property + this.equinoxContainer.getConfiguration().setConfiguration(EquinoxPersistentUUIDNamespace.PERSISTENT_UUID_NAMESPACE, getPersistentUUID()); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; @@ -613,6 +616,7 @@ public class Storage { } return builder; } + // First we must make sure the VM profile has been loaded loadVMProfile(generation); // dealing with system bundle find the extra capabilities and exports @@ -635,6 +639,11 @@ public class Storage { result.append(extraSystemCapabilities).append(", "); //$NON-NLS-1$ } + // if there is an existing system module check if it has a persistent UUID + String persistentUUID = getPersistentUUID(); + result.append(EquinoxPersistentUUIDNamespace.PERSISTENT_UUID_NAMESPACE).append("; "); //$NON-NLS-1$ + result.append(EquinoxPersistentUUIDNamespace.PERSISTENT_UUID_NAMESPACE).append("=\"").append(persistentUUID).append("\", "); //$NON-NLS-1$//$NON-NLS-2$ + result.append(EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE).append("; "); //$NON-NLS-1$ result.append(EquinoxConfiguration.PROP_OSGI_OS).append("=").append(equinoxConfig.getOS()).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ result.append(EquinoxConfiguration.PROP_OSGI_WS).append("=").append(equinoxConfig.getWS()).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ @@ -665,6 +674,18 @@ public class Storage { return result.toString(); } + String getPersistentUUID() { + Requirement persistentUUIDReq = ModuleContainer.createRequirement(EquinoxPersistentUUIDNamespace.PERSISTENT_UUID_NAMESPACE, Collections.<String, String> emptyMap(), Collections.<String, String> emptyMap()); + Collection<BundleCapability> persistentUUIDs = moduleContainer.getFrameworkWiring().findProviders(persistentUUIDReq); + for (BundleCapability persistentUUIDCap : persistentUUIDs) { + if (persistentUUIDCap.getRevision().getBundle().getBundleId() == 0) { + return (String) persistentUUIDCap.getAttributes().get(EquinoxPersistentUUIDNamespace.PERSISTENT_UUID_NAMESPACE); + } + } + // not available; generate a new persistent UUID + return UUID.randomUUID().toString(); + } + String getAliasList(Collection<String> aliases) { if (aliases.isEmpty()) { return null; |