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