From 839e243bdbc3598541ee7040716ebf0a1e5fae86 Mon Sep 17 00:00:00 2001 From: slewis Date: Thu, 30 Apr 2009 19:10:00 +0000 Subject: Fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=254684 --- .../org/eclipse/ecf/core/identity/IDFactory.java | 171 +++++++++++++++------ .../ecf/internal/core/identity/Activator.java | 148 ++++++++++++------ 2 files changed, 226 insertions(+), 93 deletions(-) (limited to 'framework/bundles/org.eclipse.ecf.identity/src') 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 7b83d1895..9081f88a5 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 @@ -23,7 +23,8 @@ 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; @@ -40,36 +41,58 @@ public class IDFactory implements IIDFactory { addNamespace0(new LongID.LongNamespace()); } - protected IDFactory() { - // protected constructor + private synchronized static void initialize() { + if (!initialized) { + Trace.entering(Activator.PLUGIN_ID, + IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, + "initialize"); + Activator a = Activator.getDefault(); + if (a != null) + a.setupNamespaceExtensionPoint(); + initialized = true; + Trace.exiting(Activator.PLUGIN_ID, + IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, + "initialize"); + } } - public static IIDFactory getDefault() { + private static boolean initialized = false; + + public synchronized static IIDFactory getDefault() { return instance; } /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#addNamespace(org.eclipse.ecf.core.identity.Namespace) + * @see + * org.eclipse.ecf.core.identity.IIDFactory#addNamespace(org.eclipse.ecf + * .core.identity.Namespace) */ 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)); + initialize(); 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; } - protected final static Namespace addNamespace0(Namespace namespace) { + public final static Namespace addNamespace0(Namespace namespace) { if (namespace == null) return null; 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); } @@ -77,15 +100,24 @@ public class IDFactory implements IIDFactory { /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#containsNamespace(org.eclipse.ecf.core.identity.Namespace) + * @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 { if (namespace == null) return false; - checkPermission(new NamespacePermission(namespace.toString(), NamespacePermission.CONTAINS_NAMESPACE)); + Trace.entering(Activator.PLUGIN_ID, + IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, + "containsNamespace", namespace); //$NON-NLS-1$ + checkPermission(new NamespacePermission(namespace.toString(), + NamespacePermission.CONTAINS_NAMESPACE)); + initialize(); 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; } @@ -95,11 +127,14 @@ 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$ + initialize(); return new ArrayList(namespaces.values()); } - protected final static boolean containsNamespace0(Namespace n) { + public final static boolean containsNamespace0(Namespace n) { if (n == null) return false; return namespaces.containsKey(n.getName()); @@ -108,27 +143,42 @@ public class IDFactory implements IIDFactory { /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#getNamespace(org.eclipse.ecf.core.identity.Namespace) + * @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$ if (namespace == null) return null; - checkPermission(new NamespacePermission(namespace.toString(), NamespacePermission.GET_NAMESPACE)); + Trace.entering(Activator.PLUGIN_ID, + IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, + "getNamespace", namespace); //$NON-NLS-1$ + checkPermission(new NamespacePermission(namespace.toString(), + NamespacePermission.GET_NAMESPACE)); + initialize(); 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; } /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#getNamespaceByName(java.lang.String) + * @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$ + initialize(); 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; } @@ -159,14 +209,19 @@ 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$ @@ -174,22 +229,30 @@ 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; } /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#createID(org.eclipse.ecf.core.identity.Namespace, - * java.lang.Object[]) + * @see + * org.eclipse.ecf.core.identity.IIDFactory#createID(org.eclipse.ecf.core + * .identity.Namespace, 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("Namespace cannot be null", null); //$NON-NLS-1$ + initialize(); // Make sure that namespace is in table of known namespace. If not, // throw...we don't create any instances that we don't know about! Namespace ns = getNamespace0(n); @@ -199,7 +262,9 @@ public class IDFactory implements IIDFactory { // 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; } @@ -207,33 +272,37 @@ public class IDFactory implements IIDFactory { * (non-Javadoc) * * @see org.eclipse.ecf.core.identity.IIDFactory#createID(java.lang.String, - * java.lang.Object[]) + * 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("Namespace {0} not found", namespaceName)); //$NON-NLS-1$ + throw new IDCreateException(NLS.bind( + "Namespace {0} not found", namespaceName)); //$NON-NLS-1$ 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 }); } /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#createStringID(java.lang.String) + * @see + * org.eclipse.ecf.core.identity.IIDFactory#createStringID(java.lang.String) */ public ID createStringID(String idstring) throws IDCreateException { if (idstring == null) throw new IDCreateException("StringID cannot be null"); //$NON-NLS-1$ Namespace n = new StringID.StringIDNamespace(); - return createID(n, new String[] {idstring}); + return createID(n, new String[] { idstring }); } /* @@ -243,21 +312,29 @@ 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) }); } /* * (non-Javadoc) * - * @see org.eclipse.ecf.core.identity.IIDFactory#removeNamespace(org.eclipse.ecf.core.identity.Namespace) + * @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$ if (n == null) return null; - checkPermission(new NamespacePermission(n.toString(), NamespacePermission.REMOVE_NAMESPACE)); + Trace.entering(Activator.PLUGIN_ID, + IdentityDebugOptions.METHODS_ENTERING, IDFactory.class, + "removeNamespace", n); //$NON-NLS-1$ + checkPermission(new NamespacePermission(n.toString(), + NamespacePermission.REMOVE_NAMESPACE)); + initialize(); 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/internal/core/identity/Activator.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java index e5b088930..4287116e7 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 @@ -61,16 +61,20 @@ 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; } @@ -83,7 +87,8 @@ 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(); @@ -93,7 +98,8 @@ public class Activator implements BundleActivator { 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(); @@ -102,21 +108,21 @@ public class Activator implements BundleActivator { /* * (non-Javadoc) * - * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + * @see + * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) */ public void start(BundleContext ctxt) throws Exception { plugin = this; this.context = ctxt; + // Register IIDFactory service + idFactoryServiceRegistration = context.registerService(IIDFactory.class + .getName(), IDFactory.getDefault(), null); + final IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) { this.registryManager = new IdentityRegistryManager(); reg.addRegistryChangeListener(registryManager); } - this.setupNamespaceExtensionPoint(); - 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); - } public BundleContext getBundleContext() { @@ -125,15 +131,18 @@ public class Activator implements BundleActivator { protected class IdentityRegistryManager implements IRegistryChangeListener { public void registryChanged(IRegistryChangeEvent event) { - final IExtensionDelta delta[] = event.getExtensionDeltas(PLUGIN_ID, NAMESPACE_NAME); + final 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; } } } @@ -146,7 +155,9 @@ 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++) { final IConfigurationElement member = members[m]; String name = null; @@ -164,14 +175,23 @@ 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 (final 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() { @@ -182,7 +202,8 @@ 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(); } logService = (LogService) logServiceTracker.getService(); @@ -196,7 +217,8 @@ public class Activator implements BundleActivator { 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()); } /** @@ -206,7 +228,9 @@ 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$ final String bundleName = getDefault().getBundle().getSymbolicName(); for (int m = 0; m < members.length; m++) { final IConfigurationElement member = members[m]; @@ -215,35 +239,64 @@ public class Activator implements BundleActivator { final IExtension extension = member.getDeclaringExtension(); String nsName = null; try { - final Namespace ns = (Namespace) member.createExecutableExtension(CLASS_ATTRIBUTE); + final Namespace ns = (Namespace) member + .createExecutableExtension(CLASS_ATTRIBUTE); final String clazz = ns.getClass().getName(); nsName = member.getAttribute(NAME_ATTRIBUTE); if (nsName == null) { nsName = clazz; } - final String nsDescription = member.getAttribute(DESCRIPTION_ATTRIBUTE); + final 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(IStatus.ERROR, bundleName, FACTORY_NAME_COLLISION_ERRORCODE, "name=" //$NON-NLS-1$ - + nsName + ";extension point id=" //$NON-NLS-1$ - + extension.getExtensionPointUniqueIdentifier(), null)); + if (IDFactory.containsNamespace0(ns)) + 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 - 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$ + IDFactory.addNamespace0(ns); + org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, + IdentityDebugOptions.DEBUG, + "addNamespaceExtensions.addedNamespaceToFactory(" + ns //$NON-NLS-1$ + + ")"); //$NON-NLS-1$ } catch (final 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 (final Exception e) { - 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$ + 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$ } } - 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$ } /** @@ -254,7 +307,8 @@ public class Activator implements BundleActivator { // Process extension points final IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) { - final IExtensionPoint extensionPoint = reg.getExtensionPoint(NAMESPACE_EPOINT); + final IExtensionPoint extensionPoint = reg + .getExtensionPoint(NAMESPACE_EPOINT); if (extensionPoint == null) { return; } @@ -265,10 +319,12 @@ public class Activator implements BundleActivator { /* * (non-Javadoc) * - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + * @see + * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext ctxt) 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$ final IExtensionRegistry reg = getExtensionRegistry(); if (reg != null) reg.removeRegistryChangeListener(registryManager); -- cgit v1.2.3