Package org.apache.sis.storage

Examples of org.apache.sis.storage.StorageConnector


        final String file = files.get(0);
        if (file.endsWith(".xml")) {
            final Object obj = XML.unmarshal(new File(file));
            metadata = (obj instanceof Metadata) ? (Metadata) obj : null;
        } else {
            final NetcdfStore store = new NetcdfStore(new StorageConnector(file));
            try {
                metadata = store.getMetadata();
            } finally {
                store.close();
            }
View Full Code Here


     *
     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testCanOpenFromStream() throws DataStoreException {
        final StorageConnector c = new StorageConnector(IOTestCase.getResourceAsStream(NCEP));
        final NetcdfStoreProvider provider = new NetcdfStoreProvider();
        assertTrue(provider.canOpen(c));
        c.closeAllExcept(null);
    }
View Full Code Here

     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testCanOpenFromUCAR() throws IOException, DataStoreException {
        final NetcdfFile file = open(NCEP);
        final StorageConnector c = new StorageConnector(file);
        final NetcdfStoreProvider provider = new NetcdfStoreProvider();
        assertTrue(provider.canOpen(c));
        file.close();
    }
View Full Code Here

     * @throws IOException If an error occurred while opening the NetCDF file.
     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testDecoderFromStream() throws IOException, DataStoreException {
        final StorageConnector c = new StorageConnector(IOTestCase.getResourceAsStream(NCEP));
        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
        assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
        decoder.close();
    }
View Full Code Here

     * @throws IOException If an error occurred while opening the NetCDF file.
     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testDecoderFromUCAR() throws IOException, DataStoreException {
        final StorageConnector c = new StorageConnector(open(NCEP));
        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
        assertInstanceOf(NCEP, DecoderWrapper.class, decoder);
        decoder.close();
    }
View Full Code Here

     * @throws DataStoreException If an error occurred while reading the metadata.
     */
    @Test
    public void testMetadata() throws DataStoreException {
        final Metadata metadata;
        final XMLStore store = new XMLStore(new StorageConnector(new StringReader(XML)));
        try {
            metadata = store.getMetadata();
            assertSame("Expected cached value.", metadata, store.getMetadata());
        } finally {
            store.close();
View Full Code Here

     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testProbeContentFromReader() throws DataStoreException {
        final XMLStoreProvider p = new XMLStoreProvider();
        final StorageConnector c = new StorageConnector(new StringReader(XMLStoreTest.XML));
        final ProbeResult      r = p.probeContent(c);
        c.closeAllExcept(null);
        assertTrue  ("isSupported()", r.isSupported());
        assertEquals("getMimeType()", "application/vnd.iso.19139+xml", r.getMimeType());
    }
View Full Code Here

     *
     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testProbeContentFromStream() throws DataStoreException {
        final StorageConnector c = new StorageConnector(IOTestCase.getResourceAsStream(NCEP));
        final NetcdfStoreProvider provider = new NetcdfStoreProvider();
        final ProbeResult probe = provider.probeContent(c);
        assertTrue  ("isSupported", probe.isSupported());
        assertEquals("getMimeType", NetcdfStoreProvider.MIME_TYPE, probe.getMimeType());
        assertEquals("getVersion"new Version("1"), probe.getVersion());
        c.closeAllExcept(null);
    }
View Full Code Here

     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testProbeContentFromUCAR() throws IOException, DataStoreException {
        final NetcdfFile file = open(NCEP);
        final StorageConnector c = new StorageConnector(file);
        final NetcdfStoreProvider provider = new NetcdfStoreProvider();
        final ProbeResult probe = provider.probeContent(c);
        assertTrue  ("isSupported", probe.isSupported());
        assertEquals("getMimeType", NetcdfStoreProvider.MIME_TYPE, probe.getMimeType());
        assertNull  ("getVersion",  probe.getVersion());
View Full Code Here

     * @throws IOException If an error occurred while opening the NetCDF file.
     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testDecoderFromStream() throws IOException, DataStoreException {
        final StorageConnector c = new StorageConnector(IOTestCase.getResourceAsStream(NCEP));
        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
        assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
        decoder.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.sis.storage.StorageConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.