/** * Look up an implementation of the named process on the classpath. * * @param name Name of the Process to create * @return created process */ public static synchronized Process createProcess(Name name) { ProcessFactory factory = createProcessFactory(name); if (factory == null) return null; return factory.create(name); }
page.setLayout(new GridLayout(0, 2)); JLabel title = new JLabel(factory.getTitle().toString()); page.add(title); JLabel description = new JLabel(factory.getDescription(name).toString()); page.add(description); for (Entry<String, Parameter<?>> entry : factory.getParameterInfo(name).entrySet()) { Parameter<?> parameter = entry.getValue();
functionNames = new ArrayList<FunctionName>(); for (ProcessFactory factory : factories) { if (!factory.isAvailable()) { continue; for (Name processName : factory.getNames()) { try { Map<String, Parameter<?>> resultInfo = factory.getResultInfo(processName, null); Parameter<?> result = getPrimary(resultInfo); factory.getParameterInfo(processName); List<String> argumentNames = new ArrayList<String>(parameterInfo.keySet());
/** * Update the process description based on the selected process * * @param selection title of selected process * @param name */ private void updateProcessDesc(ProcessFactory factory, Name name) { if (name == null || factory == null) { return; } InternationalString title = factory.getTitle(name); InternationalString description = factory.getDescription(name); descLabel.setText(defaultDesc); selectedFactory = factory; updateNavButtons(); descLabel.setText("<html><b>" + title + "</b>" + description); updateNavButtons(); }
for (Name name : pf.getNames()) { try { for (Parameter<?> p : pf.getParameterInfo(name).values()) { List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context); if (ppios.isEmpty()) { for (Parameter<?> p : pf.getResultInfo(name, null).values()) { List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context); if (ppios.isEmpty()) { LOGGER.info("Found " + count + " bindable processes in " + pf.getTitle());
for (Name name : pf.getNames()) { ProcessBriefType p = wpsf.createProcessBriefType(); p.setProcessVersion(pf.getVersion(name)); po.getProcess().add(p); p.setTitle(Ows11Util.languageString(pf.getTitle(name))); p.setAbstract(Ows11Util.languageString(pf.getDescription(name)));
process.setProcessVersion(pf.getVersion(processName)); process.setTitle(Ows11Util.languageString(pf.getTitle(processName))); process.setAbstract(Ows11Util.languageString(pf.getDescription(processName))); response.setProcessOutputs(processOutputs); Map<String, Parameter<?>> resultInfo = pf.getResultInfo(processName, null);
/** * 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); }
private void processDescription(ProcessFactory pf, Name identifier) { AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "wps:processVersion", "wps:processVersion", "", pf.getVersion(identifier)); attributes.addAttribute("", "statusSupported", "statusSupported", "", Boolean.toString(pf.supportsProgress(identifier))); start("ProcessDescription", attributes); element("ows:Identifier", identifier.getURI()); element("ows:Title", pf.getTitle(identifier).toString(this.locale)); element("ows:Abstract", pf.getDescription(identifier).toString(this.locale)); this.dataInputs(pf, identifier); this.processOutputs(pf, identifier); end("ProcessDescription"); }
/** * Look up a Factory by name of a process it supports. * * @param name Name of the Process you wish to work with * @return ProcessFactory capable of creating an instanceof the named process */ public static synchronized ProcessFactory createProcessFactory(Name name) { // store a local reference to last factory, since it could change if this method is called // within the factories getNames() method, which could happen if a factory delegates in some // way ProcessFactory last = lastFactory; if (last != null && last.getNames().contains(name)) { return last; } for (ProcessFactory factory : getProcessFactories()) { if (factory.getNames().contains(name)) { lastFactory = factory; return factory; } } return null; // go fish }
/** * 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; } }
void processDescription(CodeType id, ProcessDescriptionsType pds) { Name name = Ows11Util.name(id); ProcessFactory pf = GeoServerProcessors.createProcessFactory(name, true); if (pf == null || pf.create(name) == null) { throw new WPSException("No such process: " + id.getValue()); } ProcessDescriptionType pd = wpsf.createProcessDescriptionType(); pds.getProcessDescription().add(pd); pd.setProcessVersion("1.0.0"); pd.setIdentifier(Ows11Util.code(id.getValue())); pd.setTitle(Ows11Util.languageString(pf.getTitle(name))); pd.setAbstract(Ows11Util.languageString(pf.getDescription(name))); pd.setStatusSupported(true); pd.setStoreSupported(true); // data inputs DataInputsType inputs = wpsf.createDataInputsType(); pd.setDataInputs(inputs); dataInputs(inputs, pf, name); // process outputs ProcessOutputsType outputs = wpsf.createProcessOutputsType(); pd.setProcessOutputs(outputs); processOutputs(outputs, pf, name); }
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)); } }
InternalDistributedRenderProcess.class); 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();
/** * Look up an implementation of the named process on the classpath and describe the expected * results. * * <p>Note the expected results are generated in part by the input parameters provided; this is * to allow for processes where the output is controlled by the parameters (such as choosing a * greyscale or color raster product; or choosing the version of GML produced etc...). * * @param name Name of the Process * @param parameters * @return Description of the parameters required */ public static synchronized Map<String, Parameter<?>> getResultInfo( Name name, Map<String, Object> parameters) { ProcessFactory factory = createProcessFactory(name); if (factory == null) return null; return factory.getResultInfo(name, parameters); }
@Override public InternationalString perform( ProcessFactory f, Name oldName, Name newName, Object... args) { return f.getDescription(newName); } });
@Override public Boolean perform( ProcessFactory f, Name oldName, Name newName, Object... args) { return f.supportsProgress(newName); } });
@Override public String perform( ProcessFactory f, Name oldName, Name newName, Object... args) { return f.getVersion(newName); } });