@@ -62,17 +62,11 @@ public class DiskResource implements DiskService {
6262 @ Context HttpServletRequest request ;
6363 @ Context SecurityContext securityContext ;
6464
65- DiskRepository repo ;
66-
67- public DiskResource () {
68- this .repo = DiskRepository .get ();
69- }
70-
7165 @ GET
7266 @ Path ("server/endpoints" )
7367 @ Override
7468 public List <DataAdapterResponse > getEndpoints () {
75- return this . repo .getDataAdapters ();
69+ return DiskRepository . get () .getDataAdapters ();
7670 }
7771
7872 /*
@@ -82,7 +76,7 @@ public List<DataAdapterResponse> getEndpoints() {
8276 @ Path ("vocabulary" )
8377 @ Override
8478 public Map <String , Vocabulary > getVocabularies () {
85- return this . repo .getVocabularies ();
79+ return DiskRepository . get () .getVocabularies ();
8680 }
8781
8882 @ GET
@@ -91,7 +85,7 @@ public Map<String, Vocabulary> getVocabularies() {
9185 @ Override
9286 public String reloadVocabularies () {
9387 try {
94- this . repo .reloadKBCaches ();
88+ DiskRepository . get () .reloadKBCaches ();
9589 return "OK" ;
9690 } catch (Exception e ) {
9791 e .printStackTrace ();
@@ -114,7 +108,7 @@ private void addAuthorFromRequest (DISKResource obj, HttpServletRequest request)
114108
115109 String username = (String ) request .getAttribute ("username" ); //username is an email.
116110 if (username != null ) {
117- Entity author = this . repo .getOrCreateEntity (username );
111+ Entity author = DiskRepository . get () .getOrCreateEntity (username );
118112 obj .setAuthor (author );
119113 }
120114 }
@@ -128,22 +122,22 @@ private void addAuthorFromRequest (DISKResource obj, HttpServletRequest request)
128122 public Goal addGoal (
129123 @ JsonProperty ("goal" ) Goal goal ) {
130124 this .addAuthorFromRequest (goal , request );
131- return this . repo .addGoal (goal );
125+ return DiskRepository . get () .addGoal (goal );
132126 }
133127
134128 @ GET
135129 @ Path ("goals" )
136130 @ Override
137131 public List <Goal > listGoals () {
138- return this . repo .listGoals ();
132+ return DiskRepository . get () .listGoals ();
139133 }
140134
141135 @ GET
142136 @ Path ("goals/{id}" )
143137 @ Override
144138 public Goal getGoal (
145139 @ PathParam ("id" ) String id ) {
146- return this . repo .getGoal (id );
140+ return DiskRepository . get () .getGoal (id );
147141 }
148142
149143 @ PUT
@@ -153,15 +147,15 @@ public Goal updateGoal(
153147 @ PathParam ("id" ) String id ,
154148 @ JsonProperty ("goal" ) Goal goal ) {
155149 this .addAuthorFromRequest (goal , request );
156- return this . repo .updateGoal (id , goal );
150+ return DiskRepository . get () .updateGoal (id , goal );
157151 }
158152
159153 @ DELETE
160154 @ Path ("goals/{id}" )
161155 @ Override
162156 public void deleteGoal (
163157 @ PathParam ("id" ) String id ) {
164- this . repo .removeGoal (id );
158+ DiskRepository . get () .removeGoal (id );
165159 }
166160
167161 @ GET
@@ -173,7 +167,7 @@ public List<TriggeredLOI> queryGoal(
173167 response .setContentType ("application/json" );
174168 response .setCharacterEncoding ("utf-8" );
175169 try {
176- return this . repo .queryGoal (id );
170+ return DiskRepository . get () .queryGoal (id );
177171 } catch (NotFoundException e ) {
178172 try {
179173 ErrorMessage error = new ErrorMessage (e .getMessage ());
@@ -222,22 +216,22 @@ public List<TriggeredLOI> queryGoal(
222216 public LineOfInquiry addLOI (
223217 @ JsonProperty ("loi" ) LineOfInquiry loi ) {
224218 this .addAuthorFromRequest (loi , request );
225- return this . repo .addLOI (loi );
219+ return DiskRepository . get () .addLOI (loi );
226220 }
227221
228222 @ GET
229223 @ Path ("lois" )
230224 @ Override
231225 public List <LineOfInquiry > listLOIs () {
232- return this . repo .listLOIs ();
226+ return DiskRepository . get () .listLOIs ();
233227 }
234228
235229 @ GET
236230 @ Path ("lois/{id}" )
237231 @ Override
238232 public LineOfInquiry getLOI (
239233 @ PathParam ("id" ) String id ) {
240- return this . repo .getLOI (id );
234+ return DiskRepository . get () .getLOI (id );
241235 }
242236
243237 @ PUT
@@ -247,15 +241,15 @@ public LineOfInquiry updateLOI(
247241 @ PathParam ("id" ) String id ,
248242 @ JsonProperty ("loi" ) LineOfInquiry loi ) {
249243 this .addAuthorFromRequest (loi , request );
250- return this . repo .updateLOI (id , loi );
244+ return DiskRepository . get () .updateLOI (id , loi );
251245 }
252246
253247 @ DELETE
254248 @ Path ("lois/{id}" )
255249 @ Override
256250 public void deleteLOI (
257251 @ PathParam ("id" ) String id ) {
258- this . repo .removeLOI (id );
252+ DiskRepository . get () .removeLOI (id );
259253 }
260254
261255 /*
@@ -266,7 +260,7 @@ public void deleteLOI(
266260 @ Override
267261 public TriggeredLOI addTriggeredLOI (
268262 @ JsonProperty ("tloi" ) TriggeredLOI tloi ) {
269- return this . repo .addTriggeredLOI (tloi );
263+ return DiskRepository . get () .addTriggeredLOI (tloi );
270264 }
271265
272266 @ PUT
@@ -276,30 +270,30 @@ public TriggeredLOI updateTLOI(
276270 @ PathParam ("id" ) String id ,
277271 @ JsonProperty ("tloi" ) TriggeredLOI tloi ) {
278272 this .addAuthorFromRequest (tloi , request );
279- return this . repo .updateTriggeredLOI (id , tloi );
273+ return DiskRepository . get () .updateTriggeredLOI (id , tloi );
280274 }
281275
282276 @ GET
283277 @ Path ("tlois" )
284278 @ Override
285279 public List <TriggeredLOI > listTriggeredLOIs () {
286- return this . repo .listTriggeredLOIs ();
280+ return DiskRepository . get () .listTriggeredLOIs ();
287281 }
288282
289283 @ GET
290284 @ Path ("tlois/{id}" )
291285 @ Override
292286 public TriggeredLOI getTriggeredLOI (
293287 @ PathParam ("id" ) String id ) {
294- return this . repo .getTriggeredLOI (id );
288+ return DiskRepository . get () .getTriggeredLOI (id );
295289 }
296290
297291 @ DELETE
298292 @ Path ("tlois/{id}" )
299293 @ Override
300294 public void deleteTriggeredLOI (
301295 @ PathParam ("id" ) String id ) {
302- this . repo .removeTriggeredLOI (id );
296+ DiskRepository . get () .removeTriggeredLOI (id );
303297 }
304298
305299 /*
@@ -311,7 +305,7 @@ public void deleteTriggeredLOI(
311305 public List <WorkflowTemplateResponse > listWorkflows () {
312306 Gson response_error = new Gson ();
313307 try {
314- return this . repo .methodAdapters .getWorkflowList ();
308+ return DiskRepository . get () .methodAdapters .getWorkflowList ();
315309 } catch (Exception e ) {
316310 try {
317311 // Create Json error response
@@ -339,7 +333,7 @@ public List<WorkflowTemplateResponse> listWorkflows() {
339333 public List <WorkflowVariable > getWorkflowVariables (
340334 @ PathParam ("source" ) String source ,
341335 @ PathParam ("id" ) String id ) {
342- return this . repo .methodAdapters .getWorkflowVariablesByName (source , id );
336+ return DiskRepository . get () .methodAdapters .getWorkflowVariablesByName (source , id );
343337 }
344338
345339 @ GET
@@ -348,7 +342,7 @@ public List<WorkflowVariable> getWorkflowVariables(
348342 public Execution monitorWorkflow (
349343 @ PathParam ("source" ) String source ,
350344 @ PathParam ("id" ) String id ) {
351- return this . repo .getWorkflowRunStatus (source , id );
345+ return DiskRepository . get () .getWorkflowRunStatus (source , id );
352346 }
353347
354348 @ GET
@@ -360,7 +354,7 @@ public Map<String, List<String>> queryExternalStore(
360354 @ QueryParam ("query" ) String query ) {
361355 try {
362356 // return WingsAdapter.get().getWorkflowList();
363- return repo .queryExternalStore (endpoint , query , variables );
357+ return DiskRepository . get () .queryExternalStore (endpoint , query , variables );
364358 } catch (Exception e ) {
365359 try {
366360 // Create Json error response
@@ -390,15 +384,15 @@ public Map<String, List<String>> queryExternalStore(
390384 @ Path ("questions" )
391385 @ Override
392386 public List <Question > listQuestions () {
393- return this . repo .listHypothesesQuestions ();
387+ return DiskRepository . get () .listHypothesesQuestions ();
394388 }
395389
396390 @ POST
397391 @ Path ("question/options" )
398392 public Map <String , List <VariableOption >> listDynamicOptions (
399393 @ JsonProperty ("config" ) QuestionOptionsRequest opts ) {
400394 try {
401- return this . repo .listDynamicOptions (opts );
395+ return DiskRepository . get () .listDynamicOptions (opts );
402396 } catch (Exception e ) {
403397 try {
404398 e .printStackTrace ();
@@ -431,7 +425,7 @@ public Map<String, List<VariableOption>> listDynamicOptions(
431425 public List <TriggeredLOI > getExecutions (
432426 @ PathParam ("hid" ) String hid ,
433427 @ PathParam ("lid" ) String lid ) {
434- return this . repo .getTLOIsForHypothesisAndLOI (hid , lid );
428+ return DiskRepository . get () .getTLOIsForHypothesisAndLOI (hid , lid );
435429 }
436430
437431 @ GET
@@ -441,7 +435,7 @@ public List<TriggeredLOI> runHypothesisAndLOI(
441435 @ PathParam ("hid" ) String hid ,
442436 @ PathParam ("lid" ) String lid ) {
443437 try {
444- return this . repo .runHypothesisAndLOI (hid , lid );
438+ return DiskRepository . get () .runHypothesisAndLOI (hid , lid );
445439 } catch (Exception e ) {
446440 try {
447441 // Create Json error response
@@ -469,7 +463,7 @@ public List<TriggeredLOI> runHypothesisAndLOI(
469463 @ Override
470464 public Boolean runHypotheses () {
471465 try {
472- return this . repo .runAllHypotheses ();
466+ return DiskRepository . get () .runAllHypotheses ();
473467 } catch (Exception e ) {
474468 try {
475469 // Create Json error response
@@ -496,7 +490,7 @@ public Boolean runHypotheses() {
496490 @ Path ("getData" )
497491 @ Override
498492 public Response getOutputData (@ JsonProperty ("request" ) ExternalDataRequest r ) {
499- FileAndMeta result = this . repo .getOutputData (r .getSource (), r .getDataId ());
493+ FileAndMeta result = DiskRepository . get () .getOutputData (r .getSource (), r .getDataId ());
500494 if (result == null ) {
501495 ResponseBuilder rBuilder = Response .status (Response .Status .NOT_FOUND );
502496 return rBuilder .type (MediaType .TEXT_PLAIN )
@@ -513,7 +507,7 @@ public Response getOutputData(@JsonProperty("request") ExternalDataRequest r) {
513507 @ Override
514508 public Response getOntologyAll () {
515509 try {
516- FileAndMeta all = this . repo .getOntologyAll ();
510+ FileAndMeta all = DiskRepository . get () .getOntologyAll ();
517511 ResponseBuilder rBuild = Response .ok (all .data , all .contentType );
518512 return rBuild .build ();
519513 } catch (Exception e ) {
0 commit comments