Search in sources :

Example 6 with Stats

use of nl.uva.cs.lobcder.rest.wrappers.Stats in project lobcder by skoulouzis.

the class StatsService method setStats.

@Path("set")
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void setStats(JAXBElement<Stats> jbStats) {
    MyPrincipal mp = (MyPrincipal) request.getAttribute("myprincipal");
    if (mp.getRoles().contains("worker") || mp.isAdmin()) {
        try {
            Stats stats = jbStats.getValue();
            getCatalogue().setSpeed(stats);
        } catch (SQLException ex) {
            Logger.getLogger(StatsService.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Also used : MyPrincipal(nl.uva.cs.lobcder.auth.MyPrincipal) SQLException(java.sql.SQLException) Stats(nl.uva.cs.lobcder.rest.wrappers.Stats)

Aggregations

Stats (nl.uva.cs.lobcder.rest.wrappers.Stats)6 SQLException (java.sql.SQLException)4 PDRI (nl.uva.cs.lobcder.resources.PDRI)4 Path (io.milton.common.Path)2 BadRequestException (io.milton.http.exceptions.BadRequestException)2 LogicalData (nl.uva.cs.lobcder.resources.LogicalData)2 PDRIDescr (nl.uva.cs.lobcder.resources.PDRIDescr)2 Range (io.milton.http.Range)1 NotAuthorizedException (io.milton.http.exceptions.NotAuthorizedException)1 NotFoundException (io.milton.http.exceptions.NotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Connection (java.sql.Connection)1 ArrayList (java.util.ArrayList)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1