diff options
author | slewis | 2011-08-19 01:29:25 +0000 |
---|---|---|
committer | slewis | 2011-08-19 01:29:25 +0000 |
commit | edccd1ae619681604b2b664002dc74b39e7f8dde (patch) | |
tree | 6103d335521d70068502e102e8b11da0e0fc0196 /framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core | |
parent | ea25ef76141361e9477cba59fd11e0c1081ad6d2 (diff) | |
download | org.eclipse.ecf-edccd1ae619681604b2b664002dc74b39e7f8dde.tar.gz org.eclipse.ecf-edccd1ae619681604b2b664002dc74b39e7f8dde.tar.xz org.eclipse.ecf-edccd1ae619681604b2b664002dc74b39e7f8dde.zip |
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=355180
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core')
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 + "]"; + } + } |