@Override public GenericFileDataWithGTBinding parse(InputStream stream, String mimeType, String schema) { GenericFileDataWithGTBinding data = new GenericFileDataWithGTBinding( new GenericFileDataWithGT(stream, "text/xml")); return data; }
public static String loadSingleDataItem(IData dataItem, File workspaceDir){ Object payload = dataItem.getPayload(); String fileName = null; //File if (payload instanceof GenericFileDataWithGT){ GenericFileDataWithGT gfd = (GenericFileDataWithGT)payload; fileName = gfd.writeData(workspaceDir); } //String if (payload instanceof String) fileName = (String) payload; //Float if (payload instanceof Float) fileName = ((Float)payload).toString(); //Integer if (payload instanceof Integer) fileName = ((Integer)payload).toString(); //Double if (payload instanceof Double) fileName = ((Double)payload).toString(); return fileName; }
public File getShpFile() { return getAsGTVectorDataBinding().getPayloadAsShpFile(); }
public String writeData(File workspaceDir) { String fileName = null; if (GenericFileDataConstants.getIncludeFilesByMimeType(mimeType) != null) { try { fileName = unzipData(dataStream, fileExtension, workspaceDir); } catch (IOException e) { LOGGER.error("Could not unzip the archive to " + workspaceDir); } } else { try { fileName = justWriteData(dataStream, fileExtension, workspaceDir); } catch (IOException e) { LOGGER.error("Could not write the input to " + workspaceDir); } } return fileName; }
File file = null; try { GenericFileDataWithGT fileData = new GenericFileDataWithGT(gtData.getPayload()); file = fileData.getBaseFile(true); } catch (IOException e1) { e1.printStackTrace();
String fileName = writeData(tempDir); LOGGER.info("Temp file is: " + fileName); File shpFile = new File(fileName); return parser.parse(getDataStream(), mimeType, null); return parser.parse(getDataStream(), mimeType, null);
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
public GenericFileDataWithGT(FeatureCollection<?, ?> featureCollection) throws IOException { this(getShpFile(featureCollection), IOHandler.MIME_TYPE_ZIPPED_SHP); }
}else if (isSupportedShapefileType(geomProperty.getType()) && (geomProperty.getValue() != null)) { builder.add(geomProperty.getName().getLocalPart(), geomProperty }else if (isSupportedShapefileType(prop.getType()) && (prop.getValue() != null)) { builder.add(prop.getName().getLocalPart(), prop
GenericFileDataWithGT fileData = new GenericFileDataWithGT(gtData.getPayload(), null); file = fileData.getBaseFile(true);
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
public File getPayloadAsShpFile(){ try { return GenericFileDataWithGT.getShpFile(featureCollection); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Could not transform Feature Collection into shp file. Reason " +e.getMessage()); } } private synchronized void writeObject(java.io.ObjectOutputStream oos) throws IOException
@Override public GenericFileDataWithGTBinding parse(InputStream input, String mimeType, String schema) { GenericFileDataWithGT theData = new GenericFileDataWithGT(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataWithGTBinding(theData); }
GenericFileDataWithGT fileData = new GenericFileDataWithGT(gtData.getPayload()); file = fileData.getBaseFile(true); } catch (IOException e1) { e1.printStackTrace(); GenericFileDataWithGT fileData = new GenericFileDataWithGT(gtData.getPayload(), null); file = fileData.getBaseFile(true);
private String loadSingleDataItem(IData dataItem){ Object payload = dataItem.getPayload(); String value = null; //File if (payload instanceof GenericFileDataWithGT){ GenericFileDataWithGT gfd = (GenericFileDataWithGT)payload; value = gfd.writeData(this.workspace.getWorkspace()); } //String else if (payload instanceof String) value = (String) payload; //Float else if (payload instanceof Float) value = ((Float)payload).toString(); //Integer else if (payload instanceof Integer) value = ((Integer)payload).toString(); //Double else if (payload instanceof Double) value = ((Double)payload).toString(); return value; }
@Override public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { // // check for correct request before returning the stream // if (!(this.isSupportedGenerate(data.getSupportedClass(), mimeType, schema))){ // throw new IOException("I don't support the incoming datatype"); // } GTVectorDataBinding vectorBindingData = ((GenericFileDataWithGTBinding)data).getPayload().getAsGTVectorDataBinding(); IGenerator assistanceGen = GeneratorFactory.getInstance().getGenerator(schema, mimeType, IOHandler.DEFAULT_ENCODING, GTVectorDataBinding.class); return assistanceGen.generateStream(vectorBindingData, mimeType, schema); }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
@Override public GenericFileDataWithGTBinding parse(InputStream input, String mimeType, String schema) { GenericFileDataWithGT theData = new GenericFileDataWithGT(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataWithGTBinding(theData); }
LOGGER.debug("The data passed from the algorithm to the generator is GenericFileDataBinding"); try { gvdb = ((GenericFileDataWithGT) data.getPayload()).getAsGTVectorDataBinding(); isShapefile = true; } catch (Exception e){
private GenericFileDataWithGTBinding parseXML(File file) { SimpleFeatureCollection fc = new GML2BasicParser().parseSimpleFeatureCollection(file); GenericFileDataWithGTBinding data = null; try { data = new GenericFileDataWithGTBinding(new GenericFileDataWithGT(fc)); } catch (IOException e) { LOGGER.error("Exception while trying to wrap GenericFileData around GML2 FeatureCollection.", e); } return data; }