Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 39d0ce0b984345167046665df846d2d7dee2ddbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*******************************************************************************
 * Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tm.tcf.internal.extensions;

import java.util.Map;

import org.eclipse.tm.tcf.extensions.TcfAbstractExtensionPointManager;
import org.eclipse.tm.tcf.extensions.TcfExtensionProxy;
import org.eclipse.tm.tcf.protocol.IServiceProvider;
import org.eclipse.tm.tcf.protocol.Protocol;

/**
 * Extension point manager implementation for "org.eclipse.tm.tcf.serviceProviders".
 */
public class TcfServiceProvidersExtensionPointManager extends TcfAbstractExtensionPointManager<IServiceProvider> {
    /*
     * Thread save singleton instance creation.
     */
    private static class LazyInstanceHolder {
        public static TcfServiceProvidersExtensionPointManager fInstance = new TcfServiceProvidersExtensionPointManager();
    }

    /**
     * Returns the singleton instance for the manager.
     */
    public static TcfServiceProvidersExtensionPointManager getInstance() {
        return LazyInstanceHolder.fInstance;
    }

    /* (non-Javadoc)
     * @see org.eclipse.tm.tcf.extensions.TcfAbstractExtensionPointManager#getExtensionPointId()
     */
    @Override
    protected String getExtensionPointId() {
        return "org.eclipse.tm.tcf.serviceProviders"; //$NON-NLS-1$
    }

    /* (non-Javadoc)
     * @see org.eclipse.tm.tcf.extensions.TcfAbstractExtensionPointManager#getConfigurationElementName()
     */
    @Override
    protected String getConfigurationElementName() {
        return "serviceProvider"; //$NON-NLS-1$
    }

    /**
     * Register the contributed service provider extensions with the framework.
     */
    public void registerServiceProviders() {
        // Load the extensions
        Map<String, TcfExtensionProxy<IServiceProvider>> extensions = getExtensions();
        // Loop the extensions and get the service provider instance.
        // This will activate the contributing plugin.
        for (TcfExtensionProxy<IServiceProvider> proxy : extensions.values()) {
            IServiceProvider provider = proxy.getInstance();
            if (provider != null) Protocol.addServiceProvider(provider);
        }
    }
}

Back to the top