Esempio n. 1
0
 private List<CommcareApplicationJson> application() throws IOException {
   try (InputStream in =
       getClass().getClassLoader().getResourceAsStream("json/service/appStructure.json")) {
     Type appStructureResponseType = new TypeToken<AppStructureResponseJson>() {}.getType();
     return ((AppStructureResponseJson)
             motechJsonReader.readFromStream(in, appStructureResponseType))
         .getApplications();
   }
 }
Esempio n. 2
0
  /**
   * Loads {@link org.motechproject.security.domain.MotechSecurityConfiguration} from {@link
   * org.motechproject.security.service.MotechProxyManager#DEFAULT_SECURITY_CONFIG_FILE}
   *
   * @return loaded security configuration
   */
  private MotechSecurityConfiguration loadDefaultSecurityConfiguration() {
    try (InputStream in =
        this.getClass().getClassLoader().getResourceAsStream(DEFAULT_SECURITY_CONFIG_FILE)) {
      LOGGER.debug("Load default security rules from: {}", DEFAULT_SECURITY_CONFIG_FILE);
      MotechSecurityConfiguration config =
          (MotechSecurityConfiguration)
              motechJsonReader.readFromStream(in, MotechSecurityConfiguration.class);
      loadedDefaultSecurityConfiguration = true;

      return config;
    } catch (IOException e) {
      throw new MotechException("Error while loading json file", e);
    }
  }