@Override public Object decode(Object input) throws Exception { if (input instanceof String) { return decode(new ByteArrayInputStream(((String) input).getBytes())); } return super.decode(input); }
/** * Encodes the internal object representation of a parameter into an output stream using * specific encoding parameters */ public void encode(Object value, Map<String, Object> encodingParameters, OutputStream os) throws Exception { encode(value, os); };
/** * Provides a suitable extension for the output file given the object being encoded. The default * implementation simply calls {@link #getFileExtension()} * * @param object */ public String getFileExtension(Object object) { return getFileExtension(); } }
File file = resourceManager.getOutputFile(executionId, key + "." + cppio.getFileExtension()); try { fos = new FileOutputStream(file); cppio.encode(o, fos); } finally { IOUtils.closeQuietly(fos); kvp.put("executionId", executionId); kvp.put("outputId", file.getName()); kvp.put("mimetype", cppio.getMimeType()); outputReference.setHref(ResponseUtils.buildURL(request.getBaseUrl(), "ows", kvp, URLType.SERVICE)); outputReference.setMimeType(cppio.getMimeType()); } else { complex.setMimeType(cppio.getMimeType());
extension = "." + ((ComplexPPIO) ppio_).getFileExtension(); ((ComplexPPIO) ppio_).encode(features, os);
public static ProcessParameterIO find(Parameter<?> p, ApplicationContext context, String mime) { // enum special treatment if (p.type.isEnum()) { return new EnumPPIO(p.type); } // TODO: come up with some way to flag one as "default" List<ProcessParameterIO> all = findAll(p, context); if (all.isEmpty()) { return null; } if (mime != null) { for (ProcessParameterIO ppio : all) { if (ppio instanceof ComplexPPIO && ((ComplexPPIO) ppio).getMimeType().equals(mime)) { return ppio; } } } // fall back on the first found return all.get(0); }
refInput, complexPPIO.getMimeType())); } else { throw new WPSException( post.setRequestEntity( new StringRequestEntity( (String) body, complexPPIO.getMimeType(), encoding)); } else { throw new WPSException( Object result = complexPPIO.decode(is); if (result == null || complexPPIO.getType().isInstance(result)) { return result; + complexPPIO.getType().getName() + ", got a: " + result.getClass().getName());
.getMimeType())); } else { throw new WPSException("A POST request should contain a non empty body"); .getMimeType(), encoding)); } else { throw new WPSException( return ppio.decode(input); } else { throw new WPSException("Could not find a mean to read input " + inputId);
String name = key + "." + cppio.getFileExtension(o); Resource outputResource = resourceManager.getOutputResource(status.getExecutionId(), name); (FeatureCollection) o, listener); cppio.encode(o, os); mime = rawData.getMimeType(); } else { mime = cppio.getMimeType(); complex.setMimeType(cppio.getMimeType());
String extension = complexPPIO.getFileExtension(); complexPPIO.encode(gridCoverage, encodingParams, new OutputStreamAdapter(os)); os.flush(); } finally {
if (ppio instanceof ComplexPPIO && ((ComplexPPIO) ppio).getMimeType().equals(mime)) { return ppio;
&& ((ComplexPPIO) ppio).getMimeType().equals(mime)) { return ppio;
@Override protected Object getValueInternal(ProgressListener listener) throws Exception { WebFeatureService wfs = (WebFeatureService) context.getBean("wfsServiceTarget"); GetFeatureType gft = null; InputReferenceType ref = input.getReference(); if (ref.getMethod() == MethodType.POST_LITERAL) { gft = (GetFeatureType) ref.getBody(); } else { GetFeatureKvpRequestReader reader = (GetFeatureKvpRequestReader) context.getBean("getFeatureKvpReader"); gft = (GetFeatureType) kvpParse(ref.getHref(), reader); } FeatureCollectionResponse featureCollectionType = wfs.getFeature(gft); // this will also deal with axis order issues return ((ComplexPPIO) ppio).decode(featureCollectionType.getAdaptee()); }
fext = ((ComplexPPIO) ppio) .getFileExtension( result.getData() .getComplexData()
format.setMimeType(cppio.getMimeType()); if (cppio instanceof BinaryPPIO) { format.setEncoding("base64");
/** * Process the request as an internal one, without going through GML encoding/decoding * * @param ppio * @param ref * @param method * @return * @throws Exception */ Object handleAsInternalWFS(ProcessParameterIO ppio, InputReferenceType ref) throws Exception { WebFeatureService wfs = (WebFeatureService) context.getBean("wfsServiceTarget"); GetFeatureType gft = null; if (ref.getMethod() == MethodType.POST_LITERAL) { gft = (GetFeatureType) ref.getBody(); } else { GetFeatureKvpRequestReader reader = (GetFeatureKvpRequestReader) context .getBean("getFeatureKvpReader"); gft = (GetFeatureType) kvpParse(ref.getHref(), reader); } FeatureCollectionResponse featureCollectionType = wfs.getFeature(gft); // this will also deal with axis order issues return ((ComplexPPIO) ppio).decode(featureCollectionType.getAdaptee()); }
format.setMimeType( cppio.getMimeType() );
format.setMimeType( cppio.getMimeType() );
} else if (data.getComplexData() != null) { ComplexDataType complex = data.getComplexData(); value = ((ComplexPPIO) ppio).decode(complex.getData().get(0)); } else if (data.getBoundingBoxData() != null) { value = ((BoundingBoxPPIO) ppio).decode(data.getBoundingBoxData());