Search in sources :

Example 1 with SensorMLDocument

use of net.opengis.sensorML.x101.SensorMLDocument in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createSensorMLDescription.

protected SensorMLDocument createSensorMLDescription(final SensorML smlSensorDesc) throws EncodingException {
    final SensorMLDocument sensorMLDoc = SensorMLDocument.Factory.newInstance(getXmlOptions());
    final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = sensorMLDoc.addNewSensorML();
    xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
    if (smlSensorDesc.isSetMembers()) {
        for (final AbstractProcess sml : smlSensorDesc.getMembers()) {
            if (sml instanceof System) {
                final SystemType xbSystem = (SystemType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_SYSTEM), SystemType.type);
                final System smlSystem = (System) sml;
                addAbstractProcessValues(xbSystem, smlSystem);
                addSystemValues(xbSystem, smlSystem);
            } else if (sml instanceof ProcessModel) {
                final ProcessModelType xbProcessModel = (ProcessModelType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_PROCESS_MODEL), ProcessModelType.type);
                final ProcessModel smlProcessModel = (ProcessModel) sml;
                addAbstractProcessValues(xbProcessModel, smlProcessModel);
                addProcessModelValues(xbProcessModel, smlProcessModel);
            } else if (sml instanceof org.n52.shetland.ogc.sensorML.Component) {
                final ComponentType xbCompontent = (ComponentType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_COMPONENT), ComponentType.type);
                final org.n52.shetland.ogc.sensorML.Component smlComponent = (org.n52.shetland.ogc.sensorML.Component) sml;
                addAbstractProcessValues(xbCompontent, smlComponent);
                addComponentValues(xbCompontent, smlComponent);
            }
        }
    }
    return sensorMLDoc;
}
Also used : ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel) ComponentType(net.opengis.sensorML.x101.ComponentType) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) QName(javax.xml.namespace.QName) SystemType(net.opengis.sensorML.x101.SystemType) System(org.n52.shetland.ogc.sensorML.System) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) ProcessModelType(net.opengis.sensorML.x101.ProcessModelType)

Example 2 with SensorMLDocument

use of net.opengis.sensorML.x101.SensorMLDocument in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method encodeSystem.

private SystemType encodeSystem(final SensorML sensorMl) throws EncodingException {
    final XmlObject encodedSml = sensorMLEncoderv101.encode(sensorMl);
    assertThat(encodedSml, instanceOf(SensorMLDocument.class));
    final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSml = ((SensorMLDocument) encodedSml).getSensorML();
    assertThat(xbSml.getMemberArray().length, is(1));
    assertThat(xbSml.getMemberArray()[0].getProcess(), instanceOf(SystemType.class));
    return (SystemType) xbSml.getMemberArray()[0].getProcess();
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) XmlObject(org.apache.xmlbeans.XmlObject) SystemType(net.opengis.sensorML.x101.SystemType)

Example 3 with SensorMLDocument

use of net.opengis.sensorML.x101.SensorMLDocument in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_set_identifier_by_identifier_definition.

@Test
public void should_set_identifier_by_identifier_definition() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
    addIdentifier(xbIdentifierList, "any name", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
    addIdentifier(xbIdentifierList, "any other name", null, TEST_ID_2);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
    assertThat(absProcess.getIdentifications().size(), is(2));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) Test(org.junit.Test)

Example 4 with SensorMLDocument

use of net.opengis.sensorML.x101.SensorMLDocument in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_set_gml_id.

@Test
public void should_set_gml_id() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    xbSystem.setId(TEST_ID_1);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getGmlId(), is(TEST_ID_1));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) Test(org.junit.Test)

Example 5 with SensorMLDocument

use of net.opengis.sensorML.x101.SensorMLDocument in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_decode_features_of_interest_from_sml.

@Test
public void should_decode_features_of_interest_from_sml() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    Capabilities xbCapabilities = xbSystem.addNewCapabilities();
    xbCapabilities.setName(SensorMLConstants.ELEMENT_NAME_FEATURES_OF_INTEREST);
    SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.addNewAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
    addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_1, TEST_NAME_1);
    addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_2, TEST_NAME_2);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    // assertThat(absProcess.getFeaturesOfInterest().size(), is(2));
    assertThat(absProcess.getCapabilities().size(), is(1));
// List<String> featuresOfInterest = new ArrayList<String>(absProcess.getFeaturesOfInterest());
// Collections.sort(featuresOfInterest);
// assertThat(featuresOfInterest.get(0), is(TEST_ID_1));
// assertThat(featuresOfInterest.get(1), is(TEST_ID_2));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) Capabilities(net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities) SystemType(net.opengis.sensorML.x101.SystemType) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Aggregations

SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)18 SystemType (net.opengis.sensorML.x101.SystemType)16 Test (org.junit.Test)13 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 XmlObject (org.apache.xmlbeans.XmlObject)5 SensorML (org.n52.shetland.ogc.sensorML.SensorML)5 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)4 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)4 System (org.n52.shetland.ogc.sensorML.System)4 AbstractProcessType (net.opengis.sensorML.x101.AbstractProcessType)3 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)3 Person (net.opengis.sensorML.x101.PersonDocument.Person)3 ResponsibleParty (net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty)3 Member (net.opengis.sensorML.x101.SensorMLDocument.SensorML.Member)3 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)3 SmlResponsibleParty (org.n52.shetland.ogc.sensorML.SmlResponsibleParty)3 ComponentType (net.opengis.sensorML.x101.ComponentType)2 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)2 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)2 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)2