public TileExporter (String zookeeperQuorum, String zookeeperPort, String hbaseMaster, String rootPath, String extension) throws IOException { _from = new HBasePyramidIO(zookeeperQuorum, zookeeperPort, hbaseMaster); _to = new FileBasedPyramidIO(new FileSystemPyramidSource(rootPath, extension)); }
private void updatePyramid () { FileBasedPyramidIO oldIO = _io; if (null != _rootPath && null != _extension) { _io = new FileBasedPyramidIO(new FileSystemPyramidSource(_rootPath, _extension)); firePropertyChange(BinVisualizer.PYRAMID_IO, oldIO, _io); } else if (null != _io) { _io = null; firePropertyChange(BinVisualizer.PYRAMID_IO, oldIO, _io); } }
source = new FileSystemPyramidSource(rootpath, extension); } else if (rootpath.startsWith("res://")) { } else { source = new FileSystemPyramidSource(rootpath, extension);
@Before public void setup () { try { _dataIO = new FileSystemAnnotationIO( new FileSystemAnnotationSource( ROOT_PATH, DATA_EXT ) ); _tileIO = new FileBasedPyramidIO(new FileSystemPyramidSource(ROOT_PATH, TILE_EXT)); } catch (Exception e) { LOGGER.debug("Error: " + e.getMessage()); } _pyramid = new WebMercatorTilePyramid(); _indexer = new AnnotationIndexerImpl(); _tileSerializer = new StringLongPairArrayMapJsonSerializer(); _dataSerializer = new JSONAnnotationDataSerializer(); }
@Test public void writeReadAvroRoundTripTest () { FileBasedPyramidIO io = new FileBasedPyramidIO(new FileSystemPyramidSource(SOURCE_DIR, SOURCE_EXT)); TileSerializer<Integer> serializer = new PrimitiveAvroSerializer<>(Integer.class, CodecFactory.nullCodec()); ArrayList<TileData<Integer>> writeTiles = new ArrayList<>(); TileIndex index = new TileIndex( LEVEL, X_INDEX, Y_INDEX ); TileData<Integer> tile = new DenseTileData<>(index); for (int x=0; x<256; ++x) { for (int y=0; y<256; ++y) { tile.setBin(x, y, x+256*y); } } writeTiles.add(tile); writeAvroTiles(io, serializer, SOURCE_LAYER, writeTiles); List<TileData<Integer>> readTiles = readAvroTiles(io, serializer, SOURCE_LAYER); for (int i=0; i<writeTiles.size(); i++){ TileData<Integer> writeTile = writeTiles.get(i); TileIndex writeTileDef = writeTile.getDefinition(); TileData<Integer> readTile = readTiles.get(i); TileIndex readTileDef = readTile.getDefinition(); Assert.assertEquals(writeTileDef, readTileDef); for (int x = 0; x < writeTile.getDefinition().getXBins(); ++x) { for (int y = 0; y < writeTile.getDefinition().getYBins(); ++y) { Assert.assertEquals(writeTile.getBin(x, y), readTile.getBin(x, y)); } } } }
@Test public void writeReadAvroRoundTripTest () { FileBasedPyramidIO io = new FileBasedPyramidIO(new FileSystemPyramidSource(SOURCE_DIR, SOURCE_EXT)); TileSerializer<Integer> serializer = new PrimitiveAvroSerializer<>(Integer.class, CodecFactory.nullCodec()); ArrayList<TileData<Integer>> writeTiles = new ArrayList<>(); TileIndex index = new TileIndex( LEVEL, X_INDEX, Y_INDEX ); TileData<Integer> tile = new DenseTileData<>(index); for (int x=0; x<256; ++x) { for (int y=0; y<256; ++y) { tile.setBin(x, y, x+256*y); } } writeTiles.add(tile); writeAvroTiles(io, serializer, SOURCE_LAYER, writeTiles); List<TileData<Integer>> readTiles = readAvroTiles(io, serializer, SOURCE_LAYER); for (int i=0; i<writeTiles.size(); i++){ TileData<Integer> writeTile = writeTiles.get(i); TileIndex writeTileDef = writeTile.getDefinition(); TileData<Integer> readTile = readTiles.get(i); TileIndex readTileDef = readTile.getDefinition(); Assert.assertEquals(writeTileDef, readTileDef); for (int x = 0; x < writeTile.getDefinition().getXBins(); ++x) { for (int y = 0; y < writeTile.getDefinition().getYBins(); ++y) { Assert.assertEquals(writeTile.getBin(x, y), readTile.getBin(x, y)); } } } }