-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
OSEOXStreamLoader.java
73 lines (61 loc) · 2.33 KB
/
OSEOXStreamLoader.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
/* (c) 2017 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.opensearch.eo;
import java.util.List;
import org.geoserver.catalog.Keyword;
import org.geoserver.catalog.KeywordInfo;
import org.geoserver.config.GeoServer;
import org.geoserver.config.util.XStreamPersister;
import org.geoserver.config.util.XStreamServiceLoader;
import org.geoserver.platform.GeoServerResourceLoader;
import org.geotools.metadata.iso.identification.KeywordsImpl;
import com.thoughtworks.xstream.XStream;
/**
* Loads the OpenSearch EO configuration from XML
*
* @author Andrea Aime - GeoSolutions
*/
public class OSEOXStreamLoader extends XStreamServiceLoader<OSEOInfo> {
public OSEOXStreamLoader(GeoServerResourceLoader resourceLoader) {
super(resourceLoader, "oseo");
}
public Class<OSEOInfo> getServiceClass() {
return OSEOInfo.class;
}
protected OSEOInfo createServiceFromScratch(GeoServer gs) {
OSEOInfo oseo = new OSEOInfoImpl();
oseo.setName("OSEO");
oseo.setAbstract("Provides interoperable access, following ISO/OGC interface guidelines, to Earth Observation metadata.");
oseo.setTitle("OpenSearch for Earth Observation");
oseo.setMaximumRecords(OSEOInfo.DEFAULT_MAXIMUM_RECORDS);
oseo.setRecordsPerPage(OSEOInfo.DEFAULT_RECORDS_PER_PAGE);
final List<KeywordInfo> keywords = oseo.getKeywords();
keywords.add(new Keyword("EarthObservation"));
keywords.add(new Keyword("OGC"));
return oseo;
}
@Override
protected void initXStreamPersister(XStreamPersister xp, GeoServer gs) {
super.initXStreamPersister(xp, gs);
initXStreamPersister(xp);
}
/**
* Sets up aliases and allowed types for the xstream persister
*
* @param xs
*/
public static void initXStreamPersister(XStreamPersister xp) {
XStream xs = xp.getXStream();
xs.alias("oseo", OSEOInfo.class, OSEOInfoImpl.class);
}
@Override
protected OSEOInfo initialize(OSEOInfo service) {
super.initialize(service);
if (!service.getVersions().contains(OSEOInfo.VERSION_1_0_0)) {
service.getVersions().add(OSEOInfo.VERSION_1_0_0);
}
return service;
}
}