Package nz.co.abrahams.asithappens.cartgraph

Examples of nz.co.abrahams.asithappens.cartgraph.DataGraph


        FlowOptions options;
        PacketTraceLoadTask task;
        ProgressBar progressBar;
        FlowData data;
        TimeSeriesContext context;
        DataGraph graphFrame;
        SimpleDateFormat dateFormat;
        long fromDate;
        long toDate;
       
        try {
View Full Code Here


        }
    }//GEN-LAST:event_fileButtonActionPerformed
   
    public static void createGraph(Component parent, DataSets dataSets) {
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        try {
            context = new TimeSeriesContext(dataSets);
            graphFrame = new DataGraph(context);
            //graphFrame.setVisible(true);
        } catch (Exception e) {
            ErrorHandler.modalError(parent, e.toString(), "Problem creating graph", e);
        }       
    }   
View Full Code Here

        String portString;
        BandwidthSNMP snmp;
        BandwidthCollector 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;
        }
       
        try {
            device = portsSelectorPanel.getModel().getDevice();
            ifIndices = portsSelectorPanel.getIfIndices();
            ifDescriptions = portsSelectorPanel.getIfDescriptions();
            portString = portsSelectorPanel.getPortsString();

            snmp = new BandwidthSNMP(device);
            collector = new BandwidthCollector(snmp, Integer.parseInt(pollField.getText()), ifIndices, ifDescriptions, prefer64BitCheckBox.isSelected());
            data = new DataSets(DataType.BANDWIDTH, collector, device, Integer.parseInt(pollField.getText()), portString, DataSets.DIRECTION_BOTH, 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 \"" + portsSelectorPanel.getModel().getDevice().getName() + "\" is valid",
View Full Code Here

        Device device;
        int pollInterval;
        DataCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        try {
            //data = new ResponseData(new Device(deviceField.getText()), Integer.parseInt(pollField.getText()) * 1000, "Response Graph", "ms", storeDataCheckBox.isSelected());
            device = new Device(deviceField.getText());
            //pollInterval = Integer.parseInt(pollField.getText()) * 1000;
            pollInterval = Integer.parseInt(pollField.getText());
            if ( Configuration.getProperty("collector.response.class").equals("windows") )
                collector = new ResponseWindowsCollector(device, pollInterval);
            else
                collector = new ResponseCollector(device, pollInterval);
            data = new DataSets(DataType.RESPONSE, collector, device, pollInterval, null, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
            context = new TimeSeriesContext(data);
            //graphFrame = new DataGraph(context);
            graphFrame = new DataGraph(context);
        } catch (DBException e) {
            ErrorHandler.modalError(null, "Please ensure that database is running and accessible",
                    "Error opening database connection", e);
        } catch (java.net.UnknownHostException e) {
            ErrorHandler.modalError(null, "Please ensure that device name \"" + deviceField.getText() + "\" is valid",
View Full Code Here

    }
   
    public static void createGraph(Component parent, DataSets dataSets, int dataTypeID, TimeSeriesContext.Aggregation aggregation, TimeSeriesContext.Interpolation interpolation) {
        int graphID;
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        try {
            context = new TimeSeriesContext(dataSets);
            context.setXAxisScaling(TimeSeriesContext.XAxisScaling.AbsoluteBoundaries);
            context.setAggregation(aggregation);
            context.setInterpolation(interpolation);
            graphFrame = new DataGraph(context);
        } catch (Exception e) {
            ErrorHandler.modalError(parent, e.toString(),
                    "Error creating graph from stored session", e);
        }
    }
View Full Code Here

   
    public static void createGraphWithContext(Component parent, int sessionID, DataSets dataSets, TimeSeriesContext.Aggregation aggregation, TimeSeriesContext.Interpolation interpolation) {
        DataGraphDAO graphDAO;
        int graphID;
        TimeSeriesContext context;
        DataGraph graphFrame;
       
        try {
           
            graphDAO = DAOFactory.getDataGraphDAO();
            graphID = graphDAO.retrieveGraphIDForSession(sessionID);

            graphFrame = graphDAO.retrieveGraph(graphID, dataSets);

            graphDAO.closeConnection();
            graphFrame.getContext().setAggregation(aggregation);
            graphFrame.getContext().setInterpolation(interpolation);
            graphFrame.getContext().setXAxisScaling(TimeSeriesContext.XAxisScaling.AbsoluteBoundaries);
        } catch (Exception e) {
            ErrorHandler.modalError(parent, e.toString(),
                    "Error creating graph from stored session", e);
        }
    }
View Full Code Here

    }
   
    public static synchronized void saveLayout(String layout) throws DBException, UnknownHostException, DAOCreationException {
        LayoutDAO layoutDAO;
        DataGraphDAO graphDAO;
        DataGraph graph;
        Iterator<DataGraph> iterator;
       
        layoutDAO = DAOFactory.getLayoutDAO();
        layoutDAO.create(layout, list.iterator());
        layoutDAO.closeConnection();
View Full Code Here

        this.connection = connection;
    }
   
    public void create(String layout, Iterator<DataGraph> iterator) throws DBException, UnknownHostException, DAOCreationException {
        PreparedStatement statement;
        DataGraph graph;
        DataGraphDAO graphDAO;
       
        try {
            statement = connection.prepareStatement(CREATE);
            statement.setString(1, layout);
            statement.executeUpdate();
           
            graphDAO = DAOFactory.getDataGraphDAO();
            while ( iterator.hasNext() ) {
                graph = iterator.next();
                logger.info("Graph: " + graph.getContext().getData().getTitle());
                if ( graph.getContext().getData().isCollector() ) {
                    logger.info("  (a collector)");
                    //collector = graph.getContext().getData().getCollector();
                    //graph.getContext().getData().getCollector().store(layout);
                    //graph.store(layout);
                    graphDAO.createGraph(layout, graph);
View Full Code Here

   
    private void storageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_storageButtonActionPerformed
        DataCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
        int storageIndex;
        String storageString;
        Device currentDevice;
        MemoryUCDSNMP memoryUCDSNMP;
        int pollInterval;
       
        pollInterval = Integer.parseInt(pollField.getText());
        //pollInterval = Integer.parseInt(pollField.getText()) * 1000;
        if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_HR ) {
            try {
                storageIndex = memoryHRSNMP.getStorageIndex()[((JList)(storagePane.getViewport().getView())).getSelectedIndex()];
                storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
                collector = new MemoryHRCollector(memoryHRSNMP, pollInterval, storageIndex);
                data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (NullPointerException e) {
                ErrorHandler.modalError(this, "Please enumerate resources on a device and select a storage object",
                        "No storage object selected");
            } catch (ArrayIndexOutOfBoundsException e) {
                ErrorHandler.modalError(this, "Please select a storage object", "No storage object selected");
            } 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 \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            }
        }
       
        else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_UCD ) {
            try {
                storageIndex = ((JList)(storagePane.getViewport().getView())).getSelectedIndex();
                storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
                //currentDevice = new Device(deviceField.getText(), communityField.getText());
                memoryUCDSNMP = new MemoryUCDSNMP(device);
                collector = new MemoryUCDCollector(memoryUCDSNMP, pollInterval, storageIndex);
                data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (NullPointerException e) {
                ErrorHandler.modalError(this, "Please enumerate resources on a device and select a memory type",
                        "No memory type selected");
            } catch (ArrayIndexOutOfBoundsException e) {
                ErrorHandler.modalError(this, "Please select a memory type", "No memory type selected");
            } 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 \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            }
        }
       
        else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_CISCO ) {
            try {
                storageIndex = memoryCiscoSNMP.getStorageIndex()[((JList)(storagePane.getViewport().getView())).getSelectedIndex()];
                storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
                //currentDevice = new Device(deviceField.getText(), communityField.getText());
                collector = new MemoryCiscoCollector(memoryCiscoSNMP, pollInterval, storageIndex);
                data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (NullPointerException e) {
                ErrorHandler.modalError(this, "Please enumerate resources on a Cisco device and select a memory pool",
                        "No memory pool selected");
            } catch (ArrayIndexOutOfBoundsException e) {
                ErrorHandler.modalError(this, "Please select a memory pool", "No memory pool selected");
View Full Code Here

    /** Creates a new processor graph. */
    private void processorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_processorButtonActionPerformed
        DataCollector collector;
        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
        int processorIndex;
        String processorString;
        Device currentDevice;
        ProcessorUCDSNMP processorUCDSNMP;
        ProcessorCiscoSNMP processorCiscoSNMP;
        int pollInterval;
       
        //pollInterval = Integer.parseInt(pollField.getText()) * 1000;
        pollInterval = Integer.parseInt(pollField.getText());
        if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_HR ) {
           
            try {
                processorIndex = processorHRSNMP.getProcessorsIndex()[((JList)(processorsPane.getViewport().getView())).getSelectedIndex()];
                processorString = (String)((JList)processorsPane.getViewport().getView()).getSelectedValue();
                collector = new ProcessorHRCollector(processorHRSNMP, pollInterval, processorIndex);
                data = new DataSets(DataType.PROCESSOR, collector, device, pollInterval, processorString, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (NullPointerException e) {
                ErrorHandler.modalError(this, "Please enumerate resources on a device and select a processor",
                        "No processor selected");
            } catch (ArrayIndexOutOfBoundsException e) {
                ErrorHandler.modalError(this, "Please select a processor", "No processor selected");
            } 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 \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            } catch (ClassCastException e) {
                ErrorHandler.modalError(null, "Please ensure that device supports processor usage in the Host Resources MIB",
                        "Cannot find processor usage information on device " + deviceField.getText(), e);
            }
           
        } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_UCD ) {
            try {
                currentDevice = new Device(deviceField.getText(), communityField.getText(), null, false);
                processorUCDSNMP = new ProcessorUCDSNMP(currentDevice);
                collector = new ProcessorUCDCollector(processorUCDSNMP, (long)pollInterval);
                data = new DataSets(DataType.NETSNMP_PROCESSOR, collector, currentDevice, pollInterval, null, DataSets.DIRECTION_NONE, 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 \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            }
        } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_CISCO ) {
            try {
                currentDevice = new Device(deviceField.getText(), communityField.getText(), null, false);
                processorCiscoSNMP = new ProcessorCiscoSNMP(currentDevice);
                collector = new ProcessorCiscoCollector(processorCiscoSNMP, pollInterval);
                data = new DataSets(DataType.PROCESSOR, collector, currentDevice, pollInterval, null, DataSets.DIRECTION_NONE, 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 \"" + deviceField.getText() + "\" is valid",
View Full Code Here

TOP

Related Classes of nz.co.abrahams.asithappens.cartgraph.DataGraph

Copyright © 2018 www.massapicom. 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.