use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class ExcludeTimeRangeAnalysisDialog method initialize.
/**
* Initializes the dialog.
*
* @return void
*/
private void initialize() {
PacketAnalyzerResult traceresult = ((MainFrame) parent).getController().getTheModel().getAnalyzerResult();
if (traceresult == null) {
LOGGER.error("Trace result error! ");
MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, "wrong..");
} else {
if (endTimeResetValue == 0.0) {
endTimeResetValue = traceresult.getTraceresult().getTraceDuration();
}
traceEndTime = endTimeResetValue;
TimeRange timeRange = traceresult.getFilter().getTimeRange();
if (timeRange != null) {
timeRangeStartTime = timeRange.getBeginTime();
timeRangeEndTime = timeRange.getEndTime();
} else {
timeRangeStartTime = 0.0;
timeRangeEndTime = traceEndTime;
}
}
// For cancel button
saveInitTimeRangeValues(timeRangeStartTime, timeRangeEndTime);
this.setSize(400, 150);
this.setModal(true);
this.setTitle(ResourceBundleHelper.getMessageString(DialogItem.excludetimerangeanalysis_title));
this.setLocationRelativeTo(getOwner());
this.setContentPane(getJDialogPanel());
getRootPane().setDefaultButton(startButton);
new EnableEscKeyCloseDialog(getRootPane(), this);
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange 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();
}
}
}
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange 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);
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method reset.
private void reset(boolean cloneFilter) {
traceEndTime = endTimeResetValue;
startTimeTextField.setText(DECIMAL_FORMAT.format(0.0));
endTimeTextField.setText(doubleToFixedDecimal(endTimeResetValue, 3));
chkIpv4.setSelected(ipv4Selection = initialFilter.isIpv4Sel());
chkIpv6.setSelected(ipv6Selection = initialFilter.isIpv6Sel());
chkTCP.setSelected(tcpSelection = initialFilter.isTcpSel());
chkUdp.setSelected(udpSelection = initialFilter.isUdpSel());
chkDns.setSelected(dnsSelection = initialFilter.isDnsSelection());
currentTraceResult.setFilter(cloneFilter ? cloneFilter(initialFilter) : initialFilter);
currentTraceResult.getFilter().setTimeRange(new TimeRange(initTimeRangeStartTime, initTimeRangeEndTime));
timeRangeAnalysisResultsTextArea.setText("");
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange 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;
}
Aggregations