From: greatim Date: Wed, 14 May 2014 11:28:18 +0000 (+0900) Subject: [Title] enable to execute efl app, fix for managing app info, dev info X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d16d182a5ace9e24383f82c419efd2465a6e76f0;p=sdk%2Ftools%2Fdynamic-analyzer.git [Title] enable to execute efl app, fix for managing app info, dev info [Desc.] [Issue] Change-Id: Iba7e2fc602ddf0919e7d95d5a01baaa8c5d79ad0 --- diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java index dc95f44..54229a5 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java @@ -37,8 +37,6 @@ import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea; import org.tizen.dynamicanalyzer.util.DALogger; import org.tizen.dynamicanalyzer.util.WorkbenchUtil; -import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; -import org.tizen.dynamicanalyzer.utils.InternalLogManager; import org.tizen.dynamicanalyzer.widgets.da.base.DADialog; import org.tizen.dynamicanalyzer.workbench.SingletonFocusManager; @@ -114,9 +112,9 @@ public class AutoStartManager implements Runnable { DA_LOG.debug("auto start : " + appid); DeviceInfo device = DACommunicator.getDeviceByName(deviceName); - DACommunicator.setSelectedDevice(device); + GlobalInformation.setCurrentDeviceInfo(device); - List appList = DACommunicator.getSelectedDevice().getAppInfoList(); + List appList = device.getAppInfoList(); AppInfo appInfo = null; for (int i = 0; i < appList.size(); i++) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java index b5af9a9..ec23508 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java @@ -44,6 +44,6 @@ public abstract class BaseCommunicator { public abstract void closeSock(); - public void setSelectedApp(AppInfo app) { + public void onAppSelected(AppInfo app) { } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java index c6403ec..c7a2666 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java @@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Display; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.HostResult; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.model.DeviceInfo; @@ -160,21 +161,25 @@ public class Communicator22 extends BaseCommunicator { isArm = 1; } - DeviceInfo device = DACommunicator.getSelectedDevice(); + DeviceInfo device = GlobalInformation.getCurrentDeviceInfo(); if (null != device && device.getIDevice().getSerialNumber() .startsWith(CommonConstants.EMULATOR)) { isEmul = 1; } - if (null == DACommunicator.getSelectedApp()) { + if (null == GlobalInformation.getCurrentApplication()) { return HostResult.ERR_SELECTED_APP_IS_NULL; } - String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm + String rearMessage = CommonConstants.EMPTY + + res + + isEmul + + isArm + CommonConstants.CMD_SPLIT + ConfigureManager.getInstance().getConfiguration(device) + CommonConstants.CMD_SPLIT - + DACommunicator.getSelectedApp().getInfo(AppInfo.EXEC_INDEX); + + GlobalInformation.getCurrentApplication().getInfo( + AppInfo.EXEC_INDEX); String message = AnalyzerConstants.MSG_START + CommonConstants.CMD_SPLIT + rearMessage.length() @@ -231,7 +236,7 @@ public class Communicator22 extends BaseCommunicator { controlWriter.flush(); } - DA_LOG.debug("wait for ack... [send message : " + message+ " ]"); + DA_LOG.debug("wait for ack... [send message : " + message + " ]"); while (DACommunicator.isRunning()) { char cbuf[] = new char[64]; blocked = true; @@ -284,8 +289,8 @@ public class Communicator22 extends BaseCommunicator { .execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER); // step 3. get remote port from /tmp/port.da in device or emul - remotePort = CommunicatorUtils.getRemotePort(DACommunicator - .getSelectedDevice().getIDevice()); + remotePort = CommunicatorUtils.getRemotePort(GlobalInformation + .getCurrentDeviceInfo().getIDevice()); if (remotePort < 0) { return HostResult.ERR_REMOTE_PORT_GET_FAILED; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java index 849a175..6cccf2e 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/CommunicatorUtils.java @@ -41,6 +41,7 @@ import java.util.List; import org.tizen.common.sdb.command.SdbCommand; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.HostResult; import org.tizen.dynamicanalyzer.common.path.PathConstants; import org.tizen.dynamicanalyzer.common.path.PathManager; @@ -61,7 +62,7 @@ import org.tizen.sdblib.service.SyncService; public class CommunicatorUtils { private static final DALogger DA_LOG = DALogger.getInstance(); - + private static List uploadDataResult = new ArrayList(); private static boolean isArch = false; private static final int PORT_WAIT_TIME = 5 * 1000 * 2; // ms @@ -113,9 +114,9 @@ public class CommunicatorUtils { return HostResult.ERR_FILE_IS_NOT_EXISTS; } - result = uploadFile(DACommunicator.getSelectedDevice().getIDevice(), - source, PathConstants.DA_REMOTE_PATH - + AnalyzerConstants.READELF_BIN); + result = uploadFile(GlobalInformation.getCurrentDeviceInfo() + .getIDevice(), source, PathConstants.DA_REMOTE_PATH + + AnalyzerConstants.READELF_BIN); if (!result.isSuccess()) { return result; } @@ -161,7 +162,7 @@ public class CommunicatorUtils { public static void execShellCommand(String command, IShellOutputReceiver receiver) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); if (null != currentDevice && isOnline(currentDevice.getIDevice())) { try { currentDevice.getIDevice().executeShellCommand(command, @@ -248,7 +249,7 @@ public class CommunicatorUtils { public static SyncResult pull(String remote, String local, ISyncProgressMonitor monitor) { SyncResult result = null; - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); if (null != currentDevice && isOnline(currentDevice.getIDevice())) { FileOutputStream fileOut = null; try { @@ -325,8 +326,7 @@ public class CommunicatorUtils { String line = portLines.get(0); try { remotePort = Integer.parseInt(line); - DA_LOG.debug(" !! \nport get success!! : " - + remotePort); + DA_LOG.debug(" !! \nport get success!! : " + remotePort); break; } catch (NumberFormatException e) { System.out.print("="); @@ -382,13 +382,13 @@ public class CommunicatorUtils { } public static HostResult foward(int local, int remote) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); return foward(currentDevice.getIDevice(), local, remote); } public static void unfoward(int local, int remote) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); unfoward(currentDevice.getIDevice(), local, remote); } @@ -411,7 +411,7 @@ public class CommunicatorUtils { } public static void removeCommand(String path) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); if (null != currentDevice && isOnline(currentDevice.getIDevice())) { try { currentDevice.getIDevice().executeShellCommand( @@ -432,7 +432,7 @@ public class CommunicatorUtils { public static void execHostCommand(String command, IShellOutputReceiver receiver) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); if (null != currentDevice && isOnline(currentDevice.getIDevice())) { try { currentDevice.getIDevice() @@ -455,7 +455,7 @@ public class CommunicatorUtils { } public static Process execCommand(String command) { - DeviceInfo currentDevice = DACommunicator.getSelectedDevice(); + DeviceInfo currentDevice = GlobalInformation.getCurrentDeviceInfo(); if (null != currentDevice) { return execCommand(currentDevice.getIDevice(), command); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java index ed5d3c8..d60dd79 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java @@ -41,6 +41,7 @@ import java.util.List; import org.eclipse.swt.widgets.Display; import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.HostResult; import org.tizen.dynamicanalyzer.common.path.PathConstants; import org.tizen.dynamicanalyzer.common.path.PathManager; @@ -61,7 +62,7 @@ import org.tizen.sdblib.service.SyncResult; public class DACommunicator { private static final DALogger DA_LOG = DALogger.getInstance(); - + public static int MSG_TYPE_CONFIG = 0; public static int MSG_TYPE_SWAP_INST = 1; public static int READ_BUFFER_SIZE = 1024; @@ -70,10 +71,7 @@ public class DACommunicator { private static List packageInfoMultiLines = new ArrayList(); - private static AppInfo selectedApp = null; - private static List devices = null; - private static DeviceInfo currentDevice = null; private static List filterMultiLines = new ArrayList(); private static List unittestList = new ArrayList(); @@ -94,25 +92,26 @@ public class DACommunicator { } public static HostResult startTrace() { - return currentDevice.getCommunicator().startTrace(); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .startTrace(); } public static HostResult sendRuntimeMessage(int type, String message) { - return currentDevice.sendRuntimeMessage(type, message); + return GlobalInformation.getCurrentDeviceInfo().sendRuntimeMessage( + type, message); } public static HostResult stopTrace() { - return currentDevice.getCommunicator().stopTrace(); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .stopTrace(); } public static void exit() { - currentDevice.getCommunicator().exit(); + GlobalInformation.getCurrentDeviceInfo().getCommunicator().exit(); } public static void reload() { setNewBridge(); - selectedApp = null; - currentDevice = null; isRunning = false; devices = null; packageInfoMultiLines.clear(); @@ -139,28 +138,9 @@ public class DACommunicator { return null; } - public static DeviceInfo getSelectedDevice() { - return currentDevice; - } - - public static void setSelectedDevice(DeviceInfo device) { - currentDevice = device; - } - - public static AppInfo getSelectedApp() { - return selectedApp; - } - public static PackageInfo getSelectedPackage() { - return getSelectedDevice().getPackageInfoHash().get( - selectedApp.getPackageId()); - } - - public static void setSelectedApp(AppInfo app) { - selectedApp = app; - if (null != app && null != currentDevice) { - currentDevice.getCommunicator().setSelectedApp(app); - } + return GlobalInformation.getCurrentDeviceInfo().getPackageInfoHash() + .get(GlobalInformation.getCurrentApplication().getPackageId()); } public static void setNewBridge() { @@ -199,7 +179,7 @@ public class DACommunicator { if (!devs.isEmpty()) { init(devs); if (!getDevices().isEmpty()) { - setSelectedDevice(devs.get(0)); + GlobalInformation.setCurrentDeviceInfo(devs.get(0)); } } } else { @@ -263,11 +243,13 @@ public class DACommunicator { } public static List getAppListFromTarget() { - if (null == currentDevice) { + if (null == GlobalInformation.getCurrentDeviceInfo()) { return null; } - List appInfoList = currentDevice.getAppInfoList(); - HashMap appInfoHash = currentDevice.getAppInfoHash(); + List appInfoList = GlobalInformation.getCurrentDeviceInfo() + .getAppInfoList(); + HashMap appInfoHash = GlobalInformation + .getCurrentDeviceInfo().getAppInfoHash(); List backList = new ArrayList(); backList.addAll(appInfoHash.values()); @@ -301,12 +283,15 @@ public class DACommunicator { } lines.add(packageInfoMultiLines.get(ii + i)); } - AppInfo appInfo = makePackageInfo(currentDevice, lines); + AppInfo appInfo = makePackageInfo( + GlobalInformation.getCurrentDeviceInfo(), lines); if (null != appInfo && (appInfo.getInfo(AppInfo.APPTYPE_INDEX).contains( - AppInfo.APPTYPE_CPP) || appInfo.getInfo( - AppInfo.APPTYPE_INDEX).contains( - AppInfo.APPTYPE_WEB)) + AppInfo.APPTYPE_CPP) + || appInfo.getInfo(AppInfo.APPTYPE_INDEX) + .contains(AppInfo.APPTYPE_WEB) || appInfo + .getInfo(AppInfo.APPTYPE_INDEX).contains( + AppInfo.APPTYPE_CAPP)) && appInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals( AppInfo.FLAG_ZERO) && appInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals( @@ -360,10 +345,11 @@ public class DACommunicator { private static void checkUnittest() { unittestList.clear(); - if (null == currentDevice) { + if (null == GlobalInformation.getCurrentDeviceInfo()) { return; } - String appInstallPath = currentDevice.getIDevice().getAppInstallPath(); + String appInstallPath = GlobalInformation.getCurrentDeviceInfo() + .getIDevice().getAppInstallPath(); filterMultiLines.clear(); CommunicatorUtils.execHostCommand( @@ -395,7 +381,7 @@ public class DACommunicator { private static void checkIME() { imeList.clear(); - if (null == currentDevice) { + if (null == GlobalInformation.getCurrentDeviceInfo()) { return; } @@ -450,10 +436,12 @@ public class DACommunicator { } public static AppInfo getPkgInfoByName(String appLabel) { - if (null != currentDevice) { - int size = currentDevice.getAppInfoList().size(); + if (null != GlobalInformation.getCurrentDeviceInfo()) { + int size = GlobalInformation.getCurrentDeviceInfo() + .getAppInfoList().size(); for (int i = 0; i < size; i++) { - AppInfo pkgInfo = currentDevice.getAppInfoList().get(i); + AppInfo pkgInfo = GlobalInformation.getCurrentDeviceInfo() + .getAppInfoList().get(i); if (pkgInfo.getInfo(AppInfo.LABEL_INDEX).equals(appLabel)) { return pkgInfo; } @@ -463,10 +451,12 @@ public class DACommunicator { } public static AppInfo getPkgInfoByAppPkgId(String pkgid) { - if (null != currentDevice) { - int size = currentDevice.getAppInfoList().size(); + if (null != GlobalInformation.getCurrentDeviceInfo()) { + int size = GlobalInformation.getCurrentDeviceInfo() + .getAppInfoList().size(); for (int i = 0; i < size; i++) { - AppInfo ai = currentDevice.getAppInfoList().get(i); + AppInfo ai = GlobalInformation.getCurrentDeviceInfo() + .getAppInfoList().get(i); if (ai.getInfo(AppInfo.PACKAGE_INDEX).equals(pkgid)) { return ai; } @@ -481,7 +471,7 @@ public class DACommunicator { } public static boolean isTargetEmulator() { - DeviceInfo device = getSelectedDevice(); + DeviceInfo device = GlobalInformation.getCurrentDeviceInfo(); if (device != null) { if (device.getIDevice().getSerialNumber() .contains(CommonConstants.EMULATOR)) { @@ -510,10 +500,10 @@ public class DACommunicator { @Override public void onDisconnected(IDevice device) { // called : each device disconnected time - DA_LOG.debug("device disconnected : " - + device.getSerialNumber()); + DA_LOG.debug("device disconnected : " + device.getSerialNumber()); DeviceInfo deviceInfo = getDeviceByName(device.getSerialNumber()); - DeviceInfo selectedDevice = getSelectedDevice(); + DeviceInfo selectedDevice = GlobalInformation + .getCurrentDeviceInfo(); if (null != devices && !devices.isEmpty()) { devices.remove(deviceInfo); if (!AnalyzerManager.isRunning()) { @@ -542,7 +532,8 @@ public class DACommunicator { updateToolbarDevice(); } } - if (null != getSelectedDevice() && null != getSelectedApp()) { + if (null != GlobalInformation.getCurrentDeviceInfo() + && null != GlobalInformation.getCurrentApplication()) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { @@ -557,8 +548,8 @@ public class DACommunicator { public void onChanged(IDevice device, int changeMask) { // called : device added - already dynamic-analyzer running (not // tracing) - DA_LOG.debug("device changed : " + device.getSerialNumber() - + " " + changeMask); + DA_LOG.debug("device changed : " + device.getSerialNumber() + " " + + changeMask); if (1 == changeMask) { if (!AnalyzerManager.isRunning()) { DeviceInfo devInfo = new DeviceInfo(device); @@ -568,7 +559,8 @@ public class DACommunicator { updateToolbarDevice(); } } - if (null != getSelectedDevice() && null != getSelectedApp()) { + if (null != GlobalInformation.getCurrentDeviceInfo() + && null != GlobalInformation.getCurrentApplication()) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { @@ -588,8 +580,10 @@ public class DACommunicator { @Override public void run() { List deviceSerials = new ArrayList(); - String selectedDevice = ToolbarArea.getInstance() - .getSelectedDevice(); + String selectedDevice = null; + DeviceInfo selDev = GlobalInformation.getCurrentDeviceInfo(); + if (selDev != null) + selectedDevice = selDev.getIDevice().getSerialNumber(); int size = getDevices().size(); int selIndex = 0; for (int i = 0; i < size; i++) { @@ -601,7 +595,8 @@ public class DACommunicator { } } if (!devices.isEmpty()) { - setSelectedDevice(devices.get(selIndex)); + GlobalInformation.setCurrentDeviceInfo(devices + .get(selIndex)); } else { clearDeviceAppInfo(); } @@ -612,26 +607,30 @@ public class DACommunicator { } private static void clearDeviceAppInfo() { - setSelectedDevice(null); - setSelectedApp(null); + GlobalInformation.setCurrentDeviceInfo(null); + GlobalInformation.setCurrentApplication(null); packageInfoMultiLines.clear(); } - public static void setSelectedDeviceBySerial(String serial) { + public static DeviceInfo setSelectedDeviceBySerial(String serial) { + DeviceInfo dev = null; if (null == serial || serial.isEmpty()) { - setSelectedDevice(null); + GlobalInformation.setCurrentDeviceInfo(null); } else { int size = getDevices().size(); for (int i = 0; i < size; i++) { IDevice idev = devices.get(i).getIDevice(); if (null != idev) { if (serial.equals(idev.getSerialNumber())) { - setSelectedDevice(devices.get(i)); + dev = devices.get(i); + GlobalInformation.setCurrentDeviceInfo(dev); break; } } } } + + return dev; } public static void pullDaemonLog() { @@ -678,30 +677,33 @@ public class DACommunicator { // } public static boolean isWaitControlMessage() { - return currentDevice.getCommunicator().isBlocked(); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .isBlocked(); } public static BufferedReader getSockBufferedReader() { - return currentDevice.getCommunicator().getDataBufferedReader(); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .getDataBufferedReader(); } public static void closeAll() { - currentDevice.getCommunicator().clear(); + GlobalInformation.getCurrentDeviceInfo().getCommunicator().clear(); } public static void closeSock() { - currentDevice.getCommunicator().closeSock(); + GlobalInformation.getCurrentDeviceInfo().getCommunicator().closeSock(); } public static HostResult handleControlMessage(String msg) { - return currentDevice.getCommunicator().handleControlMessage(msg); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .handleControlMessage(msg); } public static HostResult sendBinaryInfoMessageForLib( List input) { if (isSWAPVersion()) { - return ((Communicator30) currentDevice.getCommunicator()) - .sendBinaryInfoMessageForLib(input); + return ((Communicator30) GlobalInformation.getCurrentDeviceInfo() + .getCommunicator()).sendBinaryInfoMessageForLib(input); } return null; } @@ -709,16 +711,16 @@ public class DACommunicator { public static HostResult sendSWAPMessage(int messageId, List input) { if (isSWAPVersion()) { - return ((Communicator30) currentDevice.getCommunicator()) - .sendSWAPMessage(messageId, input); + return ((Communicator30) GlobalInformation.getCurrentDeviceInfo() + .getCommunicator()).sendSWAPMessage(messageId, input); } return null; } public static HostResult sendScreenShotMessage() { if (isSWAPVersion()) { - return ((Communicator30) currentDevice.getCommunicator()) - .sendScreenShotRequest(); + return ((Communicator30) GlobalInformation.getCurrentDeviceInfo() + .getCommunicator()).sendScreenShotRequest(); } return null; } @@ -728,7 +730,8 @@ public class DACommunicator { } public static Socket getDataSocket() { - return currentDevice.getCommunicator().getDataSocket(); + return GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .getDataSocket(); } public static String getTargetVersion(DeviceInfo device) { @@ -736,7 +739,8 @@ public class DACommunicator { } public static boolean isSWAPVersion() { - if (currentDevice.getTargetVersion().contains("3.0")) { + if (GlobalInformation.getCurrentDeviceInfo().getTargetVersion() + .contains("3.0")) { return true; } else { return false; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java index d147533..6f3e4d1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java @@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.model.DeviceInfo; @@ -281,7 +282,7 @@ public class IDECommunicator implements Runnable { DA_LOG.debug("auto start : " + appid); DeviceInfo device = DACommunicator.getDeviceByName(deviceName); - DACommunicator.setSelectedDevice(device); + GlobalInformation.setCurrentDeviceInfo(device); DACommunicator.getAppListFromTarget(); AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(appid); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBColumn.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBColumn.java index a515931..5c7febc 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBColumn.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBColumn.java @@ -6,11 +6,20 @@ public class DBColumn { private String name; private String option; private String type; + private int string_size; public DBColumn(String name, String option, String type) { this.name = name; this.option = option; this.type = type; + this.string_size = 0; + } + + public DBColumn(String name, String option, String type, int size) { + this.name = name; + this.option = option; + this.type = type; + this.string_size = size; } public String getName() { @@ -25,9 +34,18 @@ public class DBColumn { return type; } + public int getStringSize() { + return string_size; + } + public String getColumnString() { - return name + CommonConstants.SPACE + type + CommonConstants.SPACE - + option; + if (DBConstants.VARCHAR.equals(type)) { + return name + CommonConstants.SPACE + type + "(" + string_size + + ")" + CommonConstants.SPACE + option; + } else { + return name + CommonConstants.SPACE + type + CommonConstants.SPACE + + option; + } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java index ba4fcf9..db8387f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java @@ -7,6 +7,11 @@ public class DBConstants { public static final String EMPTY = CommonConstants.EMPTY; public static final String PRIMARY_KEY = "PRIMARY KEY NOT NULL";//$NON-NLS-1$ public static final String NOT_NULL = "not null";//$NON-NLS-1$ + + // length of common string column + public static final int FUNCNAME_LEN = 256; + public static final int FILENAME_LEN = 256; + public static final int FILEPATH_LEN = 1024; // length of string type column public static final int TEXT_LEN = 256; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java index d538b2a..4cb7273 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBTable.java @@ -2,10 +2,9 @@ package org.tizen.dynamicanalyzer.database; import java.util.ArrayList; import java.util.List; - import org.tizen.dynamicanalyzer.constant.CommonConstants; -public abstract class DBTable { +public abstract class DBTable implements IPreparedStatement { private List columns = new ArrayList(); public abstract String getTableName(); @@ -22,6 +21,17 @@ public abstract class DBTable { columns.add(col); } + protected final String clipString(String colstr, int str_len, String key) { + String retstr = colstr; + if (colstr.length() > str_len) { + retstr = colstr.substring(0, str_len); + RemainingDataManager.addRemainingData(getTableName(), key, + colstr.substring(str_len, colstr.length())); + } + + return retstr; + } + public final void createTable() { StringBuffer query = new StringBuffer(); query.append("create table "); @@ -45,15 +55,12 @@ public abstract class DBTable { public final void insertData(List> data) { if (data.size() > 0) { - List columnType = new ArrayList(); StringBuffer query = new StringBuffer(); query.append("insert into ").append(getTableName()) .append(" values( "); int columnsize = columns.size(); for (int i = 0; i < columnsize; i++) { - columnType.add(columns.get(i).getType()); - if (i == columnsize - 1) { query.append(" ? )"); } else { @@ -63,8 +70,8 @@ public abstract class DBTable { query.append(CommonConstants.SEMICOLON); // execute prepared with data - SqlConnectionManager.executePrepared(query.toString(), data, - columnType); + SqlConnectionManager.executePreparedWithInterface(query.toString(), + data, this); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/IPreparedStatement.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/IPreparedStatement.java new file mode 100644 index 0000000..7685557 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/IPreparedStatement.java @@ -0,0 +1,8 @@ +package org.tizen.dynamicanalyzer.database; + +import java.sql.PreparedStatement; +import java.util.List; + +public interface IPreparedStatement { + public boolean prepare(PreparedStatement prep, List rowData); +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/RemainingDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/RemainingDataManager.java new file mode 100644 index 0000000..e4bb554 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/RemainingDataManager.java @@ -0,0 +1,21 @@ +package org.tizen.dynamicanalyzer.database; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class RemainingDataManager { + private static Map> remainingDataMap = new ConcurrentHashMap>(); + + // return null if add is succeed + // return not null else (already exist) + public static String addRemainingData(String category, String key, + String data) { + Map dataMap = remainingDataMap.get(category); + if (dataMap == null) { + dataMap = new ConcurrentHashMap(); + remainingDataMap.put(category, dataMap); + } + + return dataMap.put(key, data); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java index 4883070..f61911f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java @@ -31,10 +31,8 @@ public class SqlConnectionManager { connection = DriverManager.getConnection(dbUrl, "SA", ""); SQLWarning warning = connection.getWarnings(); while (warning != null) { - DA_LOG.debug("[DB] Message: " - + warning.getMessage()); - DA_LOG.debug("[DB] SQL state: " - + warning.getSQLState()); + DA_LOG.debug("[DB] Message: " + warning.getMessage()); + DA_LOG.debug("[DB] SQL state: " + warning.getSQLState()); DA_LOG.debug("[DB] Vendor code: " + warning.getErrorCode()); warning = warning.getNextWarning(); @@ -101,8 +99,8 @@ public class SqlConnectionManager { } } - public static void executePrepared(String query, List> data, - List columnType) { + public static void executePreparedWithType(String query, + List> data, List columnType) { PreparedStatement prep = null; if (data.size() == 0) @@ -110,6 +108,7 @@ public class SqlConnectionManager { try { if (connection != null) { + int batchCount = 0; prep = connection.prepareStatement(query); // count ? in query @@ -144,19 +143,22 @@ public class SqlConnectionManager { if (columnType.get(i).equals(DBConstants.TEXT)) { String colstr = (String) col; if (colstr.length() > DBConstants.TEXT_LEN) - colstr = colstr.substring(0, DBConstants.TEXT_LEN); + colstr = colstr.substring(0, + DBConstants.TEXT_LEN); prep.setString(i + 1, colstr); } else if (columnType.get(i).equals( DBConstants.BIG_TEXT)) { String colstr = (String) col; if (colstr.length() > DBConstants.BIG_TEXT_LEN) - colstr = colstr.substring(0, DBConstants.BIG_TEXT_LEN); + colstr = colstr.substring(0, + DBConstants.BIG_TEXT_LEN); prep.setString(i + 1, colstr); } else if (columnType.get(i).equals( DBConstants.BIGBIG_TEXT)) { String colstr = (String) col; if (colstr.length() > DBConstants.BIGBIG_TEXT_LEN) - colstr = colstr.substring(0, DBConstants.BIGBIG_TEXT_LEN); + colstr = colstr.substring(0, + DBConstants.BIGBIG_TEXT_LEN); prep.setString(i + 1, colstr); } else if (columnType.get(i).equals( DBConstants.INTEGER)) { @@ -183,12 +185,14 @@ public class SqlConnectionManager { } } catch (SQLException e) { e.printStackTrace(); + isPrepared = false; } } try { if (isPrepared) { prep.addBatch(); + batchCount++; } prep.clearParameters(); } catch (SQLException e) { @@ -199,7 +203,63 @@ public class SqlConnectionManager { } } - prep.executeBatch(); + if (batchCount > 0) + prep.executeBatch(); + connection.commit(); + connection.setAutoCommit(true); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + CommonUtil.tryClose(prep); + } + } + + public static void executePreparedWithInterface(String query, + List> data, IPreparedStatement ip) { + PreparedStatement prep = null; + + if (data.size() == 0) + return; + + try { + if (connection != null) { + int batchCount = 0; + prep = connection.prepareStatement(query); + + // count ? in query + int questionCount = 0; + int querylen = query.length(); + for (int i = 0; i < querylen; i++) { + if (query.charAt(i) == '?') + questionCount++; + } + + // set data into prepared statement + int datasize = data.size(); + + connection.setAutoCommit(false); + + for (int k = 0; k < datasize; k++) { + List row = data.get(k); + int datacolsize = row.size(); + if (datacolsize == questionCount) { // column count is equal + try { + if (ip.prepare(prep, row)) { + prep.addBatch(); + batchCount++; + } + prep.clearParameters(); + } catch (SQLException e) { + e.printStackTrace(); + } + } else { // column count is not equal + DA_LOG.error("column count is not equal !!"); + } + } + + if (batchCount > 0) + prep.executeBatch(); connection.commit(); connection.setAutoCommit(true); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java index d1a3c75..b99b678 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java @@ -37,6 +37,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; @@ -78,7 +79,7 @@ import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite; public class OpenTraceHandler extends AbstractHandler { private static final DALogger DA_LOG = DALogger.getInstance(); - + public static final String ID = OpenTraceHandler.class.getName(); Project project = null; @@ -174,7 +175,7 @@ public class OpenTraceHandler extends AbstractHandler { OpenTraceProgressManager.getInstance().runThreads(); OpenTraceProgressManager.getInstance().openTraceComplete(); SqlManager.getInstance().closeConnection(); - + NetworkDataManager.getInstance().openProcess(); return null; } @@ -251,7 +252,7 @@ public class OpenTraceHandler extends AbstractHandler { List info = dbInfo.get(0); TargetInfo targetInfo = new TargetInfo(); targetInfo.loadSaveFormat(info); - DACommunicator.getSelectedDevice().setTargetInfo(targetInfo); + GlobalInformation.getCurrentDeviceInfo().setTargetInfo(targetInfo); } List pids = SqlManager.getInstance().getPids(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java index 7140d62..3dd8e58 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java @@ -25,53 +25,30 @@ */ package org.tizen.dynamicanalyzer.logparser; -import java.io.File; import java.util.List; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; -import org.tizen.dynamicanalyzer.common.SymbolManager; -import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils; -import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.constant.CommonConstants; -import org.tizen.dynamicanalyzer.model.ImageInfo; -import org.tizen.dynamicanalyzer.nl.InformationViewLabels; import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager; -import org.tizen.dynamicanalyzer.swap.channel.data.BasicDataMessage; import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants; -import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; import org.tizen.dynamicanalyzer.swap.model.ByteUtils; import org.tizen.dynamicanalyzer.swap.model.data.LogData; import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory; -import org.tizen.dynamicanalyzer.swap.model.data.ScreenShotData; -import org.tizen.dynamicanalyzer.swap.model.data.SystemData; -import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData; -import org.tizen.dynamicanalyzer.ui.page.BaseView; import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.util.DALogger; -import org.tizen.dynamicanalyzer.utils.ImageUtil; -import org.tizen.sdblib.service.SyncResult; public class LogParser implements Runnable { private static final DALogger DA_LOG = DALogger.getInstance(); - - private final String OSP_MAIN = "OspMain"; //$NON-NLS-1$ + private static Thread logParser = null; private static boolean dropCallTraceLog = false; private static LogQueue logQueue = null; // private static boolean isLogParsingComplete = false; - private int SMALL_IMG_WIDTH = 40; - private int SMALL_IMG_HEIGHT = 66; - - private int DEFAULT_IMG_WIDTH = 480; - private int DEFAULT_IMG_HEIGHT = 800; - - /** thread **/ - private int pid = -1; - public static void clear() { stopLogParser(); getLogQueue().clear(); @@ -287,57 +264,57 @@ public class LogParser implements Runnable { // updateLog(logPack); } -// private void processImage(final String from, String rotate) { -// final String fileName = getImageName(from); -// final String to = AnalyzerManager.getProject().getSavePath() -// + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME -// + File.separator + fileName; -// final int angle = Integer.parseInt(rotate); -// if (angle != 0) { -// System.out.println("[ image rotate : " + angle + " ]"); -// } -// -// new Thread(null, new Runnable() { -// int count = 0; -// -// @Override -// public void run() { -// while (true && count < 5) { -// SyncResult res = CommunicatorUtils.pull(from, to); -// if (null != res && res.isOk()) { -// /* image resizing */ -// String smallImagePath = AnalyzerManager.getProject() -// .getSavePath() -// + File.separator -// + AnalyzerConstants.IMAGE_FOLDER_NAME -// + File.separator -// + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME -// + File.separator + fileName; -// ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH, -// DEFAULT_IMG_HEIGHT, angle); -// if (angle == 90 || angle == 270) { -// ImageUtil.resize(to, smallImagePath, -// SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH); -// } else { -// ImageUtil.resize(to, smallImagePath, -// SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT); -// } -// -// break; -// } else { -// System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$ -// try { -// Thread.sleep(1000); -// count++; -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// } -// } -// } -// }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start(); -// -// } + // private void processImage(final String from, String rotate) { + // final String fileName = getImageName(from); + // final String to = AnalyzerManager.getProject().getSavePath() + // + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME + // + File.separator + fileName; + // final int angle = Integer.parseInt(rotate); + // if (angle != 0) { + // System.out.println("[ image rotate : " + angle + " ]"); + // } + // + // new Thread(null, new Runnable() { + // int count = 0; + // + // @Override + // public void run() { + // while (true && count < 5) { + // SyncResult res = CommunicatorUtils.pull(from, to); + // if (null != res && res.isOk()) { + // /* image resizing */ + // String smallImagePath = AnalyzerManager.getProject() + // .getSavePath() + // + File.separator + // + AnalyzerConstants.IMAGE_FOLDER_NAME + // + File.separator + // + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME + // + File.separator + fileName; + // ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH, + // DEFAULT_IMG_HEIGHT, angle); + // if (angle == 90 || angle == 270) { + // ImageUtil.resize(to, smallImagePath, + // SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH); + // } else { + // ImageUtil.resize(to, smallImagePath, + // SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT); + // } + // + // break; + // } else { + // System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$ + // try { + // Thread.sleep(1000); + // count++; + // } catch (InterruptedException e) { + // e.printStackTrace(); + // } + // } + // } + // } + // }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start(); + // + // } private String getImageName(String fullPath) { String name = null; @@ -676,7 +653,7 @@ public class LogParser implements Runnable { coreCount = i + 1; } if (coreCount != 0) { - DACommunicator.getSelectedDevice().getTargetInfo() + GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .setCpuCount(coreCount); } byte[] cpuFrequency = new byte[temp.length]; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java index 7884879..5ba6385 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java @@ -31,10 +31,10 @@ import java.util.HashMap; import java.util.List; import org.tizen.dynamicanalyzer.common.ElfSymbolExtracter; -import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.model.AddrSymbolPair; -import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInfo; +import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInst; import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; @@ -55,6 +55,7 @@ public class AppInfo { public static final int PKGINFO_SIZE = 12; public static final String APPTYPE_CPP = "c++";//$NON-NLS-1$ + public static final String APPTYPE_CAPP = "capp";//$NON-NLS-1$ public static final String APPTYPE_WEB = "webapp";//$NON-NLS-1$ public static final String FLAG_ZERO = "0";//$NON-NLS-1$ public static final String FLAG_ONE = "1";//$NON-NLS-1$ @@ -116,7 +117,7 @@ public class AppInfo { if (null == execFileName) { String execPath = appInfo.get(EXEC_INDEX); String[] splitPath = execPath.split(CommonConstants.SLASH); - if (type == ApplicationInfo.APPTYPE_TIZEN) { + if (type == ApplicationInst.APPTYPE_TIZEN) { execFileName = splitPath[splitPath.length - 1] + CommonConstants.EXTENSION_EXEC_FILE; } else { @@ -131,7 +132,7 @@ public class AppInfo { } public BinaryInfo getBinaryInfo(String targetBinPath) { - PackageInfo pkgInfo = DACommunicator.getSelectedDevice() + PackageInfo pkgInfo = GlobalInformation.getCurrentDeviceInfo() .getPackageInfoHash().get(getPackageId()); BinaryInfo ret = pkgInfo.getBinaryInfo(targetBinPath); return ret; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java index 9b5fbdb..7ff4574 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java @@ -42,6 +42,7 @@ import java.util.Iterator; import java.util.List; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.path.PathConstants; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.communicator.DACommunicator; @@ -235,20 +236,22 @@ public class Project { } public void setCoreCount(int count) { - DACommunicator.getSelectedDevice().getTargetInfo().setCpuCount(count); + GlobalInformation.getCurrentDeviceInfo().getTargetInfo() + .setCpuCount(count); } public int getCoreCount() { - return DACommunicator.getSelectedDevice().getTargetInfo().getCpuCount(); + return GlobalInformation.getCurrentDeviceInfo().getTargetInfo() + .getCpuCount(); } public int getMaxBrightness() { - return DACommunicator.getSelectedDevice().getTargetInfo() + return GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getMaxBrightness(); } public long getSystemMemorySize() { - return DACommunicator.getSelectedDevice().getTargetInfo() + return GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getSystemMemorySize(); } @@ -264,20 +267,23 @@ public class Project { } public void init() { - if (null == DACommunicator.getSelectedApp()) { + if (null == GlobalInformation.getCurrentApplication()) { String comboText = ToolbarArea.getInstance().getAppCombo() .getText(); AppInfo appInfo = DACommunicator.getPkgInfoByName(comboText); - DACommunicator.setSelectedApp(appInfo); - ToolbarArea.getInstance().setSelectedApp(appInfo); + GlobalInformation.setCurrentApplication(appInfo); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(appInfo); } - setAppName(DACommunicator.getSelectedApp().getInfo(AppInfo.LABEL_INDEX)); - setPkgId(DACommunicator.getSelectedApp().getInfo(AppInfo.PACKAGE_INDEX)); - DeviceInfo deviceName = DACommunicator.getSelectedDevice(); + setAppName(GlobalInformation.getCurrentApplication().getInfo( + AppInfo.LABEL_INDEX)); + setPkgId(GlobalInformation.getCurrentApplication().getInfo( + AppInfo.PACKAGE_INDEX)); + DeviceInfo deviceName = GlobalInformation.getCurrentDeviceInfo(); if (null != deviceName && null != deviceName.getIDevice().getSerialNumber() && !deviceName.getIDevice().getSerialNumber().isEmpty()) { - setDevice(DACommunicator.getSelectedDevice().getIDevice() + setDevice(GlobalInformation.getCurrentDeviceInfo().getIDevice() .getSerialNumber()); } else { setDevice(CommonConstants.SPACE); @@ -316,7 +322,7 @@ public class Project { // close previous database connection SqlConnectionManager.closeConnection(); - + // establish database connection boolean conn_res = SqlConnectionManager .establishConnection(getSavePath() + File.separator diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java index b086300..1cb10f8 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java @@ -43,6 +43,7 @@ import java.util.List; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; @@ -375,7 +376,7 @@ public class SqlManager { String insertQuery = info.insertQuery(); if (insertQuery != null) { - TargetInfo targetInfo = DACommunicator.getSelectedDevice() + TargetInfo targetInfo = GlobalInformation.getCurrentDeviceInfo() .getTargetInfo(); List insetRowData = new ArrayList(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java index 04c2d51..80e18da 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java @@ -32,6 +32,7 @@ import java.util.TreeMap; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.project.AppInfo; @@ -132,10 +133,10 @@ public abstract class BaseCallstackManager { public String getUserFunctionPosition() { if (userFunctionBin == null || userFunctionBin.isEmpty()) { if (AnalyzerManager.isOsp()) { - userFunctionBin = new String(DACommunicator.getSelectedApp() + userFunctionBin = new String(GlobalInformation.getCurrentApplication() .getInfo(AppInfo.EXEC_INDEX) + ".exe"); //$NON-NLS-1$ } else { - userFunctionBin = new String(DACommunicator.getSelectedApp() + userFunctionBin = new String(GlobalInformation.getCurrentApplication() .getInfo(AppInfo.EXEC_INDEX)); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java index a72133d..88bd011 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java @@ -37,6 +37,7 @@ import java.util.TreeMap; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.SymbolManager; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; @@ -478,7 +479,7 @@ public class SWAPCallStackManager extends BaseCallstackManager { String path = processInfo.getMainTargetBinaryPath(); String key = AnalyzerUtil.getTargetPathKey(path); - BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key); + BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key); if (null == binInfo) { return false; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInfo.java deleted file mode 100755 index 4265581..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInfo.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jooyoul Lee - * Juyoung Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * - S-Core Co., Ltd - * - */ -package org.tizen.dynamicanalyzer.swap.channel.control; - -import org.tizen.dynamicanalyzer.swap.model.ByteUtils; -import org.tizen.dynamicanalyzer.swap.model.SWAPModel; - -public class ApplicationInfo implements SWAPModel { - public static final int APPTYPE_TIZEN = 0x01; - public static final int APPTYPE_PROCESS = 0x02; - public static final int APPTYPE_COMMON_EXEC = 0x03; - public static final int APPTYPE_WEB = 0x04; - /*** - * target application type - * 01: tizen native application - * 02: already launched process - * 03: common executables - */ - private int appType = 0; - - /*** - * target application ID - * depends on the target application type - * 01: AppID, pkg_id.app_name, the standard tizen native application ID - * 02: PID - * 03: "\0" - */ - private String appId = null; - private String execPath = null; - - public int getAppType() { - return appType; - } - - public void setAppType(int appType) { - this.appType = appType; - } - - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - public String getExecPath() { - return execPath; - } - - public void setExecPath(String execPath) { - this.execPath = execPath; - } - - @Override - public byte[] getByteValue() { - return ByteUtils.getByte(appType, appId, execPath); - } - - @Override - public void setByteToValues(byte[] input) { - // TODO Auto-generated method stub - - } -} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInst.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInst.java index a821130..8c89183 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInst.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/ApplicationInst.java @@ -32,8 +32,30 @@ import org.tizen.dynamicanalyzer.swap.model.ByteUtils; import org.tizen.dynamicanalyzer.swap.model.SWAPModel; public class ApplicationInst implements SWAPModel { + public static final int APPTYPE_TIZEN = 0x01; + public static final int APPTYPE_PROCESS = 0x02; + public static final int APPTYPE_COMMON_EXEC = 0x03; + public static final int APPTYPE_WEB = 0x04; + + /*** + * target application type + * 01: tizen native application + * 02: already launched process + * 03: common executables + * 04: web application + */ private int applicationType = 0; + + /*** + * target application ID + * depends on the target application type + * 01: AppID, pkg_id.app_name, the standard tizen native application ID + * 02: PID + * 03: "\0" -> empty string + * 04: AppID, pkg_id.app_name, the standard tizen web application ID + */ private String applicationId = null; + private String executablePath = null; private int functionCount = 0; private List functionInstList = new ArrayList(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ApiNameManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ApiNameManager.java index c744719..275e2eb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ApiNameManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ApiNameManager.java @@ -28,6 +28,7 @@ package org.tizen.dynamicanalyzer.swap.channel.data; import java.util.List; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; public class ApiNameManager { @@ -50,7 +51,7 @@ public class ApiNameManager { } public static List getApiList() { - return DACommunicator.getSelectedDevice().getApiList(); + return GlobalInformation.getCurrentDeviceInfo().getApiList(); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ProcessInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ProcessInfo.java index de41f1e..ad59e95 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ProcessInfo.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ProcessInfo.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.model.DeviceInfo; @@ -97,8 +98,8 @@ public class ProcessInfo { public BinaryInfo getTargetBinary(long pcAddr) { BinaryInfo binInfo = null; if (pcAddr >= getLowestAddress() && pcAddr <= getHighestAddress()) { - String pkgId = DACommunicator.getSelectedApp().getPackageId(); - DeviceInfo devInfo = DACommunicator.getSelectedDevice(); + String pkgId = GlobalInformation.getCurrentApplication().getPackageId(); + DeviceInfo devInfo = GlobalInformation.getCurrentDeviceInfo(); PackageInfo pkgInfo = devInfo.getSelectedPackage(pkgId); List apps = pkgInfo.getAppInfos(); for (AppInfo app : apps) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java index 67bb315..388568a 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java @@ -58,6 +58,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands; import org.tizen.dynamicanalyzer.common.ElfSymbolExtracter; import org.tizen.dynamicanalyzer.common.ErrorCode; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.HostResult; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.communicator.BaseCommunicator; @@ -69,7 +70,6 @@ import org.tizen.dynamicanalyzer.model.DeviceInfo; import org.tizen.dynamicanalyzer.project.AppInfo; import org.tizen.dynamicanalyzer.project.PackageInfo; import org.tizen.dynamicanalyzer.resources.ImageResources; -import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInfo; import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInst; import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo; import org.tizen.dynamicanalyzer.swap.channel.control.FunctionInst; @@ -208,7 +208,7 @@ public class Communicator30 extends BaseCommunicator { AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD); // start message send HostResult result = handleControlMessage( - DACommunicator.getSelectedDevice(), ret); + GlobalInformation.getCurrentDeviceInfo(), ret); DA_LOG.performance("TEST", "Start Trace", "Make and Send start message"); // FIX @@ -235,7 +235,8 @@ public class Communicator30 extends BaseCommunicator { index += INT_SIZE; int nano = ByteUtils.toInt(data, index); - AnalyzerManager.getProject().setProfileStartTime(new DATime(sec, nano)); + AnalyzerManager.getProject().setProfileStartTime( + new DATime(sec, nano)); } } else { DACommunicator.setRunning(false); @@ -291,14 +292,16 @@ public class Communicator30 extends BaseCommunicator { String appType = app.getInfo(AppInfo.APPTYPE_INDEX); if (appType.contains(AppInfo.APPTYPE_CPP)) { - appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN); + appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN); + appInst.setApplicationId(app.getAppId()); } else if (appType.contains(AppInfo.APPTYPE_WEB)) { - appInst.setApplicationType(ApplicationInfo.APPTYPE_WEB); + appInst.setApplicationType(ApplicationInst.APPTYPE_WEB); + appInst.setApplicationId(app.getAppId()); } else { - appInst.setApplicationType(ApplicationInfo.APPTYPE_COMMON_EXEC); + appInst.setApplicationType(ApplicationInst.APPTYPE_COMMON_EXEC); + appInst.setApplicationId(CommonConstants.EMPTY); } - appInst.setApplicationId(app.getAppId()); appInst.setExecutablePath(app.getExecPath()); DA_LOG.debug("Set execute path : " + app.getExecPath()); BinaryInfo binInfo = app.getMainBinaryInfo(); @@ -342,7 +345,7 @@ public class Communicator30 extends BaseCommunicator { byte[] msgBinInfo = ByteUtils .toBytes(AnalyzerConstants.MSG_BINARY_INFO); - PackageInfo pkgInfo = DACommunicator.getSelectedDevice() + PackageInfo pkgInfo = GlobalInformation.getCurrentDeviceInfo() .getPackageInfoHash() .get(selectedApp.getInfo(AppInfo.PACKAGE_INDEX)); List apps = pkgInfo.getAppInfos(); @@ -362,7 +365,7 @@ public class Communicator30 extends BaseCommunicator { byte[] msg = ByteUtils.getByte(msgBinInfo, length, preMsg); HostResult result = handleControlMessage( - DACommunicator.getSelectedDevice(), msg); + GlobalInformation.getCurrentDeviceInfo(), msg); if (!result.isSuccess() || !isCorrectAck(MSG_BINARY_INFO_ACK, result)) { return HostResult.ERR_BIN_INFO_GET_FAIL; @@ -481,7 +484,7 @@ public class Communicator30 extends BaseCommunicator { private HostResult pullTheFile(String from, String to) { try { - DACommunicator.getSelectedDevice().getIDevice() + GlobalInformation.getCurrentDeviceInfo().getIDevice() .becomeSuperUser(true); } catch (TimeoutException e) { e.printStackTrace(); @@ -548,7 +551,7 @@ public class Communicator30 extends BaseCommunicator { int length = 0; byte[] stopMsg = ByteUtils.getByte(stop, length); HostResult result = handleControlMessage( - DACommunicator.getSelectedDevice(), stopMsg); + GlobalInformation.getCurrentDeviceInfo(), stopMsg); if (result.isSuccess()) { if (isCorrectAck(MSG_STOP_ACK, result)) { @@ -773,7 +776,7 @@ public class Communicator30 extends BaseCommunicator { @Override public Socket getDataSocket() { - return DACommunicator.getSelectedDevice().getDataSock(); + return GlobalInformation.getCurrentDeviceInfo().getDataSock(); } private TargetInfo processTargetInfo(byte[] payload, int index) { @@ -837,7 +840,7 @@ public class Communicator30 extends BaseCommunicator { @Override public void closeSock() { - DACommunicator.getSelectedDevice().releaseDataSock(); + GlobalInformation.getCurrentDeviceInfo().releaseDataSock(); } private int getReturnId(byte[] data) { @@ -908,17 +911,19 @@ public class Communicator30 extends BaseCommunicator { } @Override - public void setSelectedApp(AppInfo app) { - HostResult hr = sendBinaryInfoMessage(app); - if (!hr.isSuccess()) { - DA_LOG.debug("binary info get failed :" + hr.getMessage()); + public void onAppSelected(AppInfo app) { + if (app != null) { + HostResult hr = sendBinaryInfoMessage(app); + if (!hr.isSuccess()) { + DA_LOG.debug("binary info get failed :" + hr.getMessage()); + } } } public HostResult sendScreenShotRequest() { byte[] msg = ByteUtils.getByte(AnalyzerConstants.MSG_GET_SCREENSHOT, 0); HostResult result = HostResult.SUCCESS; - Socket controlSock = DACommunicator.getSelectedDevice() + Socket controlSock = GlobalInformation.getCurrentDeviceInfo() .getControlSock(); try { @@ -1011,7 +1016,7 @@ public class Communicator30 extends BaseCommunicator { // ByteUtils.printByteArrayForStart(msg); HostResult result = handleControlMessage( - DACommunicator.getSelectedDevice(), msg); + GlobalInformation.getCurrentDeviceInfo(), msg); int ackMsg = AnalyzerConstants.MSG_SWAP_INST_ADD_ACK; if (messageId == AnalyzerConstants.MSG_SWAP_INST_REMOVE) { @@ -1036,7 +1041,7 @@ public class Communicator30 extends BaseCommunicator { String key = AnalyzerUtil.getTargetPathKey(binInfo .getTargetBinaryPath()); - DACommunicator.getSelectedApp().getBinaryInfoMap() + GlobalInformation.getCurrentApplication().getBinaryInfoMap() .put(key, binInfo); binInfoList.add(binInfo); } @@ -1053,7 +1058,7 @@ public class Communicator30 extends BaseCommunicator { byte[] msg = ByteUtils.getByte(AnalyzerConstants.MSG_BINARY_INFO, length, sendBin); HostResult result = handleControlMessage( - DACommunicator.getSelectedDevice(), msg); + GlobalInformation.getCurrentDeviceInfo(), msg); if (!result.isSuccess() || !isCorrectAck(MSG_BINARY_INFO_ACK, result)) { return HostResult.ERR_BIN_INFO_GET_FAIL; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java index e84d2ec..13f470d 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java @@ -47,6 +47,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler; @@ -244,7 +245,7 @@ public class MessageParser { pInfo.setDepLibCount(dependantLibCount); // User Call Trace : App is Tizen C++ or Tizen native - String applicationType = DACommunicator.getSelectedApp().getInfo( + String applicationType = GlobalInformation.getCurrentApplication().getInfo( AppInfo.APPTYPE_INDEX); if (applicationType.contains(AppInfo.APPTYPE_CPP)) { pInfoPack.setDropLog(true); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java index 032890d..58f0850 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java @@ -32,6 +32,7 @@ import java.util.List; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.SymbolManager; import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils; import org.tizen.dynamicanalyzer.communicator.DACommunicator; @@ -62,7 +63,7 @@ import org.tizen.sdblib.service.SyncResult; public class SWAPLogParser implements Runnable { private static final DALogger DA_LOG = DALogger.getInstance(); - + private static final String OSP_MAIN = "OspMain"; //$NON-NLS-1$ private static Thread logParser = null; // default false, turn on when Tizen C++ app @@ -144,8 +145,8 @@ public class SWAPLogParser implements Runnable { int id = log.getId(); int seqNum = log.getSeq(); if (log instanceof SystemData) { -// System.out -// .println("=========systemData is slicing===========\n"); + // System.out + // .println("=========systemData is slicing===========\n"); pushLog(log, logPack); } else if (log instanceof ProfileData) { if (!AnalyzerManager.isProcessInfoArrived()) { @@ -235,9 +236,10 @@ public class SWAPLogParser implements Runnable { String remoteImgPath; if (DACommunicator.isTargetEmulator() && SocketClient.getInstance().isConnected()) { - DACommunicator.getSelectedDevice().emulatorScreenshot + GlobalInformation.getCurrentDeviceInfo().emulatorScreenshot .send(); - remoteImgPath = DACommunicator.getSelectedDevice().emulatorScreenshot + remoteImgPath = GlobalInformation + .getCurrentDeviceInfo().emulatorScreenshot .getFilePath(); bECS = true; } else { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java index 1435f8e..9c04337 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java @@ -33,6 +33,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.swap.model.ByteUtils; @@ -86,9 +87,9 @@ public class SystemData extends LogData { public void makeData(byte[] data) { super.makeData(data); // index = MessageParser.MSG_HEADER_SIZE; - int coreCount = DACommunicator.getSelectedDevice().getTargetInfo() + int coreCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getCpuCount(); - int deviceCount = DACommunicator.getSelectedDevice().getTargetInfo() + int deviceCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getDeviceCount(); appCpuUsage = ByteUtils.toFloat(data, index); index += FLOAT_SIZE; @@ -229,7 +230,7 @@ public class SystemData extends LogData { } private static String parseCpu(int start, byte[] payload) { - int coreCount = DACommunicator.getSelectedDevice().getTargetInfo() + int coreCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getCpuCount(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < coreCount; i++) { @@ -244,7 +245,7 @@ public class SystemData extends LogData { } private static String parseUsage(int start, byte[] payload) { - int count = DACommunicator.getSelectedDevice().getTargetInfo() + int count = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getDeviceCount(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < count; i++) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorer.java index c4e790a..7903ade 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorer.java @@ -35,7 +35,7 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; -import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.model.DeviceInfo; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; @@ -114,11 +114,11 @@ public class DAFileTreeExplorer extends Composite { } public void makeTree() { - DeviceInfo selectedDevice = DACommunicator.getSelectedDevice(); + DeviceInfo selectedDevice = GlobalInformation.getCurrentDeviceInfo(); if (null == selectedDevice) { return; } - IDevice device = DACommunicator.getSelectedDevice().getIDevice(); + IDevice device = GlobalInformation.getCurrentDeviceInfo().getIDevice(); FileEntry root = device.getRoot(); GridItem item = new GridItem(table, SWT.NONE); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorerDilaog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorerDilaog.java index 3f64270..dfba451 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorerDilaog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorerDilaog.java @@ -43,6 +43,7 @@ import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.appearance.DesignConstants; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.nl.WidgetLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -72,8 +73,8 @@ public class DeviceExplorerDilaog extends DAMessageBox { data.height = 476; data.width = 434; explorer.setLayoutData(data); - explorer.setDevice(DACommunicator.getSelectedDevice().getIDevice()); - explorer.setRoot(DACommunicator.getSelectedDevice().getIDevice() + explorer.setDevice(GlobalInformation.getCurrentDeviceInfo().getIDevice()); + explorer.setRoot(GlobalInformation.getCurrentDeviceInfo().getIDevice() .getRoot().getFullPath()); // explorer.updateData(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackUnit.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackUnit.java index 138471e..537b126 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackUnit.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackUnit.java @@ -28,6 +28,7 @@ package org.tizen.dynamicanalyzer.ui.info.callstack; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.SymbolManager; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; @@ -102,7 +103,7 @@ public class CallStackUnit { .demanglingFunctionName(prevFunctionName); } } else { - AppInfo selectedApp = DACommunicator.getSelectedApp(); + AppInfo selectedApp = GlobalInformation.getCurrentApplication(); if (DACommunicator.isDeviceConnected() && null != selectedApp && path.equals(selectedApp.getInfo(AppInfo.EXEC_INDEX)) && AnalyzerManager.isOsp()) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/ContextDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/ContextDataDBTable.java index c902b4c..708a069 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/ContextDataDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/ContextDataDBTable.java @@ -1,5 +1,9 @@ package org.tizen.dynamicanalyzer.ui.kernel.data; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; + import org.tizen.dynamicanalyzer.database.DBColumn; import org.tizen.dynamicanalyzer.database.DBConstants; import org.tizen.dynamicanalyzer.database.DBTable; @@ -41,4 +45,31 @@ public class ContextDataDBTable extends DBTable { addColumn(new DBColumn(ENDADDR, DBConstants.EMPTY, DBConstants.LONG)); } + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + boolean isPrepared = true; + + int columnsize = getColumnSize(); + if (columnsize != rowData.size()) { + isPrepared = false; + } else { + try { + prep.setInt(1, (Integer) (rowData.get(0))); + prep.setInt(2, (Integer) (rowData.get(1))); + prep.setInt(3, (Integer) (rowData.get(2))); + prep.setInt(4, (Integer) (rowData.get(3))); + + prep.setLong(5, (Long) (rowData.get(4))); + prep.setLong(6, (Long) (rowData.get(5))); + prep.setLong(7, (Long) (rowData.get(6))); + prep.setLong(8, (Long) (rowData.get(7))); + } catch (SQLException e) { + e.printStackTrace(); + isPrepared = false; + } + } + + return isPrepared; + } + } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/FunctionDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/FunctionDataDBTable.java index e535565..8588e25 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/FunctionDataDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/FunctionDataDBTable.java @@ -1,5 +1,9 @@ package org.tizen.dynamicanalyzer.ui.kernel.data; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; + import org.tizen.dynamicanalyzer.database.DBColumn; import org.tizen.dynamicanalyzer.database.DBConstants; import org.tizen.dynamicanalyzer.database.DBTable; @@ -48,6 +52,42 @@ public class FunctionDataDBTable extends DBTable { addColumn(new DBColumn(ENDTIME, DBConstants.EMPTY, DBConstants.LONG)); addColumn(new DBColumn(ENDTYPE, DBConstants.EMPTY, DBConstants.INTEGER)); addColumn(new DBColumn(ENDADDR, DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(FUNCNAME, DBConstants.EMPTY, DBConstants.TEXT)); + addColumn(new DBColumn(FUNCNAME, DBConstants.EMPTY, + DBConstants.VARCHAR, DBConstants.FUNCNAME_LEN)); + } + + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + boolean isPrepared = true; + + int columnsize = getColumnSize(); + if (columnsize != rowData.size()) { + isPrepared = false; + } else { + try { + prep.setInt(1, (Integer) (rowData.get(0))); + prep.setInt(2, (Integer) (rowData.get(1))); + prep.setInt(3, (Integer) (rowData.get(2))); + prep.setInt(4, (Integer) (rowData.get(3))); + + prep.setLong(5, (Long) (rowData.get(4))); + prep.setInt(6, (Integer) (rowData.get(5))); + prep.setLong(7, (Long) (rowData.get(6))); + + prep.setLong(8, (Long) (rowData.get(7))); + prep.setInt(9, (Integer) (rowData.get(8))); + prep.setLong(10, (Long) (rowData.get(9))); + + String retstr = clipString((String) (rowData.get(10)), + DBConstants.FUNCNAME_LEN, rowData.get(0).toString()); + + prep.setString(11, retstr); + } catch (SQLException e) { + e.printStackTrace(); + isPrepared = false; + } + } + + return isPrepared; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkAPIDBManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkAPIDBManager.java index 016fbb3..9b75802 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkAPIDBManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkAPIDBManager.java @@ -1,5 +1,6 @@ package org.tizen.dynamicanalyzer.ui.network.data; +import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.List; @@ -123,4 +124,10 @@ public class NetworkAPIDBManager extends DBTable { return statusSeriesList; } + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + // TODO Auto-generated method stub + return false; + } + } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkSeriesDBManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkSeriesDBManager.java index 92afb0a..9cd9e1b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkSeriesDBManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/data/NetworkSeriesDBManager.java @@ -1,5 +1,6 @@ package org.tizen.dynamicanalyzer.ui.network.data; +import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.List; @@ -72,4 +73,10 @@ public class NetworkSeriesDBManager extends DBTable { return statusSeriesList; } + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + // TODO Auto-generated method stub + return false; + } + } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBTable.java index 319f701..7c61534 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBTable.java @@ -1,5 +1,8 @@ package org.tizen.dynamicanalyzer.ui.timeline; +import java.sql.PreparedStatement; +import java.util.List; + import org.tizen.dynamicanalyzer.database.DBColumn; import org.tizen.dynamicanalyzer.database.DBConstants; import org.tizen.dynamicanalyzer.database.DBTable; @@ -27,5 +30,11 @@ public class ScreenShotDBTable extends DBTable { addColumn(new DBColumn(IMAGE_FILE_PATH, DBConstants.NOT_NULL, DBConstants.TEXT)); // TODO integer -> float addColumn(new DBColumn(IMAGE_ORIENTATION, DBConstants.NOT_NULL, DBConstants.INTEGER)); } + + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + // TODO Auto-generated method stub + return false; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java index eea1c2d..2848306 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java @@ -26,50 +26,21 @@ package org.tizen.dynamicanalyzer.ui.timeline; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; + import org.tizen.dynamicanalyzer.database.DBColumn; import org.tizen.dynamicanalyzer.database.DBConstants; import org.tizen.dynamicanalyzer.database.DBTable; public class SystemDataDBTable extends DBTable { private static final String TABLENAME = "TIMELINE_SYSTEM_DATA"; - + public static enum COLUMN { - TIME, - CPU_LOAD_APP, - PROCESS_COUNT, - HEAP_ALLOCATION_TOTAL, - HEAP_ALLOCATION_APP, - MEMORY_VIRTUAL, - MEMORY_RESIDENT, - MEMORY_SHARED, - MEMORY_PSS, - MEMORY_TOTAL_SYSTEM, - MEMORY_USAGE_SYSTEM, - NETWORK_SIZE_SEND, - NETWORK_SIZE_RECEIVE, - DEVICE_STATUS_WIFI, - DEVICE_STATUS_BLUETOOTH, - DEVICE_STATUS_GPS, - DEVICE_STATUS_BRIGHTNESS, - DEVICE_STATUS_DNET, - DEVICE_STATUS_CAMERA, - DEVICE_STATUS_SOUND, - DEVICE_STATUS_AUDIO, - DEVICE_STATUS_VIBRATION, - DEVICE_STATUS_VOLTAGE, - DEVICE_STATUS_RSSI, - DEVICE_STATUS_VIDEO, - DEVICE_STATUS_CALL, - DISK_TOTAL_USAGE, - DISK_IO_READ_SIZE, - DISK_IO_READ_SECTOR, - DISK_IO_WRITE_SIZE, - DISK_IO_WRITE_SECTOR, - ENERGY_USAGE, - FD_COUNT, - FD_ACTIVITY + TIME, CPU_LOAD_APP, PROCESS_COUNT, HEAP_ALLOCATION_TOTAL, HEAP_ALLOCATION_APP, MEMORY_VIRTUAL, MEMORY_RESIDENT, MEMORY_SHARED, MEMORY_PSS, MEMORY_TOTAL_SYSTEM, MEMORY_USAGE_SYSTEM, NETWORK_SIZE_SEND, NETWORK_SIZE_RECEIVE, DEVICE_STATUS_WIFI, DEVICE_STATUS_BLUETOOTH, DEVICE_STATUS_GPS, DEVICE_STATUS_BRIGHTNESS, DEVICE_STATUS_DNET, DEVICE_STATUS_CAMERA, DEVICE_STATUS_SOUND, DEVICE_STATUS_AUDIO, DEVICE_STATUS_VIBRATION, DEVICE_STATUS_VOLTAGE, DEVICE_STATUS_RSSI, DEVICE_STATUS_VIDEO, DEVICE_STATUS_CALL, DISK_TOTAL_USAGE, DISK_IO_READ_SIZE, DISK_IO_READ_SECTOR, DISK_IO_WRITE_SIZE, DISK_IO_WRITE_SECTOR, ENERGY_USAGE, FD_COUNT, FD_ACTIVITY } - + public static final String TIME = "TIME"; public static final String CPU_LOAD_APP = "CPU_LOAD_APP"; public static final String PROCESS_COUNT = "PROCESS_COUNT"; @@ -112,38 +83,122 @@ public class SystemDataDBTable extends DBTable { public SystemDataDBTable() { addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.NOT_NULL, DBConstants.INTEGER)); // TODO integer -> float - addColumn(new DBColumn(PROCESS_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(MEMORY_SHARED, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(MEMORY_PSS, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.NOT_NULL, DBConstants.LONG)); //10 - addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_WIFI, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_BLUETOOTH, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.NOT_NULL, DBConstants.INTEGER)); //20 - addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_VOLTAGE, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_RSSI, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_VIDEO, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER)); //30 - addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(ENERGY_USAGE, DBConstants.NOT_NULL, DBConstants.INTEGER)); -// addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER)); -// addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL, DBConstants.INTEGER)); + addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.NOT_NULL, + DBConstants.INTEGER)); // TODO integer -> float + addColumn(new DBColumn(PROCESS_COUNT, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.NOT_NULL, + DBConstants.LONG)); + addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.NOT_NULL, + DBConstants.LONG)); + addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(MEMORY_SHARED, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(MEMORY_PSS, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.NOT_NULL, + DBConstants.LONG)); // 10 + addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.NOT_NULL, + DBConstants.LONG)); + addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_WIFI, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_BLUETOOTH, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.NOT_NULL, + DBConstants.INTEGER)); // 20 + addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_VOLTAGE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_RSSI, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_VIDEO, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); // 30 + addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + addColumn(new DBColumn(ENERGY_USAGE, DBConstants.NOT_NULL, + DBConstants.INTEGER)); + // addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL, + // DBConstants.INTEGER)); + // addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL, + // DBConstants.INTEGER)); + } + + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + boolean isPrepared = true; + + int columnsize = getColumnSize(); + if (columnsize != rowData.size()) { + isPrepared = false; + } else { + try { + prep.setLong(1, (Long) (rowData.get(0))); + prep.setInt(2, (Integer) (rowData.get(1))); + prep.setInt(3, (Integer) (rowData.get(2))); + prep.setLong(4, (Long) (rowData.get(3))); + prep.setLong(5, (Long) (rowData.get(4))); + prep.setInt(6, (Integer) (rowData.get(5))); + prep.setInt(7, (Integer) (rowData.get(6))); + prep.setInt(8, (Integer) (rowData.get(7))); + prep.setInt(9, (Integer) (rowData.get(8))); + prep.setLong(10, (Long) (rowData.get(9))); + prep.setLong(11, (Long) (rowData.get(10))); + + prep.setInt(12, (Integer) (rowData.get(11))); + prep.setInt(13, (Integer) (rowData.get(12))); + prep.setInt(14, (Integer) (rowData.get(13))); + prep.setInt(15, (Integer) (rowData.get(14))); + prep.setInt(16, (Integer) (rowData.get(15))); + prep.setInt(17, (Integer) (rowData.get(16))); + prep.setInt(18, (Integer) (rowData.get(17))); + prep.setInt(19, (Integer) (rowData.get(18))); + prep.setInt(20, (Integer) (rowData.get(19))); + prep.setInt(21, (Integer) (rowData.get(20))); + prep.setInt(22, (Integer) (rowData.get(21))); + prep.setInt(23, (Integer) (rowData.get(22))); + prep.setInt(24, (Integer) (rowData.get(23))); + prep.setInt(25, (Integer) (rowData.get(24))); + prep.setInt(26, (Integer) (rowData.get(25))); + prep.setInt(27, (Integer) (rowData.get(26))); + prep.setInt(28, (Integer) (rowData.get(27))); + prep.setInt(29, (Integer) (rowData.get(28))); + prep.setInt(30, (Integer) (rowData.get(29))); + prep.setInt(31, (Integer) (rowData.get(30))); + prep.setInt(32, (Integer) (rowData.get(31))); + } catch (SQLException e) { + e.printStackTrace(); + isPrepared = false; + } + } + + return isPrepared; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java index cf55760..584508e 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java @@ -1,5 +1,8 @@ package org.tizen.dynamicanalyzer.ui.timeline; +import java.sql.PreparedStatement; +import java.util.List; + import org.tizen.dynamicanalyzer.database.DBColumn; import org.tizen.dynamicanalyzer.database.DBConstants; import org.tizen.dynamicanalyzer.database.DBTable; @@ -39,4 +42,10 @@ public class UIEventDBTable extends DBTable { addColumn(new DBColumn(INFO_STRING, DBConstants.NOT_NULL, DBConstants.TEXT)); addColumn(new DBColumn(INFO_INTEGER, DBConstants.NOT_NULL, DBConstants.INTEGER)); } + + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + // TODO Auto-generated method stub + return false; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java index 14cb987..6f84cce 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.swt.graphics.Color; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; @@ -89,7 +90,7 @@ public class CPUCoreChart extends TimelineChart { private void parseLog(SystemData logData) { try { if (coreSize == TimelineConstants.NOT_INITED) { - coreSize = DACommunicator.getSelectedDevice().getTargetInfo() + coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getCpuCount(); for (int i = 0; i < coreSize; i++) { DAChartSeries chartSeries = new DAChartSeries( diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java index 473037f..14909c1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.swt.graphics.Color; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; @@ -100,7 +101,7 @@ public class CPUFrequencyChart extends TimelineChart { private void parseLog(SystemData logData) { try { if (coreSize == TimelineConstants.NOT_INITED) { - coreSize = DACommunicator.getSelectedDevice().getTargetInfo() + coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getCpuCount(); for (int i = 0; i < coreSize; i++) { DAChartSeries chartSeries = new DAChartSeries( diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java index 345acda..a685233 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.tizen.dynamicanalyzer.constant.CommonConstants; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -113,7 +114,7 @@ public class EnergyChart extends TimelineChart { private void parseLog(SystemData logData) { try { if (!isInitialized) { - String[] deviceList = DACommunicator.getSelectedDevice() + String[] deviceList = GlobalInformation.getCurrentDeviceInfo() .getTargetInfo().getDevices() .split(CommonConstants.COMMA); for (String device : deviceList) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java index 30a8086..3f0dca3 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java @@ -34,6 +34,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ImageResources; @@ -118,7 +119,7 @@ public class ScreenshotChart extends TimelineChart { if(DACommunicator.isTargetEmulator() && SocketClient.getInstance().isConnected()) { - imagePathLog = DACommunicator.getSelectedDevice() + imagePathLog = GlobalInformation.getCurrentDeviceInfo() .emulatorScreenshot.getFilePath(); } else { imagePathLog = logData.getImageFilePath(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java index 3439697..1713795 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.appearance.DesignConstants; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler; @@ -93,9 +94,6 @@ public class ToolbarArea { public static final String PROCESS_SPLITER = CommonConstants.SPACE + CommonConstants.COLON + CommonConstants.SPACE; - String selectedDevice = null; - AppInfo selectedApp = null; - private static ToolbarArea coolbarArea; // Toolbar @@ -128,22 +126,6 @@ public class ToolbarArea { public static final int TOOLBAR_STATE_RECORDING = 0; public static final int TOOLBAR_STATE_READY = 1; - public String getSelectedDevice() { - return selectedDevice; - } - - public void setSelectedDevice(String selectedDevice) { - this.selectedDevice = selectedDevice; - } - - public AppInfo getSelectedApp() { - return selectedApp; - } - - public void setSelectedApp(AppInfo selectedApp) { - this.selectedApp = selectedApp; - } - public static void createInstance(Composite parent) { if (null == coolbarArea) { coolbarArea = new ToolbarArea(parent); @@ -187,7 +169,7 @@ public class ToolbarArea { return; } - String sDeviceName = DACommunicator.getSelectedDevice() + String sDeviceName = GlobalInformation.getCurrentDeviceInfo() .getIDevice().getSerialNumber(); String pDeviceName = p.getDevice(); @@ -213,11 +195,15 @@ public class ToolbarArea { @Override public void selectionEvent(DACustomCombo combo) { - String oldDevice = getSelectedDevice(); + String oldDeviceName = null; + DeviceInfo oldDevInfo = GlobalInformation + .getCurrentDeviceInfo(); + if (oldDevInfo != null) + oldDeviceName = oldDevInfo.getIDevice().getSerialNumber(); String serial = combo.getText(); - if (!serial.equals(oldDevice)) { - DACommunicator.setSelectedDeviceBySerial(serial); - setSelectedDevice(serial); + if (!serial.equals(oldDeviceName)) { + GlobalInformation.setCurrentDeviceInfo(DACommunicator + .setSelectedDeviceBySerial(serial)); if (null != serial && !serial.isEmpty()) { initAppCombo(); } @@ -262,13 +248,16 @@ public class ToolbarArea { .getPkgInfoByName(appName); if (null != selectedApp) { - DACommunicator.setSelectedApp(selectedApp); - setSelectedApp(selectedApp); - DACommunicator.getSelectedDevice().setSelectedAppName( - selectedApp.getInfo(AppInfo.LABEL_INDEX)); + GlobalInformation.setCurrentApplication(selectedApp); + GlobalInformation.getCurrentDeviceInfo() + .getCommunicator().onAppSelected(selectedApp); + GlobalInformation.getCurrentDeviceInfo() + .setSelectedAppName( + selectedApp + .getInfo(AppInfo.LABEL_INDEX)); } - if (null != DACommunicator.getSelectedDevice()) { + if (null != GlobalInformation.getCurrentDeviceInfo()) { // AnalyzerUtil // .setRecordState(RecordStateSourceProvider.RECORD_READY); AnalyzerManager.setRunningState(false); @@ -472,12 +461,12 @@ public class ToolbarArea { } if (!deviceCombo.isEnabled() - || null == DACommunicator.getSelectedDevice()) { + || null == GlobalInformation.getCurrentDeviceInfo()) { appCombo.setEnabled(false); } if (!appCombo.isEnabled() - || null == DACommunicator.getSelectedApp()) { + || null == GlobalInformation.getCurrentApplication()) { setStartButtonEnablement(false); } @@ -823,36 +812,37 @@ public class ToolbarArea { appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX)); } if (size > 0) { - String appName = DACommunicator.getSelectedDevice() + String appName = GlobalInformation.getCurrentDeviceInfo() .getSelectedAppName(); if (null == appName) { appCombo.select(0); - setSelectedApp(apps.get(0)); - DACommunicator.setSelectedApp(apps.get(0)); - DACommunicator.getSelectedDevice().setSelectedAppName( + GlobalInformation.setCurrentApplication(apps.get(0)); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(apps.get(0)); + GlobalInformation.getCurrentDeviceInfo().setSelectedAppName( apps.get(0).getInfo(AppInfo.LABEL_INDEX)); } else { AppInfo appInfo = DACommunicator.getPkgInfoByName(appName); if (null != appInfo) { appCombo.setText(appName); - setSelectedApp(appInfo); - DACommunicator.setSelectedApp(appInfo); - DACommunicator.getSelectedDevice().setSelectedAppName( - appInfo.getInfo(AppInfo.LABEL_INDEX)); + GlobalInformation.setCurrentApplication(appInfo); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(appInfo); + GlobalInformation.getCurrentDeviceInfo() + .setSelectedAppName( + appInfo.getInfo(AppInfo.LABEL_INDEX)); // startButton.setButtonEnabled(true); setStartButtonState(true); } else { appCombo.setText(appName); appCombo.select(0); - setSelectedApp(null); - DACommunicator.setSelectedApp(null); + GlobalInformation.setCurrentApplication(null); } } } else { appCombo.add(CommonConstants.EMPTY); appCombo.select(0); - setSelectedApp(null); - DACommunicator.setSelectedApp(null); + GlobalInformation.setCurrentApplication(null); } } @@ -879,8 +869,8 @@ public class ToolbarArea { } else { int size = items.size(); int selIndex = 0; - String selDevice = DACommunicator.getSelectedDevice().getIDevice() - .getSerialNumber(); + String selDevice = GlobalInformation.getCurrentDeviceInfo() + .getIDevice().getSerialNumber(); for (int i = 0; i < size; i++) { deviceCombo.add(items.get(i)); if (items.get(i).equals(selDevice)) { @@ -889,7 +879,8 @@ public class ToolbarArea { } deviceCombo.select(selIndex); - setSelectedDevice(items.get(selIndex)); + GlobalInformation.setCurrentDeviceInfo(DACommunicator + .getDeviceByName(items.get(selIndex))); deviceCombo.setToolTipText(items.get(selIndex)); if (null == oldDevice || !oldDevice.equals(selDevice)) { @@ -918,8 +909,10 @@ public class ToolbarArea { appCombo.select(COMBO_FIRST_INDEX); AppInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0)); if (null != appInfo) { - DACommunicator.setSelectedApp(appInfo); - DACommunicator.getSelectedDevice().setSelectedAppName( + GlobalInformation.setCurrentApplication(appInfo); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(appInfo); + GlobalInformation.getCurrentDeviceInfo().setSelectedAppName( appInfo.getInfo(AppInfo.LABEL_INDEX)); appCombo.setToolTipText(appCombo.getItem(0)); setStartButtonState(true); @@ -935,8 +928,10 @@ public class ToolbarArea { public void setAppComboText(final String text) { AppInfo appInfo = DACommunicator.getPkgInfoByName(text); if (null != appInfo) { - DACommunicator.setSelectedApp(appInfo); - DACommunicator.getSelectedDevice().setSelectedAppName( + GlobalInformation.setCurrentApplication(appInfo); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(appInfo); + GlobalInformation.getCurrentDeviceInfo().setSelectedAppName( appInfo.getInfo(AppInfo.LABEL_INDEX)); Display.getDefault().syncExec(new Runnable() { @Override @@ -950,8 +945,10 @@ public class ToolbarArea { public void setAppComboTextByAppId(String id) { AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id); if (null != appInfo) { - DACommunicator.setSelectedApp(appInfo); - DACommunicator.getSelectedDevice().setSelectedAppName( + GlobalInformation.setCurrentApplication(appInfo); + GlobalInformation.getCurrentDeviceInfo().getCommunicator() + .onAppSelected(appInfo); + GlobalInformation.getCurrentDeviceInfo().setSelectedAppName( appInfo.getInfo(AppInfo.LABEL_INDEX)); appCombo.setText(appInfo.getInfo(AppInfo.LABEL_INDEX)); } @@ -985,8 +982,8 @@ public class ToolbarArea { } String text = deviceCombo.getText(); - String device = DACommunicator.getSelectedDevice().getIDevice() - .getSerialNumber(); + String device = GlobalInformation.getCurrentDeviceInfo() + .getIDevice().getSerialNumber(); if (!device.equals(text)) { // startButton.setButtonEnabled(false); setStartButtonState(false); @@ -1005,8 +1002,8 @@ public class ToolbarArea { @Override public void run() { String text = deviceCombo.getText(); - String device = DACommunicator.getSelectedDevice().getIDevice() - .getSerialNumber(); + String device = GlobalInformation.getCurrentDeviceInfo() + .getIDevice().getSerialNumber(); if (!device.equals(text)) { // startButton.setButtonEnabled(false); setStartButtonState(false); @@ -1193,7 +1190,7 @@ public class ToolbarArea { private void setStartButtonState(boolean enabled) { if (enabled) { - DeviceInfo device = DACommunicator.getSelectedDevice(); + DeviceInfo device = GlobalInformation.getCurrentDeviceInfo(); if (null != device && device.isConfigSuccess()) { startButton.setButtonEnabled(true); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java index e8f12bf..11e1390 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java @@ -100,7 +100,7 @@ public class BinarySettingsPage extends DAPageComposite { @Override public void handleClickEvent(DACustomButton button) { DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(getShell()); - dialog.setFilter(".so"); +// dialog.setFilter(".so"); Object result = dialog.open(); if (result != null) { BinarySettingProgressManager.getInstance().startProcessStart( diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java index 40b805f..da4afc6 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java @@ -31,6 +31,7 @@ import java.util.List; import org.eclipse.nebula.widgets.grid.Grid; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.HostResult; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; @@ -562,13 +563,13 @@ public class ConfigurationDialogDataManager { public void applySwapValue(DATableComposite featuresTable) { setFeaturesValueFromTableItemsList(featuresTable.getTable()); applySettingValueToConfigureManager(); - if (null != DACommunicator.getSelectedDevice()) { + if (null != GlobalInformation.getCurrentDeviceInfo()) { HostResult result = DACommunicator.sendRuntimeMessage( DACommunicator.MSG_TYPE_CONFIG, null); if (!result.equals(HostResult.SUCCESS)) { applyFailedSwapValue(featuresTable); - } else if (!DACommunicator.getSelectedDevice().isConfigSuccess()) { - DACommunicator.getSelectedDevice().setConfigSuccess(true); + } else if (!GlobalInformation.getCurrentDeviceInfo().isConfigSuccess()) { + GlobalInformation.getCurrentDeviceInfo().setConfigSuccess(true); ToolbarArea.getInstance().setStartButtonEnablement(true); } else { updateFeaturesValueFromConfigureManager(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replay/data/ReplayDBManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replay/data/ReplayDBManager.java index 90e3cfb..de9b1a7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replay/data/ReplayDBManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replay/data/ReplayDBManager.java @@ -1,5 +1,6 @@ package org.tizen.dynamicanalyzer.ui.toolbar.replay.data; +import java.sql.PreparedStatement; import java.util.List; import org.tizen.dynamicanalyzer.database.DBColumn; @@ -84,4 +85,10 @@ public class ReplayDBManager extends DBTable { SqlConnectionManager.executeUpdate(DELETE_QUERY); return true; } + + @Override + public boolean prepare(PreparedStatement prep, List rowData) { + // TODO Auto-generated method stub + return false; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replayEditor/ReplayEditScreenshotDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replayEditor/ReplayEditScreenshotDialog.java index bba9cbb..9ed0d4b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replayEditor/ReplayEditScreenshotDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replayEditor/ReplayEditScreenshotDialog.java @@ -47,6 +47,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.common.ScreenshotConstants; import org.tizen.dynamicanalyzer.common.path.PathManager; import org.tizen.dynamicanalyzer.communicator.DACommunicator; @@ -203,7 +204,7 @@ public class ReplayEditScreenshotDialog extends DAMessageBox { } private void getDeviceResolution() { - String selDeviceName = DACommunicator.getSelectedDevice().getIDevice() + String selDeviceName = GlobalInformation.getCurrentDeviceInfo().getIDevice() .getDeviceName(); String resolutionInfoXmlPath = PathManager.TIZEN_SDK_DATA_PATH + File.separator + "emulator-vms" + File.separator + "vms"//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java index 8c71c50..f5de68b 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java @@ -56,6 +56,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.IHandlerService; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.GlobalInformation; import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo; @@ -404,7 +405,7 @@ public class AnalyzerUtil { public static String getBinarySourcePath(int pid, long time) { String localBinPath = AnalyzerUtil.getProcessLocalBinaryPath(pid, time); String key = getTargetPathKey(localBinPath); - BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key); + BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key); String sourceBinPath = binInfo.getTempBinaryPath(); return sourceBinPath; } @@ -419,7 +420,7 @@ public class AnalyzerUtil { String path = processInfo.getMainTargetBinaryPath(); String key = getTargetPathKey(path); - BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key); + BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key); return binInfo; } @@ -434,7 +435,7 @@ public class AnalyzerUtil { String path = processInfo.getMainTargetBinaryPath(); String key = getTargetPathKey(path); - BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key); + BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key); if (null == binInfo) { return false; } @@ -445,7 +446,7 @@ public class AnalyzerUtil { } public static boolean getBinaryBuildType(String localBinaryPath) { - HashMap binMap = DACommunicator.getSelectedApp() + HashMap binMap = GlobalInformation.getCurrentApplication() .getBinaryInfoMap(); String key = AnalyzerUtil.getTargetPathKey(localBinaryPath); BinaryInfo binInfo = binMap.get(key);