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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations