Beispiel #1
0
  /**
   * {@inheritDoc}
   *
   * @throws Exception
   */
  @Test
  public void testCacheBug() throws Exception {
    String pv = "Chiller:Pressure:1";

    // get the pv as DoubleProperty
    DoubleProperty doubleProperty = _propertyFactory.getProperty(pv, DoubleProperty.class, null);
    assertNotNull(doubleProperty);
    assertTrue(doubleProperty instanceof DoubleProperty);

    doubleProperty.addDynamicValueListener(
        new DynamicValueListener() {

          public void conditionChange(DynamicValueEvent arg0) {}

          public void errorResponse(DynamicValueEvent arg0) {}

          public void timelagStarts(DynamicValueEvent arg0) {}

          public void timelagStops(DynamicValueEvent arg0) {}

          public void timeoutStarts(DynamicValueEvent arg0) {}

          public void timeoutStops(DynamicValueEvent arg0) {}

          public void valueChanged(DynamicValueEvent event) {
            AnyData anyData = event.getData();
            MetaData metaData = anyData.getMetaData();
            System.out.println("Metadata available = " + (metaData != null ? "yes" : "no"));
          }

          public void valueUpdated(DynamicValueEvent arg0) {}
        });

    Thread.sleep(5000);
  }
Beispiel #2
0
  /** {@inheritDoc} */
  protected void doInit() {
    // get or create a real DAL property
    DynamicValueProperty property = null;

    try {
      RemoteInfo ri = getProcessVariableAddress().toDalRemoteInfo();

      PropertyFactory factory =
          DALPropertyFactoriesProvider.getInstance()
              .getPropertyFactory(getProcessVariableAddress().getControlSystem());

      switch (getValueType()) {
        case OBJECT:
          property = factory.getProperty(ri);
          break;
        case STRING:
          /*
           * swende: 2010-03-06: this is a dirty quickfix which is related
           * to problems with SDS displays that specifiy
           * "pv[severity], String" as pv address / please remove if it
           * does not work as expected or when all current SDS files at
           * DESY have been propertly changed
           */
          String characteristic = getProcessVariableAddress().getCharacteristic();
          // If connection is made as pv[severity] or just pv, than ignore everything
          // and go to default. In all other cases (e.g. pv[graphMin}, string), create
          // a default property.
          if (characteristic != null
              && !CharacteristicInfo.C_SEVERITY.getName().equals(characteristic)) {
            property = factory.getProperty(ri);
            break;
          }
        default:
          property = factory.getProperty(ri, getValueType().getDalType(), null);
          break;
      }

      if (property != null) {
        setDalProperty(property);
      }
    } catch (Throwable e) {
      forwardError(e.getLocalizedMessage());
    }
  }