Package org.opengis.metadata

Examples of org.opengis.metadata.Metadata


         * Read metadata from the data storage.
         */
        if (hasUnexpectedFileCount(1, 1)) {
            return Command.INVALID_ARGUMENT_EXIT_CODE;
        }
        final Metadata metadata;
        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 {
View Full Code Here


     *
     * @throws IOException Should never happen.
     */
    @Test
    public void testEmbedded() throws IOException {
        final Metadata metadata;
        final Decoder input = ChannelDecoderTest.createChannelDecoder(NCEP);
        try {
            metadata = new MetadataReader(input).read();
        } finally {
            input.close();
View Full Code Here

     *
     * @throws IOException Should never happen.
     */
    @Test
    public void testUCAR() throws IOException {
        final Metadata metadata;
        final Decoder input = new DecoderWrapper(TestCase.LISTENERS, new NetcdfDataset(open(NCEP)));
        try {
            metadata = new MetadataReader(input).read();
        } finally {
            input.close();
View Full Code Here

                    return method.getName();
                }
                return null;
            }
        };
        Metadata data = (Metadata) Proxy.newProxyInstance(getClass().getClassLoader(),
                    new Class<?>[] { Metadata.class }, handler);
        /*
         * Wrap the metadata in a DefaultMetadata, and ensure
         * we can marshall it without an exception being throw.
         */
 
View Full Code Here

     *
     * @throws JAXBException if the (un)marshalling process fails.
     */
    @Test
    public void testMetadataWithVerticalCRS() throws JAXBException {
        final Metadata metadata = unmarshalFile(Metadata.class, VERTICAL_CRS_XML);
        assertEquals("fileIdentifier", "20090901",                     metadata.getFileIdentifier());
        assertEquals("language",       Locale.ENGLISH,                 metadata.getLanguage());
        assertEquals("characterSet",   CharacterSet.UTF_8,             metadata.getCharacterSet());
        assertEquals("dateStamp",      xmlDate("2014-01-04 00:00:00"), metadata.getDateStamp());
        /*
         * <gmd:contact>
         *   <gmd:CI_ResponsibleParty>
         *     …
         *   </gmd:CI_ResponsibleParty>
         * </gmd:contact>
         */
        final ResponsibleParty contact = getSingleton(metadata.getContacts());
        final OnlineResource onlineResource = contact.getContactInfo().getOnlineResource();
        assertNotNull("onlineResource", onlineResource);
        assertEquals("organisationName", "Apache SIS", contact.getOrganisationName().toString());
        assertEquals("linkage", URI.create("http://sis.apache.org"), onlineResource.getLinkage());
        assertEquals("function", OnLineFunction.INFORMATION, onlineResource.getFunction());
        assertEquals("role", Role.PRINCIPAL_INVESTIGATOR, contact.getRole());
        /*
         * <gmd:spatialRepresentationInfo>
         *   <gmd:MD_VectorSpatialRepresentation>
         *     …
         *   </gmd:MD_VectorSpatialRepresentation>
         * </gmd:spatialRepresentationInfo>
         */
        final SpatialRepresentation spatial = getSingleton(metadata.getSpatialRepresentationInfo());
        assertInstanceOf("spatialRepresentationInfo", VectorSpatialRepresentation.class, spatial);
        assertEquals("geometricObjectType", GeometricObjectType.POINT, getSingleton(
                ((VectorSpatialRepresentation) spatial).getGeometricObjects()).getGeometricObjectType());
        /*
         * <gmd:referenceSystemInfo>
         *   <gmd:MD_ReferenceSystem>
         *     …
         *   </gmd:MD_ReferenceSystem>
         * </gmd:referenceSystemInfo>
         */
        assertIdentifierEquals("referenceSystemInfo", null, "EPSG", null, "World Geodetic System 84",
                getSingleton(metadata.getReferenceSystemInfo()).getName());
        /*
         * <gmd:identificationInfo>
         *   <gmd:MD_DataIdentification>
         *     …
         */
        final DataIdentification identification = (DataIdentification) getSingleton(metadata.getIdentificationInfo());
        final Citation citation = identification.getCitation();
        assertInstanceOf("citation", NilObject.class, citation);
        assertEquals("nilReason", NilReason.MISSING, ((NilObject) citation).getNilReason());
        assertEquals("abstract", "SIS test", identification.getAbstract().toString());
        assertEquals("language", Locale.ENGLISH, getSingleton(identification.getLanguages()));
View Full Code Here

     */
    @Test
    public void testLanguageCode() throws JAXBException {
        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
        final String xml = getMetadataXML(LANGUAGE_CODE);
        final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
        assertEquals(Locale.JAPANESE, metadata.getLanguage());
    }
View Full Code Here

    @Test
    @DependsOnMethod("testLanguageCode")
    public void testLanguageCodeWithoutAttributes() throws JAXBException {
        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
        final String xml = getMetadataXML(LANGUAGE_CODE_WITHOUT_ATTRIBUTE);
        final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
        assertEquals(Locale.JAPANESE, metadata.getLanguage());
        pool.recycle(unmarshaller);
    }
View Full Code Here

     */
    @Test
    public void testCharacterString() throws JAXBException {
        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
        final String xml = getMetadataXML(CHARACTER_STRING);
        final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
        assertEquals(Locale.JAPANESE, metadata.getLanguage());
        pool.recycle(unmarshaller);
    }
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();
        }
        final ResponsibleParty party  = getSingleton(metadata.getContacts());
        final OnlineResource resource = party.getContactInfo().getOnlineResource();

        assertEquals(Locale.ENGLISH,              metadata.getLanguage());
        assertEquals(CharacterSet.UTF_8,          metadata.getCharacterSet());
        assertEquals(Role.PRINCIPAL_INVESTIGATOR, party.getRole());
        assertEquals("Apache SIS",                String.valueOf(party.getOrganisationName()));
        assertEquals("http://sis.apache.org",     String.valueOf(resource.getLinkage()));
        assertEquals(OnLineFunction.INFORMATION,  resource.getFunction());
    }
View Full Code Here

                    return method.getName();
                }
                return null;
            }
        };
        Metadata data = (Metadata) Proxy.newProxyInstance(getClass().getClassLoader(),
                    new Class<?>[] { Metadata.class }, handler);
        /*
         * Wrap the metadata in a DefaultMetadata, and ensure
         * we can marshall it without an exception being throw.
         */
 
View Full Code Here

TOP

Related Classes of org.opengis.metadata.Metadata

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.