-
-
Notifications
You must be signed in to change notification settings - Fork 477
/
LocalFilesystemParams.java
100 lines (90 loc) · 3.78 KB
/
LocalFilesystemParams.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//=============================================================================
//=== Copyright (C) 2001-2009 Food and Agriculture Organization of the
//=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
//=== and United Nations Environment Programme (UNEP)
//===
//=== 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 2 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, write to the Free Software
//=== Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
//===
//=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
//=== Rome - Italy. email: geonetwork@osgeo.org
//==============================================================================
package org.fao.geonet.kernel.harvest.harvester.localfilesystem;
import jeeves.exceptions.BadInputEx;
import jeeves.utils.Util;
import org.fao.geonet.kernel.DataManager;
import org.fao.geonet.kernel.harvest.harvester.AbstractParams;
import org.jdom.Element;
import org.jfree.util.Log;
/**
* Params for local filesystem harvesting.
*
* @author heikki doeleman
*
*/
public class LocalFilesystemParams extends AbstractParams {
public String icon;
public String directoryname;
public boolean recurse;
public boolean checkFileLastModifiedForUpdate;
public boolean nodelete;
public LocalFilesystemParams(DataManager dm) {
super(dm);
}
//---------------------------------------------------------------------------
//---
//--- Create : called when a new entry must be added. Reads values from the
//--- provided entry, providing default values
//---
//---------------------------------------------------------------------------
public void create(Element node) throws BadInputEx {
super.create(node);
createOrUpdate(node);
}
//---------------------------------------------------------------------------
//---
//--- Update : called when an entry has changed and variables must be updated
//---
//---------------------------------------------------------------------------
public void update(Element node) throws BadInputEx {
super.update(node);
createOrUpdate(node);
}
/**
* TODO Javadoc.
*
* @param node
*/
private void createOrUpdate(Element node) {
Element site = node.getChild("site");
directoryname = Util.getParam(site, "directory", "");
icon = Util.getParam(site, "icon", "filesystem.gif");
String recurseString = Util.getParam(site, "recurse", "true");
recurse = (recurseString.equals("on") || recurseString.equals("true"));
String nodeleteString = Util.getParam(site, "nodelete", "true");
nodelete = (nodeleteString.equals("on") || nodeleteString.equals("true"));
String checkFileLastModifiedForUpdateString = Util.getParam(site, "checkFileLastModifiedForUpdate", "true");
checkFileLastModifiedForUpdate = (checkFileLastModifiedForUpdateString.equals("on") || checkFileLastModifiedForUpdateString.equals("true"));
}
public LocalFilesystemParams copy() {
LocalFilesystemParams copy = new LocalFilesystemParams(dm);
copyTo(copy);
copy.icon = icon;
copy.directoryname = directoryname;
copy.recurse = recurse;
copy.nodelete = nodelete;
copy.checkFileLastModifiedForUpdate = checkFileLastModifiedForUpdate;
return copy;
}
}