01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.http.webclient.server;
07:
08: import java.util.ArrayList;
09: import java.util.Collections;
10: import java.util.List;
11:
12: import org.slf4j.Logger;
13: import org.slf4j.LoggerFactory;
14:
15: import org.openrdf.repository.RepositoryException;
16: import org.openrdf.repository.manager.RemoteRepositoryManager;
17: import org.openrdf.repository.manager.RepositoryInfo;
18:
19: public class Server {
20:
21: /** Logger for this class and subclasses */
22: final Logger logger = LoggerFactory.getLogger(this .getClass());
23:
24: private String location;
25:
26: private RemoteRepositoryManager repositoryManager;
27:
28: public Server(String location) throws RepositoryException {
29: this .location = location;
30:
31: if (!this .location.endsWith("/")) {
32: this .location += "/";
33: }
34:
35: repositoryManager = new RemoteRepositoryManager(location);
36: repositoryManager.initialize();
37: }
38:
39: public String getLocation() {
40: return location;
41: }
42:
43: /**
44: * @return Returns the repositoryManager.
45: */
46: public RemoteRepositoryManager getRepositoryManager() {
47: return repositoryManager;
48: }
49:
50: public List<RepositoryInfo> getRepositoryInfos()
51: throws RepositoryException {
52: List<RepositoryInfo> result = new ArrayList<RepositoryInfo>();
53:
54: result.addAll(repositoryManager.getAllRepositoryInfos(false));
55: Collections.sort(result);
56:
57: return result;
58: }
59: }
|