Ejemplo n.º 1
0
  public Sample snapshotTake(Snapshot snapshot)
      throws CommunicationException, DataTypeUnsupportedException {
    Sample s = null;
    this.checkConnection();

    try {
      String xmlSnapshot = snapshotSerializer.serializeSnapshot(snapshot);
      String xmlSample = this.jniSnapshotTake(xmlSnapshot);
      this.checkConnection();
      s = untypedSampleDeserializer.deserializeSample(xmlSample, snapshot.getUserDataType());
    } catch (TransformationException e) {
      throw new CommunicationException("Could not take from snapshot.");
    } catch (CMException ce) {
      throw new CommunicationException(ce.getMessage());
    }
    return s;
  }
Ejemplo n.º 2
0
  public Sample readerTake(Reader reader)
      throws CommunicationException, DataTypeUnsupportedException {
    Sample result = null;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(reader);
      String xmlSample = this.jniReaderTake(xmlEntity);
      this.checkConnection();
      result = untypedSampleDeserializer.deserializeSample(xmlSample, reader.getDataType());
    } catch (CMException e) {
      throw new CommunicationException(e.getMessage());
    } catch (TransformationException e) {
      throw new CommunicationException("Could not take sample.");
    }
    return result;
  }
Ejemplo n.º 3
0
  public Sample readerReadNext(Reader reader, GID instanceGID)
      throws CommunicationException, DataTypeUnsupportedException {
    Sample result = null;
    this.checkConnection();

    try {
      String xmlEntity = entitySerializer.serializeEntity(reader);
      String xmlSample =
          this.jniReaderReadNext(
              xmlEntity,
              Long.toString(instanceGID.getLocalId()),
              Long.toString(instanceGID.getSystemId()));
      this.checkConnection();
      result = untypedSampleDeserializer.deserializeSample(xmlSample, reader.getDataType());
    } catch (CMException e) {
      throw new CommunicationException(e.getMessage());
    } catch (TransformationException e) {
      throw new CommunicationException("Could not read next sample.");
    }
    return result;
  }