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

Commit e07c75b

Browse files
committed
fix missing statement framework-configuration-template and generalised ServerErrorResponse handler
1 parent 4751451 commit e07c75b

File tree

16 files changed

+87
-239
lines changed

16 files changed

+87
-239
lines changed

src/main/java/authentication/FrameworkConfiguration.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class FrameworkConfiguration {
6464
* @throws Exception
6565
*/
6666
public static synchronized FrameworkConfiguration getInstance(
67-
ServletContext context) throws IOException {
67+
ServletContext context) throws Exception {
6868

6969
if (instance == null) {
7070

@@ -87,6 +87,7 @@ public static synchronized FrameworkConfiguration getInstance(
8787
try {
8888
configurationModel.read(configurationFile);
8989
} catch (RiotException e) {
90+
instance = null;
9091
throw new IOException("Malformed " + configurationFile
9192
+ " file");
9293
}
@@ -106,9 +107,11 @@ public static synchronized FrameworkConfiguration getInstance(
106107
QueryExecution qexec = QueryExecutionFactory.create(query,
107108
configurationModel);
108109
ResultSet results = qexec.execSelect();
109-
if (!results.hasNext())
110+
if (!results.hasNext()) {
111+
instance = null;
110112
throw new NullPointerException(
111-
"Invalid initial parameter required at:" + query);
113+
"Invalid initial parameter required at:\n" + query);
114+
}
112115
for (; results.hasNext();) {
113116
QuerySolution soln = results.next();
114117
instance.setFrameworkUri(soln.get("uri").toString());
@@ -140,9 +143,11 @@ public static synchronized FrameworkConfiguration getInstance(
140143

141144
qexec = QueryExecutionFactory.create(query, configurationModel);
142145
results = qexec.execSelect();
143-
if (!results.hasNext())
146+
if (!results.hasNext()) {
147+
instance = null;
144148
throw new NullPointerException(
145149
"Invalid initial parameter required");
150+
}
146151
for (; results.hasNext();) {
147152
QuerySolution soln = results.next();
148153
instance.setAuthSparqlEndpoint(soln.get("endpoint").toString());
@@ -165,9 +170,11 @@ public static synchronized FrameworkConfiguration getInstance(
165170
+ " ?service lds:password ?password }";
166171
qexec = QueryExecutionFactory.create(query, configurationModel);
167172
results = qexec.execSelect();
168-
if (!results.hasNext())
173+
if (!results.hasNext()) {
174+
instance = null;
169175
throw new NullPointerException(
170176
"Invalid initial parameter required");
177+
}
171178
for (; results.hasNext();) {
172179
QuerySolution soln = results.next();
173180
instance.setVirtuosoJdbcConnString(soln.get("connectionString")
@@ -187,9 +194,11 @@ public static synchronized FrameworkConfiguration getInstance(
187194
+ "{ ?s sd:namedGraph ?o . ?o sd:name ?name . ?o sd:graph ?g . ?g rdfs:label ?label } ";
188195
qexec = QueryExecutionFactory.create(query, configurationModel);
189196
results = qexec.execSelect();
190-
if (!results.hasNext())
197+
if (!results.hasNext()) {
198+
instance = null;
191199
throw new NullPointerException(
192200
"Invalid initial parameter required");
201+
}
193202
for (; results.hasNext();) {
194203
QuerySolution soln = results.next();
195204

src/main/java/rest/Configuration.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package rest;
22

3-
import java.io.IOException;
4-
53
import javax.servlet.ServletContext;
64
import javax.ws.rs.GET;
75
import javax.ws.rs.Path;
@@ -56,11 +54,11 @@ public Response getConfiguration(@Context ServletContext context) {
5654
config.addProperty("flagPath",
5755
context.getInitParameter("framework-setup-path"));
5856

59-
} catch (IOException e) {
57+
} catch (Exception e) {
6058
log.error(e);
6159
e.printStackTrace();
6260
return Response.status(Response.Status.EXPECTATION_FAILED)
63-
.entity("Error reading configuration files.").build();
61+
.entity(e.getMessage()).build();
6462
}
6563
return Response.ok(config.toString(), MediaType.APPLICATION_JSON)
6664
.build();

src/main/resources/framework-components-template.ttl

Lines changed: 0 additions & 145 deletions
This file was deleted.
Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
@prefix : <http://***PROJECT_URL***/resource/> .
1+
@prefix : <http://generator.geoknow.eu/resource/> .
2+
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
3+
@prefix dcmit: <http://purl.org/dc/dcmitype/> .
24
@prefix dcterms: <http://purl.org/dc/terms/> .
35
@prefix lds: <http://stack.linkeddata.org/ldis-schema/> .
6+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
47
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
58
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9+
@prefix schema: <http://schema.org/> .
610
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
711
@prefix void: <http://rdfs.org/ns/void#> .
812
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
913
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
10-
@prefix ontos: <http://ldiw.ontos.com/ontology/> .
14+
@prefix gkg: <http://generator.geoknow.eu/ontology/> .
15+
1116

1217
########### ABOUT THIS FILE #############################################################
1318
# This file contains the configuration for the GeoKnow generator concerning
1419
# the endpoints and default user credentials
15-
# To have different instances of the workbench different prefixes for projects:
16-
# Replace ***PROJECT_URL*** with the desided URI
17-
# Replace ***ENDPOINT*** and ***REMOVED*** with the corresponding data
1820
# #######################################################################################
1921

2022
# These triples describes the URL endpoints for the application
2123

22-
:LDWorkbench
24+
:GeoKnowGenerator
2325
a lds:StackComponent ;
2426
rdfs:comment "This resource contains all the configuration required by the application"^^xsd:string ;
25-
rdfs:label "LDWorkbench"^^xsd:string ;
27+
rdfs:label "GeoKnowGeneator"^^xsd:string ;
2628
dcterms:hasVersion "2.0"^^xsd:string ;
27-
ontos:publicEndpoint :VirtuosoEndpoint ;
28-
ontos:authEndpoint :VirtuosoAuthSPARQLEndpoint ;
29+
gkg:publicEndpoint :VirtuosoEndpoint ;
30+
gkg:authEndpoint :VirtuosoAuthSPARQLEndpoint ;
2931
lds:integrates :Virtuoso ;
3032
foaf:homepage <http://localhost:8080/generator> .
3133

@@ -39,21 +41,23 @@
3941
:VirtuosoConductor
4042
a lds:StorageService ;
4143
lds:password "***REMOVED***"^^xsd:string ;
42-
lds:serviceUrl <http://:8890/conductor> ;
43-
lds:connectionString "jdbc:virtuoso://***ENDPOINT***:1111/"^^xsd:string;
44+
lds:serviceUrl <http://***REMOVED***:8890/conductor> ;
45+
lds:connectionString "jdbc:virtuoso://***REMOVED***:1111/"^^xsd:string;
4446
lds:user "***REMOVED***"^^xsd:string .
4547

4648
:VirtuosoAuthSPARQLEndpoint
47-
a lds:SecuredSPARQLEndPointService, void:Dataset , ontos:SPARQLEndpoint , ontos:DataSource ;
48-
rdfs:label "Workbench Auth" ;
49+
a lds:SecuredSPARQLEndPointService, void:Dataset , gkg:SPARQLEndpoint , gkg:DataSource ;
50+
rdfs:label "Workbench Authenticated Endpoint" ;
4951
lds:password "***REMOVED***"^^xsd:string ;
50-
lds:serviceUrl <http://***ENDPOINT***:8890/sparql-auth> ;
52+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql-auth> ;
53+
lds:serviceUrl <http://***REMOVED***:8890/sparql-auth> ;
5154
lds:user "***REMOVED***"^^xsd:string .
5255

5356
:VirtuosoEndpoint
54-
a lds:SecuredSPARQLEndPointService, void:Dataset , ontos:SPARQLEndpoint , ontos:DataSource ;
55-
rdfs:label "Workbench Pub" ;
56-
lds:serviceUrl <http://***ENDPOINT***:8890/sparql> .
57+
a lds:SPARQLEndPointService, void:Dataset , gkg:SPARQLEndpoint , gkg:DataSource ;
58+
rdfs:label "Workbench public Endpoint" ;
59+
lds:serviceUrl <http://***REMOVED***:8890/sparql> ;
60+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql> .
5761

5862

5963
# #######################################################################################
@@ -75,11 +79,7 @@
7579
.
7680

7781
:defaultNamedGraph
78-
<<<<<<< HEAD
79-
sd:name <http://***REMOVED***/DAV>;
80-
=======
81-
sd:name <http://***ENDPOINT***:8890/DAV>;
82-
>>>>>>> master
82+
sd:name <http://***REMOVED***:8890/DAV>;
8383
sd:graph [
8484
a sd:Graph, void:Dataset;
8585
rdfs:label "default"^^xsd:string;
@@ -96,11 +96,7 @@
9696
dcterms:description "GeoKnow Generator settings and configurations"^^xsd:string;
9797
dcterms:modified "2013-09-12"^^xsd:date;
9898
dcterms:created "2013-09-12"^^xsd:date;
99-
<<<<<<< HEAD
100-
void:sparqlEndpoint <http://***REMOVED***/sparql> ]
101-
=======
102-
void:sparqlEndpoint <http://***ENDPOINT***:8890/sparql> ]
103-
>>>>>>> master
99+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql> ]
104100
.
105101

106102
:initialSettingsNamedGraph
@@ -112,11 +108,7 @@
112108
dcterms:description "Initial configuration of components in the framework"^^xsd:string;
113109
dcterms:modified "2013-09-12"^^xsd:date;
114110
dcterms:created "2013-09-12"^^xsd:date;
115-
<<<<<<< HEAD
116-
void:sparqlEndpoint <http://***REMOVED***/sparql> ]
117-
=======
118-
void:sparqlEndpoint <http://***ENDPOINT***:8890/sparql> ]
119-
>>>>>>> master
111+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql> ]
120112
.
121113

122114
:accountsNamedGraph
@@ -128,11 +120,7 @@
128120
dcterms:description "A graph to store the users accounts"^^xsd:string;
129121
dcterms:modified "2014-04-12"^^xsd:date;
130122
dcterms:created "2014-04-12"^^xsd:date;
131-
<<<<<<< HEAD
132-
void:sparqlEndpoint <http://***REMOVED***/sparql> ]
133-
=======
134-
void:sparqlEndpoint <http://***ENDPOINT***:8890/sparql> ]
135-
>>>>>>> master
123+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql> ]
136124
.
137125

138126
:groupsNamedGraph
@@ -144,16 +132,14 @@
144132
dcterms:description "A graph for groups of graphs"^^xsd:string;
145133
dcterms:modified "2014-04-12"^^xsd:date;
146134
dcterms:created "2014-04-12"^^xsd:date;
147-
<<<<<<< HEAD
148-
void:sparqlEndpoint <http://***REMOVED***/sparql> ]
149-
=======
150-
void:sparqlEndpoint <http://***ENDPOINT***:8890/sparql> ]
151-
>>>>>>> master
135+
void:sparqlEndpoint <http://***REMOVED***:8890/sparql> ]
152136
.
153137

154138
:admin
155-
a ontos:Account;
156-
foaf:accountName "***REMOVED***"^^xsd:string;
157-
lds:password "***REMOVED***"^^xsd:string;
139+
a gkg:Account;
140+
foaf:accountName "admin"^^xsd:string;
141+
lds:password "admin"^^xsd:string;
158142
foaf:mbox <mailto:***REMOVED***>;
159-
ontos:Role ontos:Administrator.
143+
gkg:Role gkg:Administrator.
144+
145+

0 commit comments

Comments
 (0)