Package com.etsy.pushbot.config

Examples of com.etsy.pushbot.config.Config


      }
      catch(Throwable t) {
        System.err.println(t.getMessage());
        t.printStackTrace();
      }
      return new Config();
  }
View Full Code Here


    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public String get(@PathParam("member") String member) {
        try {
            Config config = ConfigDao.getInstance().getConfigForMember(member);
            return new Response<Config>(config).toString();
        }
        catch(Throwable t) {
            t.printStackTrace();
            return new Response<String>(1, t.getMessage()).toString();
View Full Code Here

    @POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public String set(@PathParam("member") String member, String configJson) {
        Config config = Config.fromString(configJson);

        try {
            ConfigDao.getInstance().setConfigForMember(member, config);
            return new Response<String>(0,"success").toString();
        }
View Full Code Here

        rs.close();
    }
  
    public Config getConfigForMember(String member) throws SQLException {

        Config cachedConfig = this.configCache.get(member);
        if(cachedConfig != null) {
            return cachedConfig;
        }

        PreparedStatement preparedStatement =
            connection.prepareStatement("SELECT config FROM config WHERE member=?;");

        preparedStatement.setString(1, member);

        ResultSet rs = preparedStatement.executeQuery();

        if(!rs.next()) {
            this.configCache.put(member, new Config());
        }
        else {
            this.configCache.put(member,Config.fromString(rs.getString("config")));
        }
        rs.close();
View Full Code Here

TOP

Related Classes of com.etsy.pushbot.config.Config

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.