Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-04-02 16:15:49 -0400
committerslewis2018-04-02 16:15:49 -0400
commit4a57e441dc58fb13dd1ed03fbf564d2fb72e3b20 (patch)
tree3907300cae1f2135cb399e672c5761c5d4e948b0 /framework/bundles/org.eclipse.ecf.identity/src
parent26609be7053ab3524e383a75e11e2b0a25dfca2c (diff)
downloadorg.eclipse.ecf-4a57e441dc58fb13dd1ed03fbf564d2fb72e3b20.tar.gz
org.eclipse.ecf-4a57e441dc58fb13dd1ed03fbf564d2fb72e3b20.tar.xz
org.eclipse.ecf-4a57e441dc58fb13dd1ed03fbf564d2fb72e3b20.zip
Additional fixes for bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=532205 Added support for osgi.basic serialization specification in the form of org.eclipse.ecf.util.OSGIObjectOutputStream and OSGIObjectInputStream Change-Id: Ic82780c6f4179a27928fb95261ad766be7ad4526
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/BaseID.java12
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/GUID.java7
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/LongID.java7
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/Namespace.java78
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java7
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/StringID.java13
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/URIID.java9
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/UuID.java22
8 files changed, 94 insertions, 61 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
index aa5e1cb25..1630a79b3 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
@@ -26,7 +26,10 @@ public abstract class BaseID implements ID {
protected Namespace namespace;
- protected BaseID() {
+ /**
+ * @since 3.9
+ */
+ public BaseID() {
//
}
@@ -125,16 +128,15 @@ public abstract class BaseID implements ID {
/**
* Called by {@link Namespace#getHashCodeForID(BaseID)}.
*
- * @return int hashCode for this ID. Returned value must be unique within
- * this process.
+ * @return int hashCode for this ID. Returned value must be unique within this
+ * process.
*/
protected abstract int namespaceHashCode();
/**
* Called by {@link Namespace#toExternalForm(BaseID)}.
*
- * @return String that represents this ID. Default implementation is to
- * return
+ * @return String that represents this ID. Default implementation is to return
*
* <pre>
* namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName();
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/GUID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/GUID.java
index c084da12d..666ea7239 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/GUID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/GUID.java
@@ -71,6 +71,13 @@ public class GUID extends StringID {
protected static transient SecureRandom random;
/**
+ * @since 3.9
+ */
+ public GUID() {
+
+ }
+
+ /**
* Protected constructor for factory-based construction
*
* @param n
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/LongID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/LongID.java
index 9e3b94be8..52271c18e 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/LongID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/LongID.java
@@ -57,6 +57,13 @@ public class LongID extends BaseID {
}
}
+ /**
+ * @since 3.9
+ */
+ public LongID() {
+
+ }
+
protected LongID(Namespace n, Long v) {
super(n);
value = v;
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/Namespace.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/Namespace.java
index ad3c8ce99..f13ba0e97 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/Namespace.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/Namespace.java
@@ -49,9 +49,9 @@ public abstract class Namespace implements Serializable, IAdaptable {
private String description;
- private int hashCode;
+ private transient int hashCode;
- private boolean isInitialized = false;
+ private transient boolean isInitialized = false;
public Namespace() {
// public null constructor
@@ -74,9 +74,9 @@ public abstract class Namespace implements Serializable, IAdaptable {
}
/**
- * Override of Object.equals. This equals method returns true if the
- * provided Object is also a Namespace instance, and the names of the two
- * instances match.
+ * Override of Object.equals. This equals method returns true if the provided
+ * Object is also a Namespace instance, and the names of the two instances
+ * match.
*
* @param other
* the Object to test for equality
@@ -115,8 +115,8 @@ public abstract class Namespace implements Serializable, IAdaptable {
}
/**
- * The default implementation of this method is to call
- * id.namespaceGetName(). Subclasses may override.
+ * The default implementation of this method is to call id.namespaceGetName().
+ * Subclasses may override.
*
* @param id
* the ID to get the name for. Must not be <code>null</code>.
@@ -142,14 +142,14 @@ public abstract class Namespace implements Serializable, IAdaptable {
}
/**
- * The default implementation of this method is to call
- * id.namespaceHashCode(). Subclasses may override.
+ * The default implementation of this method is to call id.namespaceHashCode().
+ * Subclasses may override.
*
* @param id
* the id in this Namespace to get the hashcode for. Must not be
* <code>null</code>.
- * @return the hashcode for the given id. Returned value must be unique
- * within this process.
+ * @return the hashcode for the given id. Returned value must be unique within
+ * this process.
*/
protected int getHashCodeForID(BaseID id) {
return id.namespaceHashCode();
@@ -161,11 +161,10 @@ public abstract class Namespace implements Serializable, IAdaptable {
*
* @param id
* the id in this Namespace to convert to external form.
- * @return String that represents the given id in an external form. Note
- * that this external form may at some later time be passed to
- * {@link #createInstance(Object[])} as a single String parameter,
- * and should result in a valid ID instance of the appropriate
- * Namespace.
+ * @return String that represents the given id in an external form. Note that
+ * this external form may at some later time be passed to
+ * {@link #createInstance(Object[])} as a single String parameter, and
+ * should result in a valid ID instance of the appropriate Namespace.
*/
protected String toExternalForm(BaseID id) {
return id.namespaceToExternalForm();
@@ -174,9 +173,9 @@ public abstract class Namespace implements Serializable, IAdaptable {
/**
* Get the name of this namespace. Must not return <code>null</code>.
*
- * @return String name of Namespace instance. Must not return
- * <code>null</code>, and the returned value should be a globally
- * unique name for this Namespace subclass.
+ * @return String name of Namespace instance. Must not return <code>null</code>,
+ * and the returned value should be a globally unique name for this
+ * Namespace subclass.
*
*/
public String getName() {
@@ -184,8 +183,8 @@ public abstract class Namespace implements Serializable, IAdaptable {
}
/**
- * Get the description, associated with this Namespace. The returned value
- * may be <code>null</code>.
+ * Get the description, associated with this Namespace. The returned value may
+ * be <code>null</code>.
*
* @return the description associated with this Namespace. May be
* <code>null</code>.
@@ -195,9 +194,8 @@ public abstract class Namespace implements Serializable, IAdaptable {
}
/**
- * Make an instance of this namespace. Namespace subclasses, provided by
- * plugins must implement this method to construct ID instances for the
- * given namespace.
+ * Make an instance of this namespace. Namespace subclasses, provided by plugins
+ * must implement this method to construct ID instances for the given namespace.
* <p>
* </p>
* See {@link #getSupportedParameterTypes()} to get information relevant to
@@ -206,8 +204,7 @@ public abstract class Namespace implements Serializable, IAdaptable {
* </p>
*
* @param parameters
- * an Object[] of parameters for creating ID instances. May be
- * null.
+ * an Object[] of parameters for creating ID instances. May be null.
*
* @return a non-null ID instance. The class used may extend BaseID or may
* implement the ID interface directly
@@ -227,8 +224,8 @@ public abstract class Namespace implements Serializable, IAdaptable {
public abstract String getScheme();
/**
- * Get an array of schemes supported by this Namespace instance. Subclasses
- * may override to support multiple schemes.
+ * Get an array of schemes supported by this Namespace instance. Subclasses may
+ * override to support multiple schemes.
*
* @return String[] of schemes supported by this Namespace. Will not be
* <code>null</code>, but returned array may be of length 0.
@@ -239,20 +236,20 @@ public abstract class Namespace implements Serializable, IAdaptable {
/**
* Get the supported parameter types for IDs created via subsequent calls to
- * {@link #createInstance(Object[])}. Callers may use this method to
- * determine the available parameter types, and then create and pass in
- * conforming Object arrays to to {@link #createInstance(Object[])}.
+ * {@link #createInstance(Object[])}. Callers may use this method to determine
+ * the available parameter types, and then create and pass in conforming Object
+ * arrays to to {@link #createInstance(Object[])}.
* <p>
* </p>
- * An empty two-dimensional array (new Class[0][0]) is the default returned
- * by this abstract superclass. This means that the Object [] passed to
+ * An empty two-dimensional array (new Class[0][0]) is the default returned by
+ * this abstract superclass. This means that the Object [] passed to
* {@link #createInstance(Object[])} will be ignored.
* <p>
* </p>
- * Subsclasses should override this method to specify the parameters that
- * they will accept in calls to {@link #createInstance(Object[])}. The rows
- * of the returned Class array are the acceptable types for a given
- * invocation of createInstance.
+ * Subsclasses should override this method to specify the parameters that they
+ * will accept in calls to {@link #createInstance(Object[])}. The rows of the
+ * returned Class array are the acceptable types for a given invocation of
+ * createInstance.
* <p>
* </p>
* Consider the following example:
@@ -265,10 +262,9 @@ public abstract class Namespace implements Serializable, IAdaptable {
* }
* </pre>
*
- * The above means that there are two acceptable values for the Object []
- * passed into {@link #createInstance(Object[])}: 1) a single String, and 2)
- * two Strings. These would therefore be acceptable as input to
- * createInstance:
+ * The above means that there are two acceptable values for the Object [] passed
+ * into {@link #createInstance(Object[])}: 1) a single String, and 2) two
+ * Strings. These would therefore be acceptable as input to createInstance:
*
* <pre>
* ID newID1 = namespace.createInstance(new Object[] { &quot;Hello&quot; });
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
index 2053d1e14..b93dcacac 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
@@ -26,6 +26,13 @@ public class NamespacePermission extends BasicPermission {
protected String actions;
+ /**
+ * @since 3.9
+ */
+ public NamespacePermission() {
+ super("", "");
+ }
+
public NamespacePermission(String s) {
super(s);
}
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/StringID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/StringID.java
index a11401e18..e5e1d8220 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/StringID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/StringID.java
@@ -33,8 +33,7 @@ public class StringID extends BaseID {
return new StringID(this, init);
return new StringID(this, (String) parameters[0]);
} catch (Exception e) {
- throw new IDCreateException(StringIDNamespace.this.getName()
- + " createInstance()", e); //$NON-NLS-1$
+ throw new IDCreateException(StringIDNamespace.this.getName() + " createInstance()", e); //$NON-NLS-1$
}
}
@@ -56,6 +55,13 @@ public class StringID extends BaseID {
protected String value;
/**
+ * @since 3.9
+ */
+ public StringID() {
+
+ }
+
+ /**
* Protected constructor for factory-based construction
*
* @param n
@@ -128,8 +134,7 @@ public class StringID extends BaseID {
protected synchronized void setEmptyNamespace() {
if (namespace == null) {
- namespace = IDFactory.getDefault().getNamespaceByName(
- StringID.class.getName());
+ namespace = IDFactory.getDefault().getNamespaceByName(StringID.class.getName());
}
}
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 36454db99..a449926b5 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
@@ -78,7 +78,14 @@ public class URIID extends BaseID implements IResourceID {
}
private static final long serialVersionUID = 7328962407044918278L;
- private final URI uri;
+ private URI uri;
+
+ /**
+ * @since 3.9
+ */
+ public URIID() {
+
+ }
public URIID(Namespace namespace, URI uri) {
super(namespace);
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/UuID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/UuID.java
index 8e8675e90..8ce1b6559 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/UuID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/UuID.java
@@ -41,20 +41,16 @@ public class UuID extends BaseID {
return new UuID(this, UUID.fromString(init));
if (parameters != null && parameters.length > 0) {
if (parameters[0] instanceof String)
- return new UuID(this,
- UUID.fromString((String) parameters[0]));
+ return new UuID(this, UUID.fromString((String) parameters[0]));
else if (parameters[0] instanceof URI)
- return new UuID(this,
- UUID.fromString(((URI) parameters[0])
- .getSchemeSpecificPart()));
+ return new UuID(this, UUID.fromString(((URI) parameters[0]).getSchemeSpecificPart()));
else if (parameters[0] instanceof UUID)
return new UuID(this, (UUID) parameters[0]);
}
// If we get here, then use random
return new UuID(this, UUID.randomUUID());
} catch (Exception e) {
- throw new IDCreateException(UuIDNamespace.this.getName()
- + " createInstance()", e); //$NON-NLS-1$
+ throw new IDCreateException(UuIDNamespace.this.getName() + " createInstance()", e); //$NON-NLS-1$
}
}
@@ -65,12 +61,18 @@ public class UuID extends BaseID {
@Override
public Class<?>[][] getSupportedParameterTypes() {
- return new Class[][] { { String.class }, { UUID.class },
- { URI.class } };
+ return new Class[][] { { String.class }, { UUID.class }, { URI.class } };
}
}
- protected final UUID uuid;
+ protected UUID uuid;
+
+ /**
+ * @since 3.9
+ */
+ public UuID() {
+
+ }
protected UuID(UuIDNamespace ns, UUID uuid) {
super(ns);

Back to the top