All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.disy.ogc.wps.v_1_0_0.SimpleWpsProcessRegistry Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/**
 * Legato is a configurable, lightweight web mapping client that can be
 * easily embedded into web pages and portals, CMS and individual web
 * applications. Legato is implemented in JavaScript and based on the
 * popular open source library OpenLayers.
 *
 * Copyright (C) 2010  disy Informationssysteme GmbH, http://www.disy.net
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */

package net.disy.ogc.wps.v_1_0_0;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import net.disy.ogc.ows.v_1_1_0.NoApplicableCodeException;
import net.disy.ogc.ows.v_1_1_0.OwsException;
import net.opengis.ows.v_1_1_0.CodeType;

import org.apache.commons.collections15.map.ListOrderedMap;

public class SimpleWpsProcessRegistry implements WpsProcessRegistry {

  private final Map registry;

  public SimpleWpsProcessRegistry() {
    registry = new ListOrderedMap();
  }

  @Override
  public void registerProcess(WpsProcess process) throws OwsException {
    CodeType identifier = process.getProcessDescription().getIdentifier();
    if (registry.containsKey(identifier)) {
      throw new NoApplicableCodeException("The provided identifier " //$NON-NLS-1$
          + identifier
          + "already exists in the registry"); //$NON-NLS-1$
    }
    registry.put(identifier, process);
  }

  @Override
  public WpsProcess getProcessByIdentifier(CodeType identifier) {
    return registry.get(identifier);
  }

  @Override
  public Collection getProcesses() {
    return new ArrayList(registry.values());
  }

  @Override
  public List getAllProcessIds() {
    return new ArrayList(registry.keySet());
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy