Ejemplo n.º 1
0
  private void stopDataSource(int id) {
    synchronized (runningDataSources) {
      DataSourceRT dataSource = getRunningDataSource(id);
      if (dataSource == null) return;

      // Stop the data points.
      for (DataPointRT p : dataPoints.values()) {
        if (p.getDataSourceId() == id) stopDataPoint(p.getId());
      }

      runningDataSources.remove(dataSource);
      dataSource.terminate();

      dataSource.joinTermination();
      LOG.info("Data source '" + dataSource.getName() + "' stopped");
    }
  }
Ejemplo 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);
      }
    }
  }