Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.identity/src')
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java49
2 files changed, 49 insertions, 1 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
index c040aed6e..7bbadf36a 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
@@ -36,6 +36,7 @@ public class IDFactory implements IIDFactory {
addNamespace0(new StringID.StringIDNamespace());
addNamespace0(new GUID.GUIDNamespace());
addNamespace0(new LongID.LongNamespace());
+ addNamespace0(new URIID.URIIDNamespace());
}
private synchronized static void initialize() {
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java
index 5c76c2ed0..661fbc7d0 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 EclipseSource and others. All rights reserved. This
+ * Copyright (c) 2011 Composent 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
@@ -19,6 +19,49 @@ import org.eclipse.core.runtime.Assert;
*/
public class URIID extends BaseID implements IResourceID {
+ static class URIIDNamespace extends Namespace {
+
+ private static final long serialVersionUID = 115165512542491014L;
+
+ public URIIDNamespace(String name, String desc) {
+ super(name, desc);
+ }
+
+ public URIIDNamespace() {
+ super(URIID.class.getName(), "URIID Namespace"); //$NON-NLS-1$
+ }
+
+ public ID createInstance(Object[] parameters) throws IDCreateException {
+ try {
+ String init = getInitStringFromExternalForm(parameters);
+ if (init != null)
+ return new URIID(this, new URI(init));
+ if (parameters[0] instanceof URI)
+ return new URIID(this, (URI) parameters[0]);
+ if (parameters[0] instanceof String)
+ return new URIID(this, new URI((String) parameters[0]));
+ throw new IDCreateException("Cannot create URIID");
+ } catch (Exception e) {
+ throw new IDCreateException(URIIDNamespace.this.getName()
+ + " createInstance()", e); //$NON-NLS-1$
+ }
+ }
+
+ public String getScheme() {
+ return "uri";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.ecf.core.identity.Namespace#
+ * getSupportedParameterTypesForCreateInstance()
+ */
+ public Class[][] getSupportedParameterTypes() {
+ return new Class[][] { { String.class }, { URI.class } };
+ }
+ }
+
private static final long serialVersionUID = 7328962407044918278L;
private final URI uri;
@@ -56,4 +99,8 @@ public class URIID extends BaseID implements IResourceID {
return uri;
}
+ public String toString() {
+ return "URIID [uri=" + uri + "]";
+ }
+
}

Back to the top