Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Commit 2c8d7d4

Browse files
committed
acceptable version but is not the good one
1 parent 1bbbb1a commit 2c8d7d4

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package rest;
2+
3+
import javax.servlet.ServletContext;
4+
import javax.ws.rs.GET;
5+
import javax.ws.rs.Path;
6+
import javax.ws.rs.Produces;
7+
import javax.ws.rs.core.Context;
8+
import javax.ws.rs.core.MediaType;
9+
10+
import org.apache.log4j.Logger;
11+
12+
import authentication.FrameworkConfiguration;
13+
14+
import com.google.gson.JsonObject;
15+
16+
/**
17+
* TODO: documentation using something like
18+
* https://github.com/kongchen/swagger-maven-plugin
19+
*/
20+
21+
@Path("/config")
22+
public class Configuration {
23+
24+
private static final Logger log = Logger.getLogger(Configuration.class);
25+
26+
/**
27+
* Get application basic parameters
28+
*
29+
* @return true/false
30+
*/
31+
@GET
32+
@Produces(MediaType.APPLICATION_JSON)
33+
public String getConfiguration(@Context ServletContext context) {
34+
35+
FrameworkConfiguration frameworkConf;
36+
JsonObject config = null;
37+
try {
38+
frameworkConf = FrameworkConfiguration.getInstance(context);
39+
config = new JsonObject();
40+
config.addProperty("frameworkUri", frameworkConf.getFrameworkUri());
41+
config.addProperty("ns", frameworkConf.getResourceNamespace());
42+
config.addProperty("defaultSettingsGraphUri",
43+
frameworkConf.getSettingsGraph());
44+
config.addProperty("groupsGraphUri",
45+
frameworkConf.getGroupsGraph());
46+
config.addProperty("frameworkOntologyNs",
47+
frameworkConf.getFrameworkOntologyNS());
48+
config.addProperty("accountsGraph",
49+
frameworkConf.getAccountsGraph());
50+
51+
} catch (Exception e) {
52+
log.error(e);
53+
e.printStackTrace();
54+
}
55+
return config.toString();
56+
}
57+
}

0 commit comments

Comments
 (0)