Package com.netflix.staash.json

Examples of com.netflix.staash.json.JsonObject


        }
        List<Row> rows = rs.all();
        Map<String,JsonObject> storageMap = new HashMap<String,JsonObject>();
        for (Row row : rows) {
            String field = row.getString(0);
            JsonObject val = new JsonObject(row.getString(1));
            storageMap.put(field, val);
        }
        return storageMap;
    }
View Full Code Here


                return metasvc.writeMetaEntity(EntityType.DB, payLoad);
            } catch (StorageDoesNotExistException e) {
                e.printStackTrace();
            }
        }
        JsonObject obj = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\"");
        return obj.toString();
    }
View Full Code Here

                return metasvc.writeMetaEntity(EntityType.STORAGE, payload);
            } catch (StorageDoesNotExistException e) {
                e.printStackTrace();
            }
        }
        JsonObject obj = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\"");
        return obj.toString();
    }
View Full Code Here

    @Path("{schema}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @ResourceFilters(StaashAuditFilter.class)
    public String createTable(@PathParam("schema") String schemaName, String payload) {
      JsonObject msg;
        try {
            if (payload!=null) {
                JsonObject obj;
                obj = new JsonObject(payload).putString("db", schemaName);
                return metasvc.writeMetaEntity(EntityType.TABLE, obj.toString());
            }
            msg = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\"");
        } catch (StorageDoesNotExistException e) {
          msg = new JsonObject("\"message\":\"Storage Does Not Exist\"");
        }
        return msg.toString();
    }
View Full Code Here

    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @ResourceFilters(StaashAuditFilter.class)
    public String createTimeseries(@PathParam("schema") String schemaName, String payload) {

      JsonObject msg;
        try {
            if (payload!=null) {
                JsonObject obj = new JsonObject(payload).putString("db", schemaName);
                return metasvc.writeMetaEntity(EntityType.SERIES, obj.toString());
            }
            msg = new JsonObject("{\"message\":\"payload can not be null must conform to: {name:<name>,cluster:<cluster>}\"");
        } catch (StorageDoesNotExistException e) {
            msg = new JsonObject("\"message\":\"Storage Does Not Exist\"");
        }
        return msg.toString();
    }
View Full Code Here

        if (storage!=null && storage.equals("mysql")) {
            MySqlService.insertRowIntoTable(db, table, query);
        } else {
        session.execute(query);
        }
        JsonObject obj = new JsonObject("{\"status\":\"ok\"}");
        return obj.toString();
    }
View Full Code Here

                        String colName = rsmd.getColumnName(i);
                        columns = columns + colName + ",";
                        String value = rs.getString(i);
                        values = values + value +",";
                    }
                    JsonObject response = new JsonObject();
                    response.putString("columns", columns.substring(0, columns.length()-1));
                    response.putString("values", values.substring(0, values.length()-1));
                    return response.toString();
                }
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
View Full Code Here

    private String convertResultSet(ResultSet rs) {
        // TODO Auto-generated method stub
        String colStr = "";
        String rowStr = "";
        JsonObject response = new JsonObject();
        List<Row> rows = rs.all();
        if (!rows.isEmpty() && rows.size() == 1) {
            rowStr = rows.get(0).toString();
        }
        ColumnDefinitions colDefs = rs.getColumnDefinitions();
        colStr = colDefs.toString();
        response.putString("columns", colStr.substring(8, colStr.length() - 1));
        response.putString("values", rowStr.substring(4, rowStr.length() - 1));
        return response.toString();
    }
View Full Code Here

        Long rowKey = (evTime/periodicity)*periodicity;
        String INSERTSTR = "insert into "+db+"."+table+"(key,column1,value) values('"+rowKey.toString()+"',"+evTime+",'"+
        value+"');";
        Print(INSERTSTR);
        session.execute(INSERTSTR);
        JsonObject obj = new JsonObject("{\"status\":\"ok\"}");
        return obj.toString();
    }
View Full Code Here

TOP

Related Classes of com.netflix.staash.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.