/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed <code>InputStream</code> for a managed file. * <code>null</code> can be returned if the given name is not managed. * * @param managedFile the name of the managed file to open. * @return an input stream to the managed file or * <code>null</code> if the given name is not managed. * @throws IOException if the content is missing, corrupt or an error occurs. */ public InputStream getInputStream(String managedFile) throws IOException { return getInputStream(managedFile, ReliableFile.OPEN_BEST_AVAILABLE); }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
/** * Returns a managed input stream set for the managed file names. * Elements of the returned set may be <code>null</code> if a given name is not managed. * This method should be used for managed file sets which use the output streams returned * by the {@link #getOutputStreamSet(String[])} to save data. * * @param managedFiles the names of the managed files to open. * @return a set input streams to the given managed files. * @throws IOException if the content of one of the managed files is missing, corrupt or an error occurs. */ public InputStream[] getInputStreamSet(String[] managedFiles) throws IOException { InputStream[] streams = new InputStream[managedFiles.length]; for (int i = 0; i < streams.length; i++) streams[i] = getInputStream(managedFiles[i], ReliableFile.OPEN_FAIL_ON_PRIMARY); return streams; }
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 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; }
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; } }