Exemplo n.º 1
0
  public void forcePointRead(int dataPointId) {
    DataPointRT dataPoint = dataPoints.get(dataPointId);
    if (dataPoint == null) throw new RTException("Point is not enabled");

    // Tell the data source to read the point value;
    DataSourceRT ds = getRunningDataSource(dataPoint.getDataSourceId());
    if (ds != null)
      // The data source may have been disabled. Just make sure.
      ds.forcePointRead(dataPoint);
  }
Exemplo n.º 2
0
  public void setDataPointValue(int dataPointId, PointValueTime valueTime, SetPointSource source) {
    DataPointRT dataPoint = dataPoints.get(dataPointId);
    if (dataPoint == null) throw new RTException("Point is not enabled");

    if (!dataPoint.getPointLocator().isSettable()) throw new RTException("Point is not settable");

    // Tell the data source to set the value of the point.
    DataSourceRT ds = getRunningDataSource(dataPoint.getDataSourceId());
    // The data source may have been disabled. Just make sure.
    if (ds != null) ds.setPointValue(dataPoint, valueTime, source);
  }
Exemplo n.º 3
0
  public void relinquish(int dataPointId) {
    DataPointRT dataPoint = dataPoints.get(dataPointId);
    if (dataPoint == null) throw new RTException("Point is not enabled");

    if (!dataPoint.getPointLocator().isSettable()) throw new RTException("Point is not settable");
    if (!dataPoint.getPointLocator().isRelinquishable())
      throw new RTException("Point is not relinquishable");

    // Tell the data source to relinquish value of the point.
    DataSourceRT ds = getRunningDataSource(dataPoint.getDataSourceId());
    // The data source may have been disabled. Just make sure.
    if (ds != null) ds.relinquish(dataPoint);
  }
Exemplo n.º 4
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();
      }
    }
  }
Exemplo n.º 5
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");
    }
  }