    001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.4_testing/src/org/deegree/framework/trigger/TriggerCapability.java $
    002    /*----------------------------------------------------------------------------
    003     This file is part of deegree, http://deegree.org/
    004     Copyright (C) 2001-2009 by:
    005       Department of Geography, University of Bonn
    006     and
    007       lat/lon GmbH
    008
    009     This library is free software; you can redistribute it and/or modify it under
    010     the terms of the GNU Lesser General Public License as published by the Free
    011     Software Foundation; either version 2.1 of the License, or (at your option)
    012     any later version.
    013     This library is distributed in the hope that it will be useful, but WITHOUT
    014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
    016     details.
    017     You should have received a copy of the GNU Lesser General Public License
    018     along with this library; if not, write to the Free Software Foundation, Inc.,
    019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    020
    021     Contact information:
    022
    023     lat/lon GmbH
    024     Aennchenstr. 19, 53177 Bonn
    025     Germany
    026     http://lat-lon.de/
    027
    028     Department of Geography, University of Bonn
    029     Prof. Dr. Klaus Greve
    030     Postfach 1147, 53001 Bonn
    031     Germany
    032     http://www.geographie.uni-bonn.de/deegree/
    033
    034     e-mail: info@deegree.org
    035    ----------------------------------------------------------------------------*/
    036    package org.deegree.framework.trigger;
    037
    038    import java.util.List;
    039    import java.util.Map;
    040
    041    import org.deegree.i18n.Messages;
    042
    043    /**
    044     *
    045     *
    046     *
    047     * @version $Revision: 18195 $
    048     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
    049     * @author last edited by: $Author: mschneider $
    050     *
    051     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
    052     *
    053     * @since 2.0
    054     */
    055    public class TriggerCapability {
    056
    057        private String name;
    058
    059        private Class clss;
    060
    061        private List<String> paramNames;
    062
    063        private Map<String, Class> paramTypes;
    064
    065        private Map<String, Object> paramValues;
    066
    067        private List<TriggerCapability> nestedTrigger;
    068
    069        /**
    070         *
    071         * @param name
    072         * @param clss
    073         * @param paramTypes
    074         * @param paramValues
    075         * @param nestedTrigger
    076         * @throws TriggerException
    077         */
    078        public TriggerCapability( String name, Class clss, List<String> paramNames, Map<String, Class> paramTypes,
    079                                  Map<String, Object> paramValues, List<TriggerCapability> nestedTrigger )
    080                                throws TriggerException {
    081            this.name = name;
    082            this.clss = clss;
    083            this.paramTypes = paramTypes;
    084            this.paramValues = paramValues;
    085            if ( paramTypes.size() != paramValues.size() ) {
    086                throw new TriggerException( Messages.getMessage( "FRAMEWORK_INVALID_TRIGGERCAP_PARAMS" ) );
    087            }
    088            this.paramNames = paramNames;
    089            this.nestedTrigger = nestedTrigger;
    090        }
    091
    092        /**
    093         * returns the triggers name
    094         *
    095         * @return the triggers name
    096         */
    097        public String getName() {
    098            return name;
    099        }
    100
    101        /**
    102         * returns a List of the names of all init parameter assigend to a
    103         *
    104         * @see Trigger
    105         * @return a List of the names of all init parameter assigend to a
    106         * @see Trigger
    107         */
    108        public List<String> getInitParameterNames() {
    109            return paramNames;
    110        }
    111
    112        /**
    113         * returns the value of a named init parameter
    114         *
    115         * @param name
    116         */
    117        public Object getInitParameterValue( String name ) {
    118            return paramValues.get( name );
    119        }
    120
    121        /**
    122         * returns the type of a named init parameter
    123         *
    124         * @param name
    125         */
    126        public Class getInitParameterType( String name ) {
    127            return paramTypes.get( name );
    128        }
    129
    130        /**
    131         * returns the Class responsible for performing trigger functionality
    132         *
    133         * @return the Class responsible for performing trigger functionality
    134         */
    135        public Class getPerformingClass() {
    136            return clss;
    137        }
    138
    139        /**
    140         * returns a list of Triggers that a nested within this Trigger
    141         *
    142         * @return a list of Triggers that a nested within this Trigger
    143         */
    144        public List<TriggerCapability> getTrigger() {
    145            return nestedTrigger;
    146        }
    147
    148        public String toString() {
    149            return "Trigger name: " + name;
    150        }
    151
    152    }