Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java23
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java8
2 files changed, 31 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java
index 100865da1..b3159bc91 100644
--- a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java
@@ -11,6 +11,8 @@
package org.eclipse.ecf.internal.storage;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.ecf.core.identity.*;
import org.eclipse.ecf.storage.*;
import org.eclipse.equinox.security.storage.*;
@@ -22,6 +24,7 @@ public class IDStore implements IIDStore {
private static final String idStoreNameSegment = "/ECF/ID Store/"; //$NON-NLS-1$
private static final String NSSEPARATOR = ":"; //$NON-NLS-1$
+ private static final ISecurePreferences[] EMPTY_SECUREPREFERENCES = {};
/* (non-Javadoc)
* @see org.eclipse.ecf.storage.IIDStore#getNode(org.eclipse.ecf.core.identity.ID)
@@ -39,6 +42,26 @@ public class IDStore implements IIDStore {
return root.node(path);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.storage.IIDStore#getNodes()
+ */
+ public ISecurePreferences[] getNodes() {
+ final ISecurePreferences root = SecurePreferencesFactory.getDefault();
+ if (root == null)
+ return null;
+ ISecurePreferences parentNode = root.node(idStoreNameSegment);
+ if (parentNode == null)
+ return EMPTY_SECUREPREFERENCES;
+ String[] childNames = parentNode.childrenNames();
+ List result = new ArrayList();
+ for (int i = 0; i < childNames.length; i++) {
+ ISecurePreferences p = parentNode.node(childNames[i]);
+ if (p != null)
+ result.add(p);
+ }
+ return (ISecurePreferences[]) result.toArray(new ISecurePreferences[] {});
+ }
+
private String getIDAsString(ID id) {
final Namespace ns = id.getNamespace();
final INamespaceStoreAdapter nsadapter = (INamespaceStoreAdapter) ns.getAdapter(INamespaceStoreAdapter.class);
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java
index 30b0d31c0..f35cc6268 100644
--- a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java
@@ -22,6 +22,14 @@ import org.eclipse.equinox.security.storage.ISecurePreferences;
public interface IIDStore {
/**
+ * Get {@link ISecurePreferences} for all IDs in ID store.
+ *
+ * @return array of ISecurePreferences instances. If number of instances current stored is 0, returns
+ * empty array. Will not return <code>null</code>.
+ */
+ public ISecurePreferences[] getNodes();
+
+ /**
* Get {@link ISecurePreferences} node for a given ID. Clients may use this to either create an {@link ISecurePreferences}
* instance for a new {@link ID}, or get an existing one from storage.
* @param id the ID to get the storage node for.

Back to the top