001: //=============================================================================
002: //=== Copyright (C) 2001-2007 Food and Agriculture Organization of the
003: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
004: //=== and United Nations Environment Programme (UNEP)
005: //===
006: //=== This program is free software; you can redistribute it and/or modify
007: //=== it under the terms of the GNU General Public License as published by
008: //=== the Free Software Foundation; either version 2 of the License, or (at
009: //=== your option) any later version.
010: //===
011: //=== This program is distributed in the hope that it will be useful, but
012: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
013: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: //=== General Public License for more details.
015: //===
016: //=== You should have received a copy of the GNU General Public License
017: //=== along with this program; if not, write to the Free Software
018: //=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
019: //===
020: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021: //=== Rome - Italy. email: geonetwork@osgeo.org
022: //==============================================================================
023:
024: package org.fao.geonet.kernel.harvest.harvester.webdav;
025:
026: import jeeves.exceptions.BadInputEx;
027: import jeeves.utils.Util;
028: import org.fao.geonet.kernel.DataManager;
029: import org.fao.geonet.kernel.harvest.harvester.AbstractParams;
030: import org.jdom.Element;
031:
032: //=============================================================================
033:
034: public class WebDavParams extends AbstractParams {
035: //--------------------------------------------------------------------------
036: //---
037: //--- Constructor
038: //---
039: //--------------------------------------------------------------------------
040:
041: public WebDavParams(DataManager dm) {
042: super (dm);
043: }
044:
045: //---------------------------------------------------------------------------
046: //---
047: //--- Create : called when a new entry must be added. Reads values from the
048: //--- provided entry, providing default values
049: //---
050: //---------------------------------------------------------------------------
051:
052: public void create(Element node) throws BadInputEx {
053: super .create(node);
054:
055: Element site = node.getChild("site");
056: Element opt = node.getChild("options");
057:
058: url = Util.getParam(site, "url", "");
059: icon = Util.getParam(site, "icon", "");
060:
061: validate = Util.getParam(opt, "validate", false);
062: recurse = Util.getParam(opt, "recurse", false);
063: }
064:
065: //---------------------------------------------------------------------------
066: //---
067: //--- Update : called when an entry has changed and variables must be updated
068: //---
069: //---------------------------------------------------------------------------
070:
071: public void update(Element node) throws BadInputEx {
072: super .update(node);
073:
074: Element site = node.getChild("site");
075: Element opt = node.getChild("options");
076:
077: url = Util.getParam(site, "url", url);
078: icon = Util.getParam(site, "icon", icon);
079:
080: validate = Util.getParam(opt, "validate", validate);
081: recurse = Util.getParam(opt, "recurse", recurse);
082: }
083:
084: //---------------------------------------------------------------------------
085: //---
086: //--- Other API methods
087: //---
088: //---------------------------------------------------------------------------
089:
090: public WebDavParams copy() {
091: WebDavParams copy = new WebDavParams(dm);
092: copyTo(copy);
093:
094: copy.url = url;
095: copy.icon = icon;
096:
097: copy.validate = validate;
098: copy.recurse = recurse;
099:
100: return copy;
101: }
102:
103: //---------------------------------------------------------------------------
104: //---
105: //--- Variables
106: //---
107: //---------------------------------------------------------------------------
108:
109: public String url;
110: public String icon;
111:
112: public boolean validate;
113: public boolean recurse;
114: }
115:
116: //=============================================================================
|