Search in sources :

Example 6 with AppSchemaDataAccessType

use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType in project hale by halestudio.

the class AppSchemaMappingTest method initMapping.

@Before
public void initMapping() {
    mappingWrapper = new AppSchemaMappingWrapper(new AppSchemaDataAccessType());
    mappingContext = new AppSchemaMappingContext(mappingWrapper);
    // initialize namespaces
    mappingContext.getOrCreateNamespace(LANDCOVER_NS, LANDCOVER_PREFIX);
    mappingContext.getOrCreateNamespace(BASE_NS, BASE_PREFIX);
    mappingContext.getOrCreateNamespace(GML_NS, GML_PREFIX);
    mappingContext.getOrCreateNamespace(GMD_NS, GMD_PREFIX);
    mappingContext.getOrCreateNamespace(XLINK_NS, XLINK_PREFIX);
}
Also used : AppSchemaDataAccessType(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType) AppSchemaMappingContext(eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingContext) AppSchemaMappingWrapper(eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingWrapper) Before(org.junit.Before)

Example 7 with AppSchemaDataAccessType

use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType in project hale by halestudio.

the class AppSchemaMappingGenerator method writeMapping.

static void writeMapping(OutputStream out, AppSchemaDataAccessType mapping) throws JAXBException {
    JAXBContext context = createJaxbContext();
    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    JAXBElement<AppSchemaDataAccessType> mappingConfElement = new ObjectFactory().createAppSchemaDataAccess(mapping);
    marshaller.marshal(mappingConfElement, out);
}
Also used : Marshaller(javax.xml.bind.Marshaller) AppSchemaDataAccessType(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType) ObjectFactory(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.ObjectFactory) JAXBContext(javax.xml.bind.JAXBContext)

Example 8 with AppSchemaDataAccessType

use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType in project hale by halestudio.

the class AppSchemaMappingWrapper method getIncludedTypesMapping.

/**
 * Returns the mapping configuration for the included types mapping file.
 *
 * <p>
 * If the mapping does not require multiple files, <code>null</code> is
 * returned.
 * </p>
 *
 * @return a copy of the included types mapping configuration, or
 *         <code>null</code>
 */
public AppSchemaDataAccessType getIncludedTypesMapping() {
    if (requiresMultipleFiles()) {
        AppSchemaDataAccessType includedTypesMapping = cloneMapping(appSchemaMapping);
        Set<FeatureTypeMapping> toBeRemoved = new HashSet<FeatureTypeMapping>();
        Set<FeatureTypeMapping> toBeKept = new HashSet<FeatureTypeMapping>();
        groupTypeMappings(toBeRemoved, toBeKept);
        purgeTypeMappings(includedTypesMapping, toBeRemoved);
        return includedTypesMapping;
    } else {
        return null;
    }
}
Also used : AppSchemaDataAccessType(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType) FeatureTypeMapping(eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.TypeMappingsPropertyType.FeatureTypeMapping) HashSet(java.util.HashSet)

Aggregations

AppSchemaDataAccessType (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.AppSchemaDataAccessType)8 FeatureTypeMapping (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.TypeMappingsPropertyType.FeatureTypeMapping)4 Namespace (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.NamespacesPropertyType.Namespace)2 AppSchemaMappingContext (eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingContext)2 AppSchemaMappingWrapper (eu.esdihumboldt.hale.io.appschema.writer.internal.mapping.AppSchemaMappingWrapper)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBException (javax.xml.bind.JAXBException)2 DefaultIOReporter (eu.esdihumboldt.hale.common.core.io.report.impl.DefaultIOReporter)1 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 ObjectFactory (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.ObjectFactory)1 DataStore (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore)1 WorkspaceMetadata (eu.esdihumboldt.hale.io.appschema.model.WorkspaceMetadata)1 AbstractAppSchemaConfigurator (eu.esdihumboldt.hale.io.appschema.writer.AbstractAppSchemaConfigurator)1 AppSchemaMappingGenerator (eu.esdihumboldt.hale.io.appschema.writer.AppSchemaMappingGenerator)1 UnsupportedTransformationException (eu.esdihumboldt.hale.io.appschema.writer.internal.UnsupportedTransformationException)1 InputStream (java.io.InputStream)1 Marshaller (javax.xml.bind.Marshaller)1 Unmarshaller (javax.xml.bind.Unmarshaller)1