core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java
author timkelly
Wed, 28 Jul 2010 11:33:05 -0500
branchC3_BUILDER_WORK
changeset 1709 6bd6640867aa
parent 1621 393b985a50f3
child 1808 88695467fd04
permissions -rw-r--r--
clean up some TODOs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
package com.nokia.carbide.cpp.sdk.core;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    15
import org.eclipse.core.runtime.IPath;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    16
import org.eclipse.core.runtime.Path;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
import org.eclipse.core.runtime.Plugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
import org.osgi.framework.BundleContext;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    19
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
    20
import com.nokia.carbide.cpp.internal.api.sdk.SDKCacheUtils;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
    22
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManagerRaptorOnly;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
    23
import com.nokia.cpp.internal.api.utils.core.HostOS;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
 * Main interface into the sdk.core plugin.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
 * @see getSDKManager() to get the SDK information
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
public class SDKCorePlugin extends Plugin {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
1359
d927acd507a6 re-enable SBSv1 builder via new flag
timkelly
parents: 1356
diff changeset
    32
	public static final boolean SUPPORTS_SBSV1_BUILDER = true;
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 608
diff changeset
    33
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
	// The plug-in ID
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
	public static final String PLUGIN_ID = "com.nokia.carbide.cpp.sdk.core"; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    37
	public static final String CACHE_FOLDER_NAME = "CarbideSDKCache"; //$NON-NLS-1$
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    38
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
	// The shared instance
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
	private static SDKCorePlugin plugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
	
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
    42
	private static ISDKManager sdkManager;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
	
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
    44
	private static SDKCacheUtils cache;
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    45
	
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    46
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    47
	 * The constructor
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
	public SDKCorePlugin() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
		plugin = this;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
	/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
	 * (non-Javadoc)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
	public void start(BundleContext context) throws Exception {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
		super.start(context);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
	/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    62
	 * (non-Javadoc)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    63
	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    64
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
	public void stop(BundleContext context) throws Exception {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    66
		try {
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    67
			if (cache != null)
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    68
				cache.flushAll();
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    69
		} catch (Exception e) {
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    70
			e.printStackTrace();
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
    71
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
		plugin = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
		super.stop(context);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
	public static String getPluginId(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
		return PLUGIN_ID;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
	 * Returns the shared instance
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
	 *
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
	 * @return the shared instance
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
	public static SDKCorePlugin getDefault() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    86
		return plugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    87
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
	 * Get the instance of the ISDKManager
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
	 * @return ISDKManager instance
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
	public static ISDKManager getSDKManager() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
		if (sdkManager == null) {
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 608
diff changeset
    95
			// TODO: SDKManagerRaptorOnly, currently only works on Linux
1356
d41a63384173 Restore use of SDKManagerRaptorOnly for Linux
Ed Swartz <ed.swartz@nokia.com>
parents: 1352
diff changeset
    96
			// ... and SDKManager depends on Windows
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1621
diff changeset
    97
			// Win32 can use this instead once ABLD support is dropped from Carbide
1356
d41a63384173 Restore use of SDKManagerRaptorOnly for Linux
Ed Swartz <ed.swartz@nokia.com>
parents: 1352
diff changeset
    98
			if (HostOS.IS_WIN32)
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 0
diff changeset
    99
				sdkManager = new SDKManager();
1356
d41a63384173 Restore use of SDKManagerRaptorOnly for Linux
Ed Swartz <ed.swartz@nokia.com>
parents: 1352
diff changeset
   100
			else
d41a63384173 Restore use of SDKManagerRaptorOnly for Linux
Ed Swartz <ed.swartz@nokia.com>
parents: 1352
diff changeset
   101
				sdkManager = new SDKManagerRaptorOnly();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
		return sdkManager;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
	
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   106
	/**
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   107
	 * Get the persistent cache this plugin.
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   108
	 * @return PersistentCache instance
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   109
	 */
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   110
	public static SDKCacheUtils getCache() {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   111
		if (cache == null)
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   112
		{
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   113
			IPath path = new Path(System.getProperty("user.home"));
1621
393b985a50f3 Raptor scanner discovery on top of new Raptor Query API.
stechong
parents: 1568
diff changeset
   114
			cache = new SDKCacheUtils(path.append(CACHE_FOLDER_NAME));
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   115
		}
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   116
		return cache;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   117
	}
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1359
diff changeset
   118
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
}