private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<StorageHook<?, ?>>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<StorageHook<?, ?>>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<StorageHook<?, ?>>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void setStorageHooks(Generation generation) throws BundleException { if (generation.getBundleInfo().getBundleId() == 0) { return; // ignore system bundle } List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); List<StorageHook<?, ?>> hooks = new ArrayList<StorageHook<?, ?>>(factories.size()); for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) { @SuppressWarnings("unchecked") StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next(); StorageHook<Object, Object> hook = next.createStorageHookAndValidateFactoryClass(generation); hooks.add(hook); } generation.setStorageHooks(Collections.unmodifiableList(hooks), true); for (StorageHook<?, ?> hook : hooks) { hook.initialize(generation.getHeaders()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void saveStorageHookData(DataOutputStream out, List<Generation> generations) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = getConfiguration().getHookRegistry().getStorageHookFactories(); out.writeInt(factories.size()); for (StorageHookFactory<?, ?, ?> factory : factories) { out.writeUTF(factory.getKey()); out.writeInt(factory.getStorageVersion()); // create a temporary in memory stream so we can figure out the length ByteArrayOutputStream tempBytes = new ByteArrayOutputStream(); DataOutputStream temp = new DataOutputStream(tempBytes); try { Object saveContext = factory.createSaveContext(); for (Generation generation : generations) { if (generation.getBundleInfo().getBundleId() == 0) { continue; // ignore system bundle } @SuppressWarnings({"rawtypes", "unchecked"}) StorageHook<Object, Object> hook = generation.getStorageHook((Class) factory.getClass()); hook.save(saveContext, temp); } } finally { temp.close(); } out.writeInt(tempBytes.size()); out.write(tempBytes.toByteArray()); } }
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<>(); int numFactories = in.readInt();
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<Generation, List<StorageHook<?, ?>>>(); int numFactories = in.readInt();
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<Generation, List<StorageHook<?, ?>>>(); int numFactories = in.readInt();
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<Generation, List<StorageHook<?, ?>>>(); int numFactories = in.readInt();
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<>(); int numFactories = in.readInt();
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException { List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories()); Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<Generation, List<StorageHook<?, ?>>>(); int numFactories = in.readInt();