/** * 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; }
protected StorageManager initFileManager(File baseDir, String lockMode, boolean readOnly) throws IOException { StorageManager sManager = new StorageManager(baseDir, lockMode, readOnly); try { sManager.open(!readOnly); } catch (IOException ex) { if (Debug.DEBUG_GENERAL) { Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, message, 0, ex, null); adaptor.getFrameworkLog().log(logEntry); FrameworkProperties.setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_MSG, baseDir) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ FrameworkProperties.setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
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; }
if (storageManager == null) { boolean readOnly = location.isReadOnly(); storageManager = new StorageManager(theStorageDir, readOnly ? "none" : null, readOnly); //$NON-NLS-1$ storageManager.open(!readOnly); if (parent != null) { theStorageDir = new File(parent.getURL().getPath() + '/' + Activator.PI_APP); StorageManager tmp = new StorageManager(theStorageDir, "none", true); //$NON-NLS-1$ tmp.open(false); dataFile = tmp.lookup(fileName, false);
protected StorageManager initFileManager(File baseDir, String lockMode, boolean readOnly) throws IOException { StorageManager sManager = new StorageManager(baseDir, lockMode, readOnly); try { sManager.open(!readOnly); } catch (IOException ex) { if (Debug.DEBUG_GENERAL) { Debug.println("Error reading framework metadata: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, message, 0, ex, null); adaptor.getFrameworkLog().log(logEntry); FrameworkProperties.setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_MSG, baseDir) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ FrameworkProperties.setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
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; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_GENERAL) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_GENERAL) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
protected StorageManager getChildStorageManager() throws IOException { String locking = getConfiguration().getConfiguration(LocationHelper.PROP_OSGI_LOCKING, LocationHelper.LOCKING_NIO); StorageManager sManager = new StorageManager(childRoot, isReadOnly() ? LocationHelper.LOCKING_NONE : locking, isReadOnly()); try { sManager.open(!isReadOnly()); } catch (IOException ex) { if (getConfiguration().getDebug().DEBUG_STORAGE) { Debug.println("Error reading framework.info: " + ex.getMessage()); //$NON-NLS-1$ Debug.printStackTrace(ex); } String message = NLS.bind(Msg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage()); equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, message, ex); getConfiguration().setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$ String errorDialog = "<title>" + Msg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(Msg.ADAPTOR_STORAGE_INIT_FAILED_MSG, childRoot) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ getConfiguration().setProperty(EclipseStarter.PROP_EXITDATA, errorDialog); throw ex; } return sManager; }
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_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; } }