示例#1
0
 public void AddComplexData(string id, string fileName, string mimeType, byte[] b)
 {
     this.fileName = fileName;
     ComplexOutput data = new ComplexOutput(id, "", "", mimeType);
     data.Value = b;
     returnValues.Add(data);
 }
示例#2
0
 public void AddComplexData(string id, string fileName, string mimeType, string s)
 {
     this.fileName = fileName;
     ComplexOutput data = new ComplexOutput(id, "", "", new ComplexFormat(mimeType,"",""));
     data.Value = System.Text.Encoding.UTF8.GetBytes(s);
     returnValues.Add(data);
 }
示例#3
0
        public void AddComplexData(string id, string fileName, string mimeType, byte[] b)
        {
            this.fileName = fileName;
            ComplexOutput data = new ComplexOutput(id, "", "", mimeType);

            data.Value = b;
            returnValues.Add(data);
        }
示例#4
0
        public void AddComplexData(string id, string fileName, string mimeType, string s)
        {
            this.fileName = fileName;
            ComplexOutput data = new ComplexOutput(id, "", "", new ComplexFormat(mimeType, "", ""));

            data.Value = System.Text.Encoding.UTF8.GetBytes(s);
            returnValues.Add(data);
        }
示例#5
0
        public override bool Parse(string str, ProcessDescription processDescription)
        {
            if (String.IsNullOrEmpty(str))
            {
                return(false);
            }

            string[] tokens = str.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length != 1)
            {
                throw new ExceptionReport("One identifier is mandatory when requesting a raw data output but "
                                          + tokens.Length + " were found.",
                                          ExceptionCode.InvalidParameterValue, "RawDataOutput");
            }

            string[] kv = str.Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
            if (kv.Length > 0)
            {
                OutputData outputData = processDescription.GetProcessOutputParameter(kv[0]);
                if (outputData == null)
                {
                    throw new ExceptionReport(String.Format("The output {0} is not a valid output for the process {1}",
                                                            kv[0], processDescription.Identifier), ExceptionCode.InvalidParameterValue, "rawDataOutput");
                }

                ComplexOutput output = outputData.asComplexOutput();
                if (output == null)
                {
                    throw new ExceptionReport(String.Format("Only ComplexOutputs can be requested as rawDataOutput but {0} is a {1}",
                                                            kv[0], outputData.GetType().ToString()), ExceptionCode.InvalidParameterValue, "rawDataOutput");
                }

                Identifier = kv[0];
                Format     = output.Format; // default format
                Format.ParseValue(str);
                if (output.Formats.Find(delegate(ComplexFormat cf) { return(cf.Equals(Format)); }) == null)
                {
                    throw new ExceptionReport(string.Format("Requested format for the output {0} is not supported", kv[0]),
                                              ExceptionCode.InvalidParameterValue, kv[0]);
                }
            }

            return(false);
        }
示例#6
0
        public override bool Parse(XmlNode node, ProcessDescription processDescription)
        {
            if (node == null)
            {
                return(false);
            }

            XmlNamespaceManager nsmgr = Utils.CreateWPSNamespaceManager(node.OwnerDocument);

            XmlNodeList childs = node.SelectNodes("ows:Identifier", nsmgr);

            if (childs.Count != 1)
            {
                throw new ExceptionReport("One identifier is mandatory when requesting a raw data output but " + childs.Count + " were found.",
                                          ExceptionCode.InvalidParameterValue, "wps:RawDataOutput/ows:Identifier");
            }
            Identifier = childs[0].InnerText;
            OutputData outputData = processDescription.GetProcessOutputParameter(Identifier);

            if (outputData == null)
            {
                throw new ExceptionReport(String.Format("The output {0} is not a valid output for the process {1}",
                                                        Identifier, processDescription.Identifier), ExceptionCode.InvalidParameterValue, "rawDataOutput");
            }

            ComplexOutput processOutput = outputData.asComplexOutput();

            if (processOutput == null)
            {
                throw new ExceptionReport(String.Format("Only ComplexOutputs can be requested as rawDataOutput but {0} is a {1}",
                                                        Identifier, outputData.GetType().Name), ExceptionCode.InvalidParameterValue, "rawDataOutput");
            }

            Format = processOutput.Format;
            Format.ParseValue(node);
            return(true);
        }
示例#7
0
文件: Add.cs 项目: salomonT/wps-net
 public ProcessDescription GetDescription()
 {
     ProcessDescription process = new ProcessDescription("Add", "Add", "(a + b) through WPS", "1.1");
     LiteralInput a = new LiteralInput("a", "operand a", "abstract a", "integer", "88");
     a.MinOccurs = 0;
     a.MaxOccurs = 3;
     //a.AllowedValues.Add("88");
     //a.AllowedValues.Add("6");
     process.inputs.Add(a);
     process.inputs.Add(new LiteralInput("b", "operand b", "abstract b", "integer", "22"));
     process.outputs.Add(new LiteralOutput("sum", "sum of a + b", "abstract sum a + b", "integer"));
     ComplexOutput sumFile = new ComplexOutput("sumFile", "sum of a + b as file", "raw abstract sum a + b", new ComplexFormat("text/xml", "utf8", ""));
     sumFile.Formats.Add(new ComplexFormat("plain/text", "utf8", ""));
     process.outputs.Add(sumFile);
     return process;
 }