List<Name> getChildren(ProcessFactory factory) { synchronized (factory) { List<Name> list = branch.get(factory); if (list == null) { list = new ArrayList<Name>(); list.addAll(factory.getNames()); Collections.sort( list, new Comparator<Name>() { @Override public int compare(Name o1, Name o2) { String s1 = o1.toString(); String s2 = o2.toString(); return s1.compareTo(s2); } }); branch.put(factory, list); } return list; } }
/** * 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 }
continue; for (Name processName : factory.getNames()) { try { Map<String, Parameter<?>> resultInfo =
public Set<Name> getNames() { return delegate.getNames(); }
/** * 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){ if( lastFactory != null && lastFactory.getNames().contains(name)){ return lastFactory; } for( ProcessFactory factory : getProcessFactories() ) { if(factory.getNames().contains(name)) { lastFactory = factory; return factory; } } return null; // go fish }
List<Name> getChildren(ProcessFactory factory) { synchronized (factory) { List<Name> list = branch.get(factory); if (list == null) { list = new ArrayList<Name>(); list.addAll(factory.getNames()); Collections.sort(list, new Comparator<Name>() { @Override public int compare(Name o1, Name o2) { String s1 = o1.toString(); String s2 = o2.toString(); return s1.compareTo(s2); } }); branch.put(factory, list); } return list; } }
@Override public ProcessFactory filterFactory(ProcessFactory pf) { // first check, do we want to return this factory at all? Set<Name> processNames = pf.getNames(); int count = 0; for (Name processName : processNames) { if (allowProcess(processName)) { count++; } } if (count == 0) { // does it generate at least one process we are going to actually produce? // if not the factory itself is going to be filtered out return null; } else if (count == processNames.size()) { return pf; } return new SelectingProcessFactory(pf, this); }
/** * Look up a Factory by name of a process it supports. * * @param name Name of the Process you wish to work with * @param applyFilters Whether to apply the available {@link ProcessFilter} to the returned * factory, or not (if the code needs to check the original process factory by class name * for example, better not to apply the filters, which often wrap the factories to add extra * functionality) * @return ProcessFactory capable of creating an instanceof the named process */ public static ProcessFactory createProcessFactory(Name name, boolean applyFilters) { ProcessFactory pf = Processors.createProcessFactory(name); if (applyFilters) { pf = applyFilters(pf); } // JD: also check the names, this could be a filtered process factory with only a subset // disabled if (pf != null && !pf.getNames().contains(name)) { pf = null; } return pf; }
private void processDescriptionAll() { for (ProcessFactory pf : GeoServerProcessors.getProcessFactories()) { for (Name processName : pf.getNames()) { if (false == this.dataTransformer.isTransmutable(pf, processName)) { continue; } this.processDescription(pf, processName); } } }
private void processDescriptionAll() { for (ProcessFactory pf : Processors.getProcessFactories()) { for (Name processName : pf.getNames()) { if (false == this.dataTransformer.isTransmutable(pf, processName)) { continue; } this.processDescription(pf, processName); } } }
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)); } }
for (Name name : pf.getNames()) { try {
for (Name name : pf.getNames()) { try {
private void updateFilters(WPSInfo wps) { List<ProcessGroupInfo> groups = wps.getProcessGroups(); disabledProcesses.clear(); if (groups != null) { for (ProcessGroupInfo group : groups) { if (!group.isEnabled()) { ProcessFactory factory = GeoServerProcessors.getProcessFactory(group.getFactoryClass(), false); if (factory != null) { disabledProcesses.addAll(factory.getNames()); } } else if (group.getFilteredProcesses() != null) { for (ProcessInfo fp : group.getFilteredProcesses()) { if (!fp.isEnabled()) { disabledProcesses.add(fp.getName()); } } } } } } }
public void testNamesUnique() throws Exception { List<String> procs = new ArrayList<String>(); Set<String> uniqueProcs = new HashSet<String>(); for (ProcessFactory pf : Processors.getProcessFactories()) { for (Name name : pf.getNames()) { String procName = name.getURI(); procs.add(procName); uniqueProcs.add(procName); } } // remove duplicate names removeSingle(procs, uniqueProcs); if (procs.size() > 0) { System.out.println("Duplicate process names: " + procs); } assertTrue(procs.size() == 0); }
GeoServerProcessors.getProcessFactory(group.getFactoryClass(), false); if (pf != null) { Set<Name> names = pf.getNames(); for (Name name : names) { prefixes.add(name.getNamespaceURI());
for (Name name : pf.getNames()) { if (!getProcessBlacklist().contains(name)) { ProcessBriefType p = wpsf.createProcessBriefType();
for (Name name : pf.getNames()) { ProcessBriefType p = wpsf.createProcessBriefType(); p.setProcessVersion(pf.getVersion(name));