Search in sources :

Example 16 with AnalysisFilter

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

the class TimeRangeAnalysisDialog method cloneFilter.

private AnalysisFilter cloneFilter(AnalysisFilter filter) {
    Collection<ApplicationSelection> appSel = filter.getApplicationSelections();
    HashMap<String, ApplicationSelection> applications = new HashMap<String, ApplicationSelection>(appSel.size());
    for (ApplicationSelection aSel : appSel) {
        ApplicationSelection clonedAP = new ApplicationSelection(aSel);
        applications.put(clonedAP.getAppName(), clonedAP);
    }
    TimeRange clonedTimeRange = null;
    if (filter.getTimeRange() != null) {
        TimeRange original = filter.getTimeRange();
        clonedTimeRange = new TimeRange(original.getTitle(), original.getTimeRangeType(), original.getBeginTime(), original.getEndTime());
    }
    AnalysisFilter clonedFilter = new AnalysisFilter(applications, clonedTimeRange, filter.getDomainNames() == null ? null : new HashMap<>(filter.getDomainNames()));
    clonedFilter.setIpv4Sel(filter.isIpv4Sel());
    clonedFilter.setIpv6Sel(filter.isIpv6Sel());
    clonedFilter.setTcpSel(filter.isTcpSel());
    clonedFilter.setUdpSel(filter.isUdpSel());
    clonedFilter.setDnsSelection(filter.isDnsSelection());
    return clonedFilter;
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) HashMap(java.util.HashMap) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection)

Example 17 with AnalysisFilter

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

the class TimeRangeAnalysisDialog method updateCurrentfilter.

private boolean updateCurrentfilter() {
    if (ipv4Selection || ipv6Selection) {
        if (tcpSelection || udpSelection || dnsSelection) {
            if (currentTraceResult.getFilter() != null) {
                AnalysisFilter filter = currentTraceResult.getFilter();
                Map<InetAddress, String> domainNames = filter.getDomainNames();
                Map<String, ApplicationSelection> appSelections = new HashMap<>(filter.getAppSelections().size());
                for (ApplicationSelection sel : filter.getAppSelections().values()) {
                    if (domainNames != null) {
                        sel.setDomainNames(domainNames);
                    }
                    appSelections.put(sel.getAppName(), new ApplicationSelection(sel));
                }
                filter.setIpv4Sel(ipv4Selection);
                filter.setIpv6Sel(ipv6Selection);
                filter.setTcpSel(tcpSelection);
                filter.setUdpSel(udpSelection);
                filter.setDnsSelection(dnsSelection);
                return true;
            }
        } else {
            MessageDialogFactory.getInstance().showErrorDialog(this, resourceBundle.getString("filter.noProtocolSelection.error"));
        }
    } else {
        MessageDialogFactory.getInstance().showErrorDialog(this, resourceBundle.getString("filter.noIpSelection.error"));
    }
    return false;
}
Also used : HashMap(java.util.HashMap) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) InetAddress(java.net.InetAddress)

Example 18 with AnalysisFilter

use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter 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 19 with AnalysisFilter

use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter 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 20 with AnalysisFilter

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

the class TemperaturePlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    XYSeries series = new XYSeries(0);
    XYIntervalSeriesCollection thermalDataSeries = new XYIntervalSeriesCollection();
    if (analysis == null) {
        LOGGER.info("analysis data is null");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("didn't get analysis trace data!");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            AnalysisFilter filter = analysis.getAnalyzerResult().getFilter();
            temperatureInfos = traceresult.getTemperatureInfos();
            thermalStatusInfos = traceresult.getThermalstatusInfos();
            NumberAxis axis = new NumberAxis();
            axis.setAutoRange(true);
            // Calculate max and min temperature
            List<Integer> tempLists = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(temperatureInfos)) {
                for (TemperatureEvent bi : temperatureInfos) {
                    series.add(bi.getTimeRecorded(), bi.getcelciusTemperature());
                    tempLists.add(bi.getcelciusTemperature());
                }
                TemperatureEvent last = temperatureInfos.get(temperatureInfos.size() - 1);
                if (filter.getTimeRange() != null) {
                    series.add(filter.getTimeRange().getEndTime().doubleValue(), last.getcelciusTemperature());
                } else {
                    series.add(traceresult.getTraceDuration(), last.getcelciusTemperature());
                }
                XYItemRenderer renderer = plot.getRenderer(0);
                renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                    @Override
                    public String generateToolTip(XYDataset dataset, int series, int item) {
                        return toolTipContent(item);
                    }
                });
                Collections.sort(tempLists);
                axis.setRange(Math.round(tempLists.get(0) / 1.2), Math.round(tempLists.get(tempLists.size() - 1) * 1.2));
                axis.setAutoRange(false);
                plot.setRenderer(0, renderer);
            }
            if (CollectionUtils.isNotEmpty(thermalStatusInfos)) {
                Map<ThermalStatus, XYIntervalSeries> seriesMap = new EnumMap<ThermalStatus, XYIntervalSeries>(ThermalStatus.class);
                for (ThermalStatus tstatus : ThermalStatus.values()) {
                    XYIntervalSeries series2 = new XYIntervalSeries(tstatus);
                    seriesMap.put(tstatus, series2);
                    thermalDataSeries.addSeries(series2);
                }
                Iterator<ThermalStatusInfo> iter = thermalStatusInfos.iterator();
                if (iter.hasNext()) {
                    while (iter.hasNext()) {
                        ThermalStatusInfo info = iter.next();
                        seriesMap.get(info.getThermalStatus()).add(info.getBeginTimeStamp(), info.getBeginTimeStamp(), info.getEndTimeStamp(), 0.5, 0, 100);
                    }
                }
                XYBarRenderer barRenderer = new XYBarRenderer();
                barRenderer.setDrawBarOutline(false);
                barRenderer.setUseYInterval(true);
                barRenderer.setAutoPopulateSeriesPaint(false);
                barRenderer.setShadowVisible(false);
                barRenderer.setGradientPaintTransformer(null);
                barRenderer.setBarPainter(new StandardXYBarPainter());
                setRenderingColorForDataSeries(barRenderer, thermalDataSeries);
                barRenderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                    @Override
                    public String generateToolTip(XYDataset dataset, int series, int item) {
                        ThermalStatus info = (ThermalStatus) thermalDataSeries.getSeries(series).getKey();
                        return MessageFormat.format(ResourceBundleHelper.getMessageString("network.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(info));
                    }
                });
                plot.setRenderer(1, barRenderer);
                plot.setRangeAxis(axis);
            }
        }
        plot.setDataset(0, new XYSeriesCollection(series));
        plot.setDataset(1, thermalDataSeries);
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) NumberAxis(org.jfree.chart.axis.NumberAxis) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) EnumMap(java.util.EnumMap) StandardXYBarPainter(org.jfree.chart.renderer.xy.StandardXYBarPainter) XYBarRenderer(org.jfree.chart.renderer.xy.XYBarRenderer) TemperatureEvent(com.att.aro.core.peripheral.pojo.TemperatureEvent) ThermalStatus(com.att.aro.core.peripheral.pojo.ThermalStatus) ThermalStatusInfo(com.att.aro.core.peripheral.pojo.ThermalStatusInfo) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) XYDataset(org.jfree.data.xy.XYDataset) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Aggregations

AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)23 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)8 ApplicationSelection (com.att.aro.core.packetanalysis.pojo.ApplicationSelection)6 HashMap (java.util.HashMap)5 MainFrame (com.att.aro.ui.view.MainFrame)4 ArrayList (java.util.ArrayList)4 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)3 Session (com.att.aro.core.packetanalysis.pojo.Session)3 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 InetAddress (java.net.InetAddress)3 Map (java.util.Map)3 JButton (javax.swing.JButton)3 BaseTest (com.att.aro.core.BaseTest)2 Profile (com.att.aro.core.configuration.pojo.Profile)2 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)2 TimeRangeAnalysis (com.att.aro.core.packetanalysis.impl.TimeRangeAnalysis)2 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)2