use of com.att.aro.core.configuration.pojo.Profile in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysis method performTimeRangeAnalysis.
/**
* Performs a TimeRangeAnalysis on the trace data.
* @param analysisData Packet analyzer result object
*/
private void performTimeRangeAnalysis(PacketAnalyzerResult analysisData) {
if (analysisData != null) {
List<RrcStateRange> rrcCollection = analysisData.getStatemachine().getStaterangelist();
List<PacketInfo> packets = analysisData.getTraceresult().getAllpackets();
if (controller != null) {
PacketAnalyzerImpl packetAnalyzerImpl = (PacketAnalyzerImpl) (controller.getAROService().getAnalyzer());
packets = packetAnalyzerImpl.filterPackets(analysisData.getFilter(), packets);
}
Profile profile = analysisData.getProfile();
int packetNum = packets.size();
for (int i = 0; i < packetNum; i++) {
PacketInfo packetInfo = packets.get(i);
if ((!ipv4Present || !ipv6Present) && packetInfo.getPacket() instanceof IPPacket) {
IPPacket p = (IPPacket) packetInfo.getPacket();
if (p.getIPVersion() == 4) {
ipv4Present = true;
} else if (p.getIPVersion() == 6) {
ipv6Present = true;
}
}
if (!tcpPresent && packetInfo.getPacket() instanceof TCPPacket) {
tcpPresent = true;
} else if ((!udpPresent || !dnsPresent) && packetInfo.getPacket() instanceof UDPPacket) {
UDPPacket p = (UDPPacket) packetInfo.getPacket();
udpPresent = true;
if (p.isDNSPacket()) {
dnsPresent = true;
}
}
if (packetInfo.getTimeStamp() >= startTime && packetInfo.getTimeStamp() <= endTime) {
payloadLen += packetInfo.getPayloadLen();
totalBytes += packetInfo.getLen();
if (packetInfo.getDir().equals(PacketDirection.UPLINK)) {
uplinkBytes += packetInfo.getLen();
} else if (packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
downlinkBytes += packetInfo.getLen();
}
}
}
int collectionSize = rrcCollection.size();
for (int i = 0; i < collectionSize; i++) {
double beginTime;
double endTime;
RrcStateRange rrc = rrcCollection.get(i);
if (rrc.getEndTime() < this.startTime) {
continue;
}
if (rrc.getBeginTime() > this.endTime) {
continue;
}
if (rrc.getBeginTime() >= this.startTime) {
beginTime = rrc.getBeginTime();
} else {
beginTime = this.startTime;
}
if (rrc.getEndTime() <= this.endTime) {
endTime = rrc.getEndTime();
} else {
endTime = this.endTime;
}
RRCState rrcState = rrc.getState();
rrcEnergy += updateEnergy(analysisData, profile, beginTime, endTime, rrcState);
activeTime += updateActiveTime(profile, beginTime, endTime, rrcState);
}
}
}
use of com.att.aro.core.configuration.pojo.Profile in project VideoOptimzer by attdevsupport.
the class ConfigurationFrame method saveConfigurationData.
/**
* Implements the functionality of Save menu item.
*/
private boolean saveConfigurationData() {
synchronized (tableModel) {
try {
Profile profile = tableModel.getProfile();
if (profile.getName() != null) {
// Make sure current editor is closed
TableCellEditor networkAttrEditor = networkAttributesTable.getCellEditor();
TableCellEditor deviceAttrEditor = deviceAttributesTable.getCellEditor();
if (networkAttrEditor != null) {
networkAttrEditor.stopCellEditing();
}
if (deviceAttrEditor != null) {
deviceAttrEditor.stopCellEditing();
}
saveProfile(null, profile);
setProfile(profile);
return true;
}
} catch (ProfileException e) {
handleProfileException(e);
} catch (IOException e) {
LOG.error("IOException saving profile", e);
MessageDialogFactory dialog = new MessageDialogFactory();
dialog.showUnexpectedExceptionDialog(ConfigurationFrame.this, e);
}
return false;
}
}
use of com.att.aro.core.configuration.pojo.Profile in project VideoOptimzer by attdevsupport.
the class ConfigurationFrame method saveAsConfigurationData.
/**
* Implements the functionality of Save As menu item.
*/
private boolean saveAsConfigurationData() {
synchronized (tableModel) {
JFileChooser fileChooser = new JFileChooser(UserPreferencesFactory.getInstance().create().getLastProfileDirectory());
fileChooser.setDialogTitle(DEFAULTBUNDLE.getString("configuration.savefile"));
fileChooser.setMultiSelectionEnabled(false);
int returnVal = fileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
try {
File file = fileChooser.getSelectedFile();
if (file.exists() && MessageDialogFactory.showConfirmDialog(this, DEFAULTBUNDLE.getString("configuration.fileExists"), DEFAULTBUNDLE.getString("configuration.confirm"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
return false;
}
// Make sure current editor is closed
TableCellEditor networkAttrEditor = networkAttributesTable.getCellEditor();
TableCellEditor deviceAttrEditor = deviceAttributesTable.getCellEditor();
if (networkAttrEditor != null) {
networkAttrEditor.stopCellEditing();
}
if (deviceAttrEditor != null) {
deviceAttrEditor.stopCellEditing();
}
Profile profile = tableModel.getProfile();
saveProfile(file, profile);
setProfile(profile);
return true;
} catch (IOException ioException) {
MessageDialogFactory dialog = new MessageDialogFactory();
dialog.showUnexpectedExceptionDialog(ConfigurationFrame.this, ioException);
} catch (ProfileException profileException) {
handleProfileException(profileException);
}
}
return false;
}
}
use of com.att.aro.core.configuration.pojo.Profile in project VideoOptimzer by attdevsupport.
the class ConfigurationFrame method setProfile.
/**
* Sets the profile selected from the list of device profiles that appears
* on the dialog which gets displayed when we click the open menu item. The
* table data in the configuration dialog gets updated when we change the
* Profile.
*
* @param profile
* The profile to be set to the dialog.
*/
private void setProfile(Profile chosenProfile) {
String name;
Profile profile = chosenProfile;
synchronized (factory) {
if (profile == null) {
profile = factory.createLTEdefault();
name = "lte";
} else {
name = profile.getName();
}
if (name == null) {
name = "";
}
setTitle(MessageFormat.format(DEFAULTBUNDLE.getString("configuration.title"), ApplicationConfig.getInstance().getAppShortName(), name));
tableModel.setProfile(profile);
}
}
use of com.att.aro.core.configuration.pojo.Profile in project VideoOptimzer by attdevsupport.
the class ProfileManager method getProfile.
/**
* Loads the profile that is stored in the specified file.
*
* @param file
* The profile file to load.
*
* @return A Profile object containing the profile, or null, if the profile
* file is not found.
*
* @throws java.io.IOException
* An unexpected exception that occurs when there is an error
* reading the profile.
*
* @throws ProfileException
*/
public Profile getProfile(File file) throws FileNotFoundException, IOException, ProfileException, IllegalArgumentException {
Profile result = createFromFile(file);
UserPreferences userPreferences = UserPreferencesFactory.getInstance().create();
userPreferences.setLastProfile(result);
userPreferences.setLastProfileDirectory(file.getParentFile());
return result;
}
Aggregations