Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-05-20 21:38:47 +0000
committerslewis2008-05-20 21:38:47 +0000
commitcc1d0b72f7c0b3a0dfb90c4635799aa2c21fbbfc (patch)
tree762b29cadcbcc52a39f7a68bbb828a362d88d8fa
parent6dedbbff20216c9523f0317ad923b3008e99decd (diff)
downloadorg.eclipse.ecf-cc1d0b72f7c0b3a0dfb90c4635799aa2c21fbbfc.tar.gz
org.eclipse.ecf-cc1d0b72f7c0b3a0dfb90c4635799aa2c21fbbfc.tar.xz
org.eclipse.ecf-cc1d0b72f7c0b3a0dfb90c4635799aa2c21fbbfc.zip
Additions to ContainerStore/ContainerEntry
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/build.properties3
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/plugin.xml12
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/ContainerStore.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableBaseContainer.java69
-rw-r--r--framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableContainerInstantiator.java25
6 files changed, 110 insertions, 3 deletions
diff --git a/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF
index 09bdb32b9..6700cdfef 100644
--- a/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ECF Storage Plug-in
-Bundle-SymbolicName: org.eclipse.ecf.storage
+Bundle-SymbolicName: org.eclipse.ecf.storage;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.storage.Activator
Bundle-Vendor: Eclipse.org
diff --git a/framework/bundles/org.eclipse.ecf.storage/build.properties b/framework/bundles/org.eclipse.ecf.storage/build.properties
index 9d6bc9f81..ff52de174 100644
--- a/framework/bundles/org.eclipse.ecf.storage/build.properties
+++ b/framework/bundles/org.eclipse.ecf.storage/build.properties
@@ -3,7 +3,8 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
- about.html
+ about.html,\
+ plugin.xml
src.includes = META-INF/,\
plugin.properties,\
about.html
diff --git a/framework/bundles/org.eclipse.ecf.storage/plugin.xml b/framework/bundles/org.eclipse.ecf.storage/plugin.xml
new file mode 100644
index 000000000..ab9516b61
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.storage/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.internal.storage.StorableContainerInstantiator"
+ name="ecf.storage.basecontainer">
+ </containerFactory>
+ </extension>
+
+</plugin>
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 f3be43d3e..a3932867e 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
@@ -46,7 +46,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(idEntries[j]);
+ results.add(new ContainerEntry(idEntries[j]));
}
}
}
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableBaseContainer.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableBaseContainer.java
new file mode 100644
index 000000000..0d68672bc
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableBaseContainer.java
@@ -0,0 +1,69 @@
+/****************************************************************************
+ * Copyright (c) 2008 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.internal.storage;
+
+import org.eclipse.ecf.core.BaseContainer;
+import org.eclipse.ecf.core.ContainerCreateException;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.storage.IStorableContainerAdapter;
+import org.eclipse.equinox.security.storage.ISecurePreferences;
+import org.eclipse.equinox.security.storage.StorageException;
+
+/**
+ *
+ */
+public class StorableBaseContainer extends BaseContainer implements IStorableContainerAdapter {
+
+ /**
+ * @param idl
+ * @throws ContainerCreateException
+ */
+ public StorableBaseContainer(long idl) throws ContainerCreateException {
+ super(idl);
+ }
+
+ /**
+ * @param id
+ */
+ public StorableBaseContainer(ID id) {
+ super(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.storage.IStorableContainerAdapter#encrypt()
+ */
+ public boolean encrypt() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.storage.IStorableContainerAdapter#getFactoryName()
+ */
+ public String getFactoryName() {
+ return "ecf.storage.basecontainer"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.storage.IStorableContainerAdapter#handleRestore(org.eclipse.equinox.security.storage.ISecurePreferences)
+ */
+ public void handleRestore(ISecurePreferences prefs) throws StorageException {
+ System.out.println("handleRestore(" + prefs + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.storage.IStorableContainerAdapter#handleStore(org.eclipse.equinox.security.storage.ISecurePreferences)
+ */
+ public void handleStore(ISecurePreferences prefs) throws StorageException {
+ System.out.println("handleStore(" + prefs + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableContainerInstantiator.java
new file mode 100644
index 000000000..7ed809c2d
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/StorableContainerInstantiator.java
@@ -0,0 +1,25 @@
+package org.eclipse.ecf.internal.storage;
+
+import org.eclipse.ecf.core.*;
+import org.eclipse.ecf.core.identity.*;
+import org.eclipse.ecf.core.provider.BaseContainerInstantiator;
+
+public class StorableContainerInstantiator extends BaseContainerInstantiator {
+
+ private static long nextBaseContainerID = 0L;
+
+ public IContainer createInstance(ContainerTypeDescription description, Object[] parameters) throws ContainerCreateException {
+ try {
+ if (parameters != null && parameters.length > 0) {
+ if (parameters[0] instanceof ID)
+ return new StorableBaseContainer((ID) parameters[0]);
+ if (parameters[0] instanceof String)
+ return new StorableBaseContainer(IDFactory.getDefault().createStringID((String) parameters[0]));
+ }
+ } catch (IDCreateException e) {
+ throw new ContainerCreateException("Could not create StorableBaseContainer"); //$NON-NLS-1$
+ }
+ return new StorableBaseContainer(nextBaseContainerID++);
+ }
+
+}

Back to the top