INTERNAL: check whether current sdk is for platform developer or not 60/29460/1
authorgreatim <jaewon81.lim@samsung.com>
Tue, 28 Oct 2014 06:19:17 +0000 (15:19 +0900)
committergreatim <jaewon81.lim@samsung.com>
Tue, 28 Oct 2014 06:19:17 +0000 (15:19 +0900)
check whether current sdk is for platform developer or not
remove preload application in applist if platform sdk is not installed

Change-Id: I63991a38f24823b3b710d563f08e2eabbc743ae7
Signed-off-by: greatim <jaewon81.lim@samsung.com>
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/common/path/PathConstants.java
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/common/path/PathManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/collection/IndexedHashMap.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPlugin.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/Global.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/control/ApplistManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/PackageInfo.java

index 20c8c17..77b0199 100644 (file)
@@ -44,6 +44,7 @@ public class PathConstants {
        public static final String IDE_FOLDER_NAME = "ide"; //$NON-NLS-1$
        public static final String PLUGINS_FOLDER_NAME = "plugins"; //$NON-NLS-1$
        public static final String BASE_PLATFORM_PLUGIN_FOLDER_NAME = "org.tizen.base.platform"; //$NON-NLS-1$
+       public static final String PLATFORM_IDE_PLUGIN_NAME = "org.tizen.nativeplatform"; //$NON-NLS-1$
        public static final String WORKBENCH_PLUGIN_FOLDER_NAME = "org.tizen.dynamicanalyzer.workbench"; //$NON-NLS-1$
        public static final String ABOUT_FILE_NAME = "about.mappings"; //$NON-NLS-1$
        public static final String SINGLETON_LOCK_FILE = "active_da";//$NON-NLS-1$
index 75b15b3..9ddbb50 100755 (executable)
@@ -51,8 +51,8 @@ public class PathManager {
        public static final String DA_INSTALL_PATH = TIZEN_SDK_INSTALL_PATH + File.separator
                        + PathConstants.TOOLS_FOLDER_NAME + File.separator
                        + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME;
-       public static final String DA_AUTOTEST_PATH = TIZEN_SDK_DATA_PATH + File.separator
-                       + "test" + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME;
+       public static final String DA_AUTOTEST_PATH = TIZEN_SDK_DATA_PATH + File.separator + "test"
+                       + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME;
        public static final String DA_READELF_PATH = DA_INSTALL_PATH + File.separator
                        + PathConstants.TARGET_FOLDER_NAME;
 
@@ -71,10 +71,10 @@ public class PathManager {
        public static final String DA_TOOL_FOLDER_PATH = DA_INSTALL_PATH + File.separator
                        + PathConstants.TOOL_FOLDER_NAME;
 
-       public static final String DA_DEBUG_DATA_CHANNEL_LOG_FILE = DA_LOG_PATH
-                       + File.separator + "data.log"; //$NON-NLS-1$
-       public static final String DA_DEBUG_CONTROL_CHANNEL_LOG_FILE = DA_LOG_PATH
-                       + File.separator + "control.log"; //$NON-NLS-1$
+       public static final String DA_DEBUG_DATA_CHANNEL_LOG_FILE = DA_LOG_PATH + File.separator
+                       + "data.log"; //$NON-NLS-1$
+       public static final String DA_DEBUG_CONTROL_CHANNEL_LOG_FILE = DA_LOG_PATH + File.separator
+                       + "control.log"; //$NON-NLS-1$
        public static final String DA_BINARY_AUTO_SAVE_FILE = DA_SAVE_PATH + File.separator
                        + "BinarySettings.save";
 
@@ -146,11 +146,11 @@ public class PathManager {
                        String platformVersion = platform.replaceAll("[A-Za-z]", "");//$NON-NLS-1$
 
                        if (Double.parseDouble(platformVersion) < 2.1) {
-                               tizenHeaderSouecePath = String.format(tempPath, platformName,
-                                               currentDevie, platformVersion + ".cpp");//$NON-NLS-1$
+                               tizenHeaderSouecePath = String.format(tempPath, platformName, currentDevie,
+                                               platformVersion + ".cpp");//$NON-NLS-1$
                        } else {
-                               tizenHeaderSouecePath = String.format(tempPath, platformName,
-                                               currentDevie, platformVersion + ".native");//$NON-NLS-1$
+                               tizenHeaderSouecePath = String.format(tempPath, platformName, currentDevie,
+                                               platformVersion + ".native");//$NON-NLS-1$
                        }
                }
 
@@ -160,10 +160,9 @@ public class PathManager {
        // currently not used
        public static String getTargetPath(String platform) {
                if (null != platform && !platform.isEmpty()) {
-                       return TIZEN_SDK_INSTALL_PATH + File.separator
-                                       + PathConstants.PLATFORM_FOLDER_NAME + File.separator + platform
-                                       + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME
-                                       + File.separator;
+                       return TIZEN_SDK_INSTALL_PATH + File.separator + PathConstants.PLATFORM_FOLDER_NAME
+                                       + File.separator + platform + File.separator
+                                       + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME + File.separator;
                } else {
                        return DA_INSTALL_PATH + File.separator + PathConstants.TARGET_FOLDER_NAME
                                        + File.separator;
@@ -199,6 +198,32 @@ public class PathManager {
                return aboutFilePath;
        }
 
+       public static boolean checkPlatformPlugin() {
+               String idePluginPath = TIZEN_SDK_INSTALL_PATH + File.separator
+                               + PathConstants.IDE_FOLDER_NAME + File.separator
+                               + PathConstants.PLUGINS_FOLDER_NAME;
+
+               File dir = new File(idePluginPath);
+               String[] files;
+               if (dir.exists()) {
+                       files = dir.list(new FilenameFilter() {
+
+                               @Override
+                               public boolean accept(File dir, String name) {
+                                       return name.contains(PathConstants.PLATFORM_IDE_PLUGIN_NAME);
+                               }
+                       });
+               } else {
+                       return false;
+               }
+
+               if (null == files || files.length < 1) {
+                       return false;
+               }
+
+               return true;
+       }
+
        public static String getWorkbenchPluginPath() {
                String aboutFolderPath = TIZEN_SDK_INSTALL_PATH + File.separator
                                + PathConstants.TOOLS_FOLDER_NAME + File.separator
@@ -230,9 +255,9 @@ public class PathManager {
 
        public static String getRootstrapsPath(String platform) {
                if (platform != null) {
-                       return TIZEN_SDK_INSTALL_PATH + File.separator
-                                       + PathConstants.PLATFORM_FOLDER_NAME + File.separator + platform
-                                       + File.separator + PathConstants.TIZEN_FOLDER_ROOTSTRAPS;
+                       return TIZEN_SDK_INSTALL_PATH + File.separator + PathConstants.PLATFORM_FOLDER_NAME
+                                       + File.separator + platform + File.separator
+                                       + PathConstants.TIZEN_FOLDER_ROOTSTRAPS;
                } else {
                        return "";
                }
@@ -245,40 +270,37 @@ public class PathManager {
                        returnstr = DA_TOOL_FOLDER_PATH + File.separator
                                        + PathConstants.WINDOW_ACTIVATOR_WINDOWS;
                } else if (CommonUtil.isMac()) {
-                       returnstr = DA_TOOL_FOLDER_PATH + File.separator
-                                       + PathConstants.WINDOW_ACTIVATOR_MACOS;
+                       returnstr = DA_TOOL_FOLDER_PATH + File.separator + PathConstants.WINDOW_ACTIVATOR_MACOS;
                } else if (CommonUtil.isLinux()) {
-                       returnstr = DA_TOOL_FOLDER_PATH + File.separator
-                                       + PathConstants.WINDOW_ACTIVATOR_LINUX;
+                       returnstr = DA_TOOL_FOLDER_PATH + File.separator + PathConstants.WINDOW_ACTIVATOR_LINUX;
                } else {
                        returnstr = null;
                }
 
                return returnstr;
        }
-       
+
        public static String getTestLogPath() {
                String returnstr = null;
 
                returnstr = getTizenSdkDataPath();
-               if (returnstr == null)  return returnstr;
-               return returnstr + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME  
-                               + File.separator + PathConstants.TEST_FOLDER_NAME;  
+               if (returnstr == null)
+                       return returnstr;
+               return returnstr + File.separator + PathConstants.DYNAMIC_ANALYZER_FOLDER_NAME
+                               + File.separator + PathConstants.TEST_FOLDER_NAME;
        }
-       
+
        public static String getDebugInfoScript() {
                String path = null;
-               
+
                if (CommonUtil.isLinux() || CommonUtil.isMac()) {
-                       path = DA_TOOL_FOLDER_PATH + File.separator
-                       + PathConstants.DEBUGINFO_LINUX_MAC;
+                       path = DA_TOOL_FOLDER_PATH + File.separator + PathConstants.DEBUGINFO_LINUX_MAC;
                } else if (CommonUtil.isWin()) {
-                       path = DA_TOOL_FOLDER_PATH + File.separator
-                       + PathConstants.DEBUGINFO_WINDOWS;
+                       path = DA_TOOL_FOLDER_PATH + File.separator + PathConstants.DEBUGINFO_WINDOWS;
                } else { // should never be here
-                       Logger.error("Unknown host OS!\n");                     
+                       Logger.error("Unknown host OS!\n");
                }
-               
+
                return path;
        }
 }
index de4f317..2ad90b5 100644 (file)
@@ -55,7 +55,7 @@ public class IndexedHashMap<K, V extends Indexable> {
        }
 
        public V getByIndex(int index) {
-               if (index < dataList.size()) {
+               if (index >= 0 && index < dataList.size()) {
                        return dataList.get(index);
                } else {
                        return null;
index e567a98..c6f7336 100644 (file)
@@ -51,6 +51,9 @@ public class AnalyzerPlugin extends AbstractUIPlugin {
        public void start(BundleContext context) throws Exception {\r
                super.start(context);\r
                plugin = this;\r
+               \r
+               // check for platform sdk\r
+               Global.setPlatformSDK(PathManager.checkPlatformPlugin());\r
 \r
                // Adds workbench listener.\r
                IWorkbench workbench = PlatformUI.getWorkbench();\r
index ad5368c..c6892d3 100644 (file)
@@ -38,17 +38,27 @@ import org.tizen.dynamicanalyzer.swap.channel.control.RunTimeConfiguration;
 // This class is for global information that can be accessed from anywhere in dynamic analyzer code.
 // So this class contains only static methods and variables.
 public class Global {
+       private static boolean isPlatformSDK = false;
+       
        private static DeviceInfo currentDevice = null;
        private static PackageInfo currentApplication = null;
        private static Project currentProject = null;
        private static RunTimeConfiguration currentConfiguration = null;
 
+       public static boolean isPlatformSDK() {
+               return isPlatformSDK;
+       }
+
+       public static void setPlatformSDK(boolean isPlatformSDK) {
+               Global.isPlatformSDK = isPlatformSDK;
+       }
+
        public static DeviceInfo getCurrentDeviceInfo() {
                return currentDevice;
        }
 
        public static void setCurrentDeviceInfo(DeviceInfo device) {
-               currentDevice = device;
+               Global.currentDevice = device;
        }
 
        public static PackageInfo getCurrentApplication() {
@@ -56,7 +66,7 @@ public class Global {
        }
 
        public static void setCurrentApplication(PackageInfo pkgInfo) {
-               currentApplication = pkgInfo;
+               Global.currentApplication = pkgInfo;
        }
 
        public static RunTimeConfiguration getCurrentConfiguration() {
@@ -64,17 +74,17 @@ public class Global {
        }
 
        public static void setCurrentConfiguration(RunTimeConfiguration currentConfig) {
-               currentConfiguration = currentConfig;
-       }
-
-       public static void setProject(Project p) {
-               currentProject = p;
+               Global.currentConfiguration = currentConfig;
        }
 
        public static Project getProject() {
                return currentProject;
        }
 
+       public static void setProject(Project p) {
+               Global.currentProject = p;
+       }
+
        public static String getFunctionName(int id) {
                if (currentProject != null) {
                        return currentProject.getFunctionName(id);
index f432b18..4eae6d8 100644 (file)
@@ -274,7 +274,7 @@ public class DACommunicator {
 
                // add lines for running process
                pkginfoLines.add(PackageInfo.PKGTYPE + "[unknown]" + PackageInfo.PKGID + "["
-                               + AnalyzerConstants.RUNNING_PROCESS + "]");
+                               + AnalyzerConstants.RUNNING_PROCESS + "]" + PackageInfo.PRELOAD + "[1]");
                pkginfoLines.add(AppInfo.PROPERTY.APPID.name + ":" + AnalyzerConstants.RUNNING_PROCESS);
                pkginfoLines.add(AppInfo.PROPERTY.PACKAGE.name + ":" + AnalyzerConstants.RUNNING_PROCESS);
                pkginfoLines.add(AppInfo.PROPERTY.LABEL.name + ":"
@@ -282,9 +282,9 @@ public class DACommunicator {
                pkginfoLines.add(AppInfo.PROPERTY.APPTYPE.name + ":" + AppInfo.APPTYPE_RUNNING);
                pkginfoLines.add("");
 
-               // add lines for without-executable
+               // add lines for common-executable
                pkginfoLines.add(PackageInfo.PKGTYPE + "[unknown]" + PackageInfo.PKGID + "["
-                               + AnalyzerConstants.COMMON_EXECUTABLE + "]");
+                               + AnalyzerConstants.COMMON_EXECUTABLE + "]" + PackageInfo.PRELOAD + "[1]");
                pkginfoLines.add(AppInfo.PROPERTY.APPID.name + ":" + AnalyzerConstants.COMMON_EXECUTABLE);
                pkginfoLines.add(AppInfo.PROPERTY.PACKAGE.name + ":" + AnalyzerConstants.COMMON_EXECUTABLE);
                pkginfoLines.add(AppInfo.PROPERTY.LABEL.name + ":"
@@ -294,7 +294,7 @@ public class DACommunicator {
 
                // add lines for without-executable
                pkginfoLines.add(PackageInfo.PKGTYPE + "[unknown]" + PackageInfo.PKGID + "["
-                               + AnalyzerConstants.WITHOUT_EXECUTABLE + "]");
+                               + AnalyzerConstants.WITHOUT_EXECUTABLE + "]" + PackageInfo.PRELOAD + "[1]");
                pkginfoLines.add(AppInfo.PROPERTY.APPID.name + ":" + AnalyzerConstants.WITHOUT_EXECUTABLE);
                pkginfoLines
                                .add(AppInfo.PROPERTY.PACKAGE.name + ":" + AnalyzerConstants.WITHOUT_EXECUTABLE);
index 5906aa2..00821bc 100644 (file)
@@ -31,6 +31,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
@@ -134,15 +135,19 @@ public class ApplistManager {
                                pkgInfo.setPackageId(value);
                        } else if (key.equals(PackageInfo.VERSION)) {
                                pkgInfo.setVersion(value);
+                       } else if (key.equals(PackageInfo.PRELOAD)) {
+                               pkgInfo.setPreload(Integer.parseInt(value));
                        } else if (key.equals(PackageInfo.INSTALLTIME)) {
                                pkgInfo.setInstallTime(Long.parseLong(value));
                        }
                }
-
-               if (pkgInfo.getPackageId() != null) {
-                       return pkgInfo;
-               } else {
+               
+               if (pkgInfo.getPackageId() == null) {
                        return null;
+               } else if (!Global.isPlatformSDK() && pkgInfo.getPreload() != 0) {
+                       return null;
+               } else {
+                       return pkgInfo;
                }
        }
 
index 94758aa..4c15f86 100644 (file)
@@ -32,11 +32,13 @@ public class PackageInfo {
        public static final String PKGTYPE = "pkg_type";
        public static final String PKGID = "pkgid";
        public static final String VERSION = "version";
+       public static final String PRELOAD = "preload";
        public static final String INSTALLTIME = "installed_time";
 
        private String id = null;
        private String pkgType = null;
        private String version = null;
+       private int preload = 0;                // 1 for preload, otherwise 0
        private long installTime = 0;
 
        private List<AppInfo> appInfos = new ArrayList<AppInfo>();
@@ -98,6 +100,14 @@ public class PackageInfo {
        public void setVersion(String version) {
                this.version = version;
        }
+       
+       public int getPreload() {
+               return preload;
+       }
+       
+       public void setPreload(int preload) {
+               this.preload = preload;
+       }
 
        public long getInstallTime() {
                return installTime;