@Override protected Encoder createEncoder( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { return new Encoder(configuration); }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { Encoder e = new Encoder( xml ); e.encode( obj, element, handler ); }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { Encoder e = new Encoder(xml); e.encode(obj, element, handler); }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { Encoder e = new Encoder(xml); e.encode(obj, element, handler); }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { Encoder e = new Encoder(xml); e.encode(obj, element, handler); }
@Override public Element marshal(MultiPolygon geometry) throws Exception { if (geometry == null) { return null; } try { Encoder encoder = new Encoder(new GMLConfiguration()); return encoder.encodeAsDOM(geometry, org.geotools.gml3.v3_2.GML.MultiGeometry) .getDocumentElement(); } catch (Exception e) { throw new Exception("Cannot transform the specified geometry in GML", e); } }
private void writeToStream(IData coll, OutputStream os) { FeatureCollection<?, ?> fc = ((GTVectorDataBinding)coll).getPayload(); Configuration configuration = new KMLConfiguration(); Encoder encoder = new org.geotools.xml.Encoder(configuration); try{ encoder.encode(fc, KML.kml, os); }catch(IOException e){ throw new RuntimeException(e); } }
/** * Returns a single-line string containing the xml representation of the given filter, as * appropriate for the {@code FILTER} parameter in a GetFeature request. */ protected String encodeGetFeatureGetFilter(final Filter filter) throws IOException { Configuration filterConfig = getFilterConfiguration(); Encoder encoder = new Encoder(filterConfig); // do not write the xml declaration encoder.setOmitXMLDeclaration(true); encoder.setEncoding(Charset.forName("UTF-8")); OutputStream out = new ByteArrayOutputStream(); encoder.encode(filter, OGC.Filter, out); String encoded = out.toString(); encoded = encoded.replaceAll("\n", ""); return encoded; }
private void writeBBox(OutputStream os, BoundingBoxType bbox) throws IOException { Encoder encoder = new Encoder(new OWSConfiguration()); encoder.encode(bbox, OWS.BoundingBox, os); }
private void writeBBox(OutputStream os, BoundingBoxType bbox) throws IOException { Encoder encoder = new Encoder(new OWSConfiguration()); encoder.encode(bbox, OWS.BoundingBox, os); }
/** * Stores the request in a binary resource for efficient later retrieval * * @param executionId * @throws IOException */ public void storeRequestObject(ExecuteType execute, String executionId) throws IOException { Resource resource = getStoredRequest(executionId); try (OutputStream out = resource.out()) { WPSConfiguration config = new WPSConfiguration(); Encoder encoder = new Encoder(config); encoder.encode(execute, WPS.Execute, out); } }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); StyledLayerDescriptor sld = sf.createStyledLayerDescriptor(); NamedLayer nl = sf.createNamedLayer(); nl.setName(""); nl.styles().add((Style) obj); sld.setStyledLayers(new StyledLayer[] {nl}); Encoder e = new Encoder(sldConfiguration); e.encode(sld, element, handler); }
@Override public void encode(Object obj, ContentHandler handler) throws Exception { StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); StyledLayerDescriptor sld = sf.createStyledLayerDescriptor(); NamedLayer nl = sf.createNamedLayer(); nl.setName(""); nl.styles().add((Style) obj); sld.setStyledLayers(new StyledLayer[] { nl }); Encoder e = new Encoder(sldConfiguration); e.encode(sld, element, handler); }
void write1_1(LockFeatureResponseType lockResponse, OutputStream output, Operation operation) throws IOException { Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); LockFeatureType req = (LockFeatureType) operation.getParameters()[0]; encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, buildSchemaURL(req.getBaseUrl(), "schemas/wfs/1.1.0/wfs.xsd")); encoder.encode(lockResponse, org.geoserver.wfs.xml.v1_1_0.WFS.LOCKFEATURERESPONSE, output); output.flush(); } }
@Override public void encode(Object object, ContentHandler handler) throws Exception { FeatureCollection features = (FeatureCollection) object; SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema(); FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType(); fc.getFeature().add(features); Encoder e = new Encoder(configuration); e.getNamespaces().declarePrefix("feature", featureType.getName().getNamespaceURI()); e.encode(fc, getElement(), handler); }
@Override public void encode(Object object, ContentHandler handler) throws Exception { FeatureCollection features = (FeatureCollection) object; SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema(); FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType(); fc.getFeature().add( features ); Encoder e = new Encoder(configuration); e.getNamespaces().declarePrefix( "feature", featureType.getName().getNamespaceURI() ); e.encode( fc, getElement(), handler ); }
@Override protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { hits.setNumberOfFeatures(BigInteger.valueOf(0)); Encoder e = new Encoder(new WFSConfiguration()); e.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); e.setSchemaLocation( WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd")); e.encode(hits.getAdaptee(), WFS.FeatureCollection, output); } }
public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { // get the feature SimpleFeature feature = (SimpleFeature) value; SimpleFeatureType featureType = feature.getType(); // grab the metadata FeatureTypeInfo meta = catalog.getFeatureTypeByName(featureType.getName()); // create teh encoder Encoder encoder = new Encoder(configuration); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); encoder.encode(feature, new QName(meta.getNamespace().getURI(), meta.getName()), output); } }
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd")); encoder.encode( hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output); } }
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { Encoder encoder = new Encoder(new WFSConfiguration()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); encoder.setOmitXMLDeclaration(Dispatcher.REQUEST.get().isSOAP()); String baseURL = (String) EMFUtils.get((EObject) operation.getParameters()[0], "baseUrl"); encoder.setSchemaLocation(WFS.NAMESPACE, buildSchemaURL(baseURL, "wfs/2.0/wfs.xsd")); encode(encoder, value, output, operation); }