/** * @param value String * @return String */ public static String scanVars(String value, boolean isModuleConfig, Map paramTable) { if (value.indexOf(TokenResolverImpl.SYS_PROP_TOKEN) != -1) { value = SparrowUtil.replaceTokens( value, TokenResolverImpl.SYS_PROP_TOKEN, TokenResolverImpl.SYS_PROP_TOKEN, SYS_PROP); } if (value.indexOf(ModuleConfigImpl.TOKEN_IDENTIFIER) != -1) { value = (isModuleConfig) ? SparrowUtil.replaceTokens(value, paramTable) : SparrowUtil.replaceTokens( value, Constants.TOKEN_START, Constants.TOKEN_END, ModuleConfigImpl.MODULE_PROP); } if (value.indexOf("{ENC}") == 0) { String[] discover = urts(value.substring(5)); try { value = cryptoUtil.fff(value.substring(5), discover[1], discover[0]); } catch (Exception ex) { throw new InitializationException(ex); } } // if (value.indexOf(Constants.VARIABLE_IDENTIFIER) != -1) { // SparrowUtil.replaceTokens(value, this); // } return value; }
/** @param config SparrowResourceConfig */ public EJBResourceInitializer(SparrowResourceConfig config) { SparrowUtil.validateParam( new String[] {ConfigKeyConstants.PARAM_LOOKUP}, "EJBResourceInitializer", config.getInitParameter()); this.config = config; }
/** * @param token String * @return String */ public String getTokenValue(String token) { if (propKey != null && token.indexOf(PROP_KEY_RPLC_TOKEN) != -1) { token = SparrowUtil.replace(token, PROP_KEY_RPLC_TOKEN, propKey); } String val = System.getProperty(token); if (val == null && userProperties != null) { val = userProperties.getProperty(token); } return val; }
/** @param p */ private Properties loadProperties() { InputStream is = null; Properties p = new Properties(); try { String[] propFiles = System.getProperty(APP_PROPERTIES).split("[,]"); for (int i = 0; i < propFiles.length; i++) { is = SparrowUtil.getFileAsStream(propFiles[i]); p.load(is); } } catch (Exception ex) { ex.printStackTrace(); p = null; } finally { if (is != null) { try { is.close(); } catch (IOException ex1) { ex1.printStackTrace(); } } } return p; }