public GenericFileDataWithGT(FeatureCollection<?, ?> featureCollection) throws IOException { this(getShpFile(featureCollection), IOHandler.MIME_TYPE_ZIPPED_SHP); }
@Override public GenericFileDataWithGTBinding parse(InputStream stream, String mimeType, String schema) { GenericFileDataWithGTBinding data = new GenericFileDataWithGTBinding( new GenericFileDataWithGT(stream, "text/xml")); return data; }
public File getShpFile() { return getAsGTVectorDataBinding().getPayloadAsShpFile(); }
public static String getStringRepresentation(String xmlDataTypeURI, IData obj) { return obj.getPayload().toString(); }
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; }
public GenericFileData(InputStream stream, String mimeType) { this.dataStream = stream; this.mimeType = mimeType; this.fileExtension = GenericFileDataConstants.mimeTypeFileTypeLUT() .get(mimeType); if(fileExtension == null){ this.fileExtension = "dat"; } }
@Override public GenericFileDataBinding parse(InputStream input, String mimeType, String schema) { GenericFileData theData = new GenericFileData(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataBinding(theData); }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataBinding)data).getPayload().getDataStream(); return theStream; }
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; }
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; }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
private static final IODataType probeMCDataType(IData iData) { Class< ? > clazz = iData.getSupportedClass(); if (clazz == IODataType.BOOLEAN.getSupportedClass()) { return IODataType.BOOLEAN; } if (clazz == IODataType.DOUBLE.getSupportedClass()) { return IODataType.DOUBLE; } if (clazz == IODataType.INTEGER.getSupportedClass()) { return IODataType.INTEGER; } if (clazz == IODataType.STRING.getSupportedClass()) { return IODataType.STRING; } if (clazz == GenericFileData.class) { return IODataType.MEDIA; } // in case we do not find a matching type return null return null; }
private GTRasterLayer wrapRasterLayer(IData rasterLayer) { if(!(rasterLayer.getPayload() instanceof GridCoverage)){ return null; } GridCoverage coverage = (GridCoverage) rasterLayer.getPayload(); GTRasterLayer sextanteRasterLayer = new GTRasterLayer(); sextanteRasterLayer.create(coverage); return sextanteRasterLayer; }
@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); }
public GenericFileDataWithGT(InputStream stream, String mimeType) { this.dataStream = stream; this.mimeType = mimeType; this.fileExtension = GenericFileDataConstants.mimeTypeFileTypeLUT() .get(mimeType); if(fileExtension == null){ this.fileExtension = "dat"; } }
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); }
public static final String[] getMimeTypes (){ return mimeTypeFileTypeLUT().keySet().toArray(new String[0]); }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }