Package com.trendrr.oss

Examples of com.trendrr.oss.DynMap


   * @return
   */
  public List<DynMap> parse(String java) {
   
   
    DynMap mp = this.parseAnnotation(java);
   
    List<DynMap> docs = this.getStrestDoc(java);
    if (mp.isEmpty() && docs.isEmpty()) {
      return docs;
    }
    if (docs.isEmpty()) {
      docs.add(mp);
    }
    List<DynMap> vals = new ArrayList<DynMap>();
    for(DynMap v : docs) {
     
      DynMap m = new DynMap().extend(mp,v);
      List<String> routes = m.getList(String.class, "route");
      if (routes != null) {
        for(String route : routes) {
          DynMap v1 = new DynMap();
          v1.putAll(m);
          v1.put("route", route);
          v1 = this.cleanUpRoute(v1);
          vals.add(v1);
        }
      }
    }
View Full Code Here


     
      for (String rp : requiredParams) {
        if (pmsMap.containsKey(rp)) {
          pmsMap.get(rp).put("required", true);
        } else {
          DynMap p = new DynMap();
          p.put("param", rp);
          p.put("required", true);
          p.put("description", "");
          params.add(p);
        }
      }
    }
    Collections.sort(params, new Comparator<DynMap>(){
View Full Code Here

    /*
     * This is all ugly as hell, and pretty slow, but it works :)
     */
   
    String ann = Regex.matchFirst(java, "\\@" + this.annotationName + "\\s*\\([^\\)]+\\)", false);
    DynMap mp = new DynMap();
    if (ann == null) {
      return mp;
    }
    ann = ann.replaceFirst("\\@" + this.annotationName + "\\s*\\(", "");
    ann = ann.replaceAll("\\)$", "");
   
   
    String[] tokens = ann.split("\\s*\\=\\s*");
    String key = null;
    String value = null;
    for (String t : tokens) {
      if (key == null) {
        key = t;
        continue;
      }
      //else parse the value.
      String nextKey = Regex.matchFirst(t, "[\\n\\r]+\\s*[^\\s]+\\s*$", false);
      value = t.replaceFirst("[\\n\\r]+\\s*[^\\s]+\\s*$", "").trim();
      boolean isList = value.startsWith("{");
     
     
      value = StringHelper.trim(value, ",");
      value = StringHelper.trim(value, "{");
      value = StringHelper.trim(value, "}");
      value = StringHelper.trim(value.trim(), "\"");
      if (isList) {
        List<String> values = new ArrayList<String>();
        for (String v : value.split(",")) {
          values.add(StringHelper.trim(v.trim(), "\""));
        }
        mp.put(key.trim(), values);
      } else {
        mp.put(key.trim(), value);
      }
     
      if (nextKey != null) {
        key = nextKey;
      }
    }
   
   
   
    System.out.println(mp.toJSONString());
   
    return mp;
  }
View Full Code Here

      //now clean it up.
      doc = doc.replaceFirst("^\\/\\*\\/\\/", "");
      doc = doc.replaceAll("(?m)^\\s*\\*", "");
      doc = doc.replaceAll("\\/$", "");
      doc = doc.trim();
      DynMap mp = new DynMap();
      //now split into key values
      for (String tmp : doc.split("[\\r\\n]\\s*\\@")) {
       
        tmp = StringHelper.trim(tmp, "@");
        int ind = tmp.indexOf(' ');
        if (ind < 0)
          continue;
        String key = tmp.substring(0, ind).trim();
        String value = tmp.substring(ind).trim();
        if (value.isEmpty()) {
          log.warn("TAG: " + key + " IS EMPTY!");
          continue;
        }
       
        Object v = this.processTag(key, value);
        if (v == null) {
          log.warn("TAG: " + key + " IS EMPTY!");
          continue;
        }
       
        if (mp.containsKey(key)) {
          List values = mp.get(List.class, key);
          values.add(v);
          mp.put(key, values);
        } else {
          mp.put(key, v);
        }
      }
      if (mp.get("method") == null) {
        mp.put("method", this.parseMethod(java));
      } else {
        mp.put("method", mp.getList(String.class, "method", ","));
      }
      results.add(mp);
    }
   
    return results;
View Full Code Here

    List<String> filters = config.getList(String.class, "filters");
    if (filters != null) {
      server.getRouter().setDefaultFilters(filters);
    }
   
    DynMap ssl = config.get(DynMap.class, "ssl");
   
    if (ssl != null) {
      SSLContextBuilder builder = new SSLContextBuilder(false);
      builder.keystoreFilename(ssl.get(String.class, "keystore"));
      builder.keystorePassword(ssl.get(String.class, "keystore_password"));
      builder.certificatePassword(ssl.get(String.class, "certificate_password"));
      server.setSSLContext(builder.toSSLContext());
      server.setSslPort(ssl.get(Integer.class, "port", server.getSslPort()));
    }
    server.config = config;
    server.getRouter().setServer(server);
  }
View Full Code Here

  public void send(String to, String from, String message) throws StrestException {
    StrestConnectionTxn con = this.notifyMessage.get(to);
    if (con == null) {
      throw new StrestHttpException(501, "Unknown user");
    }
    DynMap mp = new DynMap();
    mp.put("to", to);
    mp.put("from", from);
    mp.put("message", message);
    con.sendMessage(new ResponseBuilder().txnStatusContinue().contentJSON(mp));
  }
View Full Code Here

TOP

Related Classes of com.trendrr.oss.DynMap

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.