diff options
10 files changed, 79 insertions, 74 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF index 8455b5ca2..df913e7bc 100644 --- a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF +++ b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %plugin.name Bundle-SymbolicName: org.eclipse.ecf.identity;singleton:=true -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Activator: org.eclipse.ecf.internal.core.identity.Activator Bundle-Localization: plugin Bundle-Vendor: %plugin.provider 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 3d8fb324d..c386cb8f1 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 @@ -27,6 +27,7 @@ public abstract class BaseID implements ID { protected Namespace namespace; protected BaseID() { + // } protected BaseID(Namespace namespace) { 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 0c05b7a55..e5a9b9b7b 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 @@ -9,16 +9,11 @@ package org.eclipse.ecf.core.identity; import java.security.AccessController; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; - +import java.util.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ecf.core.util.Trace; -import org.eclipse.ecf.internal.core.identity.Activator; -import org.eclipse.ecf.internal.core.identity.IdentityDebugOptions; -import org.eclipse.ecf.internal.core.identity.Messages; +import org.eclipse.ecf.internal.core.identity.*; import org.eclipse.osgi.util.NLS; /** @@ -45,6 +40,7 @@ public class IDFactory implements IIDFactory { } protected IDFactory() { + // protected constructor } public static IIDFactory getDefault() { @@ -144,8 +140,7 @@ public class IDFactory implements IIDFactory { protected final static Namespace getNamespace0(String name) { if (name == null) return null; - else - return (Namespace) namespaces.get(name); + return (Namespace) namespaces.get(name); } /* 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 6934a7486..03f17c036 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 @@ -26,6 +26,11 @@ public class LongID extends BaseID { super(LongID.class.getName(), Messages.LongID_LongID_Namespace_Description); } + /** + * @param args must not be <code>null></code> + * @return ID created. Will not be <code>null</code>. + * @throws IDCreateException never thrown + */ public ID createInstance(Object[] args) throws IDCreateException { return new LongID(this, (Long) args[0]); } 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 aecd650d8..0173a928f 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 @@ -9,10 +9,7 @@ package org.eclipse.ecf.core.identity; import java.io.Serializable; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.core.runtime.*; import org.eclipse.ecf.internal.core.identity.Activator; import org.eclipse.ecf.internal.core.identity.Messages; @@ -58,18 +55,19 @@ public abstract class Namespace implements Serializable, IAdaptable { private boolean isInitialized = false; public Namespace() { + // public null constructor } - public final boolean initialize(String name, String desc) { - Assert.isNotNull(name, Messages.Namespace_Namespace_Name_Not_Null); + public final boolean initialize(String n, String desc) { + Assert.isNotNull(n, Messages.Namespace_Namespace_Name_Not_Null); if (!isInitialized) { - this.name = name; + this.name = n; this.description = desc; this.hashCode = name.hashCode(); this.isInitialized = true; return true; - } else - return false; + } + return false; } public Namespace(String name, String desc) { @@ -234,13 +232,11 @@ public abstract class Namespace implements Serializable, IAdaptable { public Object getAdapter(Class adapter) { if (adapter.isInstance(this)) { return this; - } else { - IAdapterManager manager = Activator.getDefault().getAdapterManager(); - if (manager == null) - return null; - else - return manager.loadAdapter(this, adapter.getName()); } + IAdapterManager manager = Activator.getDefault().getAdapterManager(); + if (manager == null) + return null; + return manager.loadAdapter(this, adapter.getName()); } public String toString() { 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 2b367e383..37ad572b7 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 @@ -31,8 +31,8 @@ public class StringID extends BaseID { public ID createInstance(Object[] parameters) throws IDCreateException { if (parameters == null || parameters.length == 0) { throw new IDCreateException(Messages.StringID_StringID_Name_Not_Null); - } else - return new StringID(this, (String) parameters[0]); + } + return new StringID(this, (String) parameters[0]); } public String getScheme() { 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 49af8848a..5eee6c6c5 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 @@ -12,11 +12,7 @@ package org.eclipse.ecf.core.util; import java.lang.reflect.Method; - -import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.*; import org.eclipse.ecf.internal.core.identity.Activator; import org.osgi.framework.Bundle; @@ -52,6 +48,7 @@ public class PlatformHelper { 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) { + // Should never happen, if does irrecoverable } } } @@ -72,8 +69,8 @@ public class PlatformHelper { Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Exception in PlatformHelper.getPlatformAdapterManager()", e)); //$NON-NLS-1$ return null; } - } else - return null; + } + return null; } public synchronized static IExtensionRegistry getExtensionRegistry() { @@ -89,7 +86,7 @@ public class PlatformHelper { return null; } - } else - return null; + } + 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 a61364c56..d71635e41 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 @@ -9,10 +9,7 @@ package org.eclipse.ecf.core.util; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - +import java.util.*; import org.eclipse.ecf.internal.core.identity.Activator; import org.eclipse.ecf.internal.core.identity.Messages; import org.eclipse.osgi.service.debug.DebugOptions; @@ -53,6 +50,12 @@ public class Trace { * Prefix for tracing the changing of values. * */ + protected static final String PREFIX_TRACING = "TRACING "; //$NON-NLS-1$ + + /** + * Prefix for tracing the changing of values. + * + */ protected static final String PREFIX_CHANGING = "CHANGING "; //$NON-NLS-1$ /** @@ -192,8 +195,7 @@ public class Trace { return getStringFromByteArray((byte[]) argument); if (argument.getClass().isArray()) return getArgumentsString((Object[]) argument); - else - return String.valueOf(argument); + return String.valueOf(argument); } private static String getStringFromByteArray(byte[] bytes) { @@ -287,6 +289,31 @@ public class Trace { } /** + * Traces the specified message from the specified plug-in for the specified + * debug option. + * + * @param pluginId + * The plug-in from which to trace. + * @param option + * The debug option for which to trace. + * @param clazz + * The class whose method is being entered. + * @param methodName + * The name of method that is being entered. + * @param message + * The message to be traced. + * + */ + public static void trace(String pluginId, String option, Class clazz, String methodName, String message) { + if (shouldTrace(pluginId, option)) { + StringBuffer buf = new StringBuffer(PREFIX_TRACING).append(clazz.getName()); + buf.append(SEPARATOR_METHOD).append(methodName); + buf.append(PARENTHESIS_OPEN).append(message).append(PARENTHESIS_CLOSE); + trace(buf.toString()); + } + } + + /** * Traces the changing of a value. * * @param pluginId 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 05fa824a0..e5b088930 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 @@ -8,29 +8,11 @@ ******************************************************************************/ package org.eclipse.ecf.internal.core.identity; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionDelta; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IRegistryChangeEvent; -import org.eclipse.core.runtime.IRegistryChangeListener; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.ecf.core.identity.IDFactory; -import org.eclipse.ecf.core.identity.IIDFactory; -import org.eclipse.ecf.core.identity.Namespace; -import org.eclipse.ecf.core.util.LogHelper; -import org.eclipse.ecf.core.util.PlatformHelper; -import org.eclipse.ecf.core.util.SystemLogService; -import org.eclipse.ecf.core.util.Trace; +import org.eclipse.core.runtime.*; +import org.eclipse.ecf.core.identity.*; +import org.eclipse.ecf.core.util.*; import org.eclipse.osgi.service.debug.DebugOptions; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; +import org.osgi.framework.*; import org.osgi.service.log.LogService; import org.osgi.util.tracker.ServiceTracker; @@ -96,6 +78,7 @@ public class Activator implements BundleActivator { * The constructor */ public Activator() { + // public null constructor } public IExtensionRegistry getExtensionRegistry() { @@ -121,9 +104,9 @@ public class Activator implements BundleActivator { * * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) */ - public void start(BundleContext context) throws Exception { + public void start(BundleContext ctxt) throws Exception { plugin = this; - this.context = context; + this.context = ctxt; final IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) { this.registryManager = new IdentityRegistryManager(); @@ -194,8 +177,7 @@ public class Activator implements BundleActivator { public Bundle getBundle() { if (context == null) return null; - else - return context.getBundle(); + return context.getBundle(); } protected LogService getLogService() { @@ -210,10 +192,11 @@ public class Activator implements BundleActivator { } public void log(IStatus status) { - final LogService logService = getLogService(); - if (logService != null) { + if (logService == null) + logService = getLogService(); + + if (logService != null) logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException()); - } } /** @@ -243,7 +226,7 @@ public class Activator implements BundleActivator { 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$ + throw new CoreException(new Status(IStatus.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 @@ -254,7 +237,7 @@ public class Activator implements BundleActivator { getDefault().log(e.getStatus()); org.eclipse.ecf.core.util.Trace.catching(Activator.PLUGIN_ID, IdentityDebugOptions.EXCEPTIONS_CATCHING, Activator.class, "addNamespaceExtensions", e); //$NON-NLS-1$ } catch (final Exception e) { - getDefault().log(new Status(Status.ERROR, bundleName, FACTORY_NAME_COLLISION_ERRORCODE, "name=" //$NON-NLS-1$ + getDefault().log(new Status(IStatus.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$ @@ -284,7 +267,7 @@ public class Activator implements BundleActivator { * * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ - public void stop(BundleContext context) throws Exception { + public void stop(BundleContext ctxt) throws Exception { Trace.entering(Activator.PLUGIN_ID, IdentityDebugOptions.METHODS_EXITING, Activator.class, "stop"); //$NON-NLS-1$ final IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Messages.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Messages.java index 7a771e45b..21a912150 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Messages.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Messages.java @@ -38,5 +38,6 @@ public class Messages extends NLS { } private Messages() { + // private null constructor } } |