Search in sources :

Example 1 with ExportProvider

use of eu.esdihumboldt.hale.common.core.io.ExportProvider in project hale by halestudio.

the class ActionProjectFile method store.

/**
 * @see ProjectFile#store(LocatableOutputSupplier)
 */
@SuppressWarnings("unchecked")
@Override
public void store(final LocatableOutputSupplier<OutputStream> target) throws Exception {
    // get the action
    IOAction action = IOActionExtension.getInstance().get(saveActionId);
    checkState(ExportProvider.class.isAssignableFrom(action.getProviderType()), "Save action not compatible to ExportProvider");
    // get specified provider
    ExportProvider provider = (ExportProvider) HaleIO.createIOProvider(action.getProviderType(), null, saveProviderId);
    if (provider == null) {
        throw new IllegalStateException("No provider for saving project file found");
    }
    // find advisor
    @SuppressWarnings("rawtypes") IOAdvisor advisor = advisorRegister.findAdvisor(saveActionId, serviceProvider);
    checkState(advisor != null, "No advisor for saving project file found");
    // configure provider
    // set given parameters
    setParameters(provider, saveParameters);
    // set target
    provider.setTarget(target);
    // execute the provider -> error is propagated outside (so project
    // writer knows of it)
    executeProvider(provider, advisor);
}
Also used : IOAdvisor(eu.esdihumboldt.hale.common.core.io.IOAdvisor) IOAction(eu.esdihumboldt.hale.common.core.io.IOAction) ExportProvider(eu.esdihumboldt.hale.common.core.io.ExportProvider)

Aggregations

ExportProvider (eu.esdihumboldt.hale.common.core.io.ExportProvider)1 IOAction (eu.esdihumboldt.hale.common.core.io.IOAction)1 IOAdvisor (eu.esdihumboldt.hale.common.core.io.IOAdvisor)1