Ejemplo n.º 1
1
  /**
   * Checks if our WPS can really handle this process inputs and outputs
   *
   * @param pf
   * @param name
   * @return
   */
  Set<Name> getProcessBlacklist() {
    synchronized (PROCESS_BLACKLIST) {
      if (PROCESS_BLACKLIST == Collections.EMPTY_SET) {

        Set<Name> blacklist = new HashSet<Name>();

        for (ProcessFactory pf : Processors.getProcessFactories()) {
          int count = 0;
          for (Name name : pf.getNames()) {
            try {
              // check inputs
              for (Parameter<?> p : pf.getParameterInfo(name).values()) {
                List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context);
                if (ppios.isEmpty()) {
                  LOGGER.log(
                      Level.INFO,
                      "Blacklisting process "
                          + name.getURI()
                          + " as the input "
                          + p.key
                          + " of type "
                          + p.type
                          + " cannot be handled");
                  blacklist.add(name);
                }
              }

              // check outputs
              for (Parameter<?> p : pf.getResultInfo(name, null).values()) {
                List<ProcessParameterIO> ppios = ProcessParameterIO.findAll(p, context);
                if (ppios.isEmpty()) {
                  LOGGER.log(
                      Level.INFO,
                      "Blacklisting process "
                          + name.getURI()
                          + " as the output "
                          + p.key
                          + " of type "
                          + p.type
                          + " cannot be handled");
                  blacklist.add(name);
                }
              }
            } catch (Throwable t) {
              blacklist.add(name);
            }

            if (!blacklist.contains(name)) {
              count++;
            }
          }
          LOGGER.info("Found " + count + " bindable processes in " + pf.getTitle());
        }

        PROCESS_BLACKLIST = blacklist;
      }
    }

    return PROCESS_BLACKLIST;
  }
Ejemplo n.º 2
0
 public List<ParameterType> getSupportedTypes() {
   if (!isComplex()) {
     return Collections.singletonList(ParameterType.LITERAL);
   } else {
     Set<ParameterType> result = new LinkedHashSet<ParameterType>();
     result.add(ParameterType.TEXT);
     result.add(ParameterType.REFERENCE);
     result.add(ParameterType.SUBPROCESS);
     for (ProcessParameterIO ppio : getProcessParameterIO()) {
       if (FeatureCollection.class.isAssignableFrom(ppio.getType())) {
         result.add(ParameterType.VECTOR_LAYER);
       } else if (GridCoverage.class.isAssignableFrom(ppio.getType())) {
         result.add(ParameterType.RASTER_LAYER);
       }
     }
     return new ArrayList<ParameterType>(result);
   }
 }
Ejemplo n.º 3
0
 List<ProcessParameterIO> getProcessParameterIO() {
   return ProcessParameterIO.findAll(getParameter(), null);
 }