/** * Get a string containing the significant runtime environment details that may require a rebuild of the OSGi cache. * * @return a string containing significant runtime details. */ @VisibleForTesting String getRuntimeEnvironment() { //Two things currently: // - JDK version // - Startup timeout which may be cached in the transformed plugins. return String.format("java.version=%s,plugin.enable.timeout=%d", System.getProperty("java.version"), PluginUtils.getDefaultEnablingWaitPeriod()); }
private byte[] generateManifest(JsonManifest descriptor) { Manifest mf = new Manifest(); mf.getMainAttributes().putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0"); mf.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2"); mf.getMainAttributes().putValue(OsgiPlugin.ATLASSIAN_PLUGIN_KEY, descriptor.getKey()); mf.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, descriptor.getKey()); mf.getMainAttributes().putValue(Constants.BUNDLE_VERSION, cleanManifestValue(descriptor.getVersion())); mf.getMainAttributes().putValue(Constants.BUNDLE_NAME, cleanManifestValue(descriptor.getName())); mf.getMainAttributes().putValue(Constants.BUNDLE_DESCRIPTION, cleanManifestValue(descriptor.getDescription())); mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, ConventionDescriptorGenerator.class.getPackage().getName()); mf.getMainAttributes().putValue("Spring-Context", "*;timeout:=" + PluginUtils.getDefaultEnablingWaitPeriod()); if (descriptor.getVendor() != null) { mf.getMainAttributes().putValue(Constants.BUNDLE_VENDOR, descriptor.getVendor().getName()); } ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { mf.write(bout); } catch (IOException e) { throw new RuntimeException("Should never happen", e); } return bout.toByteArray(); }
}, PluginUtils.getDefaultEnablingWaitPeriod(), TimeUnit.SECONDS, 1);