use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore in project hale by halestudio.
the class AppSchemaFileWriterTest method writeAlignment.
private void writeAlignment(File targetFile, String contentType) throws IOException, IOProviderConfigurationException {
AbstractAppSchemaConfigurator alignWriter = new AppSchemaMappingFileWriter();
prepareProvider(alignWriter, project, tempDir.toURI());
alignWriter.setAlignment(alignment);
alignWriter.setSourceSchema(sourceSchemaSpace);
alignWriter.setTargetSchema(targetSchemaSpace);
alignWriter.setTarget(new FileIOSupplier(targetFile));
DataStore dataStoreParam = createDataStoreParam();
alignWriter.setParameter(AppSchemaIO.PARAM_DATASTORE, new ComplexValue(dataStoreParam));
alignWriter.setContentType(HalePlatform.getContentTypeManager().getContentType(contentType));
IOReport report = alignWriter.execute(new LogProgressIndicator());
assertNotNull(report);
assertTrue(report.isSuccess());
}
use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore in project hale by halestudio.
the class AbstractAppSchemaConfigurator method generateMapping.
/**
* Uses a fresh {@link AppSchemaMappingGenerator} instance to generates the
* mapping configuration based on the current provider's configuration
* parameters.
*
* @param reporter the status reporter
* @throws IOProviderConfigurationException if something is wrong with the
* provider configuration
* @throws IOException if an error occurs loading the mapping template file
*/
public void generateMapping(IOReporter reporter) throws IOProviderConfigurationException, IOException {
if (getAlignment() == null) {
throw new IOProviderConfigurationException("No alignment was provided.");
}
if (getTargetSchema() == null) {
throw new IOProviderConfigurationException("No target schema was provided.");
}
if (getTarget() == null) {
throw new IOProviderConfigurationException("No target was provided.");
}
DataStore dataStoreParam = getDataStoreParameter();
FeatureChaining featureChainingParam = getFeatureChainingParameter();
// resolve property entity definitions here, could't do it on project
// loading
resolvePropertyTypes(featureChainingParam, getTargetSchema(), SchemaSpaceID.TARGET);
WorkspaceConfiguration workspaceConfParam = getWorkspaceConfigurationParameter();
generator = new AppSchemaMappingGenerator(getAlignment(), getTargetSchema(), dataStoreParam, featureChainingParam, workspaceConfParam);
generator.generateMapping(reporter);
}
use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore in project hale by halestudio.
the class AppSchemaMappingGenerator method applyDataStoreConfig.
private void applyDataStoreConfig() {
if (dataStore != null && dataStore.getParameters() != null) {
DataStore targetDS = mappingWrapper.getDefaultDataStore();
List<Parameter> inputParameters = dataStore.getParameters().getParameter();
List<Parameter> targetParameters = targetDS.getParameters().getParameter();
// update destination parameters
for (Parameter inputParam : inputParameters) {
boolean updated = false;
for (Parameter targetParam : targetParameters) {
if (inputParam.getName().equals(targetParam.getName())) {
targetParam.setValue(inputParam.getValue());
updated = true;
break;
}
}
if (!updated) {
// parameter was not already present: add it to the list
targetParameters.add(inputParam);
}
}
}
}
use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore in project hale by halestudio.
the class AppSchemaMappingWrapper method cloneMapping.
static AppSchemaDataAccessType cloneMapping(AppSchemaDataAccessType mapping) {
AppSchemaDataAccessType clone = new AppSchemaDataAccessType();
initMapping(clone);
clone.setCatalog(mapping.getCatalog());
clone.getIncludedTypes().getInclude().addAll(mapping.getIncludedTypes().getInclude());
for (Namespace ns : mapping.getNamespaces().getNamespace()) {
clone.getNamespaces().getNamespace().add(cloneNamespace(ns));
}
for (DataStore ds : mapping.getSourceDataStores().getDataStore()) {
clone.getSourceDataStores().getDataStore().add(cloneDataStore(ds));
}
clone.getTargetTypes().getFeatureType().getSchemaUri().addAll(mapping.getTargetTypes().getFeatureType().getSchemaUri());
for (FeatureTypeMapping ftMapping : mapping.getTypeMappings().getFeatureTypeMapping()) {
clone.getTypeMappings().getFeatureTypeMapping().add(cloneFeatureTypeMapping(ftMapping));
}
return clone;
}
use of eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.SourceDataStoresPropertyType.DataStore in project hale by halestudio.
the class AppSchemaFileWriterTest method createDataStoreParam.
private DataStore createDataStoreParam() {
DataStore dataStoreParam = new DataStore();
dataStoreParam.setParameters(new Parameters());
Parameter hostParam = new Parameter();
hostParam.setName("host");
hostParam.setValue("localhost");
Parameter dbParam = new Parameter();
dbParam.setName("database");
dbParam.setValue("postgres");
Parameter userParam = new Parameter();
userParam.setName("user");
userParam.setValue("postgres");
Parameter passwdParam = new Parameter();
passwdParam.setName("passwd");
passwdParam.setValue("postgres");
Parameter dbtypeParam = new Parameter();
dbtypeParam.setName("dbtype");
dbtypeParam.setValue("postgis");
dataStoreParam.getParameters().getParameter().addAll(Arrays.asList(hostParam, dbParam, dbtypeParam, userParam, passwdParam));
return dataStoreParam;
}
Aggregations