static void stop() { shutdown = true; stopTimer(); if (storageManager != null) { storageManager.close(); storageManager = null; } closeConfiguration(); context = null; }
static void stop() { shutdown = true; stopTimer(); if (storageManager != null) { storageManager.close(); storageManager = null; } closeConfiguration(); context = null; }
static void stop() { shutdown = true; stopTimer(); if (storageManager != null) { storageManager.close(); storageManager = null; } closeConfiguration(); context = null; }
public void frameworkStop(BundleContext fwContext) { if (stateSaver != null) stateSaver.shutdown(); saveAllData(true); storageManager.close(); storageManagerClosed = true; if (extensionListener != null) context.removeBundleListener(extensionListener); mruList.shutdown(); stateManager = null; }
public void frameworkStop(BundleContext fwContext) { if (stateSaver != null) stateSaver.shutdown(); saveAllData(true); storageManager.close(); storageManagerClosed = true; if (extensionListener != null) context.removeBundleListener(extensionListener); MRUBundleFileList current = mruList; if (current != null) current.shutdown(); mruList = null; stateManager = null; }
/** * Sets new cache file manager. If existing file manager was owned by the registry, * closes it. * * @param cacheBase the base location for the registry cache * @param isCacheReadOnly whether the file cache is read only */ protected void setFileManager(File cacheBase, boolean isCacheReadOnly) { if (cacheStorageManager != null) cacheStorageManager.close(); // close existing file manager first if (cacheBase != null) { cacheStorageManager = new StorageManager(cacheBase, isCacheReadOnly ? "none" : null, isCacheReadOnly); //$NON-NLS-1$ try { cacheStorageManager.open(!isCacheReadOnly); } catch (IOException e) { // Ignore the exception. The registry will be rebuilt from source. } } }
/** * Sets new cache file manager. If existing file manager was owned by the registry, * closes it. * * @param cacheBase the base location for the registry cache * @param isCacheReadOnly whether the file cache is read only */ protected void setFileManager(File cacheBase, boolean isCacheReadOnly) { if (cacheStorageManager != null) cacheStorageManager.close(); // close existing file manager first if (cacheBase != null) { cacheStorageManager = new StorageManager(cacheBase, isCacheReadOnly ? "none" : null, isCacheReadOnly); //$NON-NLS-1$ try { cacheStorageManager.open(!isCacheReadOnly); } catch (IOException e) { // Ignore the exception. The registry will be rebuilt from source. } } }
/** * Sets new cache file manager. If existing file manager was owned by the registry, * closes it. * * @param cacheBase the base location for the registry cache * @param isCacheReadOnly whether the file cache is read only */ protected void setFileManager(File cacheBase, boolean isCacheReadOnly) { if (cacheStorageManager != null) cacheStorageManager.close(); // close existing file manager first if (cacheBase != null) { cacheStorageManager = new StorageManager(cacheBase, isCacheReadOnly ? "none" : null, isCacheReadOnly); //$NON-NLS-1$ try { cacheStorageManager.open(!isCacheReadOnly); } catch (IOException e) { // Ignore the exception. The registry will be rebuilt from source. } } }
/** * Sets new cache file manager. If existing file manager was owned by the registry, * closes it. * * @param cacheBase the base location for the registry cache * @param isCacheReadOnly whether the file cache is read only */ protected void setFileManager(File cacheBase, boolean isCacheReadOnly) { if (cacheStorageManager != null) cacheStorageManager.close(); // close existing file manager first if (cacheBase != null) { cacheStorageManager = new StorageManager(cacheBase, isCacheReadOnly ? "none" : null, isCacheReadOnly); //$NON-NLS-1$ try { cacheStorageManager.open(!isCacheReadOnly); } catch (IOException e) { // Ignore the exception. The registry will be rebuilt from source. } } }
private State internalReadState(StateImpl toRestore, File stateDirectory, long expectedTimestamp) throws IOException { File stateFile = new File(stateDirectory, StateReader.STATE_FILE); File lazyFile = new File(stateDirectory, StateReader.LAZY_FILE); if (!stateFile.exists() || !lazyFile.exists()) { StorageManager storageManager = new StorageManager(stateDirectory, "none", true); //$NON-NLS-1$ try { // if the directory is pointing at the configuration directory then the base files will not exist storageManager.open(true); // try using the storage manager to find the managed state files (bug 143255) File managedState = storageManager.lookup(StateReader.STATE_FILE, false); File managedLazy = storageManager.lookup(StateReader.LAZY_FILE, false); if (managedState != null && managedLazy != null) { stateFile = managedState; lazyFile = managedLazy; } } finally { storageManager.close(); } } StateReader reader = new StateReader(stateFile, lazyFile, false); if (!reader.loadState(toRestore, expectedTimestamp)) return null; return toRestore; }
private State internalReadState(StateImpl toRestore, File stateDirectory, long expectedTimestamp) throws IOException { File stateFile = new File(stateDirectory, StateReader.STATE_FILE); File lazyFile = new File(stateDirectory, StateReader.LAZY_FILE); if (!stateFile.exists() || !lazyFile.exists()) { StorageManager storageManager = new StorageManager(stateDirectory, "none", true); //$NON-NLS-1$ try { // if the directory is pointing at the configuration directory then the base files will not exist storageManager.open(true); // try using the storage manager to find the managed state files (bug 143255) File managedState = storageManager.lookup(StateReader.STATE_FILE, false); File managedLazy = storageManager.lookup(StateReader.LAZY_FILE, false); if (managedState != null && managedLazy != null) { stateFile = managedState; lazyFile = managedLazy; } } finally { storageManager.close(); } } StateReader reader = new StateReader(stateFile, lazyFile, false); if (!reader.loadState(toRestore, expectedTimestamp)) return null; return toRestore; }
private State internalReadState(StateImpl toRestore, File stateDirectory, long expectedTimestamp) throws IOException { File stateFile = new File(stateDirectory, StateReader.STATE_FILE); File lazyFile = new File(stateDirectory, StateReader.LAZY_FILE); if (!stateFile.exists() || !lazyFile.exists()) { StorageManager storageManager = new StorageManager(stateDirectory, "none", true); //$NON-NLS-1$ try { // if the directory is pointing at the configuration directory then the base files will not exist storageManager.open(true); // try using the storage manager to find the managed state files (bug 143255) File managedState = storageManager.lookup(StateReader.STATE_FILE, false); File managedLazy = storageManager.lookup(StateReader.LAZY_FILE, false); if (managedState != null && managedLazy != null) { stateFile = managedState; lazyFile = managedLazy; } } finally { storageManager.close(); } } StateReader reader = new StateReader(stateFile, lazyFile, false); if (!reader.loadState(toRestore, expectedTimestamp)) return null; return toRestore; }
private State internalReadState(StateImpl toRestore, File stateDirectory, long expectedTimestamp) throws IOException { File stateFile = new File(stateDirectory, StateReader.STATE_FILE); File lazyFile = new File(stateDirectory, StateReader.LAZY_FILE); if (!stateFile.exists() || !lazyFile.exists()) { StorageManager storageManager = new StorageManager(stateDirectory, "none", true); //$NON-NLS-1$ try { // if the directory is pointing at the configuration directory then the base files will not exist storageManager.open(true); // try using the storage manager to find the managed state files (bug 143255) File managedState = storageManager.lookup(StateReader.STATE_FILE, false); File managedLazy = storageManager.lookup(StateReader.LAZY_FILE, false); if (managedState != null && managedLazy != null) { stateFile = managedState; lazyFile = managedLazy; } } finally { storageManager.close(); } } StateReader reader = new StateReader(stateFile, lazyFile, false); if (!reader.loadState(toRestore, expectedTimestamp)) return null; return toRestore; }
void save0() throws IOException { StorageManager childStorageManager = null; DataOutputStream out = null; moduleDatabase.readLock(); try { synchronized (this.saveMonitor) { if (lastSavedTimestamp == moduleDatabase.getTimestamp()) return; childStorageManager = getChildStorageManager(); out = new DataOutputStream(new BufferedOutputStream(childStorageManager.getOutputStream(FRAMEWORK_INFO))); saveGenerations(out); savePermissionData(out); moduleDatabase.store(out, true); lastSavedTimestamp = moduleDatabase.getTimestamp(); } } finally { if (out != null) { try { out.close(); } catch (IOException e) { // tried our best } } if (childStorageManager != null) { childStorageManager.close(); } moduleDatabase.readUnlock(); } }
private InputStream findStorageStream(String fileName) { InputStream storageStream = null; try { storageStream = storageManager.getInputStream(fileName); } catch (IOException ex) { if (Debug.DEBUG_GENERAL) { Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } if (storageStream == null) { Location currentConfiguration = LocationManager.getConfigurationLocation(); Location parentConfiguration = null; if (currentConfiguration != null && (parentConfiguration = currentConfiguration.getParentLocation()) != null) { try { File bundledataLocationDir = new File(parentConfiguration.getURL().getFile(), FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME); StorageManager newStorageManager = initFileManager(bundledataLocationDir, "none", true); //$NON-NLS-1$ storageStream = newStorageManager.getInputStream(fileName); newStorageManager.close(); } catch (MalformedURLException e1) { // This will not happen since all the URLs are derived by us // and we are GODS! } catch (IOException e1) { // That's ok we will regenerate the .bundleData } } } return storageStream; }
private InputStream getInfoInputStream() throws IOException { StorageManager storageManager = getChildStorageManager(); InputStream storageStream = null; try { storageStream = storageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } finally { storageManager.close(); } if (storageStream == null && parentRoot != null) { StorageManager parentStorageManager = null; try { parentStorageManager = new StorageManager(parentRoot, LocationHelper.LOCKING_NONE, true); parentStorageManager.open(false); storageStream = parentStorageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException e1) { // That's ok we will regenerate the framework.info } finally { if (parentStorageManager != null) { parentStorageManager.close(); } } } return storageStream; } }
private InputStream getInfoInputStream() throws IOException { StorageManager storageManager = getChildStorageManager(); InputStream storageStream = null; try { storageStream = storageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } finally { storageManager.close(); } if (storageStream == null && parentRoot != null) { StorageManager parentStorageManager = null; try { parentStorageManager = new StorageManager(parentRoot, LocationHelper.LOCKING_NONE, true); parentStorageManager.open(false); storageStream = parentStorageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException e1) { // That's ok we will regenerate the framework.info } finally { if (parentStorageManager != null) { parentStorageManager.close(); } } } return storageStream; } }
private InputStream getInfoInputStream() throws IOException { StorageManager storageManager = getChildStorageManager(); InputStream storageStream = null; try { storageStream = storageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_GENERAL) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } finally { storageManager.close(); } if (storageStream == null && parentRoot != null) { StorageManager parentStorageManager = null; try { parentStorageManager = new StorageManager(parentRoot, LocationHelper.LOCKING_NONE, true); parentStorageManager.open(false); storageStream = parentStorageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException e1) { // That's ok we will regenerate the framework.info } finally { if (parentStorageManager != null) { parentStorageManager.close(); } } } return storageStream; } }
private InputStream getInfoInputStream() throws IOException { StorageManager storageManager = getChildStorageManager(); InputStream storageStream = null; try { storageStream = storageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_GENERAL) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } finally { storageManager.close(); } if (storageStream == null && parentRoot != null) { StorageManager parentStorageManager = null; try { parentStorageManager = new StorageManager(parentRoot, LocationHelper.LOCKING_NONE, true); parentStorageManager.open(false); storageStream = parentStorageManager.getInputStream(FRAMEWORK_INFO); } catch (IOException e1) { // That's ok we will regenerate the framework.info } finally { if (parentStorageManager != null) { parentStorageManager.close(); } } } return storageStream; } }
private InputStream findStorageStream(String fileName) { InputStream storageStream = null; try { storageStream = getStorageManager().getInputStream(fileName); } catch (IOException ex) { if (Debug.DEBUG_GENERAL) { Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } } if (storageStream == null) { Location currentConfiguration = LocationManager.getConfigurationLocation(); Location parentConfiguration = null; if (currentConfiguration != null && (parentConfiguration = currentConfiguration.getParentLocation()) != null) { try { File bundledataLocationDir = new File(parentConfiguration.getURL().getFile(), FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME); StorageManager newStorageManager = initFileManager(bundledataLocationDir, "none", true); //$NON-NLS-1$ storageStream = newStorageManager.getInputStream(fileName); newStorageManager.close(); } catch (MalformedURLException e1) { // This will not happen since all the URLs are derived by us // and we are GODS! } catch (IOException e1) { // That's ok we will regenerate the .bundleData } } } return storageStream; }