All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ivoa.ivoa-entities.0.9.8.source-code.overview.html Maven / Gradle / Ivy






IVOA Objects


IVOA Objects

The classes within this library represent models of metadata within the IVOA. These metadata are mostly to be found in IVOA registries (e.g. the VOResource schema) and thus exclude most of the IVOA "data models" (e.g. The "Spectrum Data Model")

The classes that represent this metadata are generally auto-geneated from the schema (to be found at http://www.ivoa.net/xml/) with the JAXB framework within {@link org.javastro.ivoa.entities} packages and sub-packages i.e. the registry related classes are in {@link org.javastro.ivoa.entities.resource} and below.

Using the XML binding

There are some helper classes for using the XML binding in the {@link org.javastro.ivoa.entities.jaxb} package - in particular the {@link org.javastro.ivoa.entities.jaxb.IvoaJAXBContextFactory} sets up a JAXB context with all of the packages/schema included that are supported by the library. In addition there are some static utility methods within {@link org.javastro.ivoa.entities.jaxb.IvoaJAXBUtils} that can help with the boilerplate code needed with JAXB marshalling an unmarshalling so that unmarshalling can be as easy as

    VOResources resources = IvoaJAXBUtils.unmarshall(this.getClass().getResourceAsStream("/VOResource.xml"), VOResources.class);

RegTAP

There are additionally a set of hand written classes for converting the VOResource XML instances into RegTAP representation and for persisting these objects via JPA

The RegTAP classes for persisting to a relational database are in the {@link org.javastro.ivoa.entities.regtap} package. There is a {@link org.javastro.ivoa.jpa.ResourceJpaController} for storing and fetching {@link org.javastro.ivoa.entities.regtap.Resource} objects, and {@link org.javastro.ivoa.entities.regtap.translate.RegTapTranslator} for converting from XML to RegTAP, so that the reading of the XML to storing in the database can be achied with


    InputStream resourceStream = RegTapTranslator.class.getResourceAsStream("/VOResource.xml");
    res = IvoaJAXBUtils.unmarshall(resourceStream, org.javastro.ivoa.entities.resource.registry.iface.VOResources.class);
    org.javastro.ivoa.entities.regtap.RegTAP rt = new RegTapTranslator().translate(res);
    ResourceJpaController rjc = ResourceJpaController(emf);
    for (org.javastro.ivoa.entities.regtap.Resource r : rt.resources  ) {
        rjc.create(r);
    }



@author Paul Harrison ([email protected])




© 2015 - 2024 Weber Informatics LLC | Privacy Policy