Search in sources :

Example 11 with TimeRange

use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.

the class TimeRangeAnalysisDialog method getReanalyzeButton.

/*
	 * Get Reanalyze button
	 */
private JButton getReanalyzeButton() {
    if (reanalyzeButton == null) {
        reanalyzeButton = new JButton();
        reanalyzeButton.setText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button"));
        reanalyzeButton.setToolTipText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button.tooltip"));
        reanalyzeButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                double startTime;
                double endTime;
                try {
                    startTime = getTimeValue(startTimeTextField);
                    endTime = getTimeValue(endTimeTextField);
                } catch (NumberFormatException e) {
                    MessageDialogFactory.getInstance().showErrorDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.numberError"));
                    return;
                }
                double timeRangeEndTime = Double.valueOf(doubleToFixedDecimal(traceEndTime, 3));
                if (startTime < endTime) {
                    if (startTime >= 0.0 && startTime <= endTime && endTime <= timeRangeEndTime) {
                        if (!updateCurrentfilter()) {
                            return;
                        }
                        AnalysisFilter filter = currentTraceResult.getFilter();
                        filter.setTimeRange(new TimeRange(startTime, endTime));
                        ((MainFrame) parent).updateFilter(filter);
                        dispose();
                    } else {
                        String strErrorMessage = MessageFormat.format(resourceBundle.getString("timerangeanalysis.rangeError"), 0.00, doubleToFixedDecimal(traceEndTime, 3));
                        MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
                    }
                } else {
                    String strErrorMessage = resourceBundle.getString("timerangeanalysis.startTimeError");
                    MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
                }
            }
        });
    }
    return reanalyzeButton;
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) JButton(javax.swing.JButton)

Example 12 with TimeRange

use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.

the class ExcludeTimeRangeAnalysisDialog method getOKButton.

/**
 * Initializes and returns the start button
 */
private JButton getOKButton() {
    if (startButton == null) {
        startButton = new JButton();
        startButton.setText(ResourceBundleHelper.getMessageString(DialogItem.Button_ok));
        startButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                double startTime;
                double endTime;
                try {
                    startTime = getTimeValue(startTimeTextField);
                    endTime = getTimeValue(endTimeTextField);
                } catch (NumberFormatException e) {
                    MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_numberError));
                    return;
                }
                double timeRangeEndTime = Double.valueOf(DECIMAL_FORMAT.format(traceEndTime));
                if (startTime < endTime) {
                    if ((startTime >= 0.0) && (startTime <= endTime) && endTime <= timeRangeEndTime) {
                        AnalysisFilter filter = ((MainFrame) parent).getController().getTheModel().getAnalyzerResult().getFilter();
                        filter.setTimeRange(new TimeRange(startTime, endTime));
                        if (!hasDataAfterFiltering(filter)) {
                            MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_noResultDataError));
                        } else {
                            ((MainFrame) parent).updateFilter(filter);
                            dispose();
                        }
                    } else {
                        String strErrorMessage = MessageFormat.format(ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_rangeError), 0.00, DECIMAL_FORMAT.format(timeRangeEndTime));
                        MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
                    }
                } else {
                    String strErrorMessage = ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_startTimeError);
                    MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
                }
            }
        });
    }
    return startButton;
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) JButton(javax.swing.JButton) MainFrame(com.att.aro.ui.view.MainFrame)

Example 13 with TimeRange

use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.

the class GraphPanel method filterFlowTable.

// In 4.1.1, the method called refreshGraph()
public void filterFlowTable() {
    AROTraceData filteredSessionTraceData = getTraceData();
    double filteredStartTime = 0.0;
    double filteredEndTime = 0.0;
    double filteredDuration = filteredSessionTraceData.getAnalyzerResult().getTraceresult().getTraceDuration();
    List<Session> tcpsessionsList = new ArrayList<Session>();
    if (getTraceData() == null) {
        return;
    } else {
        TCPUDPFlowsTableModel model = (TCPUDPFlowsTableModel) parent.getJTCPFlowsTable().getModel();
        Map<String, Session> subSessionMap = model.getSessionMap();
        Map<String, Boolean> subcheckboxMap = model.getCheckboxMap();
        for (Map.Entry<String, Boolean> entry : subcheckboxMap.entrySet()) {
            if (entry.getValue()) {
                tcpsessionsList.add(subSessionMap.get(entry.getKey()));
            }
        }
        filteredSessionTraceData.getAnalyzerResult().setSessionlist(tcpsessionsList);
    }
    List<PacketInfo> packetsForSelectedSession = new ArrayList<PacketInfo>();
    for (Session tcpSession : tcpsessionsList) {
        if (tcpSession.getTcpPackets() != null) {
            packetsForSelectedSession.addAll(tcpSession.getTcpPackets());
        }
    }
    // when generating graph, make sure session is ordered by time stamp
    Collections.sort(packetsForSelectedSession, new Comparator<PacketInfo>() {

        @Override
        public int compare(PacketInfo p1, PacketInfo p2) {
            return (int) (p1.getTimeStamp() * 1000 - p2.getTimeStamp() * 1000);
        }
    });
    boolean selectedAllPackets = false;
    // Adding the TCP packets to the trace for getting redoing the analysis
    if (packetsForSelectedSession.size() > 0) {
        if (tcpsessionsList.size() == getAllTcpSessions()) {
            // For select all use all exiting packets
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(getAllPackets());
            selectedAllPackets = true;
        } else {
            // Collections.sort(packetsForSelectedSession);//?
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(packetsForSelectedSession);
        }
    }
    if (selectedAllPackets) {
        filteredStartTime = -0.01;
        filteredEndTime = filteredDuration;
    } else {
        int index = 0;
        for (Session tcpSession : tcpsessionsList) {
            if (tcpSession.getTcpPackets().size() != 0) {
                if (index == 0) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredStartTime > tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredEndTime < tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                index++;
            }
        }
        if (index == 0) {
            filteredStartTime = 0.0;
            filteredEndTime = 0.0;
        }
    }
    // for Analysis data particular time of the graph, some number is not clear..
    if (filteredStartTime > 0) {
        // adjust the time line axis number
        filteredStartTime = filteredStartTime - 2;
        if (filteredStartTime < 0) {
            filteredStartTime = -0.01;
        }
    }
    if (filteredStartTime < 0) {
        filteredStartTime = -0.01;
    }
    if (!selectedAllPackets) {
        if (filteredEndTime > 0) {
            // adjust the time line axis number
            filteredEndTime = filteredEndTime + 15;
        }
        if (filteredEndTime > filteredDuration) {
            filteredEndTime = filteredDuration;
        }
    }
    this.startTime = filteredStartTime;
    this.endTime = filteredEndTime;
    if (getTraceData() != null) {
        TimeRange timeRange = new TimeRange(filteredStartTime, filteredEndTime);
        AnalysisFilter filter = filteredSessionTraceData.getAnalyzerResult().getFilter();
        filter.setTimeRange(timeRange);
        filteredSessionTraceData.getAnalyzerResult().setFilter(filter);
        Statistic stat = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class).getStatistic(packetsForSelectedSession);
        long totaltemp = 0;
        for (Session byteCountSession : tcpsessionsList) {
            totaltemp += byteCountSession.getBytesTransferred();
        }
        stat.setTotalByte(totaltemp);
        AbstractRrcStateMachine statemachine = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class).create(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketDuration(), filteredDuration, stat.getTotalByte(), timeRange);
        BurstCollectionAnalysisData burstcollectiondata = new BurstCollectionAnalysisData();
        if (stat.getTotalByte() > 0) {
            burstcollectiondata = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class).analyze(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getUserEvents(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getCpuActivityList().getCpuActivities(), tcpsessionsList);
        }
        filteredSessionTraceData.getAnalyzerResult().getStatistic().setTotalByte(stat.getTotalByte());
        filteredSessionTraceData.getAnalyzerResult().setStatemachine(statemachine);
        filteredSessionTraceData.getAnalyzerResult().setBurstCollectionAnalysisData(burstcollectiondata);
        refresh(filteredSessionTraceData);
    }
}
Also used : TCPUDPFlowsTableModel(com.att.aro.ui.model.diagnostic.TCPUDPFlowsTableModel) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) AROTraceData(com.att.aro.core.pojo.AROTraceData) Point(java.awt.Point) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) Map(java.util.Map) EnumMap(java.util.EnumMap) TreeMap(java.util.TreeMap) IRrcStateMachineFactory(com.att.aro.core.packetanalysis.IRrcStateMachineFactory) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 14 with TimeRange

use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.

the class AROFileMenu method openTraceFolder.

/**
 * Choose a trace folder for direct analysis
 *
 * @param aEvent
 * @param isRecent
 * @return
 */
private void openTraceFolder(ActionEvent aEvent, boolean isRecent) {
    File traceFolder = null;
    Object event = aEvent.getSource();
    if (event instanceof JMenuItem) {
        if ((traceFolder = selectTraceFolder(aEvent, isRecent)) != null) {
            File trj;
            TimeRange timeRange = null;
            if ((trj = new File(traceFolder, "time-range.json")).exists()) {
                try {
                    String jsonData = fileManager.readAllData(trj.getPath());
                    if (!jsonData.contains("\"timeRangeType\" : \"DEFAULT\",")) {
                        JDialog splash = new TransitionDialog(parent.getFrame(), "Time-Range file detected\n", "Preparing to open in Time-Range chooser/editor dialog");
                        TimeRangeEditorDialog dialog;
                        try {
                            if ((dialog = displayTimeRangeEditor(traceFolder, true, splash)) != null && dialog.isContinueWithAnalyze()) {
                                timeRange = dialog.getTimeRange();
                            } else {
                                LOG.debug("Time-Range, Selection cancelled by user");
                                splash.dispose();
                                return;
                            }
                        } catch (Exception e) {
                            LOG.error("Exception in TimeRangeDialog:", e);
                            new MessageDialogFactory().showErrorDialog(null, "Exception in TimeRangeDialog:" + e.getMessage());
                            return;
                        }
                    } else {
                        TraceTimeRange traceTimeRange;
                        if ((traceTimeRange = timeRangeReadWrite.readData(traceFolder)) != null) {
                            if (traceTimeRange.getTimeRangeList().stream().filter(a -> a.getTimeRangeType().equals(TimeRangeType.DEFAULT)).count() > 1) {
                                LOG.error("Too many TimeRanges set to AUTO");
                                MessageDialogFactory.getInstance().showErrorDialog(parent.getFrame(), "Too many TimeRanges set to AUTO, please fix the selections");
                                return;
                            }
                            Optional<TimeRange> optionalTimeRange = traceTimeRange.getTimeRangeList().stream().filter(p -> p.getTimeRangeType().equals(TimeRange.TimeRangeType.DEFAULT)).findFirst();
                            if (optionalTimeRange.isPresent()) {
                                timeRange = optionalTimeRange.get();
                            }
                        }
                    }
                } catch (IOException e) {
                    LOG.error("Problem reading time-range.json", e);
                }
            }
            if (timeRange != null) {
                launchTraceFolderAnalysis(traceFolder, timeRange);
            } else {
                launchTraceFolderAnalysis(traceFolder);
            }
        } else {
            LOG.error("Invalid trace folder selected, no traffic file");
        }
    }
}
Also used : JDialog(javax.swing.JDialog) IFileManager(com.att.aro.core.fileio.IFileManager) TabPanels(com.att.aro.ui.view.SharedAttributesProcesses.TabPanels) ITimeRangeReadWrite(com.att.aro.core.peripheral.ITimeRangeReadWrite) TabPanelCommon(com.att.aro.ui.commonui.TabPanelCommon) IAROPrintable(com.att.aro.ui.commonui.IAROPrintable) PrinterJob(java.awt.print.PrinterJob) Logger(org.apache.log4j.Logger) AROUIIllegalStateException(com.att.aro.ui.exception.AROUIIllegalStateException) TimeRangeType(com.att.aro.core.packetanalysis.pojo.TimeRange.TimeRangeType) GoogleAnalyticsUtil(com.att.aro.core.util.GoogleAnalyticsUtil) AROMenuAdder(com.att.aro.ui.commonui.AROMenuAdder) Map(java.util.Map) MouseAdapter(java.awt.event.MouseAdapter) JFileChooser(javax.swing.JFileChooser) UserPreferences(com.att.aro.core.preferences.UserPreferences) ToolTipManager(javax.swing.ToolTipManager) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) Set(java.util.Set) JMenu(javax.swing.JMenu) KeyEvent(java.awt.event.KeyEvent) MenuListener(javax.swing.event.MenuListener) MissingTraceFiles(com.att.aro.ui.view.menu.file.MissingTraceFiles) PreferencesDialog(com.att.aro.ui.view.menu.file.PreferencesDialog) PrinterException(java.awt.print.PrinterException) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) Optional(java.util.Optional) TimeRangeEditorDialog(com.att.aro.ui.view.menu.file.TimeRangeEditorDialog) ActionListener(java.awt.event.ActionListener) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) ModalityType(java.awt.Dialog.ModalityType) AROPrintablePanel(com.att.aro.ui.commonui.AROPrintablePanel) MessageFormat(java.text.MessageFormat) LinkedHashMap(java.util.LinkedHashMap) OpenPcapFileDialog(com.att.aro.ui.view.menu.file.OpenPcapFileDialog) ADBPathDialog(com.att.aro.ui.view.menu.file.ADBPathDialog) JMenuItem(javax.swing.JMenuItem) UserPreferencesFactory(com.att.aro.core.preferences.UserPreferencesFactory) ResourceBundleHelper(com.att.aro.ui.utils.ResourceBundleHelper) TimeRangeReadWrite(com.att.aro.core.peripheral.impl.TimeRangeReadWrite) JComponent(javax.swing.JComponent) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange) Iterator(java.util.Iterator) Files(java.nio.file.Files) Util(com.att.aro.core.util.Util) TraceDataConst(com.att.aro.core.packetanalysis.pojo.TraceDataConst) SpringContextUtil(com.att.aro.core.SpringContextUtil) IOException(java.io.IOException) ActionEvent(java.awt.event.ActionEvent) ApplicationContext(org.springframework.context.ApplicationContext) MouseEvent(java.awt.event.MouseEvent) File(java.io.File) SharedAttributesProcesses(com.att.aro.ui.view.SharedAttributesProcesses) Paths(java.nio.file.Paths) CrashHandler(com.att.aro.core.util.CrashHandler) MenuEvent(javax.swing.event.MenuEvent) LogManager(org.apache.log4j.LogManager) TimeRangeEditorDialog(com.att.aro.ui.view.menu.file.TimeRangeEditorDialog) IOException(java.io.IOException) AROUIIllegalStateException(com.att.aro.ui.exception.AROUIIllegalStateException) PrinterException(java.awt.print.PrinterException) IOException(java.io.IOException) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) JMenuItem(javax.swing.JMenuItem) File(java.io.File) JDialog(javax.swing.JDialog)

Example 15 with TimeRange

use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.

the class TimeRangeEditorDialog method validateTimeSpan.

private double validateTimeSpan() {
    TimeRange temp = null;
    temp = loadTimeRange(temp);
    return (temp.getEndTime() - temp.getBeginTime());
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange)

Aggregations

TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)21 TraceTimeRange (com.att.aro.core.peripheral.pojo.TraceTimeRange)8 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)7 ArrayList (java.util.ArrayList)5 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)4 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)4 Profile (com.att.aro.core.configuration.pojo.Profile)3 AbstractRrcStateMachine (com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine)3 ApplicationSelection (com.att.aro.core.packetanalysis.pojo.ApplicationSelection)3 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)3 Session (com.att.aro.core.packetanalysis.pojo.Session)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 IOException (java.io.IOException)3 BaseTest (com.att.aro.core.BaseTest)2 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)2 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Set (java.util.Set)2