Search in sources :

Example 6 with ReferenceProxy

use of org.geotoolkit.wps.xml.ReferenceProxy in project geotoolkit by Geomatys.

the class ZipAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(Path candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy)
        return super.toWPS2Input(candidate);
    final byte[] bytes;
    try {
        bytes = Files.readAllBytes(candidate);
    } catch (IOException ex) {
        throw new UnconvertibleObjectException(ex.getMessage(), ex);
    }
    final String base64 = Base64.getEncoder().encodeToString(bytes);
    final DataInput dit = new DataInput();
    final Data data = new Data();
    data.setEncoding("base64");
    data.getContent().add(base64);
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) DataInput(org.geotoolkit.wps.xml.v200.DataInput) UnconvertibleObjectException(org.apache.sis.util.UnconvertibleObjectException) Data(org.geotoolkit.wps.xml.v200.Data) IOException(java.io.IOException)

Example 7 with ReferenceProxy

use of org.geotoolkit.wps.xml.ReferenceProxy in project geotoolkit by Geomatys.

the class JSONAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(TreeNode candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy)
        return super.toWPS2Input(candidate);
    final ComplexData cdt = new ComplexData();
    cdt.getContent().add(new org.geotoolkit.wps.xml.v200.Format(encoding, mimeType, schema, null));
    cdt.getContent().add(candidate);
    final Data data = new Data();
    data.getContent().add(cdt);
    final DataInput dit = new DataInput();
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) Format(org.geotoolkit.wps.xml.v200.Format) DataInput(org.geotoolkit.wps.xml.v200.DataInput) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData) Data(org.geotoolkit.wps.xml.v200.Data) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData)

Example 8 with ReferenceProxy

use of org.geotoolkit.wps.xml.ReferenceProxy in project geotoolkit by Geomatys.

the class KMLAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(Path candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy)
        return super.toWPS2Input(candidate);
    final byte[] bytes;
    try {
        bytes = Files.readAllBytes(candidate);
    } catch (IOException ex) {
        throw new UnconvertibleObjectException(ex.getMessage(), ex);
    }
    final String cdata = new String(bytes, Charset.forName("UTF-8"));
    final DataInput dit = new DataInput();
    final Data data = new Data();
    data.getContent().add("<![CDATA[" + cdata + "]]>");
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) DataInput(org.geotoolkit.wps.xml.v200.DataInput) UnconvertibleObjectException(org.apache.sis.util.UnconvertibleObjectException) Data(org.geotoolkit.wps.xml.v200.Data) IOException(java.io.IOException)

Example 9 with ReferenceProxy

use of org.geotoolkit.wps.xml.ReferenceProxy in project geotoolkit by Geomatys.

the class TextAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(CharSequence candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy) {
        return super.toWPS2Input(candidate);
    }
    final ComplexData cdt = new ComplexData();
    cdt.getContent().add(new org.geotoolkit.wps.xml.v200.Format(encoding, mimeType, schema, null));
    cdt.getContent().add("<![CDATA[" + candidate + "]]>");
    final Data data = new Data();
    data.getContent().add(cdt);
    final DataInput dit = new DataInput();
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) Format(org.geotoolkit.wps.xml.v200.Format) DataInput(org.geotoolkit.wps.xml.v200.DataInput) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData) Data(org.geotoolkit.wps.xml.v200.Data) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData)

Example 10 with ReferenceProxy

use of org.geotoolkit.wps.xml.ReferenceProxy in project geotoolkit by Geomatys.

the class CSVAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(Path candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy)
        return super.toWPS2Input(candidate);
    final byte[] bytes;
    try {
        bytes = Files.readAllBytes(candidate);
    } catch (IOException ex) {
        throw new UnconvertibleObjectException(ex.getMessage(), ex);
    }
    final String base64 = Base64.getEncoder().encodeToString(bytes);
    final DataInput dit = new DataInput();
    final Data data = new Data();
    data.setEncoding("base64");
    data.getContent().add(base64);
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) DataInput(org.geotoolkit.wps.xml.v200.DataInput) UnconvertibleObjectException(org.apache.sis.util.UnconvertibleObjectException) Data(org.geotoolkit.wps.xml.v200.Data) IOException(java.io.IOException)

Aggregations

ReferenceProxy (org.geotoolkit.wps.xml.ReferenceProxy)10 DataInput (org.geotoolkit.wps.xml.v200.DataInput)10 Data (org.geotoolkit.wps.xml.v200.Data)9 UnconvertibleObjectException (org.apache.sis.util.UnconvertibleObjectException)7 IOException (java.io.IOException)5 ComplexData (org.geotoolkit.wps.xml.v200.ComplexData)5 Format (org.geotoolkit.wps.xml.v200.Format)5 Document (org.w3c.dom.Document)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 DOMResult (javax.xml.transform.dom.DOMResult)1 AbstractCRS (org.apache.sis.referencing.crs.AbstractCRS)1 IdentifiedObjectFinder (org.apache.sis.referencing.factory.IdentifiedObjectFinder)1 DataStoreException (org.apache.sis.storage.DataStoreException)1 JAXPStreamFeatureWriter (org.geotoolkit.feature.xml.jaxp.JAXPStreamFeatureWriter)1 Reference (org.geotoolkit.wps.xml.v200.Reference)1 Geometry (org.locationtech.jts.geom.Geometry)1