Revision 605

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.catalog.CatalogLibrary
2
org.gvsig.catalog.impl.DefaultCatalogLibrary
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/languages/AbstractGeneralLanguage.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42
package org.gvsig.catalog.languages;
43
import java.util.Iterator;
44
import java.util.StringTokenizer;
45
import java.util.Vector;
46

  
47
/**
48
 * All classes that implement a "Language" must to
49
 * inherit of this class
50
 * @author Jorge Piera Llodra (jorge.piera@iver.es)
51
 */
52
public abstract class AbstractGeneralLanguage implements ILanguages {
53
	public static final String EXACT_WORDS = "E";
54
	public static final String ANY_WORDS = "Y";
55
	public static final String ALL_WORDS = "A";
56
	public static final String AND = "And";
57
	public static final String OR = "Or";
58
	//en la ver. de CSW 2.0.2 no funciona el filtro si no es may.
59
	public static final String and = "and";
60
	public static final String or = "or";
61

  
62
	protected String currentQuery = null;
63
	protected String currentClause = null;
64

  
65
	/**
66
	 * Divide a phrase in lines
67
	 * @param concordancia If is 'E' (exact) don't divide
68
	 * @return Iteraror
69
	 * A set of words
70
	 * @param line phrase to search
71
	 * @param titleKeys 
72
	 */
73
	public Iterator parseValues(String line, String titleKeys){
74
		return parseValues(line, titleKeys, FilterEncoding.PROPERTY_IS_EQUALS_TO, null);
75
	}
76

  
77
	/**
78
	 * Divide a phrase in lines
79
	 *@param concordancia If is 'E' (exact) don't divide
80
	 * @return Iteraror
81
	 * A set of words
82
	 * @param line phrase to search
83
	 * @param titleKeys 
84
	 * @param relationship
85
	 * @param wildCard
86
	 */
87
	public Iterator parseValues(String line, String titleKeys, String relationship, String wildCard) {        
88
		Vector values = new Vector();
89

  
90
		if (titleKeys == null){
91
			titleKeys = EXACT_WORDS;
92
		}
93

  
94
		if (titleKeys.equals(EXACT_WORDS)) {
95
			values.add(line);
96
			return values.iterator();
97
		}
98
		StringTokenizer doubleQuotesTokenizer = new StringTokenizer(line, "\"",
99
				true);
100
		boolean inside = false;
101
		while (doubleQuotesTokenizer.hasMoreTokens()) {
102
			String token = doubleQuotesTokenizer.nextToken();
103
			if (token.equals("\"")) {
104
				inside = !inside;
105
			} else if (inside) {
106
				if (relationship.compareTo(FilterEncoding.PROPERTY_IS_LIKE) == 0){
107
					token = wildCard + token + wildCard;
108
				}
109
				values.add(token);
110
			} else {
111
				StringTokenizer spaceTokenizer = new StringTokenizer(token, " ");
112
				while (spaceTokenizer.hasMoreTokens()) {
113
					String value = spaceTokenizer.nextToken();
114
					if (relationship.compareTo(FilterEncoding.PROPERTY_IS_LIKE) == 0){
115
						value = wildCard + value + wildCard;
116
					}
117
					values.add(value);
118
				}
119
			}
120
		}
121
		return values.iterator();
122
	} 
123

  
124
	/**
125
	 * Return logic operators
126
	 * @return Or or And
127
	 * @param titleKeys E,A o Y --> Exact, All, anY
128
	 */
129
	public String getOperator(String titleKeys) {        
130
		if (titleKeys == null){
131
			titleKeys = EXACT_WORDS;
132
		} 
133
		if (titleKeys.equals(ANY_WORDS)) {
134
			return OR;
135
		} else {
136
			return AND;
137
		}
138
	} 
139
}
0 140

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/languages/FilterEncoding.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42
package org.gvsig.catalog.languages;
43
import java.util.Iterator;
44

  
45
import org.gvsig.catalog.querys.Coordinates;
46

  
47
/**
48
 * This class implements the Filter Encoding Language. It is used to
49
 * create queries in this language
50
 * @author Jorge Piera Llodra (jorge.piera@iver.es)
51
 * @see http://portal.opengeospatial.org/files/?artifact_id=8340
52
 */
53
public class FilterEncoding extends AbstractGeneralLanguage {
54
	//Properties
55
	public static final String PROPERTY_IS_LIKE = "PropertyIsLike";
56
	public static final String PROPERTY_IS_LESS = "PropertyIsLess";
57
	public static final String PROPERTY_IS_GREATER = "PropertyIsGreater";
58
	public static final String PROPERTY_IS_GREATER_THAN = "PropertyIsGreaterThan";
59
	public static final String PROPERTY_IS_LESS_THAN = "PropertyIsLessThan";
60
	public static final String PROPERTY_IS_EQUALS_TO = "PropertyIsEqualTo";
61
	//Type options
62
	public static final String TYPE_LITERAL = "Literal";
63
	public static final String TYPE_TWO_PROPERTIES = "PropertyName";	
64
	//Default values
65
	public static final String DEFAULT_PREFIX = "ogc";
66
	public static final String DEFAULT_WILDCARD = "*";
67
	public static final String DEFAULT_SINGLECHAR = "?";
68
	public static final String DEFAULT_ESCAPE = "\\";
69
	public static final String DEFAULT_NAMESPACE = "xmlns:ogc=\"http://www.opengis.net/ogc\"";
70
	//Private labels
71
	private static final String FILTER = "Filter"; 
72

  
73
	private String prefix = null;
74
	private String wildCard = null;
75
	private String singleChar = null;
76
	private String escape = null;
77
	private String namespace = null;
78
	private String wildCardLabel = "wildCard";
79
	private String escapeCharLabel = "escapeChar";
80
	private String singleCharLabel = "singleChar";
81

  
82
	/**
83
	 * Create a new Filter Encoding Parser
84
	 * @param prefix Prefix of the labels (if its necessary). 
85
	 * Typically "ogc".
86
	 * @param wildCard It Depends of the server
87
	 * @param singleChar It Depends of the server
88
	 * @param escape It Depends of the server
89
	 */
90
	public  FilterEncoding(String prefix, String wildCard, String singleChar, String escape) {        
91
		this.prefix = prefix + ":";
92
		this.wildCard = wildCard;
93
		this.singleChar = singleChar;
94
		this.escape = escape;		
95
	} 
96

  
97
	/**
98
	 * Create a new Filter Encoding Parser with the 
99
	 * deafault values
100
	 */
101
	public  FilterEncoding() {        
102
		this.prefix = DEFAULT_PREFIX + ":";
103
		this.wildCard = DEFAULT_WILDCARD;
104
		this.singleChar = DEFAULT_SINGLECHAR;
105
		this.escape = DEFAULT_ESCAPE;		
106
	} 
107

  
108
	/**
109
	 * It Adds a new clause of the query
110
	 * @param propertyName The property name
111
	 * @param propertyValue The property value
112
	 * @param concordancia "E" (Exact phrase), "A" (All words)
113
	 * or "Y" (anY word).
114
	 * @param relationship PropertyIsLike, PropertyIsLess, PropertyIsGreater,... See the File encoding
115
	 * Documentation.
116
	 * @param type Values: "P" (to comparate two propertyes) or "L" (to comparate one property
117
	 * and one literal value)
118
	 * @param operator "And" or "Or". Operator between fields
119
	 */
120
	public void addClauses(String propertyName, String propertyValue, 
121
			String concordancia, String relationship, String type, 
122
			String operator) {        
123
		currentClause = null;
124
		//Seperating the words
125
		Iterator values = parseValues(propertyValue, concordancia, relationship, wildCard);
126
		//Filling the words
127
		addClauses(propertyName, values, concordancia, relationship, type, operator);
128
	} 
129

  
130
	/**
131
	 * It Adds a new clause of the query
132
	 * @param propertyName The property name
133
	 * @param propertyValue The property value
134
	 * @param concordancia "E" (Exact phrase), "A" (All words)
135
	 * or "Y" (anY word).
136
	 */
137
	public void addClauses(String propertyName, String propertyValue, 
138
			String concordancia) {   	
139
		addClauses(propertyName, propertyValue, concordancia,
140
				FilterEncoding.PROPERTY_IS_LIKE, 
141
				FilterEncoding.TYPE_LITERAL,
142
				FilterEncoding.AND);
143
	} 
144

  
145
	/**
146
	 * It Adds a new clause of the query
147
	 * @param propertyName The property name
148
	 * @param propertyValues The property value separated by blank spaces
149
	 * @param concordancia "E" (Exact phrase), "A" (All words)
150
	 * or "Y" (anY word).
151
	 * @param relationship PropertyIsLike, PropertyIsLess, PropertyIsGreater,... See the File encoding
152
	 * Documentation.
153
	 * @param type Values: "P" (to comparate two propertyes) or "L" (to comparate one property
154
	 * and one literal value)
155
	 * @param operator "And" or "Or". Operator between fields
156
	 */
157
	public void addClauses(String propertyName, Iterator propertyValues, 
158
			String concordancia, String relationship, String type,
159
			String operator) {        
160
		while (propertyValues.hasNext())
161
			addTerm(propertyName, (String) propertyValues.next(), concordancia,
162
					relationship, type);
163
		addCurrentClauseQuery(operator);
164
	} 
165

  
166
	/**
167
	 * It adds a new term to the full query
168
	 * @param propertyName The property name
169
	 * @param propertyValue The property value
170
	 * @param concordancia "E" (Exact phrase), "A" (All words) or "Y" (anY word).
171
	 * @param relationship PropertyIsLike, PropertyIsLess, PropertyIsGreater,... See the File encoding
172
	 * Documentation.
173
	 * @param type Values: "P" (to comparate two propertyes) or "L" (to comparate one property
174
	 * and one literal value)
175
	 */
176
	private void addTerm(String propertyName, String propertyValue, 
177
			String concordancia, String relationship, String type) {        
178
		StringBuffer term = new StringBuffer();
179
		term.append(propertyIsXXX(relationship, propertyName, propertyValue, type));
180
		if (currentClause == null) {
181
			currentClause = term.toString();
182
		} else {
183
			currentClause = currentClause + term.toString();
184
			currentClause = enterLabel(currentClause, getOperator(concordancia));
185
		}
186
	} 
187

  
188
	/**
189
	 * It adds the "and" label to join different operations
190
	 * @param operator 
191
	 */
192
	protected void addCurrentClauseQuery(String operator) {        
193
		if (currentClause != null) {
194
			if (currentQuery == null) {
195
				currentQuery = currentClause;
196
			} else {
197
				currentQuery = currentQuery + currentClause;
198
				currentQuery = enterLabel(currentQuery, operator);
199
			}
200
		}
201
	} 
202

  
203
	/**
204
	 * It returns the encoded query
205
	 * @return 
206
	 */
207
	public String toString() {        
208
		return enterLabel(currentQuery, FILTER);
209
	} 
210

  
211
	/**
212
	 * Involves a query with a label
213
	 * @param query Query to involve
214
	 * @param label Label name
215
	 * @return a filter encoding query
216
	 */
217
	private String enterLabel(String query, String label) {        
218
		if (label.equals(FILTER) && (this.namespace != null)) {
219
			return "<" + prefix + label + " " + this.namespace + ">" +
220
			query + "</" + prefix + label + ">";
221
		} else {
222
			return "<" + prefix + label + ">" + query + "</" + prefix +
223
			label + ">";
224
		}
225
	} 
226

  
227
	/**
228
	 * It writes a "PropertyIsXXX" part of a filter encoding query
229
	 * @param relationship Possible Values: PropertIsLike, PropertyIsLess,
230
	 * PropertyIsGreater,... See the Filter Encoding documentation
231
	 * @param propertyName The property name
232
	 * @param propertyValue The property value
233
	 * @param type Values: "P" (to comparate two propertyes) or "L" (to comparate one property
234
	 * and one literal value)
235
	 * @return The part of the query
236
	 */
237
	private String propertyIsXXX(String relationship, String propertyName,
238
			String propertyValue, String type) {        
239
		String cadena = "";
240
		cadena = "<" + prefix + relationship;
241
		if (relationship.equals("PropertyIsLike")) {
242
			if (this.wildCard != null) {
243
				cadena = cadena + " " + getWildCardLabel() + "=\"" + this.wildCard + "\"";
244
			}
245
			if (this.singleChar != null) {
246
				cadena = cadena + " " + getSingleCharLabel() + "=\"" + this.singleChar + "\"";
247
			}
248
			if (this.escape != null) {
249
				cadena = cadena + " " + getEscapeCharLabel() + "=\"" + this.escape + "\"";
250
			}
251
		}
252
		cadena = cadena + ">" + enterLabel(propertyName, TYPE_TWO_PROPERTIES);
253
		cadena = cadena + enterLabel(propertyValue, type);		
254
		return cadena + "</" + prefix + relationship + ">";
255
	} 
256

  
257
	/**
258
	 * It Adds a Bounding Box query
259
	 * 
260
	 * 
261
	 * @param coordinates Coordinates to find
262
	 * @param propertyName Property that contains the geom field
263
	 * @param not If we have to envolve the query with the "NOT" tag.
264
	 */
265
	public void addBoundingBox(Coordinates coordinates, String propertyName, boolean not) {        
266
		// sNorth -> Uly();
267
		// sWest -> Ulx();
268
		// sSouth -> Bry();
269
		// sEast -> Brx();
270
		String bbox = "<ogc:BBOX>" + "<ogc:PropertyName>" + propertyName +
271
		"</ogc:PropertyName>" + "<gml:Box>" + "<gml:coord>" + "<gml:X>" +
272
		coordinates.ulx + "</gml:X>" + "<gml:Y>" + coordinates.bry +
273
		"</gml:Y>" + "</gml:coord>" + "<gml:coord>" + "<gml:X>" +
274
		coordinates.brx + "</gml:X>" + "<gml:Y>" + coordinates.uly +
275
		"</gml:Y>" + "</gml:coord>" + "</gml:Box>" + "</ogc:BBOX>";
276
		if (not){
277
			bbox = "<ogc:Not>" + bbox + "</ogc:Not>"; 
278
		}
279
		if (currentQuery == null) {
280
			currentQuery = bbox;
281
		} else {
282
			currentQuery = currentQuery + bbox;
283
			currentQuery = enterLabel(currentQuery, "And");
284
		}
285
	}
286

  
287
	/**
288
	 * @return the wildCard
289
	 */
290
	public String getWildCard() {
291
		return wildCard;
292
	}
293

  
294
	/**
295
	 * @return the wildCardLabel
296
	 */
297
	public String getWildCardLabel() {
298
		return wildCardLabel;
299
	}
300

  
301
	/**
302
	 * @param wildCardLabel the wildCardLabel to set
303
	 */
304
	public void setWildCardLabel(String wildCardLabel) {
305
		this.wildCardLabel = wildCardLabel;
306
	}
307

  
308
	/**
309
	 * @return the escapeCharLabel
310
	 */
311
	public String getEscapeCharLabel() {
312
		return escapeCharLabel;
313
	}
314

  
315
	/**
316
	 * @param escapeCharLabel the escapeCharLabel to set
317
	 */
318
	public void setEscapeCharLabel(String escapeCharLabel) {
319
		this.escapeCharLabel = escapeCharLabel;
320
	}
321

  
322
	/**
323
	 * @return the singleCharLabel
324
	 */
325
	public String getSingleCharLabel() {
326
		return singleCharLabel;
327
	}
328

  
329
	/**
330
	 * @param singleCharLabel the singleCharLabel to set
331
	 */
332
	public void setSingleCharLabel(String singleCharLabel) {
333
		this.singleCharLabel = singleCharLabel;
334
	} 
335
}
0 336

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/languages/ILanguages.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.languages;
43
/**
44
 * This interface must be implementeded by all the CSW profiles
45
 * 
46
 * 
47
 * @author Jorge Piera Llodra (piera_jor@gva.es)
48
 */
49
public interface ILanguages {
50
/**
51
 * 
52
 * 
53
 * 
54
 * @return 
55
 */
56
    public String toString();
57
}
58
//Return the query
59

  
60

  
0 61

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/languages/CommonQueryLanguage.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.languages;
43
import java.util.Iterator;
44
import java.util.StringTokenizer;
45

  
46
/**
47
 * This class is used to create a Common Query Language query.
48
 * See the specification for more information.
49
 * 
50
 * 
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 * @see http://www.loc.gov/z3950/agency/zing/cql/
53
 */
54
public class CommonQueryLanguage extends AbstractGeneralLanguage {
55

  
56
/**
57
 * 
58
 * 
59
 * 
60
 * @param parameter 
61
 * @param line 
62
 * @param concordancia 
63
 */
64
    public void addClauses(String parameter, String line, String concordancia,String operator) {        
65
        currentClause = null;
66
        
67
        Iterator values = parseValues(line, concordancia);
68
        addClauses(parameter, values, concordancia,operator);
69
    } 
70

  
71
/**
72
 * 
73
 * 
74
 * 
75
 * @param parameter 
76
 * @param values 
77
 * @param concordancia 
78
 */
79
    public void addClauses(String parameter, Iterator values, String concordancia, String operator) {        
80
        while (values.hasNext())
81
            addTerm(parameter, (String) values.next(), concordancia);
82
        addCurrentClauseQuery(operator);
83
    } 
84

  
85
/**
86
 * It adds a new search field to the string
87
 * 
88
 * 
89
 * @param parameter 
90
 * @param value 
91
 * @param concordancia 
92
 */
93
    private void addTerm(String parameter, String value, String concordancia) {        
94
        StringBuffer term = new StringBuffer();
95
        term.append(parameter + "=" + cutWord(value, concordancia));
96
        if (currentClause == null) {
97
            currentClause = term.toString();
98
        } else {
99
            currentClause = "(" + currentClause + " " +
100
                getOperator(concordancia) + " " + term.toString() + ")";
101
            
102
        }          
103
    } 
104

  
105
/**
106
 * 
107
 * 
108
 */
109
    protected void addCurrentClauseQuery(String operator) {        
110
        if (currentClause != null) {
111
            if (currentQuery == null) {
112
                currentQuery = currentClause;
113
            } else {
114
                currentQuery = "(" + currentQuery + " " +
115
                operator  + " " + currentClause + ")";
116
            }
117
        }
118
    } 
119

  
120
/**
121
 * 
122
 * 
123
 * 
124
 * @return 
125
 */
126
    public String toString() {        
127
        return currentQuery;
128
    } 
129

  
130
/**
131
 * 
132
 * 
133
 * 
134
 * @return 
135
 * @param line 
136
 * @param titleKeys 
137
 */
138
    public String cutWord(String line, String titleKeys) {        
139
        
140
        if (titleKeys.equals("E")) {
141
            StringTokenizer sti = new StringTokenizer(line, " ", true);
142
            boolean first = true;
143
            String token = "";
144
            while (sti.hasMoreTokens()) {
145
                String currentToken = sti.nextToken();
146
                if (first) {
147
                    token = currentToken;
148
                    first = !first;
149
                } else if (!(currentToken.equals(" "))) {
150
                    token = "(" + token + " and " + currentToken + ")";
151
                }
152
            }
153
            return token;
154
        }
155
        return line;
156
    } 
157
 }
0 158

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/languages/BasicEncodingRules.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.languages;
43
import java.util.Iterator;
44

  
45
/**
46
 * This class is used to create a Basic Encoding Rules (BER) query.
47
 * See the specification for more information.
48
 * 
49
 * 
50
 * @author Jorge Piera Llodra (piera_jor@gva.es)
51
 * @see http://www.loc.gov/z3950/agency/
52
 */
53
public class BasicEncodingRules extends AbstractGeneralLanguage {
54

  
55
/**
56
 * It adds a new clause to the query
57
 * 
58
 * 
59
 * @param use It is a number that represent an attribute (4=Title,62=abstract,...)
60
 * @param structure It defines the attribute type (1=Phrase,2=wors,...)
61
 * @param relation Relation between the attribute and the query (1=LessThan,3=equal,...)
62
 * @param line String with the user introduced value
63
 * @param concordancia Relationship between different words of the same field (more than one words)
64
 * E,A o Y --> Exact, All, anY
65
 * @param operator Relationship between fields (title, abstract)
66
 * 'and' or 'or'
67
 */
68
    public void addClauses(String use, String structure, String relation, String line, String concordancia, String operator) {        
69
        currentClause = null;
70
        //Cut the words
71
        Iterator values = parseValues(line, concordancia);
72
        addClauses(use, structure, relation, values, concordancia,operator);
73
    } 
74

  
75
/**
76
 * It realize the same function than the "addClauses(String use, String structure
77
 * String relation,String line, String concordancia)" function, but the words
78
 * to find are in a vector.
79
 * 
80
 * 
81
 * @param use 
82
 * @param structure 
83
 * @param relation 
84
 * @param values 
85
 * @param concordancia 
86
 * @param operator 
87
 */
88
    public void addClauses(String use, String structure, String relation, Iterator values, String concordancia, String operator) {        
89
        while (values.hasNext())
90
            addTerm(use, structure, relation, (String) values.next(),
91
                getOperator(concordancia));
92
        addCurrentClauseQuery(operator);
93
    } 
94

  
95
/**
96
 * Add a new serch field
97
 * 
98
 * 
99
 * @param use BER use
100
 * @param structure BER structure
101
 * @param relation BER relation
102
 * @param value Filed value
103
 * @param operator "and" or "or"
104
 */
105
    private void addTerm(String use, String structure, String relation, String value, String operator) {        
106
        StringBuffer term = new StringBuffer();
107
        if (use != null) {
108
            term.append("@attr 1=" + use + " ");
109
        }
110
        if (structure != null) {
111
            term.append("@attr 4=" + structure + " ");
112
        }
113
        if (relation != null) {
114
            term.append("@attr 2=" + relation + " ");
115
        }
116
        term.append("\"" + value + "\" ");
117
        if (currentClause == null) {
118
            currentClause = term.toString();
119
        } else {
120
            currentClause = "@" + operator + " " + currentClause + " " + term;
121
        }
122
    } 
123

  
124
/**
125
 * It adds a new query to the current query.
126
 * 
127
 * 
128
 * @param operator 'and' or 'or'. Relation between fields
129
 */
130
    protected void addCurrentClauseQuery(String operator) {        
131
        if (currentClause != null) {
132
            if (currentQuery == null) {
133
                currentQuery = currentClause;
134
            } else {
135
                currentQuery = "@" + operator + " " + currentQuery + " " + currentClause;
136
            }
137
        }
138
    } 
139

  
140
/**
141
 * It returns the complete BER query
142
 * 
143
 * 
144
 * @return 
145
 */
146
    public String toString(String database) {        
147
        if ((database == null) || (database.equals(""))){
148
        	database = "geo";
149
        }
150
    	return "@attrset bib-1 " + currentQuery;
151
    } 
152
 }
0 153

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/DiscoveryServiceClient.java
1
package org.gvsig.catalog;
2

  
3
import java.io.IOException;
4
import java.net.Authenticator;
5
import java.net.PasswordAuthentication;
6
import java.net.Socket;
7
import java.net.URI;
8
import java.net.URISyntaxException;
9
import java.net.UnknownHostException;
10
import java.util.Properties;
11

  
12
import org.apache.commons.httpclient.HttpConnection;
13
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities;
14
import org.gvsig.catalog.drivers.IDiscoveryServiceDriver;
15
import org.gvsig.catalog.exceptions.NotSupportedProtocolException;
16
import org.gvsig.catalog.exceptions.NotSupportedVersionException;
17
import org.gvsig.catalog.exceptions.ServerIsNotReadyException;
18
import org.gvsig.catalog.querys.DiscoveryServiceQuery;
19
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
20
import org.gvsig.catalog.utils.URIUtils;
21

  
22
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
23
 *
24
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
25
 *
26
 * This program is free software; you can redistribute it and/or
27
 * modify it under the terms of the GNU General Public License
28
 * as published by the Free Software Foundation; either version 2
29
 * of the License, or (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
39
 *
40
 * For more information, contact:
41
 *
42
 *  Generalitat Valenciana
43
 *   Conselleria d'Infraestructures i Transport
44
 *   Av. Blasco Ib??ez, 50
45
 *   46010 VALENCIA
46
 *   SPAIN
47
 *
48
 *      +34 963862235
49
 *   gvsig@gva.es
50
 *      www.gvsig.gva.es
51
 *
52
 *    or
53
 *
54
 *   IVER T.I. S.A
55
 *   Salamanca 50
56
 *   46005 Valencia
57
 *   Spain
58
 *
59
 *   +34 963163400
60
 *   dac@iver.es
61
 */
62
/* CVS MESSAGES:
63
 *
64
 * $Id$
65
 * $Log$
66
 *
67
 */
68
/**
69
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
70
 */
71
public class DiscoveryServiceClient {
72
	/**
73
	 * The server URI
74
	 */
75
	private URI uri = null;
76
	/**
77
	 * The driver to make the querys
78
	 */
79
	private IDiscoveryServiceDriver driver;
80
	/**
81
	 * The service capabilities
82
	 */
83
	private DiscoveryServiceCapabilities capabilities;
84
	/**
85
	 * The server status message
86
	 */
87
	private String serverStatus = null;
88

  
89
	public DiscoveryServiceClient(String sUri,IDiscoveryServiceDriver driver) {
90
		setDriver(driver);
91
		if (driver == null){
92
			serverStatus = "errorServerNotFound";
93
		}else{
94
			try {
95
				this.uri = URIUtils.createUri(sUri,
96
						driver.getDefaultSchema(),
97
						driver.getDefaultPort());
98
			} catch (URISyntaxException e) {
99
				serverStatus = "errorServerNotFound";
100
			}
101
		}
102
	}
103

  
104
	/**
105
	 * It make a getCapabilities operation
106
	 * @return the service version
107
	 * @throws ServerIsNotReadyException 
108
	 */
109
	public DiscoveryServiceCapabilities getCapabilities() throws ServerIsNotReadyException {        
110
		if (serverIsReady()){
111
			try {
112
				if (getDriver().isProtocolSupported(getUri())) {
113
					capabilities = getDriver().getCapabilities(getUri());
114
					return capabilities;
115
				}
116
			} catch (NotSupportedProtocolException e) {
117
				capabilities = new DiscoveryServiceCapabilities();
118
				capabilities.setAvailable(false);
119
				capabilities.setServerMessage("notSupportedProtocol");
120
			} catch (NotSupportedVersionException e) {
121
				capabilities = new DiscoveryServiceCapabilities();
122
				capabilities.setAvailable(false);
123
				capabilities.setServerMessage("notSupportedVersion");
124
			} 
125
		}
126
		return capabilities;    
127
	} 
128

  
129
	/**
130
	 * It tries if the server is ready 
131
	 * @return boolean
132
	 * true --> server is ready
133
	 * false --> server is not ready
134
	 */
135
	public boolean serverIsReady() throws ServerIsNotReadyException {        
136
		Properties systemSettings = System.getProperties();
137

  
138

  
139
		Object isProxyEnabled = systemSettings.get("http.proxySet"); 
140
		if ((isProxyEnabled == null) || (isProxyEnabled.equals("false"))){
141
			Socket sock;
142
			try{				
143
				sock = new Socket(getUri().getHost(),
144
						getUri().getPort());
145
			} catch (UnknownHostException e) {
146
				throw new ServerIsNotReadyException(e);
147
			} catch (IOException e) {
148
				throw new ServerIsNotReadyException(e);
149
			}
150
			return (sock != null);
151
		}else{
152
			Object host = systemSettings.get("http.proxyHost"); 
153
			Object port = systemSettings.get("http.proxyPort");
154
			Object user = systemSettings.get("http.proxyUserName");
155
			Object password = systemSettings.get("http.proxyPassword");
156
			if ((host != null) && (port != null)){
157
				int iPort = 80;
158
				try{
159
					iPort = Integer.parseInt((String)port);
160
				}catch (Exception e) {
161
					//Use 80
162
				}
163
				HttpConnection connection = new HttpConnection(getUri().getHost(), 
164
						getUri().getPort());
165
				connection.setProxyHost((String)host);
166
				connection.setProxyPort(iPort);
167
				Authenticator.setDefault(new SimpleAuthenticator(
168
                        user,password));
169
				
170
				try {
171
					connection.open();
172
					connection.close();						
173
				} catch (IOException e) {
174
					throw new ServerIsNotReadyException(e);					
175
				}
176
			}			
177
		}		
178
		return true;
179
	} 
180

  
181
	/**
182
	 * @return the server URI
183
	 */
184
	public URI getUri() {
185
		return uri;
186
	}
187

  
188
	/**
189
	 * @return Return the server URI like a String
190
	 */
191
	public String getSUri() {
192
		return uri.toString();
193
	} 
194

  
195
	/**
196
	 * @return Returns the driver.
197
	 */
198
	protected IDiscoveryServiceDriver getDriver() {        
199
		return driver;
200
	}
201

  
202
	/**
203
	 * 
204
	 * @param driver the driver to set
205
	 */
206
	protected void setDriver(IDiscoveryServiceDriver driver) {
207
		this.driver = driver;
208
	} 
209

  
210
	/**
211
	 * @return the server protocol
212
	 */
213
	public String getProtocol() {        
214
		return driver.getServiceName();
215
	}
216

  
217
	/**
218
	 * Gets the aditional panel
219
	 * @return
220
	 */
221
	public SearchAditionalPropertiesPanel getAditionalSearchPanel(){
222
		return driver.getAditionalSearchPanel();
223
	}
224

  
225
	/**
226
	 * Gets a query
227
	 * @return
228
	 */
229
	public DiscoveryServiceQuery createQuery(){
230
		return driver.createQuery();
231
	}
232
	
233
	private class SimpleAuthenticator
234
	   extends Authenticator
235
	{
236
	   private String username,
237
	                  password;
238
	                     
239
	   public SimpleAuthenticator(Object username, Object password)
240
	   {
241
		   if (username != null){
242
			   this.username = (String)username;
243
		   }
244
		   if (password != null){
245
			   this.password = (String)password;
246
		   }
247
	   }
248
	   
249
	   protected PasswordAuthentication getPasswordAuthentication()
250
	   {
251
	      return new PasswordAuthentication(
252
	             username,password.toCharArray());
253
	   }
254
	}
255

  
256
}
0 257

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/filters/AdditionalClauses.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.filters;
43

  
44
/**
45
 * This class is used like an structure. It contains the fields needed to add a new
46
 * operation to the query language.
47
 * 
48
 * 
49
 * @author Jorge Piera Llodra (piera_jor@gva.es)
50
 */
51
public class AdditionalClauses {
52

  
53
/**
54
 * 
55
 * 
56
 */
57
    private String property;
58

  
59
/**
60
 * 
61
 * 
62
 */
63
    private String value;
64

  
65
/**
66
 * 
67
 * 
68
 */
69
    private String concorancia;
70

  
71
/**
72
 * 
73
 * 
74
 */
75
    private String relationship;
76

  
77
/**
78
 * 
79
 * 
80
 */
81
    private String type;
82

  
83
/**
84
 * 
85
 * 
86
 * 
87
 * @param property 
88
 * @param value 
89
 * @param concorancia 
90
 * @param relationship 
91
 * @param type 
92
 */
93
    public  AdditionalClauses(String property, String value, String concorancia, String relationship, String type) {        
94
        super();
95
        this.property = property;
96
        this.value = value;
97
        this.concorancia = concorancia;
98
        this.relationship = relationship;
99
        this.type = type;
100
    } 
101

  
102
/**
103
 * 
104
 * 
105
 * 
106
 * @return Returns the concorancia.
107
 */
108
    public String getConcorancia() {        
109
        return concorancia;
110
    } 
111

  
112
/**
113
 * 
114
 * 
115
 * 
116
 * @return Returns the property.
117
 */
118
    public String getProperty() {        
119
        return property;
120
    } 
121

  
122
/**
123
 * 
124
 * 
125
 * 
126
 * @return Returns the relationship.
127
 */
128
    public String getRelationship() {        
129
        return relationship;
130
    } 
131

  
132
/**
133
 * 
134
 * 
135
 * 
136
 * @return Returns the type.
137
 */
138
    public String getType() {        
139
        return type;
140
    } 
141

  
142
/**
143
 * 
144
 * 
145
 * 
146
 * @return Returns the value.
147
 */
148
    public String getValue() {        
149
        return value;
150
    } 
151
 }
0 152

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/filters/AbstractFilter.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
/*
43
* CVS MESSAGES:
44
*
45
* $Id: AbstractFilter.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
46
* $Log$
47
* Revision 1.4  2006/01/18 09:57:01  jorpiell
48
* Eliminados algunos ficheros innecesarios
49
*
50
* Revision 1.3  2006/01/12 13:52:24  jorpiell
51
* Se ha a?adido un boton close en las dos pantallas de connect. Adem?s se ha cambiado el comportamiento de las ventanas para adaptarlo a la nueva forma de buscar multihilo
52
*
53
* Revision 1.2  2006/01/10 09:32:48  jorpiell
54
* Se ha echo un commit de las versiones modificadas del catalogo y del gazetteer usando el Poseidon. Se han renombrado algunas clases por considerar que tenian un nombre confuso y se han cambiado algunas relaciones entre clases (con la intenci?n de separar GUI de la parte de control). Han habido clases que no han sido tocadas, pero como han sido formateadas usando el Poseidon TODAS las CLASES del proyecto han cambiado de versi?n.
55
*
56
* Revision 1.1  2005/12/22 08:31:43  jorpiell
57
* Aqui tambien se han producido muchos cambis, porque hemos acabado de cambiar la estructura del cat?logo: Se han creado todas las clases "XXXMessages", que sacan toda la parte de los mensajes de los drivers. Ademas se ha incluido en "CatalogClient" la operaci?n "getCapabilities", que libera a la interfaz de algunas operaciones que hac?a anteriormente.
58
*
59
*
60
*/
61
package org.gvsig.catalog.filters;
62

  
63
/**
64
 * 
65
 * 
66
 */
67
public abstract class AbstractFilter implements IFilter {
68
 }
0 69

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/filters/IFilter.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.filters;
43
import org.gvsig.catalog.querys.CatalogQuery;
44
/**
45
 * All the clases that implement a "Query" class must to
46
 * implemet this interface
47
 * 
48
 * 
49
 * @author Jorge Piera Llodra (piera_jor@gva.es)
50
 */
51
public interface IFilter {
52
/**
53
 * 
54
 * 
55
 * 
56
 * @return 
57
 * @param query 
58
 * @param profile 
59
 */
60
    public String getQuery(CatalogQuery query);
61
}
62
//Return the query that will be used for the driver
63

  
64

  
0 65

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.108/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/srw/drivers/SRWCatalogServiceDriver.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff