net.disy.ogc.wps.v_1_0_0.DefaultExecuteService Maven / Gradle / Ivy
/**
* Legato is a configurable, lightweight web mapping client that can be
* easily embedded into web pages and portals, CMS and individual web
* applications. Legato is implemented in JavaScript and based on the
* popular open source library OpenLayers.
*
* Copyright (C) 2010 disy Informationssysteme GmbH, http://www.disy.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package net.disy.ogc.wps.v_1_0_0;
import java.util.Locale;
import net.disy.ogc.ows.v_1_1_0.InvalidParameterValueException;
import net.disy.ogc.ows.v_1_1_0.MissingParameterValueException;
import net.disy.ogc.ows.v_1_1_0.OwsException;
import net.opengis.ows.v_1_1_0.CodeType;
import net.opengis.wps.v_1_0_0.Execute;
import net.opengis.wps.v_1_0_0.ExecuteResponse;
public class DefaultExecuteService implements ExecuteService {
private WpsProcessRegistry wpsProcessRegistry;
private final String url;
public DefaultExecuteService(String url) {
this.url = url;
}
public WpsProcessRegistry getWpsProcessRegistry() {
return wpsProcessRegistry;
}
public void setWpsProcessRegistry(WpsProcessRegistry wpsProcessRegistry) {
this.wpsProcessRegistry = wpsProcessRegistry;
}
public String getUri() {
return url;
}
@Override
public ExecuteResponse execute(Execute input) throws OwsException {
final CodeType identifier = input.getIdentifier();
if (identifier == null) {
throw new MissingParameterValueException("identifier"); //$NON-NLS-1$
}
final WpsProcess wpsProcess = getWpsProcessRegistry().getProcessByIdentifier(identifier);
if (wpsProcess == null) {
throw new InvalidParameterValueException("identifier", identifier.getValue()); //$NON-NLS-1$
}
final ExecuteResponse executeResponse = wpsProcess.execute(
input.getDataInputs(),
input.getResponseForm(),
Locale.ENGLISH.toString());
executeResponse.setServiceInstance(getUri() + "?request=GetCapabilities&service=WPS"); //$NON-NLS-1$
return executeResponse;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy