Examples of Device


Examples of nz.co.abrahams.asithappens.storage.Device

       
    }//GEN-LAST:event_resourcesButtonActionPerformed
   
    public void retrieveCommunity() {
        String community;
        Device candidate;
       
        try {
            candidate = new Device(deviceField.getText());
            community = candidate.retrieveReadCommunity();
            if ( community != null ) {
                communityField.setText(community);
            }
        } catch (DBException e) {
        }
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

     * @return               the collector created from the database definition
     */
    public ProcessorUCDCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        ProcessorUCDSNMP snmp;
        long pollInterval;
        int snmpIndex;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

        dialog.setVisible(true);
    }//GEN-LAST:event_setMatchCriteriaButtonActionPerformed
   
    /** Creates a new NetFlow graph. */
    private void netflowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_netflowButtonActionPerformed
        Device device;
        int ifIndex;
        String portString;
        FlowOptions options;
        NetFlowSNMP snmp;
        NetFlowCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        if ( ! portsSelectorPanel.getModel().hasEnumerated() ) {
            ErrorHandler.modalError(this, "Please enumerate ports on a device and select a port",
                    "No port selected");
            return;
        } else if ( portsSelectorPanel.rowsSelected().length == 0 ) {
            ErrorHandler.modalError(this, "Please select a port", "No port selected");
            return;
        }
       
        device = portsSelectorPanel.getModel().getDevice();
        try {
            snmp = new NetFlowSNMP(device);
            if ( snmp.getNetFlowTopFlowsTopNTable() > 0 ) {
                logger.debug("NetFlow Top-N table already exists");
                if ( JOptionPane.showConfirmDialog(this, "A Netflow Top-N table already exists - overwrite this?",
                        "Confirm NetFlow Top-N table creation", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.CANCEL_OPTION)
                    return;
            }
            /*
            ifIndex = device.getPortsIndex()[((JList)(portsPane.getViewport().getView())).getSelectedIndex()];
            portString = (String)((JList)portsPane.getViewport().getView()).getSelectedValue();
             */
            ifIndex = portsSelectorPanel.getIfIndex();
            portString = portsSelectorPanel.getIfDescription();
            options = new FlowOptions(ipProtocolCheckBox.isSelected(), sourceAddressCheckBox.isSelected(),
                    destinationAddressCheckBox.isSelected(), tosCheckBox.isSelected(), sourcePortCheckBox.isSelected(), destinationPortCheckBox.isSelected());
           
            collector = new NetFlowCollector(snmp, ifIndex, portString, directionCombo.getSelectedIndex() + 1, Configuration.getPropertyInt("collector.netflow.table.size"), Integer.parseInt(pollField.getText()) * 1000, criteria, options);
            data = new DataSets(DataType.NETFLOW, collector, device, Integer.parseInt(pollField.getText()) * 1000, portString, directionCombo.getSelectedIndex() + 1, null, storeDataCheckBox.isSelected());
            //data = new DataSets(3, device, Integer.parseInt(pollField.getText()) * 1000, ifIndex, portString, directionCombo.getSelectedIndex() + 1, "NetFlow Graph", storeDataCheckBox.isSelected());
            context = new TimeSeriesContext(data);
            graphFrame = new DataGraph(context);
        } catch (DBException e) {
            ErrorHandler.modalError(this, "Please ensure that database is running and accessible",
                    "Error opening database connection", e);
        } catch (UnknownHostException e) {
            ErrorHandler.modalError(this, "Please ensure that device name \"" + device.getName() + "\" is valid",
                    "Unknown host " + device.getName(), e);
        } catch (SNMPException e) {
            ErrorHandler.modalError(this, "Please ensure that device name and community string are correct",
                    "Cannot access SNMP service on device " + device.getName(), e);
        } catch (ClassCastException e) {
            ErrorHandler.modalError(this, "Please ensure that device supports Netflow MIB Top-N feature",
                    "Cannot find Netflow Top-N information on device " + device.getName(), e);
        }
    }//GEN-LAST:event_netflowButtonActionPerformed
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

        add(portsSelectorPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
    }
   
    /** Creates a new NBAR graph. */
    private void nbarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nbarButtonActionPerformed
        Device device;
        int ifIndex;
        String portString;
        NBARSNMP snmp;
        NBARCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        if ( ! portsSelectorPanel.getModel().hasEnumerated() ) {
            ErrorHandler.modalError(this, "Please enumerate ports on a device and select a port",
                    "No port selected");
            return;
        } else if ( portsSelectorPanel.rowsSelected().length == 0 ) {
            ErrorHandler.modalError(this, "Please select a port", "No port selected");
            return;
        }
       
        device = portsSelectorPanel.getModel().getDevice();
        try {
            /*
            ifIndex = device.getPortsIndex()[((JList)(portsPane.getViewport().getView())).getSelectedIndex()];
            portString = (String)((JList)portsPane.getViewport().getView()).getSelectedValue();
             */
           
            ifIndex = portsSelectorPanel.getIfIndex();
            portString = portsSelectorPanel.getIfDescription();
            snmp = new NBARSNMP(device);
            collector = new NBARCollector(snmp, Integer.parseInt(pollField.getText()) * 1000, ifIndex, portString, directionCombo.getSelectedIndex() + 1, Configuration.getPropertyInt("collector.nbar.table.size"));
            data = new DataSets(DataType.NBAR, collector, device, Integer.parseInt(pollField.getText()) * 1000, portString, directionCombo.getSelectedIndex() + 1, null, storeDataCheckBox.isSelected());
            context = new TimeSeriesContext(data);
            graphFrame = new DataGraph(context);
        } catch (DBException e) {
            ErrorHandler.modalError(null, "Please ensure that database is running and accessible",
                    "Error opening database connection", e);
        } catch (UnknownHostException e) {
            ErrorHandler.modalError(null, "Please ensure that device name \"" + device.getName() + "\" is valid",
                    "Unknown host " + device.getName(), e);
        } catch (SNMPException e) {
            ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                    "Cannot access SNMP service on device " + device.getName(), e);
        }
    }//GEN-LAST:event_nbarButtonActionPerformed
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

     * @return               the collector created from the database definition
     */
    public NBARCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        PortsSelectorSNMP portsSNMP;
        NBARSNMP nbarSNMP;
        long pollInterval;
        int ifIndex;
        String ifDescr;
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

        dataSets.setFinishTime(finishTime);
        try {
            dataSetsDAO = DAOFactory.getDataSetsDAO();
            dataSetDAO = DAOFactory.getDataSetDAO();
            dataSets.setDataType(DataType.types[dataSetsDAO.retrieveSessionDataTypeID(sessionID)]);
            dataSets.setDevice(new Device(dataSetsDAO.retrieveSessionDevice(sessionID)));
            dataSets.setPortString(dataSetsDAO.retrieveSessionPort(sessionID));
            dataSets.setPollInterval(dataSetsDAO.retrieveSessionPollInterval(sessionID));
            dataSets.setTitle(dataSetsDAO.retrieveSessionTitle(sessionID));
            dataSets.setDirection(dataSetsDAO.retrieveSessionDirection(sessionID));
            headings = DAOFactory.getDataHeadingsDAO().retrieve(sessionID);
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

     */
    public CustomOIDCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        CustomOIDDAO customOIDDAO;
        String name;
        Device device;
        CustomOIDSNMP snmp;
        long pollInterval;
        String valueUnits;
        Vector<Integer> oidIDs;
        Vector<CustomOID> customOIDs;
View Full Code Here

Examples of nz.co.abrahams.asithappens.storage.Device

        }
    }//GEN-LAST:event_removeButtonActionPerformed

    private void graphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graphButtonActionPerformed
        String deviceName;
        Device device;
        int ifIndex;
        String portString;
        Vector<CustomOID> oids;
        CustomOIDSNMP snmp;
        CustomOIDCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;


        if ( oidTable.getRowCount() == 0 ) {
            ErrorHandler.modalError(this, "Please add at least one OID to the table",
                    "No OIDs added");
            return;
        }
       

        deviceName = deviceField.getText();
        oids = ((CustomOIDTableModel)oidTable.getModel()).getCustomOIDVector();
        try {
            device = new Device(deviceName, communityField.getText(), null, false);
            snmp = new CustomOIDSNMP(device);
            collector = new CustomOIDCollector(snmp, Integer.parseInt(pollField.getText()), unitsField.getText(), ((CustomOIDTableModel) oidTable.getModel()).getCustomOIDVector());
            data = new DataSets(DataType.OID, collector, device, Integer.parseInt(pollField.getText()), null, 0, null, storeDataCheckBox.isSelected());
            for (int i = 0; i < oids.size(); i++) {
                data.addSet(oids.elementAt(i).label);
View Full Code Here

Examples of org.apache.devicemap.data.Device

        if (devices == null) {
            throw new RuntimeException("Uninitialized device index");
        }

        Map<String, List<Device>> hits = new HashMap<String, List<Device>>(100);
        Device winner = null;
        String winnerStr = "";

        if (text == null) {
            return getUnknownDevice();
        }

        Util.debugLog("classify: '" + text + "'");

        String[] parts = text.split(" |-|_|/|\\\\|\\[|\\]|\\(|\\)|;");

        //generate ngrams upto size 4
        for (int i = 0; i < parts.length; i++) {
            String pattern = "";
            for (int j = 0; j < 4 && (j + i) < parts.length; j++) {
                if (parts[i + j].isEmpty()) {
                    continue;
                }
               
                pattern += Util.normalize(parts[i + j]);

                List<Device> dlist = patterns.get(pattern);

                if (dlist != null) {
                    hits.put(pattern, dlist);

                    for (Device device : dlist) {
                        Util.debugLog("Hit found: " + pattern + " => " + device.getId() + " " + device.getPatterns());
                    }
                }
            }
        }

        //look for the strongest hit
        for (String hit : hits.keySet()) {
            for (Device device : hits.get(hit)) {
                if (!device.getPatterns().isValid(hits.keySet())) {
                    continue;
                }

                Util.debugLog("Hit candidate: " + hit + " => " + device.getId());

                if (winner != null) {
                    if ("simple".equals(winner.getType()) && !"simple".equals(device.getType())) {
                        winner = device;
                        winnerStr = hit;
                    } else if (hit.length() > winnerStr.length() &&
                            (!"simple".equals(device.getType()) || device.getType().equals(winner.getType()))) {
                        winner = device;
                        winnerStr = hit;
                    }
                } else {
                    winner = device;
                    winnerStr = hit;
                }
            }
        }

        if (winner != null) {
            Util.debugLog("Result: " + winner);
            return winner.getAttributes();
        } else {
            return getUnknownDevice();
        }
    }
View Full Code Here

Examples of org.cruxframework.crux.core.client.screen.DeviceAdaptive.Device

        NodeList conditions = child.getElementsByTagNameNS("http://www.cruxframework.org/crux", "condition");
        for (int j=0; j< conditions.getLength(); j++)
        {
          Element condition = (Element)conditions.item(j);
          String userAgentValue = condition.getAttribute("when");
          Device templateDevice = Device.valueOf(userAgentValue);
          if (templateDevice.equals(supportedDevice))
          {
            NodeList replacements = condition.getElementsByTagNameNS("http://www.cruxframework.org/crux", "parameter");
            for (int k=0; k< replacements.getLength(); k++)
            {
              Element replacement = (Element)replacements.item(k);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.