core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java
author timkelly
Tue, 17 Aug 2010 15:50:47 -0700
branchC3_BUILDER_WORK
changeset 1847 5a696c4ef747
parent 1808 88695467fd04
child 1857 5b2d8f8c613b
permissions -rw-r--r--
more Linux related fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
diff changeset
     1
/*
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     8
*
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    11
*
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    12
*/
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    13
package com.nokia.carbide.cpp.internal.sdk.core.model;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    14
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    15
import java.io.BufferedReader;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    16
import java.io.IOException;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    17
import java.io.InputStreamReader;
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
    18
import java.io.Serializable;
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
    19
import java.text.MessageFormat;
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:
diff changeset
    20
import java.util.ArrayList;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    21
import java.util.HashMap;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    22
import java.util.Iterator;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    23
import java.util.List;
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
    24
import java.util.Map;
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:
diff changeset
    25
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    26
import org.eclipse.core.resources.ResourcesPlugin;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    27
import org.eclipse.core.runtime.CoreException;
945
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    28
import org.eclipse.core.runtime.IConfigurationElement;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    29
import org.eclipse.core.runtime.IExtension;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    30
import org.eclipse.core.runtime.IExtensionPoint;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    31
import org.eclipse.core.runtime.IExtensionRegistry;
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:
diff changeset
    32
import org.eclipse.core.runtime.IPath;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
    33
import org.eclipse.core.runtime.IProgressMonitor;
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:
diff changeset
    34
import org.eclipse.core.runtime.IStatus;
1496
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
    35
import org.eclipse.core.runtime.NullProgressMonitor;
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:
diff changeset
    36
import org.eclipse.core.runtime.Platform;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    37
import org.eclipse.core.runtime.Status;
1488
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
    38
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
    39
import org.eclipse.core.runtime.jobs.IJobChangeListener;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
    40
import org.eclipse.core.runtime.jobs.Job;
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:
diff changeset
    41
import org.osgi.framework.Version;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    42
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    43
import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    44
import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    45
import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
945
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    46
import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook;
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:
diff changeset
    47
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
    48
import com.nokia.carbide.cpp.internal.api.sdk.SDKCacheUtils;
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:
diff changeset
    49
import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
    50
import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache;
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:
diff changeset
    51
import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore;
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1496
diff changeset
    52
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
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:
diff changeset
    53
import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
    54
import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener.SDKChangeEventType;
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:
diff changeset
    55
import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    56
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    57
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1484
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
    58
import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
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:
diff changeset
    59
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
    60
import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory;
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:
diff changeset
    61
import com.nokia.cpp.internal.api.utils.core.ListenerList;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    62
import com.nokia.cpp.internal.api.utils.core.Logging;
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    63
import com.nokia.cpp.internal.api.utils.core.PathUtils;
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:
diff changeset
    64
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    65
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    66
public abstract class AbstractSDKManager implements ISDKManager, ISDKManagerInternal {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    67
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    68
	protected static List<ISymbianSDK> sdkList = new ArrayList<ISymbianSDK>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    69
	protected HashMap<String,ISymbianSDK> missingSdkMap = new HashMap<String,ISymbianSDK>();
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
    70
	protected Job scanJob;
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:
diff changeset
    71
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
    72
	public static final String SDK_MANAGER_CACHE_KEY = "sdk_manager_cache";
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:
diff changeset
    73
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    74
	protected static final String EMPTY_STRING = "";
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    75
	protected static boolean enableBSFScanner;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    76
	protected static List<BuildPlat> platList = new ArrayList<BuildPlat>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    77
	protected static SymbianMacroStore macroStore;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    78
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    79
	protected static final String[] knownRVCTVersions = {"3.1", "3.0", "2.2", "2.1"};
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    80
	protected Version sbsV2Version;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    81
	
945
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    82
	static boolean sdkHookExtenstionsNotified;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    83
	public static final String SDK_MANAGER_LOADED_HOOK = SDKCorePlugin.PLUGIN_ID
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    84
	+ ".sdkManagerLoadedHook"; //$NON-NLS-1$
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    85
	
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
    86
	
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:
diff changeset
    87
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    88
	 * Minimum SBSv2 version supported with Carbide
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    89
	 */
1494
d0b573bc9608 fix minimum raptor version
timkelly
parents: 1488
diff changeset
    90
	public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 15, 0);
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:
diff changeset
    91
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    92
	static boolean hasScannedSDKs = false; // make sure we only scan SDKs when needed
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    93
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    94
	protected static List<IRVCTToolChainInfo> rvctInfoList = null;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    95
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    96
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    97
	 * Implement listener so other class that use this can listen to SDK 
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    98
	 * change event (e.g. validate project config description)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
    99
	 */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   100
	protected static ListenerList<ICarbideInstalledSDKChangeListener> listeners = new ListenerList<ICarbideInstalledSDKChangeListener>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   101
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   102
	/*
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   103
	 * Implement listener so other class that use this can listen for when a change to the devices.xml
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   104
	 * has been modified outside of Carbide
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   105
	 */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   106
	protected static ListenerList<ICarbideDevicesXMLChangeListener> devicesXMLListeners = new ListenerList<ICarbideDevicesXMLChangeListener>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   107
	
1488
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   108
	IJobChangeListener scanJobListener = new IJobChangeListener() {
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   109
		public void sleeping(IJobChangeEvent event) {}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   110
		public void scheduled(IJobChangeEvent event) {}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   111
		public void running(IJobChangeEvent event) {}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   112
		public void awake(IJobChangeEvent event) {}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   113
		public void aboutToRun(IJobChangeEvent event) {}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   114
		public void done(IJobChangeEvent event) {
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   115
			fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   116
		}
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   117
	};
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   118
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   119
		
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:
diff changeset
   120
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   121
	public AbstractSDKManager() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   122
		macroStore = SymbianMacroStore.getInstance();
1496
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
   123
		scanJob = new Job ("Scan for installed SDKs") {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   124
			@Override
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   125
			protected IStatus run(IProgressMonitor monitor) {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   126
				return handleScan(monitor);
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   127
			}
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   128
		};
1488
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   129
		
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   130
		addScanJobListner(scanJobListener);
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:
diff changeset
   131
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   132
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   133
	public SymbianMacroStore getSymbianMacroStore(){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   134
		return macroStore;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   135
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   136
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   137
	public void scanSDKs() {
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1496
diff changeset
   138
		SBSv2QueryUtils.removeAllCachedQueries();
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   139
		// do the real sdk scanning in a job.
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   140
		if (scanJob.getState() == Job.NONE) {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   141
			scanJob.schedule();
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   142
		}
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   143
	}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   144
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   145
	private IStatus handleScan(IProgressMonitor monitor) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   146
		synchronized (sdkList)
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   147
		{
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   148
			ArrayList<ISymbianSDK> oldSDKList = new ArrayList<ISymbianSDK>(sdkList);
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   149
			
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   150
			getSBSv2Version(true);
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   151
			
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   152
			if (sdkList != null){
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   153
				sdkList.clear();
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   154
			}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   155
		
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   156
			if (!doScanSDKs(monitor))
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   157
				return Status.OK_STATUS;;
1496
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
   158
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   159
			// now these SDK's are newly added, remove from internal list
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   160
			for (ISymbianSDK sdk : sdkList) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   161
				if (SDKManagerInternalAPI.getMissingSdk(sdk.getUniqueId()) != null) {
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   162
					SDKManagerInternalAPI.removeMissingSdk(sdk);
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   163
				}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   164
			}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   165
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   166
			// now these SDK's are removed from the old list, add to
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   167
			// internal list
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   168
			for (ISymbianSDK oldSdk : oldSDKList) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   169
				boolean found = false;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   170
				for (ISymbianSDK sdk : sdkList) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   171
					if (sdk.getUniqueId().equals(oldSdk.getUniqueId())) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   172
						found = true;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   173
						break;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   174
					}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   175
				}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   176
				if (found == false) {
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   177
					SDKManagerInternalAPI.addMissingSdk(oldSdk);
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   178
					// flush cache
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   179
					SymbianBuildContextDataCache.refreshForSDKs(new ISymbianSDK[] { oldSdk });
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   180
				}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   181
			}
1424
f27f3399e676 Updated SDK manager to make sure scan job is not already running before scheduling it; also default OS version to 9.5 if buildinfo.txt is missing from an SDK.
stechong
parents: 1421
diff changeset
   182
		}
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   183
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   184
		// make sure we don't rescan over and over again
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   185
		hasScannedSDKs = true;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   186
		
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   187
		updateCarbideSDKCache();
1455
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   188
		
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   189
		// Notify any plugins that want to know if the SDKManager has scanned plugins.
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   190
		if (!sdkHookExtenstionsNotified) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   191
			notifySDKManagerLoaded();
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   192
			sdkHookExtenstionsNotified = true;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   193
		}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   194
		if (monitor.isCanceled()) {
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   195
			return Status.CANCEL_STATUS;
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   196
		}
fb33806f2865 Moved scanning job back to invoking thread for now.
stechong
parents: 1434
diff changeset
   197
		return Status.OK_STATUS;
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:
diff changeset
   198
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   199
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   200
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   201
	 * Actually scan the SDKs available and populate sdkList.   
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   202
	 * @param oldSDkList old list of SDKs available for reference, e.g., detecting
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   203
	 * when SDKs are newly missing
743
78fd666a897a Fix filesystem caching performance as in bug #10318
Ed Swartz <ed.swartz@nokia.com>
parents: 684
diff changeset
   204
	 * @return true if scan succeeded
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:
diff changeset
   205
	 */
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   206
	abstract protected boolean doScanSDKs(IProgressMonitor monitor);
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:
diff changeset
   207
	
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   208
	public void addScanJobListner(IJobChangeListener listener) {
1488
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   209
		if (scanJob != null && listener != null) {
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   210
			scanJob.addJobChangeListener(listener);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   211
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   212
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   213
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   214
	public void removeScanJobLisner(IJobChangeListener listener) {
1488
f1eec65aaede add back in accidental merge-out of scanjob listener
timkelly
parents: 1485
diff changeset
   215
		if (scanJob != null && listener != null) {
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   216
			scanJob.removeJobChangeListener(listener);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   217
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   218
	}
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:
diff changeset
   219
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   220
	protected void ensureScannedSDKs() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   221
		if (!hasScannedSDKs) {
1496
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
   222
			handleScan(new NullProgressMonitor());
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
   223
			fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
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:
diff changeset
   224
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   225
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   226
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   227
	public List<ISymbianSDK> getSDKList() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   228
		
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   229
		synchronized(sdkList)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   230
		{
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   231
			if (sdkList.size() < 1) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   232
				ensureScannedSDKs();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   233
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   234
			List<ISymbianSDK> listCopy = new ArrayList<ISymbianSDK>(sdkList);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   235
			return listCopy;			
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   236
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   237
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   238
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   239
	public ISymbianSDK getSDK(String sdkId, boolean scanIfNecessary) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   240
		if (scanIfNecessary) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   241
			getSDKList();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   242
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   243
		synchronized(sdkList)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   244
		{
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   245
			for (Iterator iter = sdkList.iterator(); iter.hasNext();) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   246
				ISymbianSDK sdk = (ISymbianSDK)iter.next();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   247
				if (sdk.getUniqueId().compareTo(sdkId) == 0) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   248
					return sdk;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   249
				}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   250
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   251
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   252
		return null;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   253
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   254
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   255
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   256
	public void addSDK(ISymbianSDK sdk) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   257
		synchronized(sdkList)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   258
		{
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   259
			try {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   260
				sdkList.add(sdk);
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:
diff changeset
   261
				updateSDK(sdk);
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   262
				SDKManagerInternalAPI.removeMissingSdk(sdk);
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:
diff changeset
   263
				// tell others about it
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   264
				fireInstalledSdkChanged(SDKChangeEventType.eSDKAdded);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   265
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   266
			catch (Exception e) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   267
				logError("Could not add SDK", e);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   268
				String message = "Could not add this SDK. Your devices.xml file may be corrupt. If you remove the file from its current location and then rescan SDKs, Carbide will offer to create a new one.";
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   269
				Logging.showErrorDialog(WorkbenchUtils.getSafeShell(), null, message, Logging.newSimpleStatus(1, e));
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   270
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   271
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   272
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   273
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   274
	public boolean removeSDK(String sdkId) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   275
		synchronized (sdkList)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   276
		{
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   277
			if (sdkList != null){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   278
				for (ISymbianSDK currSDK : sdkList){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   279
					if (currSDK.getUniqueId().equals(sdkId)){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   280
						sdkList.remove(currSDK);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   281
						
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   282
						SDKManagerInternalAPI.addMissingSdk(currSDK);
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:
diff changeset
   283
						
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   284
						// tell others about it
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   285
						fireInstalledSdkChanged(SDKChangeEventType.eSDKRemoved);
1484
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
   286
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
   287
						// only remove sdk from devices.xml if the sdk is defined in it
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
   288
						if (((SymbianSDK)currSDK).getSupportedFeatures().contains(ISymbianSDKFeatures.IS_FROM_DEVICES_XML)) {
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
   289
							doRemoveSDK(sdkId);
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1480
diff changeset
   290
						}
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:
diff changeset
   291
						
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   292
						break;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   293
					}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   294
				}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   295
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   296
				updateCarbideSDKCache();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   297
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   298
			} else {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   299
				return false;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   300
			}			
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   301
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   302
		return true;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   303
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   304
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   305
	abstract protected boolean doRemoveSDK(String sdkId);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   306
1496
955e25610999 Prevent duplicate SDKs from getting removed during SDK rescanning; also changed SDK scanning during startup to prevent deadlock.
stechong
parents: 1494
diff changeset
   307
	protected void scanCarbideSDKCache(){
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   308
		List<String> idList = getSDKCacheIdList();
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   309
		for (Iterator<String> itr = idList.iterator(); itr.hasNext();) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   310
			String id = itr.next();
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   311
			SDKManagerCacheEntry entry = getSDKCacheEntry(id);
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   312
			ISymbianSDK sdk = getSDK(id, false);
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   313
			if (sdk == null) {
1732
c408456e415f Make sure OS version is never set to 0 when loading SDK from cache.
stechong
parents: 1717
diff changeset
   314
				Version osVersion = new Version(entry.getOsVersion());
c408456e415f Make sure OS version is never set to 0 when loading SDK from cache.
stechong
parents: 1717
diff changeset
   315
				if (osVersion.getMajor() == 0) {
c408456e415f Make sure OS version is never set to 0 when loading SDK from cache.
stechong
parents: 1717
diff changeset
   316
					osVersion = new Version("9.5");
c408456e415f Make sure OS version is never set to 0 when loading SDK from cache.
stechong
parents: 1717
diff changeset
   317
				}
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   318
				sdk = SymbianSDKFactory.createInstance(id, 
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   319
						   entry.getEpocRoot(),
1732
c408456e415f Make sure OS version is never set to 0 when loading SDK from cache.
stechong
parents: 1717
diff changeset
   320
						   osVersion);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   321
				((SymbianSDK)sdk).setEnabled(entry.isEnabled());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   322
				synchronized (sdkList) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   323
					sdkList.add(sdk);
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   324
				}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   325
			} else {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   326
				((SymbianSDK)sdk).setEnabled(entry.isEnabled());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   327
			}
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   328
		}
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   329
	}
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   330
	
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:
diff changeset
   331
	public void updateCarbideSDKCache() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   332
		if (!Platform.isRunning())
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   333
			return;
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   334
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   335
		clearSDKCache();
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   336
		synchronized(sdkList)
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   337
		{
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   338
			for (ISymbianSDK currSDK: sdkList) {
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   339
				SDKManagerCacheEntry entry = new SDKManagerCacheEntry();
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   340
				entry.setId(currSDK.getUniqueId());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   341
				entry.setEpocRoot(currSDK.getEPOCROOT());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   342
				entry.setOsVersion(currSDK.getOSVersion().toString());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   343
				entry.setEnabled(currSDK.isEnabled());
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   344
				setSDKCacheEntry(entry);
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:
diff changeset
   345
			}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 1077
diff changeset
   346
		}
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   347
	}
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1462
diff changeset
   348
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:
diff changeset
   349
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   350
	 * Tell whether EPOCROOT can be changed for a given ISymbianSDK
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   351
	 * @return flag
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   352
	 */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   353
	abstract protected boolean isEPOCRootFixed();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   354
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   355
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   356
	 * Get whether or not the UI has enabled BSF scanning.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   357
	 * @return true if BSF scanning is enabled.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   358
	 */
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:
diff changeset
   359
	public boolean getBSFScannerEnabled(){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   360
		return enableBSFScanner;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   361
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   362
	
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   363
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   364
	 * Set whether or not build platforms should be added for SDKs that contain .bsf extensions.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   365
	 * @param enabled - When true, add BSF platforms.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   366
	 */
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:
diff changeset
   367
	public void enableBSFScanner(boolean enabled){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   368
		enableBSFScanner = enabled;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   369
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   370
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   371
	public void setPlatformList(List<BuildPlat> inPlatList){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   372
		platList = inPlatList;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   373
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   374
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   375
	public List<BuildPlat> getPlatformList(){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   376
		return platList;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   377
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   378
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   379
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   380
	 * Returns toolchain info for all detected RVCT tools.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   381
	 * @return Array of toolchain information objects.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   382
	 */
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:
diff changeset
   383
	public synchronized IRVCTToolChainInfo[] getInstalledRVCTTools() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   384
		// the path wn't change inside one invocation so cache the results
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   385
		if (rvctInfoList == null) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   386
			rvctInfoList = scanForInstalledRVCTCompilers();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   387
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   388
		return (IRVCTToolChainInfo[]) rvctInfoList.toArray(new IRVCTToolChainInfo[rvctInfoList.size()]);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   389
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   390
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   391
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   392
	 * Get a list of IRVCTToolChainInfo objects for all RVCT installations detected on the PATH env var.
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   393
	 */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   394
	protected static List<IRVCTToolChainInfo> scanForInstalledRVCTCompilers() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   395
		
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   396
		Runtime rt=Runtime.getRuntime();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   397
		List<IRVCTToolChainInfo> rvctToolList = new ArrayList<IRVCTToolChainInfo>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   398
		
684
8e7900690341 Extract path-manipulation utilities into PathUtils, to correspond with the same classes in EDC.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   399
		IPath[] pathEntries = PathUtils.getPathEntries(null);
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:
diff changeset
   400
		
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   401
		for(IPath path : pathEntries) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   402
			try {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   403
				String command = path.append("armcc").toOSString() + " --vsn";
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   404
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   405
				Process p = rt.exec(command);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   406
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   407
				BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   408
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   409
				String overallOutput = null;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   410
				String stdErrLine = null;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   411
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   412
				// RVCT waits for like 4 minutes trying to find a license when the computer is
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   413
				// not connected to the network.  in such cases, the call to br.readline doesn't
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   414
				// return for 4 minutes which is unacceptable here.  Instead we'll poll at 1/2 second
1717
c652b45338b6 only wait 5 seconds for rvct version info. If not found, default to rvct2_2. (This is for abld only)
timkelly
parents: 1715
diff changeset
   415
				// intervals for 5 seconds and see if we get a response. On the first response we break out
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:
diff changeset
   416
				// of the loop and read the output. So in most normal circumstances it will take 1/2 to 1 seconds.
1717
c652b45338b6 only wait 5 seconds for rvct version info. If not found, default to rvct2_2. (This is for abld only)
timkelly
parents: 1715
diff changeset
   417
				int maxTries = 10;
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:
diff changeset
   418
				int numTries = 0;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   419
				while (numTries < maxTries) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   420
					try {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   421
						Thread.sleep(500);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   422
					} catch (InterruptedException e) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   423
						// ignore
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   424
					}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   425
					if (br.ready()) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   426
						while ((stdErrLine = br.readLine()) != null) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   427
							overallOutput += stdErrLine;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   428
						}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   429
						break;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   430
					}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   431
					numTries++;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   432
				}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   433
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   434
				p.destroy();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   435
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   436
				if (overallOutput != null && overallOutput.length() > 0){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   437
					for (String currVersion : knownRVCTVersions) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   438
						
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   439
						if(overallOutput.contains(currVersion)) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   440
							RVCTToolChainInfo rvctInfo = new RVCTToolChainInfo();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   441
							rvctInfo.setRvctToolBinariesDirectory(path.toOSString());
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   442
							rvctInfo.setRvctToolsVersion(new Version(currVersion));
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   443
							rvctToolList.add(rvctInfo);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   444
							break; // tool successfully added
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   445
						}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   446
					}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   447
				}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   448
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   449
			catch (IOException e) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   450
				// armcc isn't in this directory, ignore....
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   451
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   452
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   453
				
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   454
		return rvctToolList;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   455
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   456
	
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   457
    public void addMissingSdk(ISymbianSDK sdk) {
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   458
		missingSdkMap.put(sdk.getUniqueId(), sdk);
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   459
    }
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   460
    
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:
diff changeset
   461
    public ISymbianSDK addMissingSdk(String uid) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   462
		ISymbianSDK sdk = getMissingSdk(uid);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   463
		if (sdk == null) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   464
			sdk = SymbianMissingSDKFactory.createInstance(uid);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   465
			missingSdkMap.put(uid, sdk);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   466
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   467
    	return sdk;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   468
    }
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   469
    
1682
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   470
    public void removeMissingSdk(ISymbianSDK sdk) {
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   471
    	missingSdkMap.remove(sdk.getUniqueId());
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   472
    }
2ee63cbf206a Updated support for adding/removing missing SDK.
stechong
parents: 1667
diff changeset
   473
    
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:
diff changeset
   474
    public void removeMissingSdk(String uid) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   475
    	missingSdkMap.remove(uid);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   476
    }
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   477
    
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   478
    public ISymbianSDK getMissingSdk(String uid) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   479
    	return missingSdkMap.get(uid);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   480
    }
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   481
    
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   482
	public List<ISymbianSDK> getMissingSDKList() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   483
		List<ISymbianSDK> listCopy = new ArrayList<ISymbianSDK>();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   484
		synchronized(missingSdkMap) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   485
			for (ISymbianSDK sdk : missingSdkMap.values()) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   486
				listCopy.add(sdk);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   487
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   488
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   489
		return listCopy;			
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   490
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   491
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   492
	public void addInstalledSdkChangeListener(ICarbideInstalledSDKChangeListener listener) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   493
		listeners.add(listener);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   494
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   495
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   496
	public void removeInstalledSdkChangeListener(ICarbideInstalledSDKChangeListener listener) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   497
		listeners.remove(listener);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   498
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   499
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   500
	public void fireInstalledSdkChanged(SDKChangeEventType eventType) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   501
		for (ICarbideInstalledSDKChangeListener l : listeners) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   502
			l.installedSdkChanged(eventType);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   503
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   504
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   505
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   506
	public void addDevicesXMLChangeListener(ICarbideDevicesXMLChangeListener listener) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   507
		devicesXMLListeners.add(listener);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   508
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   509
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   510
	public void removeDevicesXMLChangeListener(ICarbideDevicesXMLChangeListener listener) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   511
		devicesXMLListeners.remove(listener);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   512
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   513
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   514
	public void fireDevicesXMLChanged() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   515
		for (ICarbideDevicesXMLChangeListener l : devicesXMLListeners) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   516
			l.devicesXMLOutOfSync();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   517
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   518
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   519
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   520
	protected void logError(String message, Throwable t) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   521
		SDKCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), message, t));		
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   522
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   523
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   524
	public Version getSBSv2Version(boolean forceScan) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   525
		if (sbsV2Version == null || forceScan){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   526
			sbsV2Version = new Version(0, 0, 0);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   527
			
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   528
			Runtime rt=Runtime.getRuntime();
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   529
			IPath sbsPath = SBSv2Utils.getSBSPath();
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   530
			Process p = null;
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:
diff changeset
   531
			try {
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   532
				p = rt.exec(new String[] { sbsPath.toOSString(), "-v" });
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   533
			} catch (IOException e) {
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   534
				// no such process, SBSv2 not available
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   535
				Logging.log(SDKCorePlugin.getDefault(), Logging.newSimpleStatus(
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   536
						0, IStatus.WARNING, 
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   537
						MessageFormat.format(
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   538
							"Could not find or launch Raptor script ''{0}''; SBSv2 support will not be available",
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   539
							sbsPath), e));
1847
5a696c4ef747 more Linux related fixes
timkelly
parents: 1808
diff changeset
   540
			} 
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   541
			if (p != null) {
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:
diff changeset
   542
				BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
1077
7bde62318913 Fix bug 10835. Also fix issue with null String check where elcipse 3.6 complier removes code, assuming it's dead.
timkelly
parents: 945
diff changeset
   543
				String overallOutput = "";
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:
diff changeset
   544
				String stdErrLine = null;
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   545
				try {
926
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   546
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   547
					// Only try for 10 seconds then bail in case Raptor hangs
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   548
					int maxTries = 20;
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   549
					int numTries = 0;
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   550
					while (numTries < maxTries) {
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   551
						try {
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   552
							Thread.sleep(500);
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   553
						} catch (InterruptedException e) {
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   554
							// ignore
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   555
						}
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   556
						if (br.ready()) {
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   557
							while ((stdErrLine = br.readLine()) != null) {
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   558
								overallOutput += stdErrLine;
1077
7bde62318913 Fix bug 10835. Also fix issue with null String check where elcipse 3.6 complier removes code, assuming it's dead.
timkelly
parents: 945
diff changeset
   559
								numTries = maxTries;
926
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   560
							}
1077
7bde62318913 Fix bug 10835. Also fix issue with null String check where elcipse 3.6 complier removes code, assuming it's dead.
timkelly
parents: 945
diff changeset
   561
							
926
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   562
						}
c6a84ca946e6 Timout SBSv2 version check if sbs hangs (bug 10467)
timkelly
parents: 745
diff changeset
   563
						numTries++;
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   564
					}
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   565
				} catch (IOException e) {
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   566
					e.printStackTrace();
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:
diff changeset
   567
				}
1077
7bde62318913 Fix bug 10835. Also fix issue with null String check where elcipse 3.6 complier removes code, assuming it's dead.
timkelly
parents: 945
diff changeset
   568
				if (overallOutput.length() > 0) {
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:
diff changeset
   569
				{
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   570
					String[] tokens = overallOutput.split(" ");
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   571
					if (tokens.length >= 3) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   572
						if (tokens[2].split("\\.").length == 3) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   573
							sbsV2Version = Version.parseVersion(tokens[2]);
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   574
						}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   575
					}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   576
						if (sbsV2Version.compareTo(MINIMUM_RAPTOR_VERSION) < 0 && sbsV2Version.getMajor() > 0) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   577
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   578
							String incorrectRaptorVersionStr = "SBSv2 version detected: "
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   579
									+ sbsV2Version.toString()
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   580
									+ ". The minimum version suggested for Carbide is: "
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   581
									+ MINIMUM_RAPTOR_VERSION.getMajor()
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   582
									+ "."
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   583
									+ MINIMUM_RAPTOR_VERSION.getMinor()
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   584
									+ "."
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   585
									+ MINIMUM_RAPTOR_VERSION.getMicro();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   586
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   587
							ResourcesPlugin.getPlugin().getLog().log(
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   588
									new Status(IStatus.WARNING,
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   589
											SDKCorePlugin.PLUGIN_ID,
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   590
											IStatus.WARNING,
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   591
											incorrectRaptorVersionStr, null));
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   592
						}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   593
					
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   594
					p.destroy();
745
51d63d83aad1 Don't log exception to console when sbs[.bat] cannot be found.
Ed Swartz <ed.swartz@nokia.com>
parents: 743
diff changeset
   595
					}
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:
diff changeset
   596
				}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   597
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   598
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   599
		return sbsV2Version;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   600
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   601
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   602
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   603
	 * Retrieve the minimum supported version of SBSv2 for Carbide.c++
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   604
	 * @return Version
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   605
	 * @since 2.3
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1732
diff changeset
   606
	 */
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:
diff changeset
   607
	public Version getMinimumSupportedSBSv2Version() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   608
		return MINIMUM_RAPTOR_VERSION;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   609
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
diff changeset
   610
	
945
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   611
	/**
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   612
	 * Find clients of the 'sdkManagerLoadedHook' extension point so their plug-ins can be loaded
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   613
	 */
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   614
	private void notifySDKManagerLoaded() {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   615
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   616
		ISDKManagerLoadedHook sdkHook = null;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   617
		IExtensionRegistry er = Platform.getExtensionRegistry();
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   618
		IExtensionPoint ep = er.getExtensionPoint(SDK_MANAGER_LOADED_HOOK);
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   619
		IExtension[] extensions = ep.getExtensions();
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   620
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   621
		for (int i = 0; i < extensions.length; i++) {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   622
			IExtension extension = extensions[i];
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   623
			IConfigurationElement[] ces = extension.getConfigurationElements();
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   624
			if (ces != null && ces.length >= 1) {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   625
				IConfigurationElement providerElement = ces[0];
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   626
				String name = providerElement.getAttribute("name"); //$NON-NLS-1$
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   627
				if (name != null) {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   628
					if (providerElement.getAttribute("class") != null) { //$NON-NLS-1$
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   629
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   630
						try {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   631
							sdkHook = (ISDKManagerLoadedHook) providerElement
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   632
									.createExecutableExtension("class"); //$NON-NLS-1$
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   633
							sdkHook.symbianSDKManagerLoaded();
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   634
						} catch (CoreException e) {
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   635
							// ignore
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   636
							// e.printStackTrace();
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   637
						}
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   638
					}
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   639
				}
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   640
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   641
			}
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   642
		}
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   643
		return;
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   644
67437bfc7c6f Add ISymbianManagerLoadedHook - currently used to notify com.nokia.qt plugins that need to ensure that Qt SDKs have been scanned and added to the Qt preferences and that ICarbideBuildConfiguration listeners are added so the proper Qt-SDK can be set with build config changes. Scanned Qt SDKs are wrapped in a Job and added SDKs are reported to the Error log as Info.
timkelly
parents: 926
diff changeset
   645
	}
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   646
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   647
	protected void clearSDKCache() {
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
   648
		SDKCacheUtils.getCache().removeCache(SDK_MANAGER_CACHE_KEY);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   649
	}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   650
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   651
	@SuppressWarnings("unchecked")
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   652
	protected List<String> getSDKCacheIdList() {
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
   653
		Map<String, SDKManagerCacheEntry> cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   654
		List<String> idList = new ArrayList<String>();
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   655
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   656
		if (cacheMap != null) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   657
			idList.addAll(cacheMap.keySet()); 
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   658
		}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   659
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   660
		return idList;
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   661
	}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   662
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   663
	@SuppressWarnings("unchecked")
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   664
	protected SDKManagerCacheEntry getSDKCacheEntry(String id) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   665
		SDKManagerCacheEntry entry = null;
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
   666
		Map<String, SDKManagerCacheEntry> cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   667
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   668
		if (cacheMap != null) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   669
			entry = cacheMap.get(id);
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   670
		}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   671
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   672
		return entry;
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   673
	}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   674
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   675
	@SuppressWarnings("unchecked")
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   676
	protected void setSDKCacheEntry(SDKManagerCacheEntry entry) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   677
		String id = entry.getId();
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
   678
		Map<String, SDKManagerCacheEntry> cacheMap = SDKCacheUtils.getCache().getCachedData(SDK_MANAGER_CACHE_KEY, Map.class, 0);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   679
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   680
		if (cacheMap == null) {
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   681
			cacheMap = new HashMap<String, SDKManagerCacheEntry>();
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   682
		}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   683
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   684
		cacheMap.put(id, entry);
1808
88695467fd04 Removed SDKCacheUtils type from public API.
stechong
parents: 1781
diff changeset
   685
		SDKCacheUtils.getCache().putCachedData(SDK_MANAGER_CACHE_KEY, (Serializable)cacheMap, 0);
1715
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   686
	}
ff0db4bbc189 Updated SDKManager to use SDKCacheUtils for caching SDK info.
stechong
parents: 1699
diff changeset
   687
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:
diff changeset
   688
}