コード例 #1
0
  private void readConfigurations() {
    ConfigurationManager manager = ConfigurationManager.getInstance();
    Configuration gtasConfig = manager.getConfig(IGtasConfig.CONFIG_NAME);

    sm.setAttribute(IAttributeKeys.ENTERPRISE_ID, gtasConfig.getString(IGtasConfig.ENTERPRISE_ID));

    sm.setAttribute(IAttributeKeys.APPLICATION, gtasConfig.getString(IGtasConfig.APPLICATION_NAME));
    // sm.setAttribute(IAttributeKeys.APPLICATION, "gridtalk");
  }
コード例 #2
0
  public static String getTempFolderPath() {
    try {
      ConfigurationManager configManager = ConfigurationManager.getInstance();
      Configuration config = configManager.getConfig(ITempDirConfig.TEMP_DIR_CONFIG);

      java.io.File file = new java.io.File(config.getString(ITempDirConfig.TEMP_DIR));
      if (!file.exists()) {
        file.mkdir();
      }
      return file.getCanonicalPath();
    } catch (Exception ex) {
      return null;
    }
  }
コード例 #3
0
  /**
   * Returns the path after removing the domain from the front.
   *
   * @param fullPath The full path with the domain
   * @return The path without the domain
   * @author Daniel D'Cotta
   */
  public String getPathWithoutDomain(String fullPath) throws FileAccessException {
    if (fullPath == null) throw new FileAccessException("fullpath is null");

    String domainPath = null;
    if (_isLocal) {
      try {
        domainPath = _rootFile.getCanonicalPath();
      } catch (IOException ex) {
        throw new FileAccessException("could not get local root path", ex);
      }
    } else {
      Configuration config =
          ConfigurationManager.getInstance().getConfig(IFrameworkConfig.FRAMEWORK_WEBDAV_CONFIG);

      //     ConfigManager configManager = ConfigManager.getInstance("file" +
      //                                                              File.separatorChar +
      //                                                              "webdav.properties");

      HttpURL httpURL = new HttpURL(config.getString(IFrameworkConfig.WEBDAV_SERVER + _domain));

      //      HttpURL httpURL = new HttpURL(configManager.get("webdav.server." + _domain));
      domainPath = httpURL.getPath();
    }

    if (fullPath.startsWith(domainPath)) {
      String path = fullPath.substring(domainPath.length());

      // Remove leading file seperator
      while (path.charAt(0) == '/' || path.charAt(0) == '\\') path = path.substring(1);

      return path;
    } else {
      throw new FileAccessException("fullPath does not start with domainPath");
    }
  }
コード例 #4
0
 private void loadConfig() {
   try {
     Configuration dbConfig =
         ConfigurationManager.getInstance().getConfig(IFrameworkConfig.FRAMEWORK_DATABASE_CONFIG);
     _useEntityBean = dbConfig.getBoolean(IFrameworkConfig.CMP_ON, true);
   } catch (Exception ex) {
     Log.error(
         ILogErrorCodes.CONFIGURATION_LOAD,
         Log.DB,
         "[MetaInfoFactory.loadConfig] Unable to load config. Setting cmp.on to true. Unexpected error: "
             + ex.getMessage(),
         ex);
   }
 }
コード例 #5
0
  private static Hashtable<String, String> getJmsSetupPropsKey(String configName)
      throws ApplicationException {
    Configuration config = ConfigurationManager.getInstance().getConfig(configName);
    Properties prop = config.getProperties();
    Log.debug(Log.FRAMEWORK, "getJmsSetupPropsKey: " + prop);

    if (prop != null && prop.size() == 0) {
      throw new ApplicationException(
          "No properties file can be found given configName: " + configName);
    }

    Hashtable<String, String> configProps = new Hashtable<String, String>();
    Enumeration keys = prop.propertyNames();
    while (keys.hasMoreElements()) {
      String key = (String) keys.nextElement();
      configProps.put(key, (String) prop.get(key));
    }

    return configProps;
  }
コード例 #6
0
  static {
    Configuration config = ConfigurationManager.getInstance().getConfig(FRAMEWORK_JMS_CONFIG);

    _retryCount = config.getInt(JMS_NUM_RETRY, 10);
    _sleepFor =
        config.getLong(JMS_RETRY_INTERVAL) == 0L ? 10000 : config.getLong(JMS_RETRY_INTERVAL);
    _isSendViaDefMode = config.getBoolean(JMS_DEF_SEND, true);

    Log.log(
        Log.FRAMEWORK,
        " Retrieve jms props from "
            + FRAMEWORK_JMS_CONFIG
            + " --> JMS Sending mode: "
            + (_isSendViaDefMode ? "Default" : "With Retry")
            + "Retry Count: "
            + _retryCount
            + " retry interval: "
            + _sleepFor
            + " ms");
  }