diff options
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.identity/src')
17 files changed, 171 insertions, 339 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 b0b7ecaef..3d8fb324d 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 @@ -40,8 +40,7 @@ public abstract class BaseID implements ID { * @see java.lang.Comparable#compareTo(T) */ public int compareTo(Object o) { - Assert.isTrue(o != null && o instanceof BaseID, - "incompatible types for compare"); //$NON-NLS-1$ + Assert.isTrue(o != null && o instanceof BaseID, "incompatible types for compare"); //$NON-NLS-1$ return namespace.getCompareToForObject(this, (BaseID) o); } @@ -104,8 +103,7 @@ public abstract class BaseID implements ID { protected abstract int namespaceHashCode(); protected String namespaceToExternalForm() { - return namespace.getScheme() + Namespace.SCHEME_SEPARATOR - + namespaceGetName(); + return namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName(); } /* @@ -115,7 +113,8 @@ public abstract class BaseID implements ID { */ public Object getAdapter(Class clazz) { IAdapterManager adapterManager = Activator.getDefault().getAdapterManager(); - if (adapterManager == null) return null; + if (adapterManager == null) + return null; return adapterManager.loadAdapter(this, clazz.getName()); } }
\ No newline at end of file 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 afafc6c53..4f4c16224 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 @@ -48,7 +48,7 @@ public class GUID extends StringID { * @see org.eclipse.ecf.core.identity.Namespace#getSupportedParameterTypesForCreateInstance() */ public Class[][] getSupportedParameterTypes() { - return new Class[][] { {}, { Integer.class } }; + return new Class[][] { {}, {Integer.class}}; } } @@ -72,15 +72,13 @@ public class GUID extends StringID { * @param byteLength * the length of the target number (in bytes) */ - protected GUID(Namespace n, String algo, String provider, int byteLength) - throws IDCreateException { + protected GUID(Namespace n, String algo, String provider, int byteLength) throws IDCreateException { super(n, ""); //$NON-NLS-1$ // Get SecureRandom instance for class try { getRandom(algo, provider); } catch (Exception e) { - throw new IDCreateException(Messages.GUID_GUID_Creation_Failure - + e.getMessage()); + throw new IDCreateException(Messages.GUID_GUID_Creation_Failure + e.getMessage()); } // make sure we have reasonable byteLength if (byteLength <= 0) @@ -113,8 +111,7 @@ public class GUID extends StringID { * @exception Exception * thrown if SecureRandom instance cannot be created/accessed */ - protected static synchronized SecureRandom getRandom(String algo, - String provider) throws Exception { + protected static synchronized SecureRandom getRandom(String algo, String provider) throws Exception { // Given algo and provider, get SecureRandom instance if (random == null) { initializeRandom(algo, provider); @@ -122,8 +119,7 @@ public class GUID extends StringID { return random; } - protected static synchronized void initializeRandom(String algo, - String provider) throws Exception { + protected static synchronized void initializeRandom(String algo, String provider) throws Exception { if (provider == null) { if (algo == null) { try { diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/ID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/ID.java index a253ba77d..cd44eb8a8 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/ID.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/ID.java @@ -29,8 +29,7 @@ import org.eclipse.core.runtime.IAdaptable; * @see Namespace * */ -public interface ID extends java.io.Serializable, java.lang.Comparable, - java.security.Principal, IAdaptable { +public interface ID extends java.io.Serializable, java.lang.Comparable, java.security.Principal, IAdaptable { public boolean equals(Object obj); diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDCreateException.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDCreateException.java index 82d5565c1..f21da14cd 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDCreateException.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDCreateException.java @@ -21,7 +21,7 @@ public class IDCreateException extends ECFException { public IDCreateException(IStatus status) { super(status); } - + public IDCreateException(String message) { super(message); } 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 8d767304e..0c05b7a55 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 @@ -27,8 +27,7 @@ import org.eclipse.osgi.util.NLS; * */ public class IDFactory implements IIDFactory { - public static final String SECURITY_PROPERTY = IDFactory.class.getName() - + ".security"; //$NON-NLS-1$ + public static final String SECURITY_PROPERTY = IDFactory.class.getName() + ".security"; //$NON-NLS-1$ private static final int IDENTITY_CREATION_ERRORCODE = 2001; @@ -60,15 +59,10 @@ public class IDFactory implements IIDFactory { public Namespace addNamespace(Namespace namespace) throws SecurityException { if (namespace == null) return null; - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "addNamespace", namespace); //$NON-NLS-1$ - checkPermission(new NamespacePermission(namespace.toString(), - NamespacePermission.ADD_NAMESPACE)); + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "addNamespace", namespace); //$NON-NLS-1$ + checkPermission(new NamespacePermission(namespace.toString(), NamespacePermission.ADD_NAMESPACE)); Namespace result = addNamespace0(namespace); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "addNamespace", result); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "addNamespace", result); //$NON-NLS-1$ return result; } @@ -78,8 +72,7 @@ public class IDFactory implements IIDFactory { return (Namespace) namespaces.put(namespace.getName(), namespace); } - protected final static void checkPermission( - NamespacePermission namespacepermission) throws SecurityException { + protected final static void checkPermission(NamespacePermission namespacepermission) throws SecurityException { if (securityEnabled) AccessController.checkPermission(namespacepermission); } @@ -89,19 +82,13 @@ public class IDFactory implements IIDFactory { * * @see org.eclipse.ecf.core.identity.IIDFactory#containsNamespace(org.eclipse.ecf.core.identity.Namespace) */ - public boolean containsNamespace(Namespace namespace) - throws SecurityException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "containsNamespace", namespace); //$NON-NLS-1$ + public boolean containsNamespace(Namespace namespace) throws SecurityException { + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "containsNamespace", namespace); //$NON-NLS-1$ if (namespace == null) return false; - checkPermission(new NamespacePermission(namespace.toString(), - NamespacePermission.CONTAINS_NAMESPACE)); + checkPermission(new NamespacePermission(namespace.toString(), NamespacePermission.CONTAINS_NAMESPACE)); boolean result = containsNamespace0(namespace); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "containsNamespace", new Boolean(result)); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "containsNamespace", new Boolean(result)); //$NON-NLS-1$ return result; } @@ -111,9 +98,7 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#getNamespaces() */ public List getNamespaces() { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "getNamespaces"); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "getNamespaces"); //$NON-NLS-1$ return new ArrayList(namespaces.values()); } @@ -129,17 +114,12 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#getNamespace(org.eclipse.ecf.core.identity.Namespace) */ public Namespace getNamespace(Namespace namespace) throws SecurityException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "getNamespace", namespace); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "getNamespace", namespace); //$NON-NLS-1$ if (namespace == null) return null; - checkPermission(new NamespacePermission(namespace.toString(), - NamespacePermission.GET_NAMESPACE)); + checkPermission(new NamespacePermission(namespace.toString(), NamespacePermission.GET_NAMESPACE)); Namespace result = getNamespace0(namespace); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "getNamespace", result); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "getNamespace", result); //$NON-NLS-1$ return result; } @@ -149,13 +129,9 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#getNamespaceByName(java.lang.String) */ public Namespace getNamespaceByName(String name) throws SecurityException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "getNamespaceByName", name); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "getNamespaceByName", name); //$NON-NLS-1$ Namespace result = getNamespace0(name); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "getNamespaceByName", result); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "getNamespaceByName", result); //$NON-NLS-1$ return result; } @@ -187,19 +163,14 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#createGUID(int) */ public ID createGUID(int length) throws IDCreateException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "createGUID", new Integer(length)); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "createGUID", new Integer(length)); //$NON-NLS-1$ Namespace namespace = new GUID.GUIDNamespace(); - ID result = createID(namespace, new Integer[] { new Integer(length) }); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "createGUID", result); //$NON-NLS-1$ + ID result = createID(namespace, new Integer[] {new Integer(length)}); + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "createGUID", result); //$NON-NLS-1$ return result; } - protected static void logAndThrow(String s, Throwable t) - throws IDCreateException { + protected static void logAndThrow(String s, Throwable t) throws IDCreateException { IDCreateException e = null; if (t != null) { e = new IDCreateException(s + ": " + t.getClass().getName() + ": " //$NON-NLS-1$ //$NON-NLS-2$ @@ -207,12 +178,8 @@ public class IDFactory implements IIDFactory { } else { e = new IDCreateException(s); } - Trace.throwing(Activator.PLUGIN_ID, - IdentityDebugOptions.EXCEPTIONS_THROWING, IDFactory.class, - "logAndThrow", e); //$NON-NLS-1$ - Activator.getDefault().log( - new Status(IStatus.ERROR, Activator.PLUGIN_ID, - IDENTITY_CREATION_ERRORCODE, s, e)); + Trace.throwing(Activator.PLUGIN_ID, IdentityDebugOptions.EXCEPTIONS_THROWING, IDFactory.class, "logAndThrow", e); //$NON-NLS-1$ + Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IDENTITY_CREATION_ERRORCODE, s, e)); throw e; } @@ -223,9 +190,7 @@ public class IDFactory implements IIDFactory { * java.lang.Object[]) */ public ID createID(Namespace n, Object[] args) throws IDCreateException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "createID", new Object[] { n, Trace.getArgumentsString(args) }); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "createID", new Object[] {n, Trace.getArgumentsString(args)}); //$NON-NLS-1$ // Verify namespace is non-null if (n == null) logAndThrow(Messages.IDFactory_Namespace_Not_Null, null); @@ -233,15 +198,12 @@ public class IDFactory implements IIDFactory { // throw...we don't create any instances that we don't know about! Namespace ns = getNamespace0(n); if (ns == null) - logAndThrow(NLS.bind(Messages.IDFactory_Namespace_Not_Found, n - .getName()), null); + logAndThrow(NLS.bind(Messages.IDFactory_Namespace_Not_Found, n.getName()), null); // We're OK, go ahead and setup array of classes for call to // instantiator // Ask instantiator to actually create instance ID result = ns.createInstance(args); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "createID", result); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "createID", result); //$NON-NLS-1$ return result; } @@ -251,22 +213,19 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#createID(java.lang.String, * java.lang.Object[]) */ - public ID createID(String namespaceName, Object[] args) - throws IDCreateException { + public ID createID(String namespaceName, Object[] args) throws IDCreateException { Namespace n = getNamespaceByName(namespaceName); if (n == null) - throw new IDCreateException(NLS.bind( - Messages.IDFactory_Namespace_Not_Found, namespaceName)); + throw new IDCreateException(NLS.bind(Messages.IDFactory_Namespace_Not_Found, namespaceName)); return createID(n, args); } - public ID createID(Namespace namespace, String uri) - throws IDCreateException { - return createID(namespace, new Object[] { uri }); + public ID createID(Namespace namespace, String uri) throws IDCreateException { + return createID(namespace, new Object[] {uri}); } public ID createID(String namespace, String uri) throws IDCreateException { - return createID(namespace, new Object[] { uri }); + return createID(namespace, new Object[] {uri}); } /* @@ -278,7 +237,7 @@ public class IDFactory implements IIDFactory { if (idstring == null) throw new IDCreateException(Messages.IDFactory_StringID_Not_Null); Namespace n = new StringID.StringIDNamespace(); - return createID(n, new String[] { idstring }); + return createID(n, new String[] {idstring}); } /* @@ -288,7 +247,7 @@ public class IDFactory implements IIDFactory { */ public ID createLongID(long l) throws IDCreateException { Namespace n = new LongID.LongNamespace(); - return createID(n, new Long[] { new Long(l) }); + return createID(n, new Long[] {new Long(l)}); } /* @@ -297,17 +256,12 @@ public class IDFactory implements IIDFactory { * @see org.eclipse.ecf.core.identity.IIDFactory#removeNamespace(org.eclipse.ecf.core.identity.Namespace) */ public Namespace removeNamespace(Namespace n) throws SecurityException { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, - "removeNamespace", n); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, "removeNamespace", n); //$NON-NLS-1$ if (n == null) return null; - checkPermission(new NamespacePermission(n.toString(), - NamespacePermission.REMOVE_NAMESPACE)); + checkPermission(new NamespacePermission(n.toString(), NamespacePermission.REMOVE_NAMESPACE)); Namespace result = removeNamespace0(n); - Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, IDFactory.class, - "removeNamespace", result); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, IDFactory.class, "removeNamespace", result); //$NON-NLS-1$ return result; } diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IIDFactory.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IIDFactory.java index a48b19bc3..54bac357e 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IIDFactory.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IIDFactory.java @@ -126,8 +126,7 @@ public interface IIDFactory { * loaded, if something goes wrong during instance * construction */ - public ID createID(String namespaceName, Object[] args) - throws IDCreateException; + public ID createID(String namespaceName, Object[] args) throws IDCreateException; /** * Make a new identity instance from a namespace and String. @@ -141,8 +140,7 @@ public interface IIDFactory { * loaded, if something goes wrong during instance * construction */ - public ID createID(Namespace namespace, String uri) - throws IDCreateException; + public ID createID(Namespace namespace, String uri) throws IDCreateException; /** * Make a new identity instance from a namespaceName and idValue. The @@ -159,8 +157,7 @@ public interface IIDFactory { * loaded, if something goes wrong during instance * construction */ - public ID createID(String namespaceName, String idValue) - throws IDCreateException; + public ID createID(String namespaceName, String idValue) throws IDCreateException; /** * Make a an ID from a String 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 5ae8d51ad..4ed20c5bc 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 @@ -40,7 +40,7 @@ public class LongID extends BaseID { * @see org.eclipse.ecf.core.identity.Namespace#getSupportedParameterTypesForCreateInstance() */ public Class[][] getSupportedParameterTypes() { - return new Class[][] { { Long.class } }; + return new Class[][] {{Long.class}}; } } 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 3c11115d7..aecd650d8 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 @@ -44,7 +44,7 @@ import org.eclipse.ecf.internal.core.identity.Messages; * @see ID */ public abstract class Namespace implements Serializable, IAdaptable { - + private static final long serialVersionUID = 3976740272094720312L; public static final String SCHEME_SEPARATOR = ":"; //$NON-NLS-1$ @@ -158,8 +158,7 @@ public abstract class Namespace implements Serializable, IAdaptable { * @throws IDCreateException * if construction fails */ - public abstract ID createInstance(Object[] parameters) - throws IDCreateException; + public abstract ID createInstance(Object[] parameters) throws IDCreateException; /** * Get the primary scheme associated with this namespace. Subclasses must @@ -226,7 +225,7 @@ public abstract class Namespace implements Serializable, IAdaptable { * parameters to {@link #createInstance(Object[])} will be ignored. */ public Class[][] getSupportedParameterTypes() { - return new Class[][] { {} }; + return new Class[][] {{}}; } /* (non-Javadoc) @@ -237,11 +236,13 @@ public abstract class Namespace implements Serializable, IAdaptable { return this; } else { IAdapterManager manager = Activator.getDefault().getAdapterManager(); - if (manager == null) return null; - else return manager.loadAdapter(this, adapter.getName()); + if (manager == null) + return null; + else + return manager.loadAdapter(this, adapter.getName()); } } - + public String toString() { StringBuffer b = new StringBuffer("Namespace["); //$NON-NLS-1$ b.append("name=").append(name).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ 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 0d5ce3e6a..2b367e383 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 @@ -45,7 +45,7 @@ public class StringID extends BaseID { * @see org.eclipse.ecf.core.identity.Namespace#getSupportedParameterTypesForCreateInstance() */ public Class[][] getSupportedParameterTypes() { - return new Class[][] { { String.class } }; + return new Class[][] {{String.class}}; } } @@ -124,8 +124,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/util/AbstractFactory.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AbstractFactory.java index 3d6de9753..212b4f30d 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AbstractFactory.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AbstractFactory.java @@ -9,8 +9,7 @@ package org.eclipse.ecf.core.util; public class AbstractFactory { - public static Class[] getClassesForTypes(String[] argTypes, Object[] args, - ClassLoader cl) throws ClassNotFoundException { + public static Class[] getClassesForTypes(String[] argTypes, Object[] args, ClassLoader cl) throws ClassNotFoundException { Class clazzes[] = null; if (args == null || args.length == 0) clazzes = new Class[0]; diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Base64.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Base64.java index 0f7d49533..d573dfd30 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Base64.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Base64.java @@ -95,10 +95,7 @@ public final class Base64 { byte[] raw = new byte[length]; int rawIndex = 0; for (int i = 0; i < base64.length(); i += 4) { - int block = (getValue(base64.charAt(i)) << 18) - + (getValue(base64.charAt(i + 1)) << 12) - + (getValue(base64.charAt(i + 2)) << 6) - + (getValue(base64.charAt(i + 3))); + int block = (getValue(base64.charAt(i)) << 18) + (getValue(base64.charAt(i + 1)) << 12) + (getValue(base64.charAt(i + 2)) << 6) + (getValue(base64.charAt(i + 3))); for (int j = 0; j < 3 && rawIndex + j < raw.length; j++) raw[rawIndex + j] = (byte) ((block >> (8 * (2 - j))) & 0xff); rawIndex += 3; @@ -121,7 +118,6 @@ public final class Base64 { // modify to use '-' instead of '=' if (c == '-') return 0; - throw new NumberFormatException(NLS.bind(Messages.Base64_Invalid_Value, - String.valueOf(c))); + throw new NumberFormatException(NLS.bind(Messages.Base64_Invalid_Value, String.valueOf(c))); } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFException.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFException.java index 74fdbef7f..74550a2b4 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFException.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFException.java @@ -41,8 +41,7 @@ public class ECFException extends CoreException { * @param cause */ public ECFException(String message, Throwable cause) { - this(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, - ((message == null) ? "" : message), cause)); //$NON-NLS-1$ + this(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, ((message == null) ? "" : message), cause)); //$NON-NLS-1$ } /** diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/LogHelper.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/LogHelper.java index 92a9764b8..a612db6d3 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/LogHelper.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/LogHelper.java @@ -20,18 +20,18 @@ public class LogHelper { public static int getLogCode(IStatus status) { switch (status.getCode()) { - case IStatus.CANCEL: - return LogService.LOG_INFO; - case IStatus.ERROR: - return LogService.LOG_ERROR; - case IStatus.INFO: - return LogService.LOG_INFO; - case IStatus.OK: - return LogService.LOG_INFO; - case IStatus.WARNING: - return LogService.LOG_WARNING; - default: - return IStatus.INFO; + case IStatus.CANCEL : + return LogService.LOG_INFO; + case IStatus.ERROR : + return LogService.LOG_ERROR; + case IStatus.INFO : + return LogService.LOG_INFO; + case IStatus.OK : + return LogService.LOG_INFO; + case IStatus.WARNING : + return LogService.LOG_WARNING; + default : + return IStatus.INFO; } } diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/PlatformHelper.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/PlatformHelper.java index c50a6a67f..49af8848a 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/PlatformHelper.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/PlatformHelper.java @@ -37,30 +37,20 @@ public class PlatformHelper { static { try { - Bundle[] bundles = Activator.getDefault().getBundleContext() - .getBundles(); + Bundle[] bundles = Activator.getDefault().getBundleContext().getBundles(); Bundle coreRuntime = null; for (int i = 0; i < bundles.length; i++) - if (bundles[i].getSymbolicName().equals( - "org.eclipse.core.runtime")) { //$NON-NLS-1$ + if (bundles[i].getSymbolicName().equals("org.eclipse.core.runtime")) { //$NON-NLS-1$ coreRuntime = bundles[i]; - platformClass = coreRuntime - .loadClass("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ + platformClass = coreRuntime.loadClass("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$ break; } } catch (Exception e) { // Platform not available...just leave platformClass == null and log // as error try { - Activator - .getDefault() - .log( - new Status( - IStatus.ERROR, - Activator.PLUGIN_ID, - IStatus.ERROR, - "Cannot load Platform class. No adapter manager available", //$NON-NLS-1$ - e)); + Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Cannot load Platform class. No adapter manager available", //$NON-NLS-1$ + e)); } catch (Throwable t) { } } @@ -79,14 +69,7 @@ public class PlatformHelper { adapterManagerCache = (IAdapterManager) m.invoke(null, null); return adapterManagerCache; } catch (Exception e) { - Activator - .getDefault() - .log( - new Status( - IStatus.ERROR, - Activator.PLUGIN_ID, - IStatus.ERROR, - "Exception in PlatformHelper.getPlatformAdapterManager()", e)); //$NON-NLS-1$ + Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Exception in PlatformHelper.getPlatformAdapterManager()", e)); //$NON-NLS-1$ return null; } } else @@ -98,20 +81,11 @@ public class PlatformHelper { return extensionRegistryCache; if (isPlatformAvailable()) { try { - Method m = platformClass - .getMethod("getExtensionRegistry", null); //$NON-NLS-1$ - extensionRegistryCache = (IExtensionRegistry) m.invoke(null, - null); + Method m = platformClass.getMethod("getExtensionRegistry", null); //$NON-NLS-1$ + extensionRegistryCache = (IExtensionRegistry) m.invoke(null, null); return extensionRegistryCache; } catch (Exception e) { - Activator - .getDefault() - .log( - new Status( - IStatus.ERROR, - Activator.PLUGIN_ID, - IStatus.ERROR, - "Exception in PlatformHelper.getExtensionRegistry()", e)); //$NON-NLS-1$ + Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Exception in PlatformHelper.getExtensionRegistry()", e)); //$NON-NLS-1$ return null; } diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java index cd638745b..a61364c56 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java @@ -130,20 +130,22 @@ public class Trace { * */ protected static boolean shouldTrace(String pluginId) { - return shouldTrace0(pluginId+"/debug"); //$NON-NLS-1$ + return shouldTrace0(pluginId + "/debug"); //$NON-NLS-1$ } protected static boolean shouldTrace0(String option) { if (option == null) return false; Activator activator = Activator.getDefault(); - if (activator == null) return false; + if (activator == null) + return false; DebugOptions debugOptions = activator.getDebugOptions(); - if (debugOptions == null) return false; + if (debugOptions == null) + return false; String result = debugOptions.getOption(option); - return (result == null)?false:result.equalsIgnoreCase("true"); //$NON-NLS-1$ + return (result == null) ? false : result.equalsIgnoreCase("true"); //$NON-NLS-1$ } - + /** * Retrieves a Boolean value indicating whether tracing is enabled for the * specified debug option of the specified plug-in. @@ -186,22 +188,26 @@ public class Trace { public static String getArgumentString(Object argument) { if (argument == null) return "null"; //$NON-NLS-1$ - if (argument instanceof byte[]) return getStringFromByteArray((byte []) argument); + if (argument instanceof byte[]) + return getStringFromByteArray((byte[]) argument); if (argument.getClass().isArray()) return getArgumentsString((Object[]) argument); else return String.valueOf(argument); } - private static String getStringFromByteArray(byte [] bytes) { + private static String getStringFromByteArray(byte[] bytes) { StringBuffer buf = new StringBuffer("["); //$NON-NLS-1$ - for(int i=0; i < bytes.length; i++) { + for (int i = 0; i < bytes.length; i++) { buf.append(bytes[i]); - if (i == (bytes.length -1)) buf.append("]"); //$NON-NLS-1$ - else buf.append(","); //$NON-NLS-1$ + if (i == (bytes.length - 1)) + buf.append("]"); //$NON-NLS-1$ + else + buf.append(","); //$NON-NLS-1$ } return buf.toString(); } + /** * Retrieves a textual representation of the specified arguments. * @@ -234,8 +240,7 @@ public class Trace { */ protected static void trace(String message) { StringBuffer buf = new StringBuffer(PARENTHESIS_OPEN); - buf.append(TRACE_STR).append(PARENTHESIS_CLOSE).append(getTimeString()) - .append(message).append(SEPARATOR_SPACE); + buf.append(TRACE_STR).append(PARENTHESIS_CLOSE).append(getTimeString()).append(message).append(SEPARATOR_SPACE); System.out.println(buf.toString()); } @@ -295,15 +300,12 @@ public class Trace { * @param newValue * The new value. */ - public static void changing(String pluginId, String option, - String valueDescription, Object oldValue, Object newValue) { + public static void changing(String pluginId, String option, String valueDescription, Object oldValue, Object newValue) { if (shouldTrace(pluginId, option)) { StringBuffer buf = new StringBuffer(PREFIX_CHANGING); - buf.append(valueDescription).append(SEPARATOR_SPACE).append( - LABEL_OLD_VALUE).append(getArgumentString(oldValue)); - buf.append(SEPARATOR_PARAMETER).append(LABEL_NEW_VALUE).append( - getArgumentString(newValue)); + buf.append(valueDescription).append(SEPARATOR_SPACE).append(LABEL_OLD_VALUE).append(getArgumentString(oldValue)); + buf.append(SEPARATOR_PARAMETER).append(LABEL_NEW_VALUE).append(getArgumentString(newValue)); trace(buf.toString()); } } @@ -325,17 +327,12 @@ public class Trace { * @param newValue * The new value. */ - public static void changing(String pluginId, String option, Class clazz, - String methodName, String valueDescription, Object oldValue, - Object newValue) { + public static void changing(String pluginId, String option, Class clazz, String methodName, String valueDescription, Object oldValue, Object newValue) { if (shouldTrace(pluginId, option)) { StringBuffer buf = new StringBuffer(PREFIX_CHANGING); - buf.append(valueDescription).append(SEPARATOR_SPACE).append( - LABEL_OLD_VALUE).append(getArgumentString(oldValue)); - buf.append(SEPARATOR_PARAMETER).append(LABEL_NEW_VALUE).append( - getArgumentString(newValue)); - buf.append(SEPARATOR_SPACE).append(PARENTHESIS_OPEN).append( - clazz.getName()).append(SEPARATOR_METHOD); + buf.append(valueDescription).append(SEPARATOR_SPACE).append(LABEL_OLD_VALUE).append(getArgumentString(oldValue)); + buf.append(SEPARATOR_PARAMETER).append(LABEL_NEW_VALUE).append(getArgumentString(newValue)); + buf.append(SEPARATOR_SPACE).append(PARENTHESIS_OPEN).append(clazz.getName()).append(SEPARATOR_METHOD); buf.append(methodName).append(PARENTHESIS_CLOSE); trace(buf.toString()); } @@ -357,14 +354,12 @@ public class Trace { * The throwable that is being caught. * */ - public static void catching(String pluginId, String option, Class clazz, - String methodName, Throwable throwable) { + public static void catching(String pluginId, String option, Class clazz, String methodName, Throwable throwable) { if (shouldTrace(pluginId, option)) { StringBuffer buf = new StringBuffer(PREFIX_CATCHING); buf.append(throwable.getMessage()).append(SEPARATOR_SPACE); - buf.append(PARENTHESIS_OPEN).append(clazz.getName()).append( - SEPARATOR_METHOD); + buf.append(PARENTHESIS_OPEN).append(clazz.getName()).append(SEPARATOR_METHOD); buf.append(methodName).append(PARENTHESIS_CLOSE); trace(buf.toString()); throwable.printStackTrace(System.err); @@ -388,14 +383,12 @@ public class Trace { * The throwable that is being thrown. * */ - public static void throwing(String pluginId, String option, Class clazz, - String methodName, Throwable throwable) { + public static void throwing(String pluginId, String option, Class clazz, String methodName, Throwable throwable) { if (shouldTrace(pluginId, option)) { StringBuffer buf = new StringBuffer(PREFIX_THROWING); buf.append(throwable.getMessage()).append(SEPARATOR_SPACE); - buf.append(PARENTHESIS_OPEN).append(clazz.getName()).append( - SEPARATOR_METHOD); + buf.append(PARENTHESIS_OPEN).append(clazz.getName()).append(SEPARATOR_METHOD); buf.append(methodName).append(PARENTHESIS_CLOSE); trace(buf.toString()); throwable.printStackTrace(System.err); @@ -415,14 +408,11 @@ public class Trace { * The name of method that is being entered. * */ - public static void entering(String pluginId, String option, Class clazz, - String methodName) { + public static void entering(String pluginId, String option, Class clazz, String methodName) { if (shouldTrace(pluginId, option)) { - StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz - .getName()); - buf.append(SEPARATOR_METHOD).append(methodName).append( - PARENTHESIS_OPEN).append(PARENTHESIS_CLOSE); + StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz.getName()); + buf.append(SEPARATOR_METHOD).append(methodName).append(PARENTHESIS_OPEN).append(PARENTHESIS_CLOSE); trace(buf.toString()); } } @@ -443,15 +433,12 @@ public class Trace { * The parameter to the method being entered. * */ - public static void entering(String pluginId, String option, Class clazz, - String methodName, Object parameter) { + public static void entering(String pluginId, String option, Class clazz, String methodName, Object parameter) { if (shouldTrace(pluginId, option)) { - StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz - .getName()); + StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz.getName()); buf.append(SEPARATOR_METHOD).append(methodName); - buf.append(PARENTHESIS_OPEN).append(getArgumentString(parameter)) - .append(PARENTHESIS_CLOSE); + buf.append(PARENTHESIS_OPEN).append(getArgumentString(parameter)).append(PARENTHESIS_CLOSE); trace(buf.toString()); } @@ -473,15 +460,12 @@ public class Trace { * The parameters to the method being entered. * */ - public static void entering(String pluginId, String option, Class clazz, - String methodName, Object[] parameters) { + public static void entering(String pluginId, String option, Class clazz, String methodName, Object[] parameters) { if (shouldTrace(pluginId, option)) { - StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz - .getName()); + StringBuffer buf = new StringBuffer(PREFIX_ENTERING).append(clazz.getName()); buf.append(SEPARATOR_METHOD).append(methodName); - buf.append(PARENTHESIS_OPEN).append(getArgumentString(parameters)) - .append(PARENTHESIS_CLOSE); + buf.append(PARENTHESIS_OPEN).append(getArgumentString(parameters)).append(PARENTHESIS_CLOSE); trace(buf.toString()); } @@ -500,12 +484,10 @@ public class Trace { * The name of method that is being exited. * */ - public static void exiting(String pluginId, String option, Class clazz, - String methodName) { + public static void exiting(String pluginId, String option, Class clazz, String methodName) { if (shouldTrace(pluginId, option)) { - StringBuffer buf = new StringBuffer(PREFIX_EXITING).append(clazz - .getName()); + StringBuffer buf = new StringBuffer(PREFIX_EXITING).append(clazz.getName()); buf.append(SEPARATOR_METHOD).append(methodName); trace(buf.toString()); } @@ -527,15 +509,12 @@ public class Trace { * The return value of the method being exited. * */ - public static void exiting(String pluginId, String option, Class clazz, - String methodName, Object returnValue) { + public static void exiting(String pluginId, String option, Class clazz, String methodName, Object returnValue) { if (shouldTrace(pluginId, option)) { - StringBuffer buf = new StringBuffer(PREFIX_EXITING).append(clazz - .getName()); + StringBuffer buf = new StringBuffer(PREFIX_EXITING).append(clazz.getName()); buf.append(SEPARATOR_METHOD).append(methodName); - buf.append(PARENTHESIS_OPEN).append(getArgumentString(returnValue)) - .append(PARENTHESIS_CLOSE); + buf.append(PARENTHESIS_OPEN).append(getArgumentString(returnValue)).append(PARENTHESIS_CLOSE); trace(buf.toString()); } diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java index 2fec00935..c4c0c04b4 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java @@ -76,20 +76,16 @@ public class Activator implements BundleActivator { public IAdapterManager getAdapterManager() { // First, try to get the adapter manager via if (adapterManagerTracker == null) { - adapterManagerTracker = new ServiceTracker(this.context, - IAdapterManager.class.getName(), null); + adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null); adapterManagerTracker.open(); } - IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker - .getService(); + IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService(); // Then, if the service isn't there, try to get from Platform class via // PlatformHelper class if (adapterManager == null) adapterManager = PlatformHelper.getPlatformAdapterManager(); if (adapterManager == null) - getDefault().log( - new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, - "Cannot get adapter manager", null)); //$NON-NLS-1$ + getDefault().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$ return adapterManager; } @@ -101,18 +97,17 @@ public class Activator implements BundleActivator { public IExtensionRegistry getExtensionRegistry() { if (extensionRegistryTracker == null) { - extensionRegistryTracker = new ServiceTracker(context, - IExtensionRegistry.class.getName(), null); + extensionRegistryTracker = new ServiceTracker(context, IExtensionRegistry.class.getName(), null); extensionRegistryTracker.open(); } return (IExtensionRegistry) extensionRegistryTracker.getService(); } public DebugOptions getDebugOptions() { - if (context == null) return null; + if (context == null) + return null; if (debugOptionsTracker == null) { - debugOptionsTracker = new ServiceTracker(context, - DebugOptions.class.getName(), null); + debugOptionsTracker = new ServiceTracker(context, DebugOptions.class.getName(), null); debugOptionsTracker.open(); } return (DebugOptions) debugOptionsTracker.getService(); @@ -132,34 +127,27 @@ public class Activator implements BundleActivator { reg.addRegistryChangeListener(registryManager); } this.setupNamespaceExtensionPoint(); - Trace - .exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, Activator.class, - "start"); //$NON-NLS-1$ + Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, Activator.class, "start"); //$NON-NLS-1$ // Register IIDFactory service - idFactoryServiceRegistration = context.registerService(IIDFactory.class - .getName(), IDFactory.getDefault(), null); - + idFactoryServiceRegistration = context.registerService(IIDFactory.class.getName(), IDFactory.getDefault(), null); + } public BundleContext getBundleContext() { return context; } - + protected class IdentityRegistryManager implements IRegistryChangeListener { public void registryChanged(IRegistryChangeEvent event) { - IExtensionDelta delta[] = event.getExtensionDeltas(PLUGIN_ID, - NAMESPACE_NAME); + IExtensionDelta delta[] = event.getExtensionDeltas(PLUGIN_ID, NAMESPACE_NAME); for (int i = 0; i < delta.length; i++) { switch (delta[i].getKind()) { - case IExtensionDelta.ADDED: - addNamespaceExtensions(delta[i].getExtension() - .getConfigurationElements()); - break; - case IExtensionDelta.REMOVED: - removeNamespaceExtensions(delta[i].getExtension() - .getConfigurationElements()); - break; + case IExtensionDelta.ADDED : + addNamespaceExtensions(delta[i].getExtension().getConfigurationElements()); + break; + case IExtensionDelta.REMOVED : + removeNamespaceExtensions(delta[i].getExtension().getConfigurationElements()); + break; } } } @@ -172,9 +160,7 @@ public class Activator implements BundleActivator { * the members to remove */ protected void removeNamespaceExtensions(IConfigurationElement[] members) { - org.eclipse.ecf.core.util.Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, Activator.class, - "removeNamespaceExtensions", members); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, Activator.class, "removeNamespaceExtensions", members); //$NON-NLS-1$ for (int m = 0; m < members.length; m++) { IConfigurationElement member = members[m]; String name = null; @@ -192,23 +178,14 @@ public class Activator implements BundleActivator { } // remove factory.removeNamespace(n); - org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, - IdentityDebugOptions.DEBUG, - "removeNamespaceExtensions.removedNamespace(" //$NON-NLS-1$ - + n + ")"); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, IdentityDebugOptions.DEBUG, "removeNamespaceExtensions.removedNamespace(" //$NON-NLS-1$ + + n + ")"); //$NON-NLS-1$ } catch (Exception e) { - org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, - IdentityDebugOptions.EXCEPTIONS_CATCHING, - Activator.class, "removeNamespaceExtensions", e); //$NON-NLS-1$ - getDefault().log( - new Status(IStatus.ERROR, Activator.PLUGIN_ID, - REMOVE_NAMESPACE_ERRORCODE, - "Exception removing namespace", e)); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, IdentityDebugOptions.EXCEPTIONS_CATCHING, Activator.class, "removeNamespaceExtensions", e); //$NON-NLS-1$ + getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, REMOVE_NAMESPACE_ERRORCODE, "Exception removing namespace", e)); //$NON-NLS-1$ } } - org.eclipse.ecf.core.util.Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, Activator.class, - "removeNamespaceExtensions", members); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, Activator.class, "removeNamespaceExtensions", members); //$NON-NLS-1$ } public Bundle getBundle() { @@ -220,8 +197,7 @@ public class Activator implements BundleActivator { protected LogService getLogService() { if (logServiceTracker == null) { - logServiceTracker = new ServiceTracker(this.context, - LogService.class.getName(), null); + logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null); logServiceTracker.open(); } return (LogService) logServiceTracker.getService(); @@ -230,8 +206,7 @@ public class Activator implements BundleActivator { public void log(IStatus status) { LogService logService = getLogService(); if (logService != null) { - logService.log(LogHelper.getLogCode(status), LogHelper - .getLogMessage(status), status.getException()); + logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException()); } } @@ -242,9 +217,7 @@ public class Activator implements BundleActivator { * the members to add */ protected void addNamespaceExtensions(IConfigurationElement[] members) { - org.eclipse.ecf.core.util.Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_ENTERING, Activator.class, - "addNamespaceExtensions", members); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_ENTERING, Activator.class, "addNamespaceExtensions", members); //$NON-NLS-1$ String bundleName = getDefault().getBundle().getSymbolicName(); for (int m = 0; m < members.length; m++) { IConfigurationElement member = members[m]; @@ -253,64 +226,35 @@ public class Activator implements BundleActivator { IExtension extension = member.getDeclaringExtension(); String nsName = null; try { - Namespace ns = (Namespace) member - .createExecutableExtension(CLASS_ATTRIBUTE); + Namespace ns = (Namespace) member.createExecutableExtension(CLASS_ATTRIBUTE); String clazz = ns.getClass().getName(); nsName = member.getAttribute(NAME_ATTRIBUTE); if (nsName == null) { nsName = clazz; } - String nsDescription = member - .getAttribute(DESCRIPTION_ATTRIBUTE); + String nsDescription = member.getAttribute(DESCRIPTION_ATTRIBUTE); ns.initialize(nsName, nsDescription); - org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, - IdentityDebugOptions.DEBUG, - "addNamespaceExtensions.createdNamespace(" + ns + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, IdentityDebugOptions.DEBUG, "addNamespaceExtensions.createdNamespace(" + ns + ")"); //$NON-NLS-1$ //$NON-NLS-2$ // Check to see if we have a namespace name collision if (IDFactory.getDefault().containsNamespace(ns)) - throw new CoreException( - new Status( - Status.ERROR, - bundleName, - FACTORY_NAME_COLLISION_ERRORCODE, - "name=" //$NON-NLS-1$ - + nsName - + ";extension point id=" //$NON-NLS-1$ - + extension - .getExtensionPointUniqueIdentifier(), - null)); + throw new CoreException(new Status(Status.ERROR, bundleName, FACTORY_NAME_COLLISION_ERRORCODE, "name=" //$NON-NLS-1$ + + nsName + ";extension point id=" //$NON-NLS-1$ + + extension.getExtensionPointUniqueIdentifier(), null)); // Now add to known namespaces IDFactory.getDefault().addNamespace(ns); - org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, - IdentityDebugOptions.DEBUG, - "addNamespaceExtensions.addedNamespaceToFactory(" + ns //$NON-NLS-1$ - + ")"); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, IdentityDebugOptions.DEBUG, "addNamespaceExtensions.addedNamespaceToFactory(" + ns //$NON-NLS-1$ + + ")"); //$NON-NLS-1$ } catch (CoreException e) { getDefault().log(e.getStatus()); - org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, - IdentityDebugOptions.EXCEPTIONS_CATCHING, - Activator.class, "addNamespaceExtensions", e); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, IdentityDebugOptions.EXCEPTIONS_CATCHING, Activator.class, "addNamespaceExtensions", e); //$NON-NLS-1$ } catch (Exception e) { - getDefault() - .log( - new Status( - Status.ERROR, - bundleName, - FACTORY_NAME_COLLISION_ERRORCODE, - "name=" //$NON-NLS-1$ - + nsName - + ";extension point id=" //$NON-NLS-1$ - + extension - .getExtensionPointUniqueIdentifier(), - null)); - org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, - IdentityDebugOptions.EXCEPTIONS_CATCHING, - Activator.class, "addNamespaceExtensions", e); //$NON-NLS-1$ + getDefault().log(new Status(Status.ERROR, bundleName, FACTORY_NAME_COLLISION_ERRORCODE, "name=" //$NON-NLS-1$ + + nsName + ";extension point id=" //$NON-NLS-1$ + + extension.getExtensionPointUniqueIdentifier(), null)); + org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, IdentityDebugOptions.EXCEPTIONS_CATCHING, Activator.class, "addNamespaceExtensions", e); //$NON-NLS-1$ } } - org.eclipse.ecf.core.util.Trace.exiting(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, Activator.class, - "addNamespaceExtensions"); //$NON-NLS-1$ + org.eclipse.ecf.core.util.Trace.exiting(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, Activator.class, "addNamespaceExtensions"); //$NON-NLS-1$ } /** @@ -321,8 +265,7 @@ public class Activator implements BundleActivator { // Process extension points IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) { - IExtensionPoint extensionPoint = reg - .getExtensionPoint(NAMESPACE_EPOINT); + IExtensionPoint extensionPoint = reg.getExtensionPoint(NAMESPACE_EPOINT); if (extensionPoint == null) { return; } @@ -336,8 +279,7 @@ public class Activator implements BundleActivator { * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { - Trace.entering(Activator.PLUGIN_ID, - IdentityDebugOptions.METHODS_EXITING, Activator.class, "stop"); //$NON-NLS-1$ + Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, Activator.class, "stop"); //$NON-NLS-1$ IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) reg.removeRegistryChangeListener(registryManager); diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/IdentityDebugOptions.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/IdentityDebugOptions.java index 197c985b6..4480e486c 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/IdentityDebugOptions.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/IdentityDebugOptions.java @@ -12,11 +12,9 @@ public interface IdentityDebugOptions { public static final String DEBUG = Activator.PLUGIN_ID + "/debug"; //$NON-NLS-1$ - public static final String EXCEPTIONS_CATCHING = DEBUG - + "/exceptions/catching"; //$NON-NLS-1$ + public static final String EXCEPTIONS_CATCHING = DEBUG + "/exceptions/catching"; //$NON-NLS-1$ - public static final String EXCEPTIONS_THROWING = DEBUG - + "/exceptions/throwing"; //$NON-NLS-1$ + public static final String EXCEPTIONS_THROWING = DEBUG + "/exceptions/throwing"; //$NON-NLS-1$ public static final String METHODS_ENTERING = DEBUG + "/methods/entering"; //$NON-NLS-1$ |