Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-05-20 16:14:09 +0000
committerslewis2008-05-20 16:14:09 +0000
commitef3ba11b03e2ed7210475d8beeeedd588635e98b (patch)
treebaab8632b62af1ea692c7c76ade5a522d0a1be27
parent035a1c24ded3f355a4e0557b79952abae5582d69 (diff)
downloadorg.eclipse.ecf-ef3ba11b03e2ed7210475d8beeeedd588635e98b.tar.gz
org.eclipse.ecf-ef3ba11b03e2ed7210475d8beeeedd588635e98b.tar.xz
org.eclipse.ecf-ef3ba11b03e2ed7210475d8beeeedd588635e98b.zip
Additions to ContainerStore/ContainerEntry
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerEntry.java16
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java10
2 files changed, 15 insertions, 11 deletions
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerEntry.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerEntry.java
index bdc04f266..ecf018614 100644
--- a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerEntry.java
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerEntry.java
@@ -14,8 +14,7 @@ package org.eclipse.ecf.internal.storage;
import org.eclipse.ecf.core.*;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
-import org.eclipse.ecf.storage.IContainerEntry;
-import org.eclipse.ecf.storage.IIDEntry;
+import org.eclipse.ecf.storage.*;
import org.eclipse.equinox.security.storage.ISecurePreferences;
import org.eclipse.equinox.security.storage.StorageException;
@@ -32,12 +31,12 @@ public class ContainerEntry implements IContainerEntry {
ID containerID;
/**
- * @param node
* @param idEntry
*/
- public ContainerEntry(ISecurePreferences node, IIDEntry idEntry) {
- this.prefs = node;
+ public ContainerEntry(IIDEntry idEntry) {
this.idEntry = idEntry;
+ ISecurePreferences prefs = idEntry.getPreferences();
+ this.prefs = prefs.node(ContainerStore.CONTAINER_NODE_NAME);
}
/* (non-Javadoc)
@@ -45,7 +44,12 @@ public class ContainerEntry implements IContainerEntry {
*/
public IContainer createContainer() throws ContainerCreateException {
try {
- return ContainerFactory.getDefault().createContainer(getFactoryName(), getContainerID());
+ IContainer container = ContainerFactory.getDefault().createContainer(getFactoryName(), getContainerID());
+ IStorableContainerAdapter containerAdapter = (IStorableContainerAdapter) container.getAdapter(IStorableContainerAdapter.class);
+ if (containerAdapter != null) {
+ containerAdapter.handleRestore(prefs);
+ }
+ return container;
} catch (IDCreateException e) {
throw new ContainerCreateException("Could not create ID for container", e); //$NON-NLS-1$
} catch (StorageException e) {
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java
index 6edd41158..c9b2a832c 100644
--- a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.security.storage.ISecurePreferences;
*/
public class ContainerStore implements IContainerStore {
- private static final String CONTAINER_NODE_NAME = "container"; //$NON-NLS-1$
+ static final String CONTAINER_NODE_NAME = "container"; //$NON-NLS-1$
final IDStore idStore;
@@ -45,7 +45,7 @@ public class ContainerStore implements IContainerStore {
String[] names = pref.childrenNames();
for (int k = 0; k < names.length; k++) {
if (names[k].equals(CONTAINER_NODE_NAME))
- results.add(new ContainerEntry(pref.node(CONTAINER_NODE_NAME), idEntries[j]));
+ results.add(idEntries[j]);
}
}
}
@@ -61,9 +61,9 @@ public class ContainerStore implements IContainerStore {
ID containerID = containerAdapter.getID();
Assert.isNotNull(containerID);
IIDEntry idEntry = idStore.store(containerID);
- ISecurePreferences prefs = idEntry.getPreferences();
- ISecurePreferences containerPrefs = prefs.node(CONTAINER_NODE_NAME);
- return new ContainerEntry(containerPrefs, idEntry);
+ ContainerEntry containerEntry = new ContainerEntry(idEntry);
+ containerAdapter.handleStore(containerEntry.getPreferences());
+ return containerEntry;
}
/* (non-Javadoc)

Back to the top