Package ch.ralscha.extdirectspring.bean.api

Examples of ch.ralscha.extdirectspring.bean.api.RemotingApi


      String group, boolean debug) {

    String apiNs = requestApiNs != null ? requestApiNs : "Ext.app";
    String remotingApiVar = requestRemotingApiVar != null ? requestRemotingApiVar : "REMOTING_API";

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    if (StringUtils.hasText(apiNs)) {
      remotingApi.setDescriptor(apiNs + "." + remotingApiVar);
    } else {
      remotingApi.setDescriptor(remotingApiVar);
    }

    buildRemotingApi(remotingApi, group);

    return configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
View Full Code Here


  private String buildApiString(String apiNs, String actionNs, String remotingApiVar, String pollingUrlsVar,
      String sseVar, String routerUrl, String basePollUrl, String baseSseUrl, String group, boolean debug,
      boolean doc) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    remotingApi.setTimeout(configurationService.getConfiguration().getTimeout());
    remotingApi.setMaxRetries(configurationService.getConfiguration().getMaxRetries());

    Object enableBuffer = configurationService.getConfiguration().getEnableBuffer();
    if (enableBuffer instanceof String && StringUtils.hasText((String) enableBuffer)) {
      String enableBufferString = (String) enableBuffer;
      if (enableBufferString.equalsIgnoreCase("true")) {
        remotingApi.setEnableBuffer(true);
      } else if (enableBufferString.equalsIgnoreCase("false")) {
        remotingApi.setEnableBuffer(false);
      } else {
        Integer enableBufferMs = NumberUtils.parseNumber(enableBufferString, Integer.class);
        remotingApi.setEnableBuffer(enableBufferMs);
      }
    } else if (enableBuffer instanceof Number || enableBuffer instanceof Boolean) {
      remotingApi.setEnableBuffer(enableBuffer);
    }

    buildRemotingApi(remotingApi, group);

    StringBuilder sb = new StringBuilder();

    if (StringUtils.hasText(apiNs)) {
      sb.append("Ext.ns('");
      sb.append(apiNs);
      sb.append("');");
    }

    if (debug) {
      sb.append("\n\n");
    }

    if (StringUtils.hasText(actionNs)) {
      sb.append("Ext.ns('");
      sb.append(actionNs);
      sb.append("');");

      if (debug) {
        sb.append("\n\n");
      }
    }

    String jsonConfig;
    if (!doc) {
      jsonConfig = configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
    } else {
      ObjectMapper mapper = new ObjectMapper();
      mapper.addMixInAnnotations(RemotingApi.class, RemotingApiMixin.class);
      try {
        jsonConfig = mapper.writer().withDefaultPrettyPrinter().writeValueAsString(remotingApi);
      } catch (JsonProcessingException e) {
        jsonConfig = null;
        LogFactory.getLog(ApiController.class).info("serialize object to json", e);
      }
    }

    if (StringUtils.hasText(apiNs)) {
      sb.append(apiNs).append(".");
    }
    sb.append(remotingApiVar).append(" = ");
    sb.append(jsonConfig);
    sb.append(";");

    List<PollingProvider> pollingProviders = remotingApi.getPollingProviders();
    if (!pollingProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }

      if (StringUtils.hasText(apiNs)) {
        sb.append(apiNs).append(".");
      }
      sb.append(pollingUrlsVar).append(" = {");
      if (debug) {
        sb.append("\n");
      }

      for (int i = 0; i < pollingProviders.size(); i++) {
        if (debug) {
          sb.append("  ");
        }

        sb.append("\"");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        sb.append(" : \"").append(basePollUrl).append("/");
        sb.append(pollingProviders.get(i).getBeanName());
        sb.append("/");
        sb.append(pollingProviders.get(i).getMethod());
        sb.append("/");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        if (i < pollingProviders.size() - 1) {
          sb.append(",");
          if (debug) {
            sb.append("\n");
          }
        }
      }
      if (debug) {
        sb.append("\n");
      }
      sb.append("};");
    }

    Map<String, List<String>> sseProviders = remotingApi.getSseProviders();
    if (!sseProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }
View Full Code Here

      String group, boolean debug) {

    String apiNs = requestApiNs != null ? requestApiNs : "Ext.app";
    String remotingApiVar = requestRemotingApiVar != null ? requestRemotingApiVar : "REMOTING_API";

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    if (StringUtils.hasText(apiNs)) {
      remotingApi.setDescriptor(apiNs + "." + remotingApiVar);
    } else {
      remotingApi.setDescriptor(remotingApiVar);
    }

    buildRemotingApi(remotingApi, group);

    return configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
View Full Code Here

  private String buildApiString(String apiNs, String actionNs, String remotingApiVar, String pollingUrlsVar,
      String sseVar, String routerUrl, String basePollUrl, String baseSseUrl, String group, boolean debug,
      boolean doc) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    remotingApi.setTimeout(configurationService.getConfiguration().getTimeout());
    remotingApi.setMaxRetries(configurationService.getConfiguration().getMaxRetries());

    Object enableBuffer = configurationService.getConfiguration().getEnableBuffer();
    if (enableBuffer instanceof String && StringUtils.hasText((String) enableBuffer)) {
      String enableBufferString = (String) enableBuffer;
      if (enableBufferString.equalsIgnoreCase("true")) {
        remotingApi.setEnableBuffer(true);
      } else if (enableBufferString.equalsIgnoreCase("false")) {
        remotingApi.setEnableBuffer(false);
      } else {
        Integer enableBufferMs = NumberUtils.parseNumber(enableBufferString, Integer.class);
        remotingApi.setEnableBuffer(enableBufferMs);
      }
    } else if (enableBuffer instanceof Number || enableBuffer instanceof Boolean) {
      remotingApi.setEnableBuffer(enableBuffer);
    }

    buildRemotingApi(remotingApi, group);

    StringBuilder sb = new StringBuilder();

    if (StringUtils.hasText(apiNs)) {
      sb.append("Ext.ns('");
      sb.append(apiNs);
      sb.append("');");
    }

    if (debug) {
      sb.append("\n\n");
    }

    if (StringUtils.hasText(actionNs)) {
      sb.append("Ext.ns('");
      sb.append(actionNs);
      sb.append("');");

      if (debug) {
        sb.append("\n\n");
      }
    }

    String jsonConfig;
    if (!doc) {
      jsonConfig = configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
    } else {
      ObjectMapper mapper = new ObjectMapper();
      mapper.addMixInAnnotations(RemotingApi.class, RemotingApiMixin.class);
      try {
        jsonConfig = mapper.writer().withDefaultPrettyPrinter().writeValueAsString(remotingApi);
      } catch (JsonProcessingException e) {
        jsonConfig = null;
        LogFactory.getLog(ApiController.class).info("serialize object to json", e);
      }
    }

    if (StringUtils.hasText(apiNs)) {
      sb.append(apiNs).append(".");
    }
    sb.append(remotingApiVar).append(" = ");
    sb.append(jsonConfig);
    sb.append(";");

    List<PollingProvider> pollingProviders = remotingApi.getPollingProviders();
    if (!pollingProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }

      if (StringUtils.hasText(apiNs)) {
        sb.append(apiNs).append(".");
      }
      sb.append(pollingUrlsVar).append(" = {");
      if (debug) {
        sb.append("\n");
      }

      for (int i = 0; i < pollingProviders.size(); i++) {
        if (debug) {
          sb.append("  ");
        }

        sb.append("\"");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        sb.append(" : \"").append(basePollUrl).append("/");
        sb.append(pollingProviders.get(i).getBeanName());
        sb.append("/");
        sb.append(pollingProviders.get(i).getMethod());
        sb.append("/");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        if (i < pollingProviders.size() - 1) {
          sb.append(",");
          if (debug) {
            sb.append("\n");
          }
        }
      }
      if (debug) {
        sb.append("\n");
      }
      sb.append("};");
    }

    Map<String, List<String>> sseProviders = remotingApi.getSseProviders();
    if (!sseProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }
View Full Code Here

    String remotingApiVar = requestRemotingApiVar != null ? requestRemotingApiVar : configuration
        .getRemotingApiVar();

    String actionNs = requestActionNs != null ? requestActionNs : configuration.getActionNs();

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    if (StringUtils.hasText(apiNs)) {
      remotingApi.setDescriptor(apiNs + "." + remotingApiVar);
    } else {
      remotingApi.setDescriptor(remotingApiVar);
    }

    buildRemotingApi(remotingApi, group);

    return configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
View Full Code Here

  private String buildApiString(String apiNs, String actionNs, String remotingApiVar, String pollingUrlsVar,
      String sseVar, String routerUrl, String basePollUrl, String baseSseUrl, String group, boolean debug,
      boolean doc) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    remotingApi.setTimeout(configurationService.getConfiguration().getTimeout());
    remotingApi.setMaxRetries(configurationService.getConfiguration().getMaxRetries());

    Object enableBuffer = configurationService.getConfiguration().getEnableBuffer();
    if (enableBuffer instanceof String && StringUtils.hasText((String) enableBuffer)) {
      String enableBufferString = (String) enableBuffer;
      if (enableBufferString.equalsIgnoreCase("true")) {
        remotingApi.setEnableBuffer(true);
      } else if (enableBufferString.equalsIgnoreCase("false")) {
        remotingApi.setEnableBuffer(false);
      } else {
        Integer enableBufferMs = NumberUtils.parseNumber(enableBufferString, Integer.class);
        remotingApi.setEnableBuffer(enableBufferMs);
      }
    } else if (enableBuffer instanceof Number || enableBuffer instanceof Boolean) {
      remotingApi.setEnableBuffer(enableBuffer);
    }

    buildRemotingApi(remotingApi, group);

    StringBuilder sb = new StringBuilder();

    if (StringUtils.hasText(apiNs)) {
      sb.append("Ext.ns('");
      sb.append(apiNs);
      sb.append("');");
    }

    if (debug) {
      sb.append("\n\n");
    }

    if (StringUtils.hasText(actionNs)) {
      sb.append("Ext.ns('");
      sb.append(actionNs);
      sb.append("');");

      if (debug) {
        sb.append("\n\n");
      }
    }

    String jsonConfig;
    if (!doc) {
      jsonConfig = configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
    } else {
      ObjectMapper mapper = new ObjectMapper();
      mapper.addMixInAnnotations(RemotingApi.class, RemotingApiMixin.class);
      try {
        jsonConfig = mapper.writer().withDefaultPrettyPrinter().writeValueAsString(remotingApi);
      } catch (JsonProcessingException e) {
        jsonConfig = null;
        LogFactory.getLog(ApiController.class).info("serialize object to json", e);
      }
    }

    if (StringUtils.hasText(apiNs)) {
      sb.append(apiNs).append(".");
    }
    sb.append(remotingApiVar).append(" = ");
    sb.append(jsonConfig);
    sb.append(";");

    List<PollingProvider> pollingProviders = remotingApi.getPollingProviders();
    if (!pollingProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }

      if (StringUtils.hasText(apiNs)) {
        sb.append(apiNs).append(".");
      }
      sb.append(pollingUrlsVar).append(" = {");
      if (debug) {
        sb.append("\n");
      }

      for (int i = 0; i < pollingProviders.size(); i++) {
        if (debug) {
          sb.append("  ");
        }

        sb.append("\"");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        sb.append(" : \"").append(basePollUrl).append("/");
        sb.append(pollingProviders.get(i).getBeanName());
        sb.append("/");
        sb.append(pollingProviders.get(i).getMethod());
        sb.append("/");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        if (i < pollingProviders.size() - 1) {
          sb.append(",");
          if (debug) {
            sb.append("\n");
          }
        }
      }
      if (debug) {
        sb.append("\n");
      }
      sb.append("};");
    }

    Map<String, List<String>> sseProviders = remotingApi.getSseProviders();
    if (!sseProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }
View Full Code Here

  }

  private String buildApiJson(String apiNs, String actionNs, String remotingApiVar, String routerUrl, String group,
      boolean debug) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    if (StringUtils.hasText(apiNs)) {
      remotingApi.setDescriptor(apiNs + "." + remotingApiVar);
    } else {
      remotingApi.setDescriptor(remotingApiVar);
    }

    buildRemotingApi(remotingApi, group);

    return configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
View Full Code Here

  private String buildApiString(String apiNs, String actionNs, String remotingApiVar, String pollingUrlsVar,
      String sseVar, String routerUrl, String basePollUrl, String baseSseUrl, String group, boolean debug,
      boolean doc) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    remotingApi.setTimeout(configurationService.getConfiguration().getTimeout());
    remotingApi.setMaxRetries(configurationService.getConfiguration().getMaxRetries());

    Object enableBuffer = configurationService.getConfiguration().getEnableBuffer();
    if (enableBuffer instanceof String && StringUtils.hasText((String) enableBuffer)) {
      String enableBufferString = (String) enableBuffer;
      if (enableBufferString.equalsIgnoreCase("true")) {
        remotingApi.setEnableBuffer(true);
      } else if (enableBufferString.equalsIgnoreCase("false")) {
        remotingApi.setEnableBuffer(false);
      } else {
        Integer enableBufferMs = NumberUtils.parseNumber(enableBufferString, Integer.class);
        remotingApi.setEnableBuffer(enableBufferMs);
      }
    } else if (enableBuffer instanceof Number || enableBuffer instanceof Boolean) {
      remotingApi.setEnableBuffer(enableBuffer);
    }

    buildRemotingApi(remotingApi, group);

    StringBuilder sb = new StringBuilder();

    if (StringUtils.hasText(apiNs)) {
      sb.append("Ext.ns('");
      sb.append(apiNs);
      sb.append("');");
    }

    if (debug) {
      sb.append("\n\n");
    }

    if (StringUtils.hasText(actionNs)) {
      sb.append("Ext.ns('");
      sb.append(actionNs);
      sb.append("');");

      if (debug) {
        sb.append("\n\n");
      }
    }

    String jsonConfig;
    if (!doc) {
      jsonConfig = configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
    } else {
      ObjectMapper mapper = new ObjectMapper();
      mapper.addMixInAnnotations(RemotingApi.class, RemotingApiMixin.class);
      try {
        jsonConfig = mapper.writer().withDefaultPrettyPrinter().writeValueAsString(remotingApi);
      } catch (JsonProcessingException e) {
        jsonConfig = null;
        LogFactory.getLog(ApiController.class).info("serialize object to json", e);
      }
    }

    if (StringUtils.hasText(apiNs)) {
      sb.append(apiNs).append(".");
    }
    sb.append(remotingApiVar).append(" = ");
    sb.append(jsonConfig);
    sb.append(";");

    List<PollingProvider> pollingProviders = remotingApi.getPollingProviders();
    if (!pollingProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }

      if (StringUtils.hasText(apiNs)) {
        sb.append(apiNs).append(".");
      }
      sb.append(pollingUrlsVar).append(" = {");
      if (debug) {
        sb.append("\n");
      }

      for (int i = 0; i < pollingProviders.size(); i++) {
        if (debug) {
          sb.append("  ");
        }

        sb.append("\"");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        sb.append(" : \"").append(basePollUrl).append("/");
        sb.append(pollingProviders.get(i).getBeanName());
        sb.append("/");
        sb.append(pollingProviders.get(i).getMethod());
        sb.append("/");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        if (i < pollingProviders.size() - 1) {
          sb.append(",");
          if (debug) {
            sb.append("\n");
          }
        }
      }
      if (debug) {
        sb.append("\n");
      }
      sb.append("};");
    }

    Map<String, List<String>> sseProviders = remotingApi.getSseProviders();
    if (!sseProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }
View Full Code Here

      String group, boolean debug) {

    String apiNs = requestApiNs != null ? requestApiNs : "Ext.app";
    String remotingApiVar = requestRemotingApiVar != null ? requestRemotingApiVar : "REMOTING_API";

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration().getProviderType(), routerUrl,
        actionNs);

    if (StringUtils.hasText(apiNs)) {
      remotingApi.setDescriptor(apiNs + "." + remotingApiVar);
    } else {
      remotingApi.setDescriptor(remotingApiVar);
    }

    buildRemotingApi(remotingApi, group);

    return configurationService.getJsonHandler().writeValueAsString(remotingApi, debug);
View Full Code Here

  private String buildApiString(String apiNs, String actionNs, String remotingApiVar,
      String pollingUrlsVar, String sseVar, String routerUrl, String basePollUrl,
      String baseSseUrl, String group, boolean debug, boolean doc) {

    RemotingApi remotingApi = new RemotingApi(configurationService.getConfiguration()
        .getProviderType(), routerUrl, actionNs);

    remotingApi.setTimeout(configurationService.getConfiguration().getTimeout());
    remotingApi
        .setMaxRetries(configurationService.getConfiguration().getMaxRetries());

    Object enableBuffer = configurationService.getConfiguration().getEnableBuffer();
    if (enableBuffer instanceof String && StringUtils.hasText((String) enableBuffer)) {
      String enableBufferString = (String) enableBuffer;
      if (enableBufferString.equalsIgnoreCase("true")) {
        remotingApi.setEnableBuffer(Boolean.TRUE);
      }
      else if (enableBufferString.equalsIgnoreCase("false")) {
        remotingApi.setEnableBuffer(Boolean.FALSE);
      }
      else {
        Integer enableBufferMs = NumberUtils.parseNumber(enableBufferString,
            Integer.class);
        remotingApi.setEnableBuffer(enableBufferMs);
      }
    }
    else if (enableBuffer instanceof Number || enableBuffer instanceof Boolean) {
      remotingApi.setEnableBuffer(enableBuffer);
    }

    buildRemotingApi(remotingApi, group);

    StringBuilder sb = new StringBuilder();

    if (StringUtils.hasText(apiNs)) {
      sb.append("Ext.ns('");
      sb.append(apiNs);
      sb.append("');");
    }

    if (debug) {
      sb.append("\n\n");
    }

    if (StringUtils.hasText(actionNs)) {
      sb.append("Ext.ns('");
      sb.append(actionNs);
      sb.append("');");

      if (debug) {
        sb.append("\n\n");
      }
    }

    String jsonConfig;
    if (!doc) {
      jsonConfig = configurationService.getJsonHandler().writeValueAsString(
          remotingApi, debug);
    }
    else {
      ObjectMapper mapper = new ObjectMapper();
      mapper.addMixInAnnotations(RemotingApi.class, RemotingApiMixin.class);
      try {
        jsonConfig = mapper.writer().withDefaultPrettyPrinter()
            .writeValueAsString(remotingApi);
      }
      catch (JsonProcessingException e) {
        jsonConfig = null;
        LogFactory.getLog(ApiController.class)
            .info("serialize object to json", e);
      }
    }

    if (StringUtils.hasText(apiNs)) {
      sb.append(apiNs).append(".");
    }
    sb.append(remotingApiVar).append(" = ");
    sb.append(jsonConfig);
    sb.append(";");

    List<PollingProvider> pollingProviders = remotingApi.getPollingProviders();
    if (!pollingProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }

      if (StringUtils.hasText(apiNs)) {
        sb.append(apiNs).append(".");
      }
      sb.append(pollingUrlsVar).append(" = {");
      if (debug) {
        sb.append("\n");
      }

      for (int i = 0; i < pollingProviders.size(); i++) {
        if (debug) {
          sb.append("  ");
        }

        sb.append("\"");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        sb.append(" : \"").append(basePollUrl).append("/");
        sb.append(pollingProviders.get(i).getBeanName());
        sb.append("/");
        sb.append(pollingProviders.get(i).getMethod());
        sb.append("/");
        sb.append(pollingProviders.get(i).getEvent());
        sb.append("\"");
        if (i < pollingProviders.size() - 1) {
          sb.append(",");
          if (debug) {
            sb.append("\n");
          }
        }
      }
      if (debug) {
        sb.append("\n");
      }
      sb.append("};");
    }

    Map<String, List<String>> sseProviders = remotingApi.getSseProviders();
    if (!sseProviders.isEmpty()) {

      if (debug) {
        sb.append("\n\n");
      }
View Full Code Here

TOP

Related Classes of ch.ralscha.extdirectspring.bean.api.RemotingApi

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.