Search in sources :

Example 11 with AnalysisFilter

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

the class FilterApplicationsAndIpDialog method cloneFilter.

/*
	 * Make a copy of the filter before selection changes 
	 * made update the filter. We can then revert the 
	 * updated filter using this copy when user clicks
	 * the cancel button.
	 */
private void cloneFilter() {
    AnalysisFilter filter = getCurrentPktAnalyzerResult().getFilter();
    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);
    }
    initialFilter = new AnalysisFilter(applications, filter.getTimeRange(), filter.getDomainNames());
    initialFilter.setIpv4Sel(filter.isIpv4Sel());
    initialFilter.setIpv6Sel(filter.isIpv6Sel());
    initialFilter.setIpv6Sel(filter.isTcpSel());
    initialFilter.setUdpSel(filter.isUdpSel());
}
Also used : HashMap(java.util.HashMap) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection)

Example 12 with AnalysisFilter

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

the class FilterApplicationsAndIpDialog method selectionReturnsData.

/*
	 * Compares user selection to trace data to determine 
	 * if all the trace data will be filtered out if user
	 * selection is applied. 
	 */
private boolean selectionReturnsData() {
    AnalysisFilter filter = getCurrentPktAnalyzerResult().getFilter();
    if (!filter.isIpv4Sel() && !filter.isIpv6Sel() && !filter.isTcpSel() && !filter.isUdpSel() && !filter.isDnsSelection()) {
        return false;
    }
    Collection<ApplicationSelection> appSel = filter.getApplicationSelections();
    List<IPAddressSelection> ipSel = new ArrayList<IPAddressSelection>();
    List<IPAddressSelection> ipSelChecked = new ArrayList<IPAddressSelection>();
    for (ApplicationSelection aSel : appSel) {
        ipSel.addAll(aSel.getIPAddressSelections());
    }
    for (IPAddressSelection iSel : ipSel) {
        if (iSel.isSelected()) {
            ipSelChecked.add(iSel);
        }
    }
    if (ipSelChecked.size() == 0) {
        return false;
    }
    List<PacketInfo> packetsInfo = getInitialPktAnalyzerResult().getTraceresult().getAllpackets();
    PacketAnalyzerImpl pktAnalyzer = (PacketAnalyzerImpl) ((MainFrame) parent).getController().getAROService().getAnalyzer();
    if (pktAnalyzer.filterPackets(filter, packetsInfo).size() > 0) {
        return true;
    }
    return false;
}
Also used : PacketAnalyzerImpl(com.att.aro.core.packetanalysis.impl.PacketAnalyzerImpl) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) IPAddressSelection(com.att.aro.core.packetanalysis.pojo.IPAddressSelection)

Example 13 with AnalysisFilter

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

the class AROVideoPlayer method refresh.

/**
 * Refreshes the Video player display using the specified analysis data.
 *
 * @param analysisData
 *            The analysis data that is used to refresh the video.
 * @throws IOException
 */
private void refresh() throws IOException {
    aroAdvancedTab.setVideoPlayer(this);
    // file:/Users/barrynelson/AROTraceAndroid/nt/video.mov
    String mediaUrl = VideoUtil.getMediaUrl(traceFile);
    if (traceFile == null || mediaUrl == null) {
        setVideoNotAvailableImage(true);
        return;
    }
    double videoStartTime = tdResult.getVideoStartTime();
    if (videoStartTime < 0.00001) {
        // checking if the video start time isn't available
        videoStartTime = new FileManagerImpl().getCreatedTime(mediaUrl) * 1000;
    }
    MediaLocator mlr = new MediaLocator(mediaUrl);
    try {
        videoPlayer = Manager.createRealizedPlayer(mlr);
    } catch (NoPlayerException noe) {
        MessageDialogFactory.getInstance().showErrorDialog(new Window(new Frame()), ResourceBundleHelper.getMessageString("video.error.noplayerexception") + noe.getMessage());
        return;
    } catch (IOException ioe) {
        MessageDialogFactory.getInstance().showErrorDialog(new Window(new Frame()), ResourceBundleHelper.getMessageString("video.error.ioexception") + ioe.getMessage());
    } catch (CannotRealizeException cre) {
        MessageDialogFactory.getInstance().showErrorDialog(new Window(new Frame()), ResourceBundleHelper.getMessageString("video.error.cannotrealizeexception") + cre.getMessage());
        return;
    }
    this.videoOffset = videoStartTime > 0.0 ? videoStartTime - ((double) tdResult.getTraceDateTime().getTime() / 1000) : 0.0;
    // Resetting the offset if the offset is longer than the video
    if (Math.abs(videoOffset) >= videoPlayer.getDuration().getSeconds()) {
        videoOffset = 0;
    }
    videoPlayer.setRate(PLAYBACK_RATE);
    setVideoNotAvailableImage(false);
    // This is to turn off plug-in settings on video info window, plugin tab
    Control[] controls = videoPlayer.getControls();
    for (int i = 0; i < controls.length; i++) {
        String strControlName = controls[i].toString();
        if (strControlName.contains("BasicJMD")) {
            Component basicJMDComp = controls[i].getControlComponent();
            if (basicJMDComp.getParent() != null) {
                basicJMDComp.getParent().setVisible(false);
            }
            basicJMDComp.setVisible(false);
        }
    }
    controlComponent = videoPlayer.getControlPanelComponent();
    if (controlComponent != null) {
        controlComponent.setVisible(true);
        aroVideoPanel.add(controlComponent, BorderLayout.SOUTH);
    }
    visualComponent = videoPlayer.getVisualComponent();
    if (visualComponent != null) {
        aroVideoPanel.add(visualComponent, BorderLayout.CENTER);
        visualComponent.setVisible(true);
    }
    videoPlayer.addControllerListener(new ControllerListener() {

        @Override
        public void controllerUpdate(ControllerEvent evt) {
            if (evt instanceof StartEvent || evt instanceof MediaTimeSetEvent) {
                if ((evt instanceof StartEvent) && showInfoMsg && tdResult.isExVideoTimeFileNotFound()) {
                    if (!syncVideoClicked) {
                        MessageDialogFactory.showMessageDialog(AROVideoPlayer.this, "The Analyzer loaded an external video. The video may not be in Sync with the traces.", "Information", 1);
                        showInfoMsg = false;
                    } else {
                        showInfoMsg = false;
                    }
                }
                VideoSyncThread syncThread = new VideoSyncThread(AROVideoPlayer.this, aroAdvancedTab, videoOffset);
                new Thread(syncThread).start();
            }
        }
    });
    setVisible(true);
    if (!tdResult.isNativeVideo()) {
        jButton.setVisible(true);
    }
    aroAdvancedTab.setGraphPanelClicked(false);
    Double startTime = 0.0;
    AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
    if (null != filter) {
        startTime = filter.getTimeRange().getBeginTime();
    }
    setMediaTime(startTime);
}
Also used : Window(java.awt.Window) JFrame(javax.swing.JFrame) MainFrame(com.att.aro.ui.view.MainFrame) Frame(java.awt.Frame) CannotRealizeException(javax.media.CannotRealizeException) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ControllerListener(javax.media.ControllerListener) MediaTimeSetEvent(javax.media.MediaTimeSetEvent) IOException(java.io.IOException) ControllerEvent(javax.media.ControllerEvent) Control(javax.media.Control) MediaLocator(javax.media.MediaLocator) StartEvent(javax.media.StartEvent) Component(java.awt.Component) NoPlayerException(javax.media.NoPlayerException) FileManagerImpl(com.att.aro.core.fileio.impl.FileManagerImpl)

Example 14 with AnalysisFilter

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

the class AROController method propertyChange.

/**
 * Not to be directly called. Triggers a re-analysis if a property change is detected.
 */
@Override
public void propertyChange(PropertyChangeEvent event) {
    Profile profile = null;
    AnalysisFilter filter = null;
    try {
        theView.hideChartItems();
        if (event.getPropertyName().equals("tracePath")) {
            // to filter or not to filter
            String path;
            TimeRange timeRange = null;
            if (event.getNewValue() instanceof TimeRange) {
                timeRange = (TimeRange) event.getNewValue();
                path = timeRange.getPath();
                if (path != null) {
                    filter = new AnalysisFilter(null, timeRange, null);
                } else {
                    LOG.error("Invalid use of TimeRange here, it needs to hold a valid path, to finish creating a filter");
                }
            } else {
                path = (String) event.getNewValue();
                if ((path != null) && (timeRange = checkForDefaultTimeRange((String) event.getNewValue())) != null) {
                    // timeRange contains TimeRangeType.Default, so continue with analysis with filter
                    filter = new AnalysisFilter(null, timeRange, null);
                }
            }
            updateModel(path, profile, filter);
        } else if (event.getPropertyName().equals("profile")) {
            if (theModel.getAnalyzerResult() != null) {
                filter = theModel.getAnalyzerResult().getFilter();
            }
            if (theModel.isSuccess()) {
                updateModel(theModel.getAnalyzerResult().getTraceresult().getTraceDirectory(), (Profile) event.getNewValue(), filter);
            }
        } else if (event.getPropertyName().equals("filter")) {
            if (theModel.getAnalyzerResult() != null) {
                profile = theModel.getAnalyzerResult().getProfile();
            }
            if (theModel.getAnalyzerResult().getTraceresult().getTraceFile() != null && !theModel.getAnalyzerResult().getTraceresult().getTraceFile().equals("")) {
                updateModel(theModel.getAnalyzerResult().getTraceresult().getTraceFile(), profile, (AnalysisFilter) event.getNewValue());
            } else {
                updateModel(theModel.getAnalyzerResult().getTraceresult().getTraceDirectory(), profile, (AnalysisFilter) event.getNewValue());
            }
        }
    } finally {
        if (theModel.getAnalyzerResult() != null) {
            if (theModel.getAnalyzerResult().getStreamingVideoData() == null || theModel.getAnalyzerResult().getStreamingVideoData().isFinished()) {
                theView.showChartItems(HIDE_SHOW_CHARTPLOTOPTIONS);
            } else {
                // turn off chunks plot
                theView.hideChartItems(HIDE_SHOW_CHARTPLOTOPTIONS);
                // show everything that is not otherwise hidden
                theView.showChartItems();
            }
        }
    }
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 15 with AnalysisFilter

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

the class AROController method initializeFilter.

/**
 * <pre>
 * Create an AnalysisFilter
 * Creates default maps of domainNames and applications
 * Combined with the supplied TimeRange or a default TimeRange to create the AnalysisFilter
 *
 * This filter will be stored in the current PacketAnalyzerResult
 *
 * @param timeRangeParam is optional
 */
private void initializeFilter(TimeRange... timeRangeParam) {
    Collection<String> appNames = theModel.getAnalyzerResult().getTraceresult().getAllAppNames();
    Map<String, Set<InetAddress>> map = theModel.getAnalyzerResult().getTraceresult().getAppIps();
    Map<InetAddress, String> domainNames = new HashMap<InetAddress, String>();
    for (Session tcpSession : theModel.getAnalyzerResult().getSessionlist()) {
        if (!domainNames.containsKey(tcpSession.getRemoteIP())) {
            domainNames.put(tcpSession.getRemoteIP(), tcpSession.getDomainName());
        }
    }
    HashMap<String, ApplicationSelection> applications = new HashMap<String, ApplicationSelection>(appNames.size());
    ApplicationSelection appSelection;
    for (String app : appNames) {
        appSelection = new ApplicationSelection(app, map.get(app));
        appSelection.setDomainNames(domainNames);
        for (IPAddressSelection ipAddressSelection : appSelection.getIPAddressSelections()) {
            ipAddressSelection.setDomainName(domainNames.get(ipAddressSelection.getIpAddress()));
        }
        applications.put(app, appSelection);
    }
    TimeRange timeRange = timeRangeParam != null && timeRangeParam.length == 1 && timeRangeParam[0] != null ? timeRangeParam[0] : null;
    if (timeRange == null) {
        timeRange = new TimeRange(0.0, theModel.getAnalyzerResult().getTraceresult().getTraceDuration());
    }
    AnalysisFilter initFilter = new AnalysisFilter(applications, timeRange, domainNames);
    currentTraceInitialAnalyzerResult = theModel.getAnalyzerResult();
    currentTraceInitialAnalyzerResult.setFilter(initFilter);
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) TraceTimeRange(com.att.aro.core.peripheral.pojo.TraceTimeRange) IPAddressSelection(com.att.aro.core.packetanalysis.pojo.IPAddressSelection) InetAddress(java.net.InetAddress) Session(com.att.aro.core.packetanalysis.pojo.Session)

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