Commit c5a34698 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Cleanup

parent 9bbf46f7
......@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that
can be used to access the Web service API for this application.
......@@ -97,7 +97,7 @@
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized
to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
......@@ -127,7 +127,7 @@
</tbody>
</table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -155,7 +155,7 @@
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -190,7 +190,7 @@
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -219,7 +219,7 @@
</tbody>
</table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML.
This is useful for accessing the resources that are published by this application, but only
......@@ -251,7 +251,7 @@
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created March 14, 2017</p>
<p class="lead">Created March 15, 2017</p>
<p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON.
This is useful for accessing the REST endpoints that are published by this application, but only
......
......@@ -102,11 +102,13 @@ provisoner to request for resources (VMs).</span>
<td> <span class="resource-name">CloudCredentialsController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/{id}</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/upload/{id}</span>
</samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span>
......@@ -179,7 +181,7 @@ provisopned based on a TOSCA description.</span>
<tr class="clickable-row" data-href="resource_ProvisionController.html">
<td> <span class="resource-name">ProvisionController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisionerall</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span>
......@@ -284,11 +286,13 @@ machine the keys correspond to.</span>
<tr class="clickable-row" data-href="resource_UserScriptController.html">
<td> <span class="resource-name">UserScriptController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/user_script/ids</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/user_script/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/upload</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/{id}</span>
</samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">GET</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li></ul></td>
......
......@@ -52,6 +52,7 @@
<div class="col-sm-3 col-md-2 sidebar" id="apinav">
<ul class="nav nav-sidebar">
<li><a href="#resource_CloudCredentialsController_postConf_POST"><abbr title="POST /user/v1.0/credentials/cloud">POST /user/v1.0/credentials/cl...</abbr></a></li>
<li><a href="#resource_CloudCredentialsController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/credentials/cloud/all">DELETE /user/v1.0/credentials/...</abbr></a></li>
<li><a href="#resource_CloudCredentialsController_getIds_GET"><abbr title="GET /user/v1.0/credentials/cloud/ids">GET /user/v1.0/credentials/clo...</abbr></a></li>
<li><a href="#resource_CloudCredentialsController_delete_DELETE"><abbr title="DELETE /user/v1.0/credentials/cloud/{id}">DELETE /user/v1.0/credentials/...</abbr></a></li>
<li><a href="#resource_CloudCredentialsController_get_GET"><abbr title="GET /user/v1.0/credentials/cloud/{id}">GET /user/v1.0/credentials/clo...</abbr></a></li>
......@@ -174,7 +175,7 @@ Accept: application/json
}, {
&quot;name&quot; : &quot;...&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PUBLIC&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;...&quot;,
&quot;property2&quot; : &quot;...&quot;
......@@ -204,6 +205,64 @@ Content-Type: application/json
</div>
</div>
<div id="resource_CloudCredentialsController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/credentials/cloud/all <a href="../user/v1.0/credentials/cloud/all" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN</dd>
</dl>
<table class="table resource-response-body">
<caption>Response Body</caption>
<thead>
<tr>
<th>media type</th>
<th>data type</th>
</tr>
</thead>
<tbody>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/json&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/json</span></abbr></td>
<td><span class="datatype-reference">string
(JSON)</span></td>
</tr>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/xml&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/xml</span></abbr></td>
<td><span class="datatype-reference">string
(XML)</span></td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<div class="container-fluid example panel">
<div class="row panel-body">
<div class="col-md-6">
<h5>Request</h5>
<pre>
DELETE /user/v1.0/credentials/cloud/all
Accept: application/json
</pre>
</div>
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
...
</code>
</pre>
</div>
</div>
</div>
</div>
<div id="resource_CloudCredentialsController_getIds_GET">
<h3><span class="label label-default resource-method">GET</span> <span class="resource-path">/user/v1.0/credentials/cloud/ids <a href="../user/v1.0/credentials/cloud/ids" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
......
......@@ -51,7 +51,7 @@
<div class="row">
<div class="col-sm-3 col-md-2 sidebar" id="apinav">
<ul class="nav nav-sidebar">
<li><a href="#resource_ProvisionController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/provisionerall">DELETE /user/v1.0/provisionera...</abbr></a></li>
<li><a href="#resource_ProvisionController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/provisioner/all">DELETE /user/v1.0/provisioner/...</abbr></a></li>
<li><a href="#resource_ProvisionController_getIds_GET">GET /user/v1.0/provisioner/ids</a></li>
<li><a href="#resource_ProvisionController_provision_POST"><abbr title="POST /user/v1.0/provisioner/provision">POST /user/v1.0/provisioner/pr...</abbr></a></li>
<li><a href="#resource_ProvisionController_delete_DELETE"><abbr title="DELETE /user/v1.0/provisioner/{id}">DELETE /user/v1.0/provisioner/...</abbr></a></li>
......@@ -74,7 +74,7 @@
based the plan generated by the planner</p>
<div id="resource_ProvisionController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisionerall <a href="../user/v1.0/provisionerall" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisioner/all <a href="../user/v1.0/provisioner/all" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
......@@ -111,7 +111,7 @@ based the plan generated by the planner</p>
<div class="col-md-6">
<h5>Request</h5>
<pre>
DELETE /user/v1.0/provisionerall
DELETE /user/v1.0/provisioner/all
Accept: application/json
</pre>
......
......@@ -55,6 +55,7 @@
<li><a href="#resource_UserPublicKeysController_getIds_GET">GET /user/v1.0/user_key/ids</a></li>
<li><a href="#resource_UserPublicKeysController_uploadUserPublicKeys_POST"><abbr title="POST /user/v1.0/user_key/upload">POST /user/v1.0/user_key/uploa...</abbr></a></li>
<li><a href="#resource_UserPublicKeysController_delete_DELETE"><abbr title="DELETE /user/v1.0/user_key/{id}">DELETE /user/v1.0/user_key/{id...</abbr></a></li>
<li><a href="#resource_UserPublicKeysController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/user_key/{id}">DELETE /user/v1.0/user_key/{id...</abbr></a></li>
<li><a href="#resource_UserPublicKeysController_get_GET">GET /user/v1.0/user_key/{id}</a></li>
<li class="divider"></li>
<li class="text-right"><a href="#top"><small>Back to Top</small></a></li>
......@@ -405,6 +406,64 @@ Content-Type: application/json
</div>
</div>
<div id="resource_UserPublicKeysController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/user_key/{id} <a href="../user/v1.0/user_key/{id}" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN</dd>
</dl>
<table class="table resource-response-body">
<caption>Response Body</caption>
<thead>
<tr>
<th>media type</th>
<th>data type</th>
</tr>
</thead>
<tbody>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/json&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/json</span></abbr></td>
<td><span class="datatype-reference">string
(JSON)</span></td>
</tr>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/xml&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/xml</span></abbr></td>
<td><span class="datatype-reference">string
(XML)</span></td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<div class="container-fluid example panel">
<div class="row panel-body">
<div class="col-md-6">
<h5>Request</h5>
<pre>
DELETE /user/v1.0/user_key/{id}
Accept: application/json
</pre>
</div>
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
...
</code>
</pre>
</div>
</div>
</div>
</div>
<div id="resource_UserPublicKeysController_get_GET">
<h3><span class="label label-default resource-method">GET</span> <span class="resource-path">/user/v1.0/user_key/{id} <a href="../user/v1.0/user_key/{id}" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
......
......@@ -51,6 +51,7 @@
<div class="row">
<div class="col-sm-3 col-md-2 sidebar" id="apinav">
<ul class="nav nav-sidebar">
<li><a href="#resource_UserScriptController_deleteAll_DELETE"><abbr title="DELETE /user/v1.0/user_script/all">DELETE /user/v1.0/user_script/...</abbr></a></li>
<li><a href="#resource_UserScriptController_getIds_GET">GET /user/v1.0/user_script/ids</a></li>
<li><a href="#resource_UserScriptController_uploadUserScript_POST"><abbr title="POST /user/v1.0/user_script/upload">POST /user/v1.0/user_script/up...</abbr></a></li>
<li><a href="#resource_UserScriptController_delete_DELETE"><abbr title="DELETE /user/v1.0/user_script/{id}">DELETE /user/v1.0/user_script/...</abbr></a></li>
......@@ -72,6 +73,64 @@
<p>This controller is responsible for handling user scripts. These user can be
used by the provisoner to run on the created VMs.</p>
<div id="resource_UserScriptController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/user_script/all <a href="../user/v1.0/user_script/all" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN</dd>
</dl>
<table class="table resource-response-body">
<caption>Response Body</caption>
<thead>
<tr>
<th>media type</th>
<th>data type</th>
</tr>
</thead>
<tbody>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/json&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/json</span></abbr></td>
<td><span class="datatype-reference">string
(JSON)</span></td>
</tr>
<tr>
<td><abbr data-toggle="tooltip" data-placement="top" title="Use the &quot;Accept: application/xml&quot; HTTP header to request that this media type be provided by the server."><span class="response-type">application/xml</span></abbr></td>
<td><span class="datatype-reference">string
(XML)</span></td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<div class="container-fluid example panel">
<div class="row panel-body">
<div class="col-md-6">
<h5>Request</h5>
<pre>
DELETE /user/v1.0/user_script/all
Accept: application/json
</pre>
</div>
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
...
</code>
</pre>
</div>
</div>
</div>
</div>
<div id="resource_UserScriptController_getIds_GET">
<h3><span class="label label-default resource-method">GET</span> <span class="resource-path">/user/v1.0/user_script/ids <a href="../user/v1.0/user_script/ids" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
......@@ -132,6 +191,11 @@ Content-Type: application/json
<p>Uploads a script</p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN, USER</dd>
</dl>
<table class="table resource-parameters">
<caption>Request Parameters</caption>
<thead>
......@@ -205,6 +269,11 @@ Content-Type: application/json
<p></p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN, USER</dd>
</dl>
<table class="table resource-parameters">
<caption>Request Parameters</caption>
<thead>
......@@ -276,6 +345,11 @@ Content-Type: application/json
<p>Gets a script</p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
<dd>ADMIN, USER</dd>
</dl>
<table class="table resource-parameters">
<caption>Request Parameters</caption>
<thead>
......
......@@ -94,11 +94,13 @@ provisoner to request for resources (VMs).</span>
<td> <span class="resource-name">CloudCredentialsController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/{id}</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/credentials/cloud/upload/{id}</span>
</samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span>
......@@ -171,7 +173,7 @@ provisopned based on a TOSCA description.</span>
<tr class="clickable-row" data-href="resource_ProvisionController.html">
<td> <span class="resource-name">ProvisionController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisionerall</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/provisioner/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/provision</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/provisioner/{id}</span>
......@@ -276,11 +278,13 @@ machine the keys correspond to.</span>
<tr class="clickable-row" data-href="resource_UserScriptController.html">
<td> <span class="resource-name">UserScriptController</span>
</td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/user_script/ids</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="resource-path">/user/v1.0/user_script/all</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/ids</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/upload</span>
</samp></li><li><samp> <span class="resource-path">/user/v1.0/user_script/{id}</span>
</samp></li></ul></td>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">GET</span>
<td class="text-nowrap"><ul class="list-unstyled"><li><samp> <span class="label label-default resource-method">DELETE</span>
</samp></li><li><samp> <span class="label label-default resource-method">GET</span>
</samp></li><li><samp> <span class="label label-default resource-method">POST</span>
</samp></li><li><samp> <span class="label label-default resource-method">DELETE</span> <span class="label label-default resource-method">GET</span>
</samp></li></ul></td>
......
......@@ -70,4 +70,9 @@ public class CloudCredentialsService {
public List<CloudCredentials> findAll() {
return dao.findAll();
}
@PostFilter("(hasRole('ROLE_ADMIN'))")
public void deleteAll() {
dao.deleteAll();
}
}
......@@ -93,4 +93,9 @@ public class UserKeyService {
upk.setOwner(owner);
return dao.save(upk);
}
@PostAuthorize("(hasRole('ROLE_ADMIN'))")
public void deleteAll() {
dao.deleteAll();
}
}
......@@ -70,4 +70,9 @@ public class UserScriptService {
public List<Script> findAll() {
return dao.findAll();
}
@PostFilter("(hasRole('ROLE_ADMIN'))")
public void deleteAll() {
dao.deleteAll();
}
}
......@@ -162,6 +162,14 @@ public class CloudCredentialsController {
return "Deleted :" + id;
}
@RequestMapping(value = "/all", method = RequestMethod.DELETE)
@RolesAllowed({UserService.ADMIN})
public @ResponseBody
String deleteAll() {
cloudCredentialsService.deleteAll();
return "Done";
}
/**
* Gets all the IDs of the stored cloud credentials
*
......
......@@ -43,8 +43,6 @@ import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class DeployController {
@Autowired
private DeployClusterService deployService;
......@@ -124,8 +122,6 @@ public class DeployController {
return "Done";
}
private void checkClusterType(String clusterType) {
switch (clusterType.toLowerCase()) {
case "kubernetes":
......
......@@ -82,7 +82,7 @@ public class ProvisionController {
throw new NotFoundException();
}
@RequestMapping(value = "all", method = RequestMethod.DELETE)
@RequestMapping(value = "/all", method = RequestMethod.DELETE)
@RolesAllowed({UserService.ADMIN})
public @ResponseBody
String deleteAll() {
......@@ -91,7 +91,6 @@ public class ProvisionController {
}
/**
* Gets the IDs of all the stored ProvisionInfo
*
......@@ -137,5 +136,4 @@ public class ProvisionController {
return null;
}
}
......@@ -169,7 +169,15 @@ public class UserPublicKeysController {
public @ResponseBody
String delete(@PathVariable("id") String id) {
service.delete(id, LoginKey.Type.PUBLIC);
return "Deleteed: " + id;
return "Deleted: " + id;
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@RolesAllowed({UserService.ADMIN})
public @ResponseBody
String deleteAll() {
service.deleteAll();
return "Done";
}
}
......@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -32,6 +33,7 @@ import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.v1.types.Script;
import org.springframework.web.bind.annotation.PathVariable;
import nl.uva.sne.drip.api.service.UserScriptService;
import nl.uva.sne.drip.api.service.UserService;
/**
* This controller is responsible for handling user scripts. These user can be
......@@ -55,6 +57,7 @@ public class UserScriptController {
* @return the ID of the stopred script
*/
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
String uploadUserScript(@RequestParam("file") MultipartFile file) {
if (!file.isEmpty()) {
......@@ -85,13 +88,15 @@ public class UserScriptController {
* @return the script
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
Script get(@PathVariable("id") String id) {
return userScriptService.findOne(id);
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String delete(@PathVariable("id") String id) {
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody String delete(@PathVariable("id") String id) {
Script script = userScriptService.findOne(id);
if (script == null) {
throw new NotFoundException();
......@@ -100,6 +105,14 @@ public class UserScriptController {
return "Deleted: " + id;
}
@RequestMapping(value = "/all", method = RequestMethod.DELETE)
@RolesAllowed({UserService.ADMIN})
public @ResponseBody String deleteAll() {
userScriptService.deleteAll();
return "Done";
}
/**
* Gets the IDs of all the stored scripts
*
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import org.springframework.stereotype.Component;
/**
*
* @author S. Koulouzis
*/
@Component
public class TestBean {
public boolean getTestBoolean() {
return false;
}
}
......@@ -22,8 +22,6 @@ if len(sys.argv) > 1:
else:
rabbitmq_host = '127.0.0.1'
print "Trying to connect to: %s" %rabbitmq_host
connection = pika.BlockingConnection(pika.ConnectionParameters(host=rabbitmq_host))
channel = connection.channel()
channel.queue_declare(queue='planner_queue')
......
......@@ -65,7 +65,7 @@ public class RPCServer {
factory.setPassword("guest");
factory.setUsername("guest");
factory.setPort(AMQP.PROTOCOL.PORT);
Logger.getLogger(RPCServer.class.getName()).log(Level.INFO, "Trying to connect to: {0}", HOST);
Logger.getLogger(RPCServer.class.getName()).log(Level.INFO, "Connected to: {0}", HOST);
try (Connection connection = factory.newConnection()) {
Channel channel = connection.createChannel();
//We define the queue name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment