/** * Look up an implementation of the named process on the classpath and describe the input * parameter required. * * @param name Name of the Process * @return Description of the parameters required */ public static synchronized Map<String, Parameter<?>> getParameterInfo(Name name) { ProcessFactory factory = createProcessFactory(name); if (factory == null) return null; return factory.getParameterInfo(name); }
factory.getParameterInfo(processName); List<String> argumentNames = new ArrayList<String>(parameterInfo.keySet());
for (Entry<String, Parameter<?>> entry : factory.getParameterInfo(name).entrySet()) { Parameter<?> parameter = entry.getValue();
@Override public Map<String, Parameter<?>> perform( ProcessFactory f, Name oldName, Name newName, Object... args) { return f.getParameterInfo(newName); } });
public Map<String, Parameter<?>> getParameterInfo(Name name) { return delegate.getParameterInfo(name); }
/** * Look up an implementation of the named process on the classpath and describe the input * parameter required. * * @param name Name of the Process * @return Description of the parameters required */ public static synchronized Map<String, Parameter<?>> getParameterInfo(Name name){ ProcessFactory factory = createProcessFactory( name ); if( factory == null ) return null; return factory.getParameterInfo(name); }
public Map<String, Parameter<?>> getParameterInfo(Name name) { if (selector.allowProcess(name)) { return delegate.getParameterInfo(name); } else { return null; } }
public Map<String, Parameter<?>> getParameterInfo(Name name) { if (selector.allowProcess(name)) { return delegate.getParameterInfo(name); } else { return null; } }
JLabel description = new JLabel(factory.getDescription().toString()); page.add(description); for( Entry<String, Parameter< ? >> entry : factory.getParameterInfo().entrySet() ) { Parameter< ? > parameter = entry.getValue();
for (Entry<String, Parameter<?>> entry : factory.getParameterInfo(name).entrySet()) { Parameter<?> parameter = entry.getValue();
public void aboutToDisplayPanel() { page.removeAll(); page.setLayout(new GridLayout(0, 2)); JLabel title = new JLabel(factory.getTitle().toString()); page.add(title); JLabel description = new JLabel(factory.getDescription().toString()); page.add(description); for( Entry<String, Parameter< ? >> entry : factory.getParameterInfo().entrySet() ) { Parameter< ? > parameter = entry.getValue(); JLabel label = new JLabel(parameter.key); page.add(label); ParamWidget widget; if (Double.class.isAssignableFrom( parameter.type )) { widget = new JDoubleField(parameter); } else if (Geometry.class.isAssignableFrom( parameter.type)){ widget = new JGeometryField(parameter); } else { // We got nothing special hope the converter api can deal widget = new JField( parameter ); } JComponent field = widget.doLayout(); page.add(field); fields.put( parameter.key, widget ); } } }
/** * Tests if all inputs and outputs of a Process are transmutable * * @param pf * @return */ public boolean isTransmutable(ProcessFactory pf, Name name) { for(Parameter<?> param : pf.getParameterInfo(name).values()) { try { this.getDefaultTransmuter(param.type); } catch(Exception e) { return false; } } for(Parameter<?> param : pf.getResultInfo(name, null).values()) { try { this.getDefaultTransmuter(param.type); } catch(Exception e) { return false; } } return true; } }
/** * Tests if all inputs and outputs of a Process are transmutable * * @param pf */ public boolean isTransmutable(ProcessFactory pf, Name name) { for (Parameter<?> param : pf.getParameterInfo(name).values()) { try { this.getDefaultTransmuter(param.type); } catch (Exception e) { return false; } } for (Parameter<?> param : pf.getResultInfo(name, null).values()) { try { this.getDefaultTransmuter(param.type); } catch (Exception e) { return false; } } return true; } }
private synchronized void init() { if(functionNames == null) { // collect and sort the factories to have a reproducable list of function names List<ProcessFactory> factories = new ArrayList<ProcessFactory>(Processors .getProcessFactories()); Collections.sort(factories, FACTORY_COMPARATOR); // collect name and params of all processes resulting in a single output processToFunction = new HashMap<Name,FunctionName>(); functionNames = new ArrayList<FunctionName>(); for (ProcessFactory factory : factories) { for (Name processName : factory.getNames()) { Map<String, Parameter<?>> resultInfo = factory.getResultInfo(processName, null); // check there is a single output if(getPrimary(resultInfo) != null) { Map<String, Parameter<?>> parameterInfo = factory.getParameterInfo(processName); List<String> argumentNames = new ArrayList<String>(parameterInfo.keySet()); FunctionName functionName = new FunctionNameImpl(processName, argumentNames); functionNames.add(functionName); processToFunction.put(processName, functionName); } } } // add the parameter function functionNames.add(new FunctionNameImpl(ParameterFunction.NAME, -1)); } }
try { for (Parameter<?> p : pf.getParameterInfo(name).values()) { List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context); if (ppios.isEmpty()) {
try { for (Parameter<?> p : pf.getParameterInfo(name).values()) { List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context); if (ppios.isEmpty()) {
private void dataInputs(ProcessFactory pf, Name processName) { start("DataInputs"); for(Parameter<?> inputIdentifier : pf.getParameterInfo(processName).values()) { AttributesImpl attributes = new AttributesImpl(); // WPS spec specifies non-negative for unlimited inputs, so -1 -> 0 int maxOccurs = inputIdentifier.maxOccurs; if (-1 == maxOccurs) { maxOccurs = Integer.MAX_VALUE; } attributes.addAttribute("", "minOccurs", "minOccurs", "", "" + inputIdentifier.minOccurs); attributes.addAttribute("", "maxOccurs", "maxOccurs", "", "" + maxOccurs); start("Input", attributes); element("ows:Identifier", inputIdentifier.key); element("ows:Title", inputIdentifier.title.toString( this.locale)); element("ows:Abstract", inputIdentifier.description.toString(this.locale)); Transmuter transmuter = this.dataTransformer.getDefaultTransmuter(inputIdentifier.type); if (transmuter instanceof ComplexTransmuter) { start("ComplexData"); this.complexParameter((ComplexTransmuter)transmuter); end("ComplexData"); } else { this.literalData((LiteralTransmuter)transmuter); } end("Input"); } end("DataInputs"); }
private void dataInputs(ProcessFactory pf, Name processName) { start("DataInputs"); for (Parameter<?> inputIdentifier : pf.getParameterInfo(processName).values()) { AttributesImpl attributes = new AttributesImpl(); // WPS spec specifies non-negative for unlimited inputs, so -1 -> 0 int maxOccurs = inputIdentifier.maxOccurs; if (-1 == maxOccurs) { maxOccurs = Integer.MAX_VALUE; } attributes.addAttribute( "", "minOccurs", "minOccurs", "", "" + inputIdentifier.minOccurs); attributes.addAttribute("", "maxOccurs", "maxOccurs", "", "" + maxOccurs); start("Input", attributes); element("ows:Identifier", inputIdentifier.key); element("ows:Title", inputIdentifier.title.toString(this.locale)); element("ows:Abstract", inputIdentifier.description.toString(this.locale)); Transmuter transmuter = this.dataTransformer.getDefaultTransmuter(inputIdentifier.type); if (transmuter instanceof ComplexTransmuter) { start("ComplexData"); this.complexParameter((ComplexTransmuter) transmuter); end("ComplexData"); } else { this.literalData((LiteralTransmuter) transmuter); } end("Input"); } end("DataInputs"); }
final Name processName = new NameImpl("internal", "InternalDistributedRender"); final RenderingProcess process = (RenderingProcess) processFactory.create(processName); final Map<String, Parameter<?>> parameters = processFactory.getParameterInfo(processName); final InternalProcessFactory factory = new InternalProcessFactory();
List<InputType> inputs = parseDataInputs(pf.getParameterInfo(processName), (String) rawKvp.get("DataInputs")); DataInputsType1 input1 = factory.createDataInputsType1(); input1.getInput().addAll(inputs);