source: FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/utils/AbstractEndpointDescriptionBase.java @ 5546

Last change on this file since 5546 was 5546, checked in by Oliver Schonefeld, 10 years ago
  • support new FCS specification (with some backwards compatibility for old spec)

HEADS UP: not yet ready for release; needs more testing

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1package eu.clarin.sru.server.fcs.utils;
2
3import java.net.URI;
4import java.util.Collections;
5import java.util.List;
6
7import eu.clarin.sru.server.fcs.DataView;
8import eu.clarin.sru.server.fcs.EndpointDescription;
9
10
11/**
12 * An abstract base class for implementing endpoint descriptions. It already
13 * implements the methods required for capabilities and supported dataviews.
14 *
15 * @see EndpointDescription
16 *
17 */
18public abstract class AbstractEndpointDescriptionBase implements EndpointDescription {
19    protected final List<URI> capabilities;
20    protected final List<DataView> supportedDataViews;
21
22    /**
23     * Constructor.
24     *
25     * @param capabilities
26     *            a list of capabilities supported by this endpoint
27     * @param supportedDataViews
28     *            a list of data views that are supported by this endpoint
29     */
30    protected AbstractEndpointDescriptionBase(List<URI> capabilities,
31            List<DataView> supportedDataViews) {
32        if (capabilities == null) {
33            throw new NullPointerException("capabilities == null");
34        }
35        if (capabilities.isEmpty()) {
36            throw new IllegalArgumentException("capabilities are empty");
37        }
38        this.capabilities = Collections.unmodifiableList(capabilities);
39
40        if (supportedDataViews == null) {
41            throw new NullPointerException("supportedDataViews == null");
42        }
43        if (supportedDataViews.isEmpty()) {
44            throw new IllegalArgumentException("supportedDataViews are empty");
45        }
46        this.supportedDataViews =
47                Collections.unmodifiableList(supportedDataViews);
48    }
49
50
51    @Override
52    public List<URI> getCapabilities() {
53        return capabilities;
54    }
55
56
57    @Override
58    public List<DataView> getSupportedDataViews() {
59        return supportedDataViews;
60    }
61
62} // abstract class EndpointDescriptionBase
Note: See TracBrowser for help on using the repository browser.