当前位置: 首页>>代码示例>>Java>>正文


Java Datastream类代码示例

本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Datastream的典型用法代码示例。如果您正苦于以下问题:Java Datastream类的具体用法?Java Datastream怎么用?Java Datastream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Datastream类属于de.fraunhofer.iosb.ilt.sta.model包,在下文中一共展示了Datastream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isValid

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Override
public boolean isValid(Observation obs) throws ProcessException {
    try {
        Instant latest;
        Datastream ds = obs.getDatastream();
        if (ds == null) {
            MultiDatastream mds = obs.getMultiDatastream();
            if (mds == null) {
                throw new ProcessException("Observation has no Datastream of Multidatastream set!");
            }
            latest = getTimeForMultiDatastream(mds);
        } else {
            latest = getTimeForDatastream(ds);
        }
        TimeObject phenomenonTime = obs.getPhenomenonTime();
        Instant obsInstant;
        if (phenomenonTime.isInterval()) {
            obsInstant = phenomenonTime.getAsInterval().getStart();
        } else {
            obsInstant = phenomenonTime.getAsDateTime().toInstant();
        }
        return latest.isBefore(obsInstant);
    } catch (ServiceFailureException ex) {
        throw new ProcessException("Failed to validate.", ex);
    }
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:27,代码来源:ValidatorNewer.java

示例2: getTimeForDatastream

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
private Instant getTimeForDatastream(Datastream ds) throws ServiceFailureException {
    Id dsId = ds.getId();
    Instant latest = datastreamCache.get(dsId);
    if (latest == null) {
        Observation firstObs = ds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
        if (firstObs == null) {
            latest = Instant.MIN;
        } else {
            TimeObject phenomenonTime = firstObs.getPhenomenonTime();
            if (phenomenonTime.isInterval()) {
                latest = phenomenonTime.getAsInterval().getStart();
            } else {
                latest = phenomenonTime.getAsDateTime().toInstant();
            }
        }
        datastreamCache.put(dsId, latest);
    }
    return latest;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:20,代码来源:ValidatorNewer.java

示例3: insertSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLInsertClause insert = qFactory.insert(qs);
    insert.set(qs.name, s.getName());
    insert.set(qs.description, s.getDescription());
    insert.set(qs.encodingType, s.getEncodingType());
    // TODO: Check metadata serialisation.
    insert.set(qs.metadata, s.getMetadata().toString());
    insert.set(qs.properties, objectToJson(s.getProperties()));

    UUID generatedId = insert.executeWithKey(qs.id);
    LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
    s.setId(new UuidId(generatedId));

    // Create new datastreams, if any.
    for (Datastream ds : s.getDatastreams()) {
        ds.setSensor(new SensorBuilder().setId(s.getId()).build());
        ds.complete();
        pm.insert(ds);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:25,代码来源:EntityInserter.java

示例4: insertSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLInsertClause insert = qFactory.insert(qs);
    insert.set(qs.name, s.getName());
    insert.set(qs.description, s.getDescription());
    insert.set(qs.encodingType, s.getEncodingType());
    // TODO: Check metadata serialisation.
    insert.set(qs.metadata, s.getMetadata().toString());
    insert.set(qs.properties, objectToJson(s.getProperties()));

    Long generatedId = insert.executeWithKey(qs.id);
    LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
    s.setId(new LongId(generatedId));

    // Create new datastreams, if any.
    for (Datastream ds : s.getDatastreams()) {
        ds.setSensor(new SensorBuilder().setId(s.getId()).build());
        ds.complete();
        pm.insert(ds);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:25,代码来源:EntityInserter.java

示例5: serialize

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Override
public void serialize(DataArrayValue value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
    gen.writeStartObject();
    Datastream datastream = value.getDatastream();
    if (datastream != null) {
        gen.writeStringField("[email protected]", datastream.getNavigationLink());
    }
    MultiDatastream multiDatastream = value.getMultiDatastream();
    if (multiDatastream != null) {
        gen.writeStringField("[email protected]", multiDatastream.getNavigationLink());
    }
    gen.writeObjectField("components", value.getComponents());
    int count = value.getDataArray().size();
    if (count >= 0) {
        gen.writeNumberField("[email protected]", count);
    }
    gen.writeFieldName("dataArray");
    gen.writeObject(value.getDataArray());
    gen.writeEndObject();
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:21,代码来源:DataArrayValueSerializer.java

示例6: build

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Override
public Datastream build() {
    Datastream ds = new Datastream(
            id,
            selfLink,
            navigationLink,
            name,
            description,
            observationType,
            properties,
            unitOfMeasurement,
            observedArea,
            phenomenonTime,
            resultTime,
            sensor,
            observedProperty,
            thing,
            observations);
    ds.setExportObject(isExportObject());
    return ds;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:22,代码来源:DatastreamBuilder.java

示例7: writeSensor_Basic_Success

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Test
public void writeSensor_Basic_Success() throws Exception {
    String expResult
            = "{\n"
            + "	\"@iot.id\": 1,\n"
            + "	\"@iot.selfLink\": \"http://example.org/v1.0/Sensors(1)\",\n"
            + "	\"[email protected]\": \"Sensors(1)/Datastreams\",\n"
            + "	\"name\": \"TMP36 - Analog Temperature sensor\",\n"
            + "	\"description\": \"TMP36 - Analog Temperature sensor\",\n"
            + "	\"encodingType\": \"application/pdf\",\n"
            + "	\"metadata\": \"http://example.org/TMP35_36_37.pdf\"\n"
            + "}";
    Entity entity = new SensorBuilder()
            .setId(new LongId(1))
            .setSelfLink("http://example.org/v1.0/Sensors(1)")
            .setDatastreams(new EntitySetImpl(EntityType.Datastream, "Sensors(1)/Datastreams"))
            .setName("TMP36 - Analog Temperature sensor")
            .setDescription("TMP36 - Analog Temperature sensor")
            .setEncodingType("application/pdf")
            .setMetadata("http://example.org/TMP35_36_37.pdf")
            .build();
    assert (jsonEqual(expResult, new EntityFormatter().writeEntity(entity)));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:24,代码来源:EntityFormatterTest.java

示例8: writeSensor_EmptyDatastreamsCollection_Success

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Test
public void writeSensor_EmptyDatastreamsCollection_Success() throws Exception {
    String expResult
            = "{\n"
            + "	\"@iot.id\": 1,\n"
            + "	\"@iot.selfLink\": \"http://example.org/v1.0/Sensors(1)\",\n"
            + "	\"name\": \"TMP36 - Analog Temperature sensor\",\n"
            + "	\"description\": \"TMP36 - Analog Temperature sensor\",\n"
            + "	\"encodingType\": \"application/pdf\",\n"
            + "	\"metadata\": \"http://example.org/TMP35_36_37.pdf\"\n"
            + "}";
    Entity entity = new SensorBuilder()
            .setId(new LongId(1))
            .setSelfLink("http://example.org/v1.0/Sensors(1)")
            .setDatastreams(new EntitySetImpl(EntityType.Datastream))
            .setName("TMP36 - Analog Temperature sensor")
            .setDescription("TMP36 - Analog Temperature sensor")
            .setEncodingType("application/pdf")
            .setMetadata("http://example.org/TMP35_36_37.pdf")
            .build();
    assert (jsonEqual(expResult, new EntityFormatter().writeEntity(entity)));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:23,代码来源:EntityFormatterTest.java

示例9: writeObservedPropertyBasic_Success

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Test
public void writeObservedPropertyBasic_Success() throws Exception {
    String expResult
            = "{\n"
            + "	\"@iot.id\": 1,\n"
            + "	\"@iot.selfLink\": \"http://example.org/v1.0/ObservedProperties(1)\",\n"
            + "	\"[email protected]\": \"ObservedProperties(1)/Datastreams\",\n"
            + "	\"description\": \"The dewpoint temperature is the temperature to which the air must be cooled, at constant pressure, for dew to form. As the grass and other objects near the ground cool to the dewpoint, some of the water vapor in the atmosphere condenses into liquid water on the objects.\",\n"
            + "	\"name\": \"DewPoint Temperature\",\n"
            + "	\"definition\": \"http://dbpedia.org/page/Dew_point\"\n"
            + "}";
    Entity entity = new ObservedPropertyBuilder()
            .setId(new LongId(1))
            .setSelfLink("http://example.org/v1.0/ObservedProperties(1)")
            .setDatastreams(new EntitySetImpl(EntityType.Datastream, "ObservedProperties(1)/Datastreams"))
            .setDescription("The dewpoint temperature is the temperature to which the air must be cooled, at constant pressure, for dew to form. As the grass and other objects near the ground cool to the dewpoint, some of the water vapor in the atmosphere condenses into liquid water on the objects.")
            .setName("DewPoint Temperature")
            .setDefinition("http://dbpedia.org/page/Dew_point")
            .build();
    assert (jsonEqual(expResult, new EntityFormatter().writeEntity(entity)));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:22,代码来源:EntityFormatterTest.java

示例10: insertSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLInsertClause insert = qFactory.insert(qs);
    insert.set(qs.name, s.getName());
    insert.set(qs.description, s.getDescription());
    insert.set(qs.encodingType, s.getEncodingType());
    // TODO: Check metadata serialisation.
    insert.set(qs.metadata, s.getMetadata().toString());
    insert.set(qs.properties, objectToJson(s.getProperties()));

    String generatedId = insert.executeWithKey(qs.id);
    LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
    s.setId(new StringId(generatedId));

    // Create new datastreams, if any.
    for (Datastream ds : s.getDatastreams()) {
        ds.setSensor(new SensorBuilder().setId(s.getId()).build());
        ds.complete();
        pm.insert(ds);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:25,代码来源:EntityInserter.java

示例11: findDataArrayValue

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
private void findDataArrayValue(Entity ds, Observation o) {
    DataArrayValue dav = davMap.get(ds);
    if (dav == null) {
        if (ds instanceof Datastream) {
            dav = new DataArrayValue((Datastream) ds, getDefinedProperties(o));
        } else {
            dav = new DataArrayValue((MultiDatastream) ds, getDefinedProperties(o));
        }
        davMap.put(ds, dav);
    }
    lastDav = dav;
    lastDatastream = ds;
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:14,代码来源:Service.java

示例12: checkReference

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
private void checkReference(Datastream source, MultiDatastream aggregate) {
    String expectedAggFor;
    if (sourceEqualsTarget) {
        expectedAggFor = "/Datastreams(" + source.getId().getUrl() + ")";
    } else {
        expectedAggFor = source.getSelfLink().toString();
    }
    checkReference(aggregate, expectedAggFor);
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:10,代码来源:ProcessorBatchAggregate.java

示例13: getPane

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
public static <T extends Entity<T>> Node getPane(SensorThingsService service, EntityType type, T entity, boolean showNavProps) throws IOException {
    if (entity != null && entity.getType() != type) {
        throw new IllegalArgumentException("Entity must have given type or be null.");
    }
    switch (type) {
        case DATASTREAM:
            return getDatastreamPane(service, (Datastream) entity, showNavProps);

        case FEATURE_OF_INTEREST:
            return getFeatureOfInterestPane(service, (FeatureOfInterest) entity, showNavProps);

        case HISTORICAL_LOCATION:
            return getHistoricalLocationPane(service, (HistoricalLocation) entity, showNavProps);

        case LOCATION:
            return getLocationPane(service, (Location) entity, showNavProps);

        case MULTIDATASTREAM:
            return getMultiDatastreamPane(service, (MultiDatastream) entity, showNavProps);

        case OBSERVATION:
            return getObservationPane(service, (Observation) entity, showNavProps);

        case OBSERVED_PROPERTY:
            return getObsPropPane(service, (ObservedProperty) entity, showNavProps);

        case SENSOR:
            return getSensorPane(service, (Sensor) entity, showNavProps);

        case THING:
            return getThingPane(service, (Thing) entity, showNavProps);

    }
    return null;
}
 
开发者ID:hylkevds,项目名称:SensorThingsManager,代码行数:36,代码来源:FactoryEntityPanel.java

示例14: getDatastreamPane

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
public static Node getDatastreamPane(SensorThingsService service, Datastream entity, boolean showNavProps) throws IOException {
    if (entity == null) {
        return new Label("No Datastream.");
    }
    FXMLLoader loader = new FXMLLoader(FactoryEntityPanel.class.getResource(ENTITY_PANE_FXML));
    Node content = (Pane) loader.load();
    ControllerEntity<Datastream> controller = loader.<ControllerEntity<Datastream>>getController();
    controller.setEntity(service, entity, new EntityGuiController.GuiControllerDatastream(), showNavProps);
    return content;
}
 
开发者ID:hylkevds,项目名称:SensorThingsManager,代码行数:11,代码来源:FactoryEntityPanel.java

示例15: init

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入依赖的package包/类
@Override
public void init(SensorThingsService service, Datastream entity, GridPane gridProperties, Accordion accordionLinks, Label labelId, boolean editable) {
    this.labelId = labelId;
    this.entity = entity;
    int i = 0;
    textName = addFieldTo(gridProperties, i, "Name", new TextField(), false, editable);
    textDescription = addFieldTo(gridProperties, ++i, "Description", new TextArea(), true, editable);
    textObservationType = addFieldTo(gridProperties, ++i, "ObservationType", new TextField(), false, editable);
    textUomName = addFieldTo(gridProperties, ++i, "UoM: Name", new TextField(), false, editable);
    textUomSymbol = addFieldTo(gridProperties, ++i, "UoM: Symbol", new TextField(), false, editable);
    textUomDefinition = addFieldTo(gridProperties, ++i, "UoM: Definition", new TextField(), false, editable);
    textObservedArea = addFieldTo(gridProperties, ++i, "ObservedArea", new TextField(), false, false);
    textPhenomenonTime = addFieldTo(gridProperties, ++i, "PhenomenonTime", new TextField(), false, false);
    textResultTime = addFieldTo(gridProperties, ++i, "ResultTime", new TextField(), false, false);

    if (accordionLinks != null) {
        try {
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getThing(), service.things().query(), entity::setThing));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getSensor(), service.sensors().query(), entity::setSensor));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getObservedProperty(), service.observedProperties().query(), entity::setObservedProperty));
            accordionLinks.getPanes().add(new TitledPane("Observations", createCollectionPaneFor(entity.observations().query())));
        } catch (IOException | ServiceFailureException ex) {
            LOGGER.error("Failed to create panel.", ex);
        } catch (NullPointerException e) {
            // Happens when entity is new.
            LOGGER.trace("Failed to create panel.", e);
        }
    }
}
 
开发者ID:hylkevds,项目名称:SensorThingsManager,代码行数:30,代码来源:EntityGuiController.java


注:本文中的de.fraunhofer.iosb.ilt.sta.model.Datastream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。