BundleInfo info = new BundleInfo(this, infoId, infoLocation, nextGenId); Generation generation = info.restoreGeneration(generationId, content, isDirectory, isReference, hasPackageInfo, cachedHeaders, lastModified); result.put(infoId, generation); generations.add(generation);
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 setStorageHooks(List<StorageHook<?, ?>> storageHooks, boolean install) { synchronized (this.genMonitor) { this.storageHooks = storageHooks; if (install) { this.hasPackageInfo = BundleInfo.hasPackageInfo(getBundleFile()); } } }
Long lockedID = getNextRootID(); try { BundleInfo info = new BundleInfo(this, lockedID, bundleLocation, 0); generation = info.createGeneration(); generation.getBundleInfo().delete(); } finally { if (generation != null) { generation.getBundleInfo().unlockGeneration(generation);
for (Generation generation : generations) { BundleInfo bundleInfo = generation.getBundleInfo(); out.writeLong(bundleInfo.getBundleId()); out.writeUTF(bundleInfo.getLocation()); out.writeLong(bundleInfo.getNextGenerationId()); out.writeLong(generation.getGenerationId()); out.writeBoolean(generation.isDirectory()); out.writeBoolean(generation.isReference()); out.writeBoolean(generation.hasPackageInfo()); if (bundleInfo.getBundleId() == 0) { } else { out.writeUTF(Storage.getBundleFilePath(bundleInfo.getBundleId(), generation.getGenerationId()));
Generation newGen = bundleInfo.createGeneration(); File contentFile = getContentFile(staged, isReference, bundleInfo.getBundleId(), newGen.getGenerationId()); newGen.setContent(contentFile, isReference); bundleInfo.unlockGeneration(newGen);
try { if (systemModule == null) { BundleInfo info = new BundleInfo(this, 0, Constants.SYSTEM_BUNDLE_LOCATION, 0); newGeneration = info.createGeneration(); ModuleRevisionBuilder newBuilder = getBuilder(currentGeneration); if (needUpdate(currentRevision, newBuilder)) { newGeneration = currentGeneration.getBundleInfo().createGeneration(); File contentFile = getSystemContent(); newGeneration.setContent(contentFile, false); } finally { if (newGeneration != null) { newGeneration.getBundleInfo().unlockGeneration(newGeneration);
@Override protected void cleanup(ModuleRevision revision) { Generation generation = (Generation) revision.getRevisionInfo(); generation.delete(); if (revision.equals(getCurrentRevision())) { // uninstall case generation.getBundleInfo().delete(); } } }
@Override public File getDataFile(String filename) { checkValid(); Generation current = (Generation) module.getCurrentRevision().getRevisionInfo(); return current.getBundleInfo().getDataFile(filename); }
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; }
Long lockedID = getNextRootID(); try { BundleInfo info = new BundleInfo(this, lockedID, bundleLocation, 0); generation = info.createGeneration(); generation.getBundleInfo().delete(); } finally { if (generation != null) { generation.getBundleInfo().unlockGeneration(generation);
for (Generation generation : generations) { BundleInfo bundleInfo = generation.getBundleInfo(); out.writeLong(bundleInfo.getBundleId()); out.writeUTF(bundleInfo.getLocation()); out.writeLong(bundleInfo.getNextGenerationId()); out.writeLong(generation.getGenerationId()); out.writeBoolean(generation.isDirectory()); out.writeBoolean(generation.isReference()); out.writeBoolean(generation.hasPackageInfo()); if (bundleInfo.getBundleId() == 0) { } else { out.writeUTF(Storage.getBundleFilePath(bundleInfo.getBundleId(), generation.getGenerationId()));
Generation newGen = bundleInfo.createGeneration(); File contentFile = getContentFile(staged, isReference, bundleInfo.getBundleId(), newGen.getGenerationId()); newGen.setContent(contentFile, isReference); bundleInfo.unlockGeneration(newGen);
try { if (systemModule == null) { BundleInfo info = new BundleInfo(this, 0, Constants.SYSTEM_BUNDLE_LOCATION, 0); newGeneration = info.createGeneration(); ModuleRevisionBuilder newBuilder = getBuilder(currentGeneration); if (needUpdate(currentRevision, newBuilder)) { newGeneration = currentGeneration.getBundleInfo().createGeneration(); File contentFile = getSystemContent(); newGeneration.setContent(contentFile, false); } finally { if (newGeneration != null) { newGeneration.getBundleInfo().unlockGeneration(newGeneration);
@Override protected void cleanup(ModuleRevision revision) { Generation generation = (Generation) revision.getRevisionInfo(); generation.delete(); if (revision.equals(getCurrentRevision())) { // uninstall case generation.getBundleInfo().delete(); } } }
@Override public File getDataFile(String filename) { checkValid(); Generation current = (Generation) module.getCurrentRevision().getRevisionInfo(); return current.getBundleInfo().getDataFile(filename); }
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 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; } }
Long lockedID = getNextRootID(); try { BundleInfo info = new BundleInfo(this, lockedID, bundleLocation, 0); generation = info.createGeneration(); generation.getBundleInfo().delete(); } finally { if (generation != null) { generation.getBundleInfo().unlockGeneration(generation);
for (Generation generation : generations) { BundleInfo bundleInfo = generation.getBundleInfo(); out.writeLong(bundleInfo.getBundleId()); out.writeUTF(bundleInfo.getLocation()); out.writeLong(bundleInfo.getNextGenerationId()); out.writeLong(generation.getGenerationId()); out.writeBoolean(generation.isDirectory()); out.writeBoolean(generation.isReference()); out.writeBoolean(generation.hasPackageInfo()); if (bundleInfo.getBundleId() == 0) { } else { out.writeUTF(Storage.getBundleFilePath(bundleInfo.getBundleId(), generation.getGenerationId()));