private void processConnectionProfile(IConfigurationElement element) { ConnectionProfileProvider p = new ConnectionProfileProvider(element); if (!mProviders.containsKey(p.getId())) mProviders.put(p.getId(), p); else // another profile provider with same id already loaded { // log and ignore profile provider with duplicated id ConnectivityPlugin.getDefault() .log( ConnectivityPlugin.getDefault() .getResourceString( "assert.invalid.profile", //$NON-NLS-1$ new Object[] {p.getId() + ": " + element.toString()})); // $NON-NLS-1$ // Mark the existing profile to be disabled mDisabledProviders.add(p.getId()); } }
private void processConfigurationType(IConfigurationElement element) { ConfigurationTypeProvider c = new ConfigurationTypeProvider(element); Assert.isTrue( !mConfigurationTypes.containsKey(c.getId()), ConnectivityPlugin.getDefault() .getResourceString( "assert.invalid.profile", new Object[] { element //$NON-NLS-1$ .toString() })); mConfigurationTypes.put(c.getId(), c); }
private void processExtensions() { mProviders = new HashMap(); mCategories = new HashMap(); mConfigurationTypes = new HashMap(); mConnectionFactoryAdapters = new HashMap(); mDisabledProviders = new HashSet(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint exp = registry.getExtensionPoint(EXTENSION_ID); IExtension[] exts = exp.getExtensions(); List profileExts = new ArrayList(exts.length); for (Iterator xit = Arrays.asList(exts).iterator(); xit.hasNext(); ) { IExtension ext = (IExtension) xit.next(); IConfigurationElement[] elems = ext.getConfigurationElements(); for (Iterator eit = Arrays.asList(elems).iterator(); eit.hasNext(); ) { IConfigurationElement elem = (IConfigurationElement) eit.next(); String elemName = elem.getName(); if (EXT_ELEM_CONNECTION_PROFILE.equals(elemName)) { processConnectionProfile(elem); } else if (EXT_ELEM_CATEGORY.equals(elemName)) { processCategory(elem); } else if (EXT_ELEM_CONFIGURATION_TYPE.equals(elemName)) { processConfigurationType(elem); } else { profileExts.add(elem); } } } for (Iterator eit = profileExts.iterator(); eit.hasNext(); ) { IConfigurationElement elem = (IConfigurationElement) eit.next(); String elemName = elem.getName(); if (EXT_ELEM_CONNECTION_FACTORY.equals(elemName)) { String profileId = elem.getAttribute(ConnectionFactoryProvider.ATTR_PROFILE); ConnectionProfileProvider p = (ConnectionProfileProvider) mProviders.get(profileId); if (p == null) ConnectivityPlugin.getDefault() .log( ConnectivityPlugin.getDefault() .getResourceString( "assert.invalid.profile", //$NON-NLS-1$ new Object[] { elemName + "." + ConnectionFactoryProvider.ATTR_PROFILE + ": " + profileId })); //$NON-NLS-1$ //$NON-NLS-2$ else p.addConnectionFactory(elem); } else if (EXT_ELEM_PROFILE_EXTENSION.equals(elemName)) { String profileId = elem.getAttribute(ProfileExtensionProvider.ATTR_PROFILE); ConnectionProfileProvider p = (ConnectionProfileProvider) mProviders.get(profileId); if (p == null) ConnectivityPlugin.getDefault() .log( ConnectivityPlugin.getDefault() .getResourceString( "assert.invalid.profile", //$NON-NLS-1$ new Object[] { elemName + "." + ProfileExtensionProvider.ATTR_PROFILE + ": " + profileId })); //$NON-NLS-1$ //$NON-NLS-2$ else p.addProfileExtension(elem); } else if (EXT_ELEM_CONNECTION_FACTORY_ADAPTER.equals(elemName)) { processConnectionFactoryAdapter(elem); } } registerConnectionFactoryAdapters(); // Bugzilla 173721 mProviders.keySet().removeAll(mDisabledProviders); initializeRepositoriesEnabledProperty(); }