Search in sources :

Example 6 with Profile

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);
        }
    }
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket) Profile(com.att.aro.core.configuration.pojo.Profile) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket)

Example 7 with Profile

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;
    }
}
Also used : MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) TableCellEditor(javax.swing.table.TableCellEditor) IOException(java.io.IOException) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 8 with Profile

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;
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) MessageDialogFactory(com.att.aro.ui.commonui.MessageDialogFactory) TableCellEditor(javax.swing.table.TableCellEditor) IOException(java.io.IOException) File(java.io.File) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 9 with Profile

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);
    }
}
Also used : Profile(com.att.aro.core.configuration.pojo.Profile)

Example 10 with 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;
}
Also used : UserPreferences(com.att.aro.core.preferences.UserPreferences) Profile(com.att.aro.core.configuration.pojo.Profile)

Aggregations

Profile (com.att.aro.core.configuration.pojo.Profile)21 IOException (java.io.IOException)7 File (java.io.File)4 IProfileFactory (com.att.aro.core.configuration.IProfileFactory)3 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)3 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)3 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)3 MessageDialogFactory (com.att.aro.ui.commonui.MessageDialogFactory)3 ArrayList (java.util.ArrayList)3 Properties (java.util.Properties)3 TableCellEditor (javax.swing.table.TableCellEditor)3 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)2 ProfileType (com.att.aro.core.configuration.pojo.ProfileType)2 EnergyModel (com.att.aro.core.packetanalysis.pojo.EnergyModel)2 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 FileNotFoundException (java.io.FileNotFoundException)2 BaseTest (com.att.aro.core.BaseTest)1 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)1