Esempio n. 1
0
  private void stopDataPoint(int dataPointId) {
    synchronized (dataPoints) {
      // Remove this point from the data image if it is there. If not, just quit.
      DataPointRT p = dataPoints.remove(dataPointId);

      // Remove it from the data source, and terminate it.
      if (p != null) {
        getRunningDataSource(p.getDataSourceId()).removeDataPoint(p);
        DataPointListener l = getDataPointListeners(dataPointId);
        if (l != null) l.pointTerminated();
        p.terminate();
      }
    }
  }
Esempio n. 2
0
  private void startDataPoint(DataPointVO vo) {
    synchronized (dataPoints) {
      Assert.isTrue(vo.isEnabled());

      // Only add the data point if its data source is enabled.
      DataSourceRT ds = getRunningDataSource(vo.getDataSourceId());
      if (ds != null) {
        // Change the VO into a data point implementation.
        DataPointRT dataPoint = new DataPointRT(vo, vo.getPointLocator().createRuntime());

        // Add/update it in the data image.
        dataPoints.put(dataPoint.getId(), dataPoint);

        // Initialize it.
        dataPoint.initialize();
        DataPointListener l = getDataPointListeners(vo.getId());
        if (l != null) l.pointInitialized();

        // Add/update it in the data source.
        ds.addDataPoint(dataPoint);
      }
    }
  }