我想在 52 north 之前开发一个 wps 进程,我应该使用org.n52.wps.server.AbstractSelfDescribingAlgorithm
所以这个类继承自net.opengis.wps.x100.ProcessDescriptionType
. 我的问题是哪个 jar 文件包含这种类型,请告诉我下载这个 jar 文件的 url?!我的代码是:
package www.gise.cse.iitb.ac.in;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.n52.wps.io.data.IData;
import org.n52.wps.io.data.binding.literal.LiteralDoubleBinding;
import org.n52.wps.server.AbstractSelfDescribingAlgorithm;
public class AddNumbersAlgo extends org.n52.wps.server.AbstractSelfDescribingAlgorithm {
@Override
public Class getInputDataType(String arg0) {
// TODO Auto-generated method stub
if (arg0.equals("Num1")){
//return GTVectorDataBinding.class;
return LiteralDoubleBinding.class;
}
if (arg0.equals("Num2")){
//return GTVectorDataBinding.class;
return LiteralDoubleBinding.class;
}
throw new RuntimeException("Error: WrongIdentifier");
}
@Override
public Class getOutputDataType(String arg0) {
// TODO Auto-generated method stub
if(arg0.equals("AdditionResult")){
return LiteralDoubleBinding.class;
}
throw new RuntimeException("Error: Wrong identifier");
}
@Override
public Map<String, IData> run(Map<String, List<IData>> arg0) {
if (arg0 == null || !arg0.containsKey("Num1")){
throw new RuntimeException("Error: While allocating Input Parameters");
}
if (arg0 == null || !arg0.containsKey("Num2")){
throw new RuntimeException("Error: While allocating Input Parameters");
}
List<IData> datalist = arg0.get("Num1");
if(datalist == null || datalist.size()!=1){
throw new RuntimeException("Error:While allocating Input Parameters");
}
//Checking for correctness of input
List<IData> datalist1 = arg0.get("Num2");
if(datalist1 == null || datalist1.size()!=1){
throw new RuntimeException("Error:While allocating Input Parameters");
}
//Extracting input
IData Num1 = datalist.get(0);
double firstNum = ((LiteralDoubleBinding)Num1).getPayload();
System.out.println(Num1);
System.out.println(firstNum);
IData Num2 = datalist1.get(0);
double secondNum = ((LiteralDoubleBinding)Num2).getPayload();
System.out.println(Num2);
System.out.println(secondNum);
double Result = firstNum + secondNum;
//double AdditionResult;
//create the response. In this case a GenericFileDataBinding is used (see this.getOutputDataType(...)
IData AdditionResult = new LiteralDoubleBinding(Result);
//new Map created
Map<String, IData> resultMap = new HashMap<String, IData>();
//created response added to corresponding identifier (see this.getOutputIdentifiers())
resultMap.put("AdditionResult", AdditionResult);
return resultMap;
}
@Override
public List<String> getInputIdentifiers() {
// TODO Auto-generated method stub
List<String> identifiers = new ArrayList<String>();
identifiers.add("Num1");
identifiers.add("Num2");
return identifiers;
}
@Override
public List<String> getOutputIdentifiers() {
// TODO Auto-generated method stub
List<String> identifiers = new ArrayList<String>();
identifiers.add("AdditionResult");
return identifiers;
}
错误是:
此行有多个标记
net.opengis.wps.x100.ProcessDescriptionType
无法解析类型。它是从所需的 .class 文件中间接引用的
net.opengis.wps.x100.ProcessDescriptionType
无法解析类型。它是从所需的 .class 文件中间接引用的