diff options
author | slewis | 2008-05-11 22:28:45 +0000 |
---|---|---|
committer | slewis | 2008-05-11 22:28:45 +0000 |
commit | 3adf09025d1d299c886f16ff62d21bffd461a3c3 (patch) | |
tree | 57927399556d0c3012b3a9dc58ee5eb9ddf2975b | |
parent | dd0afce6a0cb8f69168f34da4962a83471efe0c4 (diff) | |
download | org.eclipse.ecf-3adf09025d1d299c886f16ff62d21bffd461a3c3.tar.gz org.eclipse.ecf-3adf09025d1d299c886f16ff62d21bffd461a3c3.tar.xz org.eclipse.ecf-3adf09025d1d299c886f16ff62d21bffd461a3c3.zip |
Initial checkin of org.eclipse.ecf.storage
14 files changed, 460 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.storage/.classpath b/framework/bundles/org.eclipse.ecf.storage/.classpath new file mode 100644 index 000000000..2fbb7a23e --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/framework/bundles/org.eclipse.ecf.storage/.project b/framework/bundles/org.eclipse.ecf.storage/.project new file mode 100644 index 000000000..354d792a8 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.storage</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.core.prefs b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..c2270e889 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,94 @@ +#Fri May 09 00:38:44 PDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.ui.prefs b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..9bb86c1d3 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,57 @@ +#Wed Oct 10 22:18:36 EDT 2007 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_core +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=; +org.eclipse.jdt.ui.ondemandthreshold=3 +org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.pde.prefs b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.pde.prefs new file mode 100644 index 000000000..6686ccd10 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/.settings/org.eclipse.pde.prefs @@ -0,0 +1,3 @@ +#Thu Apr 19 20:30:05 GMT-08:00 2007 +compilers.use-project=true +eclipse.preferences.version=1 diff --git a/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF new file mode 100644 index 000000000..e06ae8130 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ECF Storage Plug-in +Bundle-SymbolicName: org.eclipse.ecf.storage +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.ecf.internal.storage.Activator +Bundle-Vendor: Eclipse.org +Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Eclipse-LazyStart: true +Import-Package: org.eclipse.equinox.security.storage;version="1.0.0", + org.osgi.framework +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.equinox.common, + org.eclipse.ecf.identity;bundle-version="2.0.0" +Bundle-Localization: plugin +Export-Package: org.eclipse.ecf.storage diff --git a/framework/bundles/org.eclipse.ecf.storage/about.html b/framework/bundles/org.eclipse.ecf.storage/about.html new file mode 100644 index 000000000..6a60a262f --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 29, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.storage/build.properties b/framework/bundles/org.eclipse.ecf.storage/build.properties new file mode 100644 index 000000000..9d6bc9f81 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + about.html +src.includes = META-INF/,\ + plugin.properties,\ + about.html diff --git a/framework/bundles/org.eclipse.ecf.storage/plugin.properties b/framework/bundles/org.eclipse.ecf.storage/plugin.properties new file mode 100644 index 000000000..7d55759f9 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/plugin.properties @@ -0,0 +1,2 @@ +plugin.name=ECF Secure Storage API +plugin.provider=Eclipse.org
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/Activator.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/Activator.java new file mode 100644 index 000000000..76c562616 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.ecf.internal.storage; + +import org.eclipse.ecf.storage.IIDStore; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.ecf.storage"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + context.registerService(IIDStore.class.getName(), new IDStore(), null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} 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 new file mode 100644 index 000000000..100865da1 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/internal/storage/IDStore.java @@ -0,0 +1,74 @@ +/**************************************************************************** + * 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.identity.*; +import org.eclipse.ecf.storage.*; +import org.eclipse.equinox.security.storage.*; + +/** + * + */ +public class IDStore implements IIDStore { + + private static final String idStoreNameSegment = "/ECF/ID Store/"; //$NON-NLS-1$ + private static final String NSSEPARATOR = ":"; //$NON-NLS-1$ + + /* (non-Javadoc) + * @see org.eclipse.ecf.storage.IIDStore#getNode(org.eclipse.ecf.core.identity.ID) + */ + public ISecurePreferences getNode(ID id) { + if (id == null) + return null; + final ISecurePreferences root = SecurePreferencesFactory.getDefault(); + if (root == null) + return null; + final String idAsString = getIDAsString(id); + if (idAsString == null) + return null; + final String path = idStoreNameSegment + EncodingUtils.encodeSlashes(idAsString); + return root.node(path); + } + + private String getIDAsString(ID id) { + final Namespace ns = id.getNamespace(); + final INamespaceStoreAdapter nsadapter = (INamespaceStoreAdapter) ns.getAdapter(INamespaceStoreAdapter.class); + final String nsName = (nsadapter != null) ? nsadapter.getNameForStorage() : ns.getName(); + if (nsName == null) + return null; + final IIDStoreAdapter idadapter = (IIDStoreAdapter) id.getAdapter(IIDStoreAdapter.class); + final String idName = (idadapter != null) ? idadapter.getNameForStorage() : id.toExternalForm(); + if (idName == null || idName.equals("")) //$NON-NLS-1$ + return null; + return nsName + NSSEPARATOR + idName; + } + + /* (non-Javadoc) + * @see org.eclipse.ecf.storage.IIDStore#createID(org.eclipse.equinox.security.storage.ISecurePreferences) + */ + public ID createID(ISecurePreferences node) throws IDCreateException { + if (node == null) + throw new IDCreateException("Node cannot be null"); //$NON-NLS-1$ + final String nodeName = node.name(); + if (nodeName == null) + throw new IDCreateException("Node name cannot be null"); //$NON-NLS-1$ + final int index = nodeName.indexOf(NSSEPARATOR); + if (index == -1) + throw new IDCreateException("Namespace name not found"); //$NON-NLS-1$ + final String nsName = nodeName.substring(0, index); + final Namespace ns = IDFactory.getDefault().getNamespaceByName(nsName); + if (ns == null) + throw new IDCreateException("Namespace cannot be found"); //$NON-NLS-1$ + final String idName = nodeName.substring(index + NSSEPARATOR.length()); + return IDFactory.getDefault().createID(ns, idName); + } +} 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 new file mode 100644 index 000000000..30b0d31c0 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStore.java @@ -0,0 +1,42 @@ +/**************************************************************************** + * 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.storage; + +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.identity.IDCreateException; +import org.eclipse.equinox.security.storage.ISecurePreferences; + +/** + * ID storage service. This interface defines access to storing a given ID instance as a node in + * secure preferences. It also provides a way to create an ID from a secure preferences node. + */ +public interface IIDStore { + + /** + * 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. + * @return ISecurePreferences for the given ID. Will return an existing node if ID is already present, and a new + * node if not. + */ + public ISecurePreferences getNode(ID id); + + /** + * Create ID for an ISecurePreferences node. + * @param node the node to use to create the new ID instance. + * @return new ID created. Will not be <code>null</code>. + * @throws IDCreateException thrown if ID cannot be created...e.g. the given node does not define + * a valid ID instance. + */ + public ID createID(ISecurePreferences node) throws IDCreateException; + +} diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStoreAdapter.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStoreAdapter.java new file mode 100644 index 000000000..8e8433c5e --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/IIDStoreAdapter.java @@ -0,0 +1,25 @@ +/**************************************************************************** + * 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.storage; + +/** + * Adapter for retrieving ID name for storage. + */ +public interface IIDStoreAdapter { + + /** + * Get the ID name for storage. + * @return String name for storage. Must not return <code>null</code>. + */ + public String getNameForStorage(); + +} diff --git a/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/INamespaceStoreAdapter.java b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/INamespaceStoreAdapter.java new file mode 100644 index 000000000..827d4508d --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.storage/src/org/eclipse/ecf/storage/INamespaceStoreAdapter.java @@ -0,0 +1,25 @@ +/**************************************************************************** + * 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.storage; + +/** + * Adapter for retrieving Namespace name for storage. + */ +public interface INamespaceStoreAdapter { + + /** + * Get the Namespace name for storage. + * @return String name for storage. Must not return <code>null</code>. + */ + public String getNameForStorage(); + +} |