--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<CREATE>
+ <NETWORK_API>
+ <SEQ DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="PRIMARY KEY" INDEX="" />
+ <DESTINATION_ADDRESS DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <FD_VALUE DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="Y" />
+ <ID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <ERROR DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <TID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <ARG DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <RET DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <BYTE_SIZE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PAYLOAD DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <API_TYPE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <CALLER_PC_ADDRESS DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <LIB_NAME DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ </NETWORK_API>
+ <NETWORK_SERIES>
+ <RID DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="PRIMARY KEY" INDEX="" />
+ <DESTINATION_ADDRESS DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <FD_VALUE DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <START_TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <END_TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <STATUS_TYPE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <ID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ </NETWORK_SERIES>
+
+</CREATE>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<CREATE>
+ <NETWORK_API>
+ <SEQUENCE_NUMBER DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="PRIMARY KEY" INDEX="" />
+ <DESTINATION_ADDRESS DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <NETWORK_FD_VALUE DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <API_TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="Y" />
+ <API_ID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <ERROR_NUMBER DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <TID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <ARGUMENT DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <RETURN_VALUE DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <BYTE_SIZE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PAYLOAD DATA_TYPE="VARCHAR(1024)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <API_TYPE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <CALLER_PC_ADDRESS DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <CALLER_LIBRARY_NAME DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ </NETWORK_API>
+ <NETWORK_SERIES>
+ <RID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="PRIMARY KEY" INDEX="" />
+ <DESTINATION_ADDRESS DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <NETWORK_FD_VALUE DATA_TYPE="VARCHAR(256)" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <START_TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <END_TIME DATA_TYPE="BIGINT" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <STATUS_TYPE DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <API_ID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ <PID DATA_TYPE="INTEGER" DEFAULT_EXPRESSION="NOT NULL" INDEX="" />
+ </NETWORK_SERIES>
+</CREATE>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<SELECT>
+ <NETWORK_API_SELECT_CHART_SERIES_QUERY
+ SELECT="SEQ,DESTINATION_ADDRESS,FD_VALUE,TIME,ID,ERROR" FROM="NETWORK_API"
+ WHERE="TIME BETWEN %s AND %s">
+ update API series of chart
+ </NETWORK_API_SELECT_CHART_SERIES_QUERY>
+ <NETWORK_API_SELECT_TABLE_CHILD_QUERY
+ SELECT="SEQ,DESTINATION_ADDRESS,FD_VALUE,TIME,ID,ERROR,PID,TID,ARG,RET,BYTE_SIZE,PAYLOAD,API_TYPE,CALLER_PC_ADDRESS,LIB_NAME"
+ FROM="NETWORK_API" WHERE="DESTINATION_ADDRESS = '%s' AND FD_VALUE = '%s'">
+ click child chart
+ </NETWORK_API_SELECT_TABLE_CHILD_QUERY>
+ <NETWORK_API_SELECT_TABLE_PARENT_QUERY
+ SELECT="SEQ,DESTINATION_ADDRESS,FD_VALUE,TIME,ID,ERROR,PID,TID,ARG,RET,BYTE_SIZE,PAYLOAD,API_TYPE,CALLER_PC_ADDRESS,LIB_NAME"
+ FROM="NETWORK_API" WHERE="DESTINATION_ADDRESS = '%s'">
+ click parent chart
+ </NETWORK_API_SELECT_TABLE_PARENT_QUERY>
+ <NETWORK_SERIES_CHART_SELECT_QUERY
+ SELECT="RID,DESTINATION_ADDRESS,FD_VALUE,START_TIME,END_TIME,STATUS_TYPE,ID,PID"
+ FROM="NETWORK_SERIES" WHERE="">
+ update chart
+ </NETWORK_SERIES_CHART_SELECT_QUERY>
+ <NETWORK_SERIES_CHART_SELECT_PID_QUERY
+ SELECT="RID,DESTINATION_ADDRESS,FD_VALUE,START_TIME,END_TIME,STATUS_TYPE,ID,PID"
+ FROM="NETWORK_SERIES" WHERE="pid = '%s'">
+ update chart by multi process
+ </NETWORK_SERIES_CHART_SELECT_PID_QUERY>
+</SELECT>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<SELECT>
+ <NETWORK_API_SELECT_CHART_SERIES_QUERY
+ SELECT="SEQUENCE_NUMBER,DESTINATION_ADDRESS,NETWORK_FD_VALUE,API_TIME,API_ID,ERROR_NUMBER"
+ FROM="NETWORK_API" WHERE="API_TIME BETWEN '%s' AND '%s'">
+ update API series of chart
+ </NETWORK_API_SELECT_CHART_SERIES_QUERY>
+ <NETWORK_API_SELECT_TABLE_CHILD_QUERY
+ SELECT="SEQUENCE_NUMBER,DESTINATION_ADDRESS,NETWORK_FD_VALUE,API_TIME,API_ID,ERROR_NUMBER,PID,TID,ARGUMENT,RETURN_VALUE,BYTE_SIZE,PAYLOAD,API_TYPE,CALLER_LIBRARY_NAME,CALLER_LIBRARY_NAME"
+ FROM="NETWORK_API" WHERE="DESTINATION_ADDRESS = '%s' AND NETWORK_FD_VALUE = '%s'">
+ click child chart
+ </NETWORK_API_SELECT_TABLE_CHILD_QUERY>
+ <NETWORK_API_SELECT_TABLE_PARENT_QUERY
+ SELECT="SEQUENCE_NUMBER,DESTINATION_ADDRESS,NETWORK_FD_VALUE,API_TIME,API_ID,ERROR_NUMBER,PID,TID,ARGUMENT,RETURN_VALUE,BYTE_SIZE,PAYLOAD,API_TYPE,CALLER_LIBRARY_NAME,CALLER_LIBRARY_NAME"
+ FROM="NETWORK_API" WHERE="DESTINATION_ADDRESS = '%s'">
+ click parent chart
+ </NETWORK_API_SELECT_TABLE_PARENT_QUERY>
+ <NETWORK_SERIES_CHART_SELECT_QUERY
+ SELECT="RID,DESTINATION_ADDRESS,NETWORK_FD_VALUE,START_TIME,END_TIME,STATUS_TYPE,API_ID,PID"
+ FROM="NETWORK_SERIES" WHERE="">
+ update chart
+ </NETWORK_SERIES_CHART_SELECT_QUERY>
+ <NETWORK_SERIES_CHART_SELECT_PID_QUERY
+ SELECT="RID,DESTINATION_ADDRESS,NETWORK_FD_VALUE,START_TIME,END_TIME,STATUS_TYPE,API_ID,PID"
+ FROM="NETWORK_SERIES" WHERE="pid = '%s'">
+ update chart - multi process
+ </NETWORK_SERIES_CHART_SELECT_PID_QUERY>
+</SELECT>
+
public static final String TEMP_FOLDER_NAME = "temp"; //$NON-NLS-1$
public static final String PROJECT_INFO_FILE_NAME = "projectInfo"; //$NON-NLS-1$
public static final String CONFIG_FOLDER_NAME = "config"; //$NON-NLS-1$
+ public static final String SQL_FOLDER_NAME = "sql"; //$NON-NLS-1$
public static final String CONFIG_FILE_NAME = "config"; //$NON-NLS-1$
public static final String IDE_FOLDER_NAME = "ide"; //$NON-NLS-1$
public static final String PLUGINS_FOLDER_NAME = "plugins"; //$NON-NLS-1$
+ PathConstants.RPM_FOLDER_NAME;
public static final String DA_CONFIG_FOLDER_PATH = DA_INSTALL_PATH + File.separator
+ PathConstants.CONFIG_FOLDER_NAME;
+ public static final String DA_SQL_PATH = DA_INSTALL_PATH + File.separator
+ + PathConstants.SQL_FOLDER_NAME;
public static final String DA_TOOL_FOLDER_PATH = DA_INSTALL_PATH + File.separator
+ PathConstants.TOOL_FOLDER_NAME;
public class AnalyzerConstants {
// if log change occurs then increase save data version!!
- public static final String CURRENT_SAVE_FORMAT_VERSION = "1.0"; //$NON-NLS-1$
- public static final String[] SUPPORTED_SAVE_FORMAT_VERSION = { "1.0" }; //$NON-NLS-1$
+ public static final String CURRENT_SAVE_FORMAT_VERSION = "2.0"; //$NON-NLS-1$
+ public static final String[] SUPPORTED_SAVE_FORMAT_VERSION = { "1.0","2.0" }; //$NON-NLS-1$
public static final boolean CHECK_INTERNAL = true;
public static final String DA_VERSION_SWAP = "3.0";
public static final String DA_VERSION_OLD = "2.2";
public static final String DA_VERSION = "DA-2014-10-07";
+
/* folder names */
public static final String TEMP_FOLDER_RUN_PREFIX = ".RUN"; //$NON-NLS-1$
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.callback.IExecutionCallback;
+import org.tizen.dynamicanalyzer.database.DBQueryXMLParser;
import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
+ DBQueryXMLParser.initQueryMap(AnalyzerConstants.CURRENT_SAVE_FORMAT_VERSION);
final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
SettingDialog dialog = new SettingDialog(shell);
Logger.performance("TEST", "DA Start", "Welcome Dialog");
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * 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.database;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class DBQueryXMLParser {
+ private static Map<String, String> selectQueryMap = null;
+ private static Map<String, List<DBColumn>> createColumnMap = null;
+
+ private static Thread mapThread = null;
+ private static String currentDAVersion = null;
+
+ private static final String SELECT_FILE_NAME = "select";//$NON-NLS-1$
+ private static final String SELECT = "SELECT";//$NON-NLS-1$
+ private static final String FROM = "FROM";//$NON-NLS-1$
+ private static final String WHERE = "WHERE";//$NON-NLS-1$
+
+ private static final String CREATE_FILE_NAME = "create";//$NON-NLS-1$
+ private static final String DATA_TYPE = "DATA_TYPE";//$NON-NLS-1$
+ private static final String DEFAULT_EXPRESSION = "DEFAULT_EXPRESSION";//$NON-NLS-1$
+ private static final String INDEX = "INDEX";//$NON-NLS-1$
+
+ public static void initQueryMap(String selectedVersion) {
+ if (null != currentDAVersion && currentDAVersion.equals(selectedVersion)) {
+ return;
+ }
+ currentDAVersion = selectedVersion;
+ selectQueryMap = new HashMap<String, String>();
+ createColumnMap = new HashMap<String, List<DBColumn>>();
+ updateMapThread();
+ }
+
+ public static String getQuery(String queryName) {
+ if (!selectQueryMap.containsKey(queryName.trim())) {
+ Logger.error("Not find query : " + queryName);
+ return CommonConstants.EMPTY;
+ }
+ return selectQueryMap.get(queryName.trim());
+ }
+
+ public static List<DBColumn> getColumn(String tableName) {
+ if (!createColumnMap.containsKey(tableName.trim())) {
+ Logger.error("Not find table : " + tableName);
+ return new ArrayList<DBColumn>();
+ }
+ return createColumnMap.get(tableName.trim());
+ }
+
+ private static void updateMapThread() {
+ if (null != mapThread && mapThread.isAlive()) {
+ Logger.debug("END DB XML Thread");
+ mapThread.interrupt();
+ }
+ mapThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ updateSelectQueryMap();
+ updateCreateColumnMap();
+ }
+ });
+ mapThread.start();
+ }
+
+ private static void updateSelectQueryMap() {
+ NodeList quertList = getSQLTableList(SELECT_FILE_NAME);
+ if (null == quertList) {
+ Logger.error("Not exist select file : " + SELECT_FILE_NAME);
+ return;
+ }
+ for (int i = 0; i < quertList.getLength(); i++) {
+ setSelectQuery(quertList.item(i));
+ }
+ return;
+ }
+
+ private static void setSelectQuery(Node queryNode) {
+ String variableName = queryNode.getNodeName();
+ StringBuffer queryValue = new StringBuffer();
+ NamedNodeMap queryAttributes = queryNode.getAttributes();
+ if (null == queryAttributes) {
+ return;
+ }
+ queryValue.append(getSelectCommandValue(queryAttributes, SELECT));
+ queryValue.append(getSelectCommandValue(queryAttributes, FROM));
+ queryValue.append(getSelectCommandValue(queryAttributes, WHERE));
+ selectQueryMap.put(variableName.trim(), queryValue.toString());
+ }
+
+ private static void updateCreateColumnMap() {
+ NodeList tableList = getSQLTableList(CREATE_FILE_NAME);
+ if (null == tableList) {
+ Logger.error("Not exist create file : " + CREATE_FILE_NAME);
+ return;
+ }
+ for (int i = 0; i < tableList.getLength(); i++) {
+ setColumn(tableList.item(i));
+ }
+ return;
+ }
+
+ private static void setColumn(Node tableNadeName) {
+ NodeList columnNodeList = tableNadeName.getChildNodes();
+ List<DBColumn> columnList = new ArrayList<DBColumn>();
+ for (int j = 0; j < columnNodeList.getLength(); j++) {
+ Node queryNode = columnNodeList.item(j);
+ String columnName = queryNode.getNodeName();
+ NamedNodeMap queryAttributes = queryNode.getAttributes();
+ if (null == queryAttributes) {
+ continue;
+ }
+ columnList.add(makeDBColumn(columnName, queryAttributes));
+ }
+ if (columnList.size() > 0) {
+ createColumnMap.put(tableNadeName.getNodeName().trim(), columnList);
+ }
+ }
+
+ private static NodeList getSQLTableList(String command) {
+ String filePath = getSQLFilePath(command);
+ DocumentBuilder builder = null;
+ Document doc = null;
+ try {
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ doc = builder.parse(filePath);
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (null == doc) {
+ return null;
+ }
+ return doc.getDocumentElement().getChildNodes();
+ }
+
+ private static String getSQLFilePath(String type) {
+ return PathManager.DA_SQL_PATH + File.separator + type + CommonConstants.UNDERBAR
+ + currentDAVersion + ".xml";//$NON-NLS-1$
+ }
+
+ private static DBColumn makeDBColumn(String columnName, NamedNodeMap queryAttributes) {
+ String dataType = "";
+ String defaultExpression = "";
+ String index = "";
+ if (checkVaildAttributes(queryAttributes, DATA_TYPE)) {
+ dataType = queryAttributes.getNamedItem(DATA_TYPE).getNodeValue();
+ }
+ if (checkVaildAttributes(queryAttributes, DEFAULT_EXPRESSION)) {
+ defaultExpression = queryAttributes.getNamedItem(DEFAULT_EXPRESSION).getNodeValue();
+ }
+ if (checkVaildAttributes(queryAttributes, INDEX)) {
+ index = queryAttributes.getNamedItem(INDEX).getNodeValue();
+ }
+ DBColumn dbColumn = new DBColumn(columnName.trim(), defaultExpression, dataType);
+ if (!index.equals(CommonConstants.EMPTY)) {
+ dbColumn.setIndex(true);
+ } else {
+ dbColumn.setIndex(false);
+ }
+ return dbColumn;
+ }
+
+ private static String getSelectCommandValue(NamedNodeMap queryAttributes, String commandName) {
+ if (checkVaildAttributes(queryAttributes, commandName)) {
+ return CommonConstants.SPACE + commandName + CommonConstants.SPACE
+ + queryAttributes.getNamedItem(commandName).getNodeValue();
+ }
+ return CommonConstants.EMPTY;
+ }
+
+ private static boolean checkVaildAttributes(NamedNodeMap queryAttributes, String commandName) {
+ String attributesValue = queryAttributes.getNamedItem(commandName).getNodeValue();
+ if (!attributesValue.equals(CommonConstants.EMPTY)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
}
public final List<DBColumn> getColumns() {
+ if (columns.size() == 0) {
+ columns = DBQueryXMLParser.getColumn(getTableName());
+ }
return columns;
}
public final int getColumnSize() {
- return columns.size();
+ return getColumns().size();
}
protected final void addColumn(DBColumn col) {
query.append(getTableName());
query.append(CommonConstants.SPACE + CommonConstants.OPEN_BRACKET);
- int size = columns.size();
+ int size = getColumnSize();
for (int i = 0; i < size; i++) {
- query.append(columns.get(i).getColumnString());
+ query.append(getColumns().get(i).getColumnString());
if (i == size - 1) {
query.append(CommonConstants.CLOSE_BRACKET);
} else {
StringBuffer query = new StringBuffer();
query.append("insert into ").append(getTableName()).append(" values( ");
- int columnsize = columns.size();
+ int columnsize = getColumnSize();
for (int i = 0; i < columnsize; i++) {
if (i == columnsize - 1) {
query.append(" ? )");
query.append(", ");//$NON-NLS-1$
}
} else {
- int columnsize = columns.size();
+ int columnsize = getColumnSize();
for (int i = 0; i < columnsize; i++) {
- query.append(columns.get(i).getName());
+ query.append(getColumns().get(i).getName());
if (i < columnsize - 1)
query.append(", ");//$NON-NLS-1$
}
}
public final void createIndexTable() {
- int size = columns.size();
+ int size = getColumnSize();
StringBuffer indexColumns = new StringBuffer();
for (int i = 0; i < size; i++) {
- if (columns.get(i).isIndex()) {
+ if (getColumns().get(i).isIndex()) {
if (indexColumns.length() > 0) {
indexColumns.append(", ");
}
- indexColumns.append(columns.get(i).getName());
+ indexColumns.append(getColumns().get(i).getName());
}
}
package org.tizen.dynamicanalyzer.ui.network;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.database.DBQueryXMLParser;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
private int preSelectionPId = -1;
+ private String networkAPISelectChartSeriesQuery = CommonConstants.EMPTY;
+
public NetworkChartBoard(Composite parent, String title) {
super(parent, title);
initIntervalMarkers();
parentChartIndex = -1;
lastChildChartIndexOfEachParent = new LinkedHashMap<Integer, Integer>();
preSelectionPId = -1;
+
+ networkAPISelectChartSeriesQuery = DBQueryXMLParser
+ .getQuery("NETWORK_API_SELECT_CHART_SERIES_QUERY");
}
public void initIntervalMarkers() {
}
public void updateApiSeries() {
- List<NetworkAPIType> apiList = NetworkDataManager.getInstance().getAPIDBManger()
- .selectAPISeries(getVisibleStartTime(), getVisibleEndTime());
+ List<NetworkAPIType> apiList = selectAPISeries(getVisibleStartTime(), getVisibleEndTime());
if (null == apiList) {
return;
}
}
}
+ public List<NetworkAPIType> selectAPISeries(double visibleStartTime, double visibleEndTime) {
+ double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
+ double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
+ String query = String.format(networkAPISelectChartSeriesQuery, selectStartTime,
+ selectEndTime);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return null;
+ }
+ List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
+ try {
+ while (rs.next()) {
+ int selectIndex = 1;
+ NetworkAPIType data = new NetworkAPIType();
+ data.setSeq(rs.getLong(selectIndex++));
+ data.setDestinationAddress(rs.getString(selectIndex++));
+ data.setFdStr(rs.getString(selectIndex++));
+ data.setTime(rs.getLong(selectIndex++));
+ data.setApiId(rs.getInt(selectIndex++));
+ data.setErrNo(rs.getLong(selectIndex++));
+ returnValue.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
+ }
+
public void updateSeries() {
if (null == chartItemList) {
return;
package org.tizen.dynamicanalyzer.ui.network;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.database.DBQueryXMLParser;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
+import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
private boolean isChangedSelected = true;
private int preSelectionPId = 1;
+ private String networkAPISelectTableChildQuery = CommonConstants.EMPTY;
+ private String networkAPISelectTableParentQuery = CommonConstants.EMPTY;
+
public enum COLUMN {
INDEX(0, NetworkPageLabels.NETWORK_API_LIST_VIEW_INDEX), START_TIME(1,
NetworkPageLabels.NETWORK_API_LIST_VIEW_START_TIME), ELASPSED_TIME(2,
tableComp.setColumnSize(columnSizes);
tableComp.setTableName(NetworkPageLabels.NETWORK_API_LIST_VIEW_TITLE);
contents.addControlListener(new TableColumnSizePackListener(tableComp, columnSizes));
+
}
@Override
return;
}
NetworkDataManager.getInstance().setSelectedTableAPIList(
- NetworkDataManager
- .getInstance()
- .getAPIDBManger()
- .selectAPITable(netSelection.getAddress(), netSelection.getFd(),
- netSelection.isParentChart()));
+ selectAPITable(netSelection.getAddress(), netSelection.getFd(),
+ netSelection.isParentChart()));
tableComp.updateTable();
tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
isChangedSelected = true;
}
}
+ public List<NetworkAPIType> selectAPITable(String address, String fd, boolean isParentChart) {
+ String query = String.format(networkAPISelectTableChildQuery, address.trim(), fd.trim());
+ if (isParentChart) {
+ query = String.format(networkAPISelectTableParentQuery, address.trim());
+ }
+
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return null;
+ }
+ List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
+ try {
+ while (rs.next()) {
+ int selectIndex = 1;
+ NetworkAPIType data = new NetworkAPIType();
+ data.setSeq(rs.getLong(selectIndex++));
+ data.setDestinationAddress(rs.getString(selectIndex++));
+ data.setFdStr(rs.getString(selectIndex++));
+ data.setTime(rs.getLong(selectIndex++));
+ data.setApiId(rs.getInt(selectIndex++));
+ data.setErrNo(rs.getLong(selectIndex++));
+ data.setPid(rs.getInt(selectIndex++));
+ data.setTid(rs.getInt(selectIndex++));
+ data.setArgs(rs.getString(selectIndex++));
+ data.setReturn(rs.getString(selectIndex++));
+ data.setPacketMessageSize(rs.getInt(selectIndex++));
+ data.setPacketMessage(rs.getString(selectIndex++));
+ data.setFdApiType(rs.getInt(selectIndex++));
+ data.setCallerAddress(rs.getLong(selectIndex++));
+ data.setBinaryId(rs.getInt(selectIndex++));
+ returnValue.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
+ }
+
@Override
public Control getControl() {
return tableComp;
@Override
public void clear() {
tableComp.getTable().removeAll();
+
+ networkAPISelectTableChildQuery = DBQueryXMLParser
+ .getQuery("NETWORK_API_SELECT_TABLE_CHILD_QUERY");
+ networkAPISelectTableParentQuery = DBQueryXMLParser
+ .getQuery("NETWORK_API_SELECT_TABLE_PARENT_QUERY");
}
public long getRangeStartTime() {
package org.tizen.dynamicanalyzer.ui.network.data;
import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.database.DBColumn;
-import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
-import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
public class NetworkAPIDBManager extends DBTable {
private static final String TABLENAME = "NETWORK_API"; //$NON-NLS-1$
- public static final String SEQ = DBConstants.COMMON_COLUMN_SEQ;
- public static final String DESTINATION_ADDRESS = "DESTINATION_ADDRESS"; //$NON-NLS-1$
- public static final String FD_VALUE = "FD_VALUE"; //$NON-NLS-1$
- public static final String API_TIME = DBConstants.COMMON_COLUMN_TIME;
- public static final String API_NAME_ID = DBConstants.COMMON_COLUMN_ID;
- public static final String ERRNO = DBConstants.COMMON_COLUMN_ERROR;
- public static final String PID = DBConstants.COMMON_COLUMN_PID;
- public static final String TID = DBConstants.COMMON_COLUMN_TID;
- public static final String ARGUMENT = DBConstants.COMMON_COLUMN_ARG;
- public static final String RETURN = DBConstants.COMMON_COLUMN_RET;
- public static final String BYTE_SIZE = "BYTE_SIZE"; //$NON-NLS-1$
- public static final String PAYLOAD = "PAYLOAD"; //$NON-NLS-1$
- public static final String API_TYPE = "API_TYPE"; //$NON-NLS-1$
- public static final String CALLER_PC_ADDRESS = DBConstants.COMMON_COLUMN_CALLER_PC_ADDRESS;
- public static final String LIB_NAME = DBConstants.COMMON_COLUMN_CALLER_LIB_NAME;
-
- public static final int DB_SEQ_INDEX = 0;
- public static final int DB_DESTINATION_ADDRESS_INDEX = 1;
- public static final int DB_FD_VALUE_INDEX = 2;
- public static final int DB_API_TIME_INDEX = 3;
- public static final int DB_API_NAME_ID_INDEX = 4;
- public static final int DB_ERRNO_INDEX = 5;
- public static final int DB_PID_INDEX = 6;
- public static final int DB_TID_INDEX = 7;
- public static final int DB_ARGUMENT_INDEX = 8;
- public static final int DB_RETURN_INDEX = 9;
- public static final int DB_BYTE_SIZE_INDEX = 10;
- public static final int DB_PAYLOAD_INDEX = 11;
- public static final int DB_API_TYPE_INDEX = 12;
- public static final int DB_CALLER_PC_ADDRESS_INDEX = 13;
- public static final int DB_LIB_NAME_INDEX = 14;
-
- private static final String SELECT_API_SERIES_QUERY = "select " //$NON-NLS-1$
- + SEQ + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA
- + FD_VALUE
- + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA
- + API_NAME_ID
- + CommonConstants.COMMA + ERRNO + " from " //$NON-NLS-1$
- + TABLENAME + " where " + API_TIME + " BETWEEN %s and %s";//$NON-NLS-1$
-
- private static final String SELECT_API_TABLE_CHILD_QUERY = "select " + SEQ//$NON-NLS-1$
- + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE
- + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA + API_NAME_ID
- + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID + CommonConstants.COMMA
- + TID + CommonConstants.COMMA + ARGUMENT + CommonConstants.COMMA + RETURN
- + CommonConstants.COMMA + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
- + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA + CALLER_PC_ADDRESS
- + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
- + TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s' and "//$NON-NLS-1$
- + FD_VALUE + " = '%s'";//$NON-NLS-1$
-
- private static final String SELECT_API_TABLE_PARENT_QUERY = "select " + SEQ//$NON-NLS-1$
- + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE
- + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA + API_NAME_ID
- + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID + CommonConstants.COMMA
- + TID + CommonConstants.COMMA + ARGUMENT + CommonConstants.COMMA + RETURN
- + CommonConstants.COMMA + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
- + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA + CALLER_PC_ADDRESS
- + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
- + TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s'";//$NON-NLS-1$ //$NON-NLS-2$
-
@Override
public String getTableName() {
return TABLENAME;
}
public NetworkAPIDBManager() {
- addColumn(new DBColumn(SEQ, DBConstants.PRIMARY_KEY, DBConstants.LONG));
- addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
- addColumn(new DBColumn(FD_VALUE, DBConstants.NOT_NULL, DBConstants.TEXT));
- addColumn(new DBColumn(API_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(API_NAME_ID, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(ERRNO, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(TID, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(ARGUMENT, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
- addColumn(new DBColumn(RETURN, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
- addColumn(new DBColumn(BYTE_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(PAYLOAD, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
- addColumn(new DBColumn(API_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(CALLER_PC_ADDRESS, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(LIB_NAME, DBConstants.NOT_NULL, DBConstants.INTEGER));
- setIndexColumn(DB_API_TIME_INDEX);
}
public void insert(List<List<Object>> insetData) {
insertData(insetData);
}
- public List<NetworkAPIType> selectAPISeries(double visibleStartTime, double visibleEndTime) {
- double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
- double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
- String query = String.format(SELECT_API_SERIES_QUERY, selectStartTime, selectEndTime);
- ResultSet rs = SqlConnectionManager.executeQueryRS(query);
- if (rs == null) {
- SqlConnectionManager.releaseResultSet(rs);
- return null;
- }
- List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
- try {
- while (rs.next()) {
- NetworkAPIType data = new NetworkAPIType();
- data.setSeq(rs.getLong(DB_SEQ_INDEX + 1));
- data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESS_INDEX + 1));
- data.setFdStr(rs.getString(DB_FD_VALUE_INDEX + 1));
- data.setTime(rs.getLong(DB_API_TIME_INDEX + 1));
- data.setApiId(rs.getInt(DB_API_NAME_ID_INDEX + 1));
- data.setErrNo(rs.getLong(DB_ERRNO_INDEX + 1));
- returnValue.add(data);
- }
- SqlConnectionManager.releaseResultSet(rs);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return returnValue;
- }
-
- public List<NetworkAPIType> selectAPITable(String address, String fd, boolean isParentChart) {
- String query = String.format(SELECT_API_TABLE_CHILD_QUERY, address.trim(), fd.trim());
- if (isParentChart) {
- query = String.format(SELECT_API_TABLE_PARENT_QUERY, address.trim());
- }
-
- ResultSet rs = SqlConnectionManager.executeQueryRS(query);
- if (rs == null) {
- SqlConnectionManager.releaseResultSet(rs);
- return null;
- }
- List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
- try {
- while (rs.next()) {
- NetworkAPIType data = new NetworkAPIType();
- data.setSeq(rs.getLong(DB_SEQ_INDEX + 1));
- data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESS_INDEX + 1));
- data.setFdStr(rs.getString(DB_FD_VALUE_INDEX + 1));
- data.setTime(rs.getLong(DB_API_TIME_INDEX + 1));
- data.setApiId(rs.getInt(DB_API_NAME_ID_INDEX + 1));
- data.setErrNo(rs.getLong(DB_ERRNO_INDEX + 1));
- data.setPid(rs.getInt(DB_PID_INDEX + 1));
- data.setTid(rs.getInt(DB_TID_INDEX + 1));
- data.setArgs(rs.getString(DB_ARGUMENT_INDEX + 1));
- data.setReturn(rs.getString(DB_RETURN_INDEX + 1));
- data.setPacketMessageSize(rs.getInt(DB_BYTE_SIZE_INDEX + 1));
- data.setPacketMessage(rs.getString(DB_PAYLOAD_INDEX + 1));
- data.setFdApiType(rs.getInt(DB_API_TYPE_INDEX + 1));
- data.setCallerAddress(rs.getLong(DB_CALLER_PC_ADDRESS_INDEX + 1));
- data.setBinaryId(rs.getInt(DB_LIB_NAME_INDEX + 1));
- returnValue.add(data);
- }
- SqlConnectionManager.releaseResultSet(rs);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return returnValue;
- }
-
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
boolean isPrepared = true;
isPrepared = false;
} else {
try {
- prep.setLong(DB_SEQ_INDEX + 1, (Long) (rowData.get(DB_SEQ_INDEX)));
- prep.setString(DB_DESTINATION_ADDRESS_INDEX + 1,
- (String) (rowData.get(DB_DESTINATION_ADDRESS_INDEX)));
- prep.setString(DB_FD_VALUE_INDEX + 1, (String) (rowData.get(DB_FD_VALUE_INDEX)));
- prep.setLong(DB_API_TIME_INDEX + 1, (Long) (rowData.get(DB_API_TIME_INDEX)));
- prep.setInt(DB_API_NAME_ID_INDEX + 1, (Integer) (rowData.get(DB_API_NAME_ID_INDEX)));
- prep.setLong(DB_ERRNO_INDEX + 1, (Long) (rowData.get(DB_ERRNO_INDEX)));
- prep.setInt(DB_PID_INDEX + 1, (Integer) (rowData.get(DB_PID_INDEX)));
- prep.setInt(DB_TID_INDEX + 1, (Integer) (rowData.get(DB_TID_INDEX)));
- prep.setString(DB_ARGUMENT_INDEX + 1, (String) (rowData.get(DB_ARGUMENT_INDEX)));
- prep.setString(DB_RETURN_INDEX + 1, (String) (rowData.get(DB_RETURN_INDEX)));
- prep.setInt(DB_BYTE_SIZE_INDEX + 1, (Integer) (rowData.get(DB_BYTE_SIZE_INDEX)));
- prep.setString(DB_PAYLOAD_INDEX + 1, (String) (rowData.get(DB_PAYLOAD_INDEX)));
- prep.setInt(DB_API_TYPE_INDEX + 1, (Integer) (rowData.get(DB_API_TYPE_INDEX)));
- prep.setLong(DB_CALLER_PC_ADDRESS_INDEX + 1,
- (Long) (rowData.get(DB_CALLER_PC_ADDRESS_INDEX)));
- prep.setInt(DB_LIB_NAME_INDEX + 1, (Integer) (rowData.get(DB_LIB_NAME_INDEX)));
-
+ int selectIndex = 0;
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
}
NetworkDataManager.getInstance().getAPIDBManger().insert(insetApiSeriesData);
destinationApiSeriesList.removeAll(removeEventQueue);
-
}
private void addFailedAPIData(NetworkData logs) {
package org.tizen.dynamicanalyzer.ui.network.data;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.tizen.dynamicanalyzer.common.DALimit;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.database.DBQueryXMLParser;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class NetworkDataManager extends PageDataManager {
public final static int MAX_CHART_TIME = 999999999;
private int chartCount = 0;
private int accessSeriesSize = 0;
+ private String networkSeriesChartSelectQuery = CommonConstants.EMPTY;
+ private String networkSeriesChartSelectPidQuery = CommonConstants.EMPTY;
+
public NetworkDataManager() {
networkDataMaker = new NetworkDataMaker();
-
apiDBManager = new NetworkAPIDBManager();
seriesDBManager = new NetworkSeriesDBManager();
}
chartCount = 0;
accessSeriesSize = 0;
networkDataMaker.clear();
+
+ networkSeriesChartSelectQuery = DBQueryXMLParser
+ .getQuery("NETWORK_SERIES_CHART_SELECT_QUERY");
+ networkSeriesChartSelectPidQuery = DBQueryXMLParser
+ .getQuery("NETWORK_SERIES_CHART_SELECT_PID_QUERY");
}
public LinkedHashMap<String, String> getCheckStatusSeries() {
return;
}
if (seriesList.size() == 0) {
- seriesList = seriesDBManager.select(0, MAX_CHART_TIME);
+ seriesList = select(0, MAX_CHART_TIME);
}
}
+ public List<NetworkSeriesType> select(double visibleStartTime, double visibleEndTime) {
+ String selectQuery = networkSeriesChartSelectQuery;
+ int selectedPid = ToolbarArea.getInstance().getSelectedPid();
+ if (selectedPid != 0) {
+ selectQuery = String.format(networkSeriesChartSelectPidQuery, selectedPid);
+ }
+
+ double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
+ double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
+ String query = String.format(selectQuery, selectStartTime, selectEndTime);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return null;
+ }
+
+ List<NetworkSeriesType> statusSeriesList = new ArrayList<NetworkSeriesType>();
+ try {
+ while (rs.next()) {
+ NetworkSeriesType data = new NetworkSeriesType();
+ int selectIndex = 1;
+ data.setRid(rs.getInt(selectIndex++));
+ data.setDestinationAddress(rs.getString(selectIndex++));
+ data.setFdValue(rs.getString(selectIndex++));
+ data.setStartTime(rs.getLong(selectIndex++));
+ data.setEndTime(rs.getLong(selectIndex++));
+ data.setAPIType(rs.getInt(selectIndex++));
+ data.setApiID(rs.getInt(selectIndex++));
+ data.setpId(rs.getInt(selectIndex++));
+ statusSeriesList.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return statusSeriesList;
+
+ }
+
public void stopProcess() {
if (null == seriesList || null == seriesDBManager) {
return;
/*** make network data thread ***/
@Override
protected void makeData(LogPackage pack) {
-// try {
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
- if (null != logs && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
+ // try {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
+ if (null != logs && logs.getRawLogs().size() != 0) {
+ List<LogData> inputs = logs.getLogs();
- networkDataMaker.makeData(inputs);
- }
-// } catch (Exception e) {
-// Logger.error("exception network updateView");
-// }
+ networkDataMaker.makeData(inputs);
+ }
+ // } catch (Exception e) {
+ // Logger.error("exception network updateView");
+ // }
}
}
package org.tizen.dynamicanalyzer.ui.network.data;
import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.database.DBColumn;
-import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
-import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class NetworkSeriesDBManager extends DBTable {
private static final String TABLENAME = " NETWORK_SERIES"; //$NON-NLS-1$
- public static final String RID = "RID";
- public static final String DESTINATION_ADDRESS = "DESTINATION_ADDRESS"; //$NON-NLS-1$
- public static final String FD_VALUE = "FD_VALUE"; //$NON-NLS-1$
- public static final String START_TIME = "START_TIME"; //$NON-NLS-1$
- public static final String END_TIME = "END_TIME"; //$NON-NLS-1$
- public static final String STATUS_TYPE = "STATUS_TYPE"; //$NON-NLS-1$
- public static final String API_ID = DBConstants.COMMON_COLUMN_ID;
- public static final String PID = DBConstants.COMMON_COLUMN_PID;
-
- public final static int DB_RID_INDEX = 0;
- public final static int DB_DESTINATION_ADDRESSINDEX = 1;
- public final static int DB_FD_VALUE_INDEX = 2;
- public final static int DB_START_TIME_INDEX = 3;
- public final static int DB_END_TIME_INDEX = 4;
- public final static int DB_STATUS_TYPE_INDEX = 5;
- public final static int DB_API_ID_INDEX = 6;
- public final static int DB_PID_INDEX = 7;
-
- private static final String SELECT_QUERY = "select " + RID + CommonConstants.COMMA
- + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + START_TIME + CommonConstants.COMMA + END_TIME + CommonConstants.COMMA + STATUS_TYPE
- + CommonConstants.COMMA + API_ID + CommonConstants.COMMA + PID + " from " + TABLENAME; //$NON-NLS-1$
-
- private static final String SELECT_PID_QUERY = "select " + RID + CommonConstants.COMMA
- + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + START_TIME + CommonConstants.COMMA + END_TIME + CommonConstants.COMMA + STATUS_TYPE
- + CommonConstants.COMMA + API_ID + CommonConstants.COMMA + PID
- + " from " + TABLENAME + " where pid = '%s'"; //$NON-NLS-1$
private static int rid = 0;
}
public NetworkSeriesDBManager() {
- addColumn(new DBColumn(RID, DBConstants.PRIMARY_KEY, DBConstants.INTEGER));
- addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL, DBConstants.TEXT));
- addColumn(new DBColumn(FD_VALUE, DBConstants.NOT_NULL, DBConstants.TEXT));
- addColumn(new DBColumn(START_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(END_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(STATUS_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(API_ID, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
rid = 0;
}
insertData(insertDataList);
}
- public List<NetworkSeriesType> select(double visibleStartTime, double visibleEndTime) {
- String selectQuery = SELECT_QUERY;
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (selectedPid != 0) {
- selectQuery = String.format(SELECT_PID_QUERY, selectedPid);
- }
-
- double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
- double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
- String query = String.format(selectQuery, selectStartTime, selectEndTime);
- ResultSet rs = SqlConnectionManager.executeQueryRS(query);
- if (rs == null) {
- SqlConnectionManager.releaseResultSet(rs);
- return null;
- }
-
- List<NetworkSeriesType> statusSeriesList = new ArrayList<NetworkSeriesType>();
- try {
- while (rs.next()) {
- NetworkSeriesType data = new NetworkSeriesType();
- data.setRid(rs.getInt(DB_RID_INDEX + 1));
- data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESSINDEX + 1));
- data.setFdValue(rs.getString(DB_FD_VALUE_INDEX + 1));
- data.setStartTime(rs.getLong(DB_START_TIME_INDEX + 1));
- data.setEndTime(rs.getLong(DB_END_TIME_INDEX + 1));
- data.setAPIType(rs.getInt(DB_STATUS_TYPE_INDEX + 1));
- data.setApiID(rs.getInt(DB_API_ID_INDEX + 1));
- data.setpId(rs.getInt(DB_PID_INDEX + 1));
- statusSeriesList.add(data);
- }
- SqlConnectionManager.releaseResultSet(rs);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return statusSeriesList;
-
- }
-
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
boolean isPrepared = true;
isPrepared = false;
} else {
try {
- prep.setInt(DB_RID_INDEX + 1, (Integer) (rowData.get(DB_RID_INDEX)));
- prep.setString(DB_DESTINATION_ADDRESSINDEX + 1,
- (String) (rowData.get(DB_DESTINATION_ADDRESSINDEX)));
- prep.setString(DB_FD_VALUE_INDEX + 1, (String) (rowData.get(DB_FD_VALUE_INDEX)));
- prep.setLong(DB_START_TIME_INDEX + 1, (Long) (rowData.get(DB_START_TIME_INDEX)));
- prep.setLong(DB_END_TIME_INDEX + 1, (Long) (rowData.get(DB_END_TIME_INDEX)));
- prep.setInt(DB_STATUS_TYPE_INDEX + 1, (Integer) (rowData.get(DB_STATUS_TYPE_INDEX)));
- prep.setInt(DB_API_ID_INDEX + 1, (Integer) (rowData.get(DB_API_ID_INDEX)));
- prep.setInt(DB_PID_INDEX + 1, (Integer) (rowData.get(DB_PID_INDEX)));
+ int selectIndex = 0;
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setString(selectIndex + 1, (String) (rowData.get(selectIndex++)));
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setLong(selectIndex + 1, (Long) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
+ prep.setInt(selectIndex + 1, (Integer) (rowData.get(selectIndex++)));
} catch (SQLException e) {
e.printStackTrace();
}
return isPrepared;
}
-
}
+
+
import java.util.List;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkSeriesDBManager;
public class NetworkSeriesType {
public final static int STATUS_TYPE_OPEN = 0;
}
public NetworkSeriesType(List<Object> data) {
- setRid((Integer) data.get(NetworkSeriesDBManager.DB_RID_INDEX));
- setDestinationAddress((String) data.get(NetworkSeriesDBManager.DB_DESTINATION_ADDRESSINDEX));
- setFdValue((String) data.get(NetworkSeriesDBManager.DB_FD_VALUE_INDEX));
- setStartTime((Long) data.get(NetworkSeriesDBManager.DB_START_TIME_INDEX));
- setEndTime((Long) data.get(NetworkSeriesDBManager.DB_END_TIME_INDEX));
- setAPIType((Integer) data.get(NetworkSeriesDBManager.DB_STATUS_TYPE_INDEX));
- setApiID((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
- setpId((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
+ int index = 0;
+ setRid((Integer) data.get(index++));
+ setDestinationAddress((String) data.get(index++));
+ setFdValue((String) data.get(index++));
+ setStartTime((Long) data.get(index++));
+ setEndTime((Long) data.get(index++));
+ setAPIType((Integer) data.get(index++));
+ setApiID((Integer) data.get(index++));
+ setpId((Integer) data.get(index++));
}
public int getRid() {
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.database.DBQueryXMLParser;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.WidgetLabels;
import org.tizen.dynamicanalyzer.project.Project;
} else {
return;
}
-
OpenTraceProgressManager.getInstance().setSavePath(openPath);
OpenTraceProgressManager.getInstance().startOpenTraceThread();
shell.dispose();
device = project.getDevice();
application = project.getAppName();
elapsedTime = project.getTotalStopTime();
+ DBQueryXMLParser.initQueryMap(project.getVersion());
return isSuccess;
}
}
}
private String getCreateTime(String path) {
- isVaildVersion = true;
+ isVaildVersion = false;
Project project = Project.getProjectInfoFromFile(path);
-
String version = project.getVersion();
- if (null != version
- && (version.isEmpty() || !version
- .equals(AnalyzerConstants.CURRENT_SAVE_FORMAT_VERSION))) {
- isVaildVersion = false;
- } else {
- isVaildVersion = true;
+ String[] vaildVersions = AnalyzerConstants.SUPPORTED_SAVE_FORMAT_VERSION;
+ if (null != version && !version.isEmpty()) {
+ for (int i = 0; i < vaildVersions.length; i++) {
+ if (vaildVersions[i].equals(version)) {
+ isVaildVersion = true;
+ }
+ }
}
return project.getCreateTime();
}