On Sat, Jun 9, 2012 at 4:05 AM, Jody Garnett <jody.garn...@gmail.com> wrote: > So this is what you were talking about with respect to the "process stuff > not being ready".
Err... just part of it. When I said it all we had were some sample processes, now we have more and I know other people have been implementing extras that have not been contributed to the community, the sore point so far has been the lack of docs (thought it seems OpenGeo is writing some, not clear wheter that will be a contribution of it will become some sort of OpenGeo white paper). So yeah, while WPS per se is still not ready for GeoServer core (over my dead body as long as it lacks of service limits and ability to hide processes), the process API looks like something we can commit to once these fixes are in. Unfortunately the way you quoted your mail is not recognized by gmail, this makes it difficult to answer, but I'll try. > @DescribeParameter(name = "multiplier", min = 0, default = 1d) double > multiplier > > We may get more milage out of taking a default String and allowing > Converters to have a go at it. > > Compare: > - @DescribeParameter(name = "background", min = 0, default = "#23112F") > Color background > - @DescribeParameter(name = "background", min = 0, default = new Color( > 35,17,47) Color background > > But still point taken; great to document the default value that can be used > if null is passed in. Hum... taking always a string no, if possible I want something that can be type safe, but allowing Object there and trying converters if the type is not the target one is indeed in line with how the rest of GeoTools works, I can go for that. > The DescribeParameter information is pulled into a Parameter object; which > contains a metadata map and common keys. The base Parameter implementation > contains methods to perform common validation checks. Yep, but they are too basic. > Still turning this DescribeParameter annotation into a Parameter object is > done by our Process object; and is not easily available to those quickly > writing a static method. Perhaps we can make a ParameterImpl.valueOf( Class > type, String method, String arg) method so this is accessible? > > class Bar { > public static double expand( int @DescribeParameter( name = "scale", > min=100, max=200,defaultValue=100) double scale ){ > Parameter scaleParam = ParamImpl.valueOf( Bar.class, "expand", "scale" > ); // find annotation and process it down into the Parameter utility class > > if( scaleParam.isRequried() && foo == null ){ > x = param.getDefaultValue(); > } > // most of the validation code is off in gt-swing and udig codebase :( > if( !scaleParam.isValid( scale ) ){ > throw new IllegalArgumentException( scaleParam.validationMessage( > scale ) ); > } > return 1.0 / (scale*100.0); > } > } Holy cow no, I don't want to make people write that much code around. Althought it's not clear to me where you'd put that code. When I write something like: @DescribeResult(name = "bar") public int execute(@DescribeParameter( name = "scale", min=100, max=200,defaultValue=100) double scale) { return foo(scale); } I want be be sure that scale is not null and valid without having to write a single extra line of code. That's why I would like to roll a set of common validation routines, to make people have to write their custom validation code only if their need is totally uncommon. As for parameter having a map, yes it has one, but it's not exposed to the outside world, which it seems it's needed to provide some extra info needed in process execution (the association between output mime type and the input that will receive the chosen one, and the default value, thought with the latter we could use the "sample" value... yet sample does not mean default...) Cheers Andrea -- Ing. Andrea Aime GeoSolutions S.A.S. Tech lead Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 mob: +39 339 8844549 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://www.linkedin.com/in/andreaaime http://twitter.com/geowolf ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel