public String[] mapLibraryNames(String mappedLibName) { int extIndex = mappedLibName.lastIndexOf('.'); List<String> LIB_EXTENSIONS = generation.getBundleInfo().getStorage().getConfiguration().LIB_EXTENSIONS; if (LIB_EXTENSIONS.isEmpty() || extIndex < 0) return EMPTY_STRINGS; String libNameBase = mappedLibName.substring(0, extIndex); String[] results = new String[LIB_EXTENSIONS.size()]; for (int i = 0; i < results.length; i++) results[i] = libNameBase + LIB_EXTENSIONS.get(i); return results; }
public String[] mapLibraryNames(String mappedLibName) { int extIndex = mappedLibName.lastIndexOf('.'); List<String> LIB_EXTENSIONS = generation.getBundleInfo().getStorage().getConfiguration().LIB_EXTENSIONS; if (LIB_EXTENSIONS.isEmpty() || extIndex < 0) return EMPTY_STRINGS; String libNameBase = mappedLibName.substring(0, extIndex); String[] results = new String[LIB_EXTENSIONS.size()]; for (int i = 0; i < results.length; i++) results[i] = libNameBase + LIB_EXTENSIONS.get(i); return results; }
private static BundleFile createBundleFile(File content, Generation generation) { if (!content.exists()) { return null; } return generation.getBundleInfo().getStorage().createBundleFile(content, generation, content.isDirectory(), false); }
public void delete() { try { getStorage().delete(getStorage().getFile(Long.toString(getBundleId()), false)); } catch (IOException e) { storage.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, "Error deleting bunlde info.", e); //$NON-NLS-1$ } }
public URL getEntry(String path) { BundleEntry entry = getBundleFile().getEntry(path); if (entry == null) return null; path = BundleFile.fixTrailingSlash(path, entry); try { //use the constant string for the protocol to prevent duplication return Storage.secureAction.getURL(BundleResourceHandler.OSGI_ENTRY_URL_PROTOCOL, Long.toString(getBundleId()) + BundleResourceHandler.BID_FWKID_SEPARATOR + Integer.toString(getStorage().getModuleContainer().hashCode()), 0, path, new Handler(getStorage().getModuleContainer(), entry)); } catch (MalformedURLException e) { return null; } }
public URL getEntry(String path) { BundleEntry entry = getBundleFile().getEntry(path); if (entry == null) return null; path = BundleFile.fixTrailingSlash(path, entry); try { //use the constant string for the protocol to prevent duplication return Storage.secureAction.getURL(BundleResourceHandler.OSGI_ENTRY_URL_PROTOCOL, Long.toString(getBundleId()) + BundleResourceHandler.BID_FWKID_SEPARATOR + Integer.toString(getStorage().getModuleContainer().hashCode()), 0, path, new Handler(getStorage().getModuleContainer(), entry)); } catch (MalformedURLException e) { return null; } }
public BundleFile getBundleFile() { synchronized (genMonitor) { if (bundleFile == null) { if (getBundleId() == 0 && content == null) { bundleFile = new SystemBundleFile(); } else { bundleFile = getStorage().createBundleFile(content, this, isDirectory, true); } } return bundleFile; } }
@Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } });
@Override public String get(Object key) { if (cached.containsKey(key)) { return cached.get(key); } if (!cached.isEmpty() && generation.getBundleInfo().getStorage().getConfiguration().getDebug().DEBUG_CACHED_MANIFEST) { Debug.println("Header key is not cached: " + key + "; for bundle: " + generation.getBundleInfo().getBundleId()); //$NON-NLS-1$ //$NON-NLS-2$ } return generation.getRawHeaders().get(key); }
public BundleFile getBundleFile() { synchronized (genMonitor) { if (bundleFile == null) { if (getBundleId() == 0 && content == null) { bundleFile = new SystemBundleFile(); } else { bundleFile = getStorage().createBundleFile(content, this, isDirectory, true); } } return bundleFile; } }
public BundleFile getBundleFile() { synchronized (genMonitor) { if (bundleFile == null) { if (getBundleId() == 0 && content == null) { bundleFile = new SystemBundleFile(); } else { bundleFile = getStorage().createBundleFile(content, this, isDirectory, true); } } return bundleFile; } }
@Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } });
public BundleFile getBundleFile() { synchronized (genMonitor) { if (bundleFile == null) { if (getBundleId() == 0 && content == null) { bundleFile = new SystemBundleFile(); } else { bundleFile = getStorage().createBundleFile(content, this, isDirectory, true); } } return bundleFile; } }
void delete(Generation generation) { try { getStorage().delete(getStorage().getFile(getBundleId() + "/" + generation.getGenerationId(), false)); //$NON-NLS-1$ } catch (IOException e) { storage.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, "Error deleting generation.", e); //$NON-NLS-1$ } }
public File getDataFile(String path) { File dataRoot = getStorage().getFile(getBundleId() + "/" + Storage.BUNDLE_DATA_DIR, false); //$NON-NLS-1$ if (!Storage.secureAction.isDirectory(dataRoot) && (storage.isReadOnly() || !(Storage.secureAction.mkdirs(dataRoot) || Storage.secureAction.isDirectory(dataRoot)))) { if (getStorage().getConfiguration().getDebug().DEBUG_STORAGE) Debug.println("Unable to create bundle data directory: " + dataRoot.getAbsolutePath()); //$NON-NLS-1$ return null; } return path == null ? dataRoot : new File(dataRoot, path); }
@Override public String get(Object key) { if (cached.containsKey(key)) { return cached.get(key); } if (!cached.isEmpty() && generation.getBundleInfo().getStorage().getConfiguration().getDebug().DEBUG_CACHED_MANIFEST) { Debug.println("Header key is not cached: " + key + "; for bundle: " + generation.getBundleInfo().getBundleId()); //$NON-NLS-1$ //$NON-NLS-2$ } return generation.getRawHeaders().get(key); }
private ManifestLocalization getManifestLocalization() { synchronized (genMonitor) { if (headerLocalization == null) { headerLocalization = new ManifestLocalization(this, getHeaders(), getStorage().getConfiguration().getConfiguration(EquinoxConfiguration.PROP_ROOT_LOCALE, "en")); //$NON-NLS-1$ } return headerLocalization; } }
private ManifestLocalization getManifestLocalization() { synchronized (genMonitor) { if (headerLocalization == null) { headerLocalization = new ManifestLocalization(this, getHeaders(), getStorage().getConfiguration().getConfiguration(EquinoxConfiguration.PROP_ROOT_LOCALE, "en")); //$NON-NLS-1$ } return headerLocalization; } }
@Override public void loadFragments(Collection<ModuleRevision> fragments) { Module systemModule = getWiring().getRevision().getRevisions().getModule(); try { this.getGeneration().getBundleInfo().getStorage().getExtensionInstaller().addExtensionContent(fragments, systemModule); } catch (BundleException e) { systemModule.getContainer().getAdaptor().publishContainerEvent(ContainerEvent.ERROR, systemModule, e); } getClasspathManager().loadFragments(fragments); } }
@Override public void loadFragments(Collection<ModuleRevision> fragments) { Module systemModule = getWiring().getRevision().getRevisions().getModule(); try { this.getGeneration().getBundleInfo().getStorage().getExtensionInstaller().addExtensionContent(fragments, systemModule); } catch (BundleException e) { systemModule.getContainer().getAdaptor().publishContainerEvent(ContainerEvent.ERROR, systemModule, e); } getClasspathManager().loadFragments(fragments); } }