/** * Looks into system variable and environment variables if url is in ${...} format. * @return Connection URL */ @Override public String getConnectionURL() { String connectionUrl = super.getConnectionURL(); if (ForceConnectorUtils.isInjectable(connectionUrl)) { connectionUrl = ForceConnectorUtils.extractValue(connectionUrl); if (connectionUrl == null || connectionUrl.equals("")) { throw new IllegalArgumentException("Unable to load ForceConnectorConfig from environment or system property " + super.getConnectionURL()); } } return connectionUrl; }
if ((connectionUrl = System.getenv(envVarName)) != null) { LOGGER.info("Connection : Creating " + connectionName + " from environment variable: " + envVarName); return cache(connectionName, loadConnectorPropsFromUrl(connectionUrl)); if ((connectionUrl = System.getProperty(sysPropName)) != null) { LOGGER.info("Connection : Creating " + connectionName + " from Java system property: " + sysPropName); return cache(connectionName, loadConnectorPropsFromUrl(connectionUrl)); if ((propsFileUrl = ForceConnectorUtils.class.getResource("/" + connectionName + ".properties")) != null) { LOGGER.info("Connection : Creating " + connectionName + " from classpath properties file: " + propsFileUrl); return cache(connectionName, loadConnectorPropsFromFile(propsFileUrl)); return cache(connectionName, loadConnectorPropsFromUrl(cliforceConnUrls.getProperty(connectionName)));
/** * Parses the connection url and sets the values pulled from it. * * @param connectionUrl String */ public void setConnectionUrl(String connectionUrl) { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromUrl(connectionUrl); if (propMap == null || propMap.size() < MIN_CONN_URL_PROPS) { throw new IllegalArgumentException("The connection url (" + connectionUrl + ") must contain at least three parts. " + "It should be in the form " + "force://<endPoint>?oauth_key=<oauthKey>&oauth_secret=<oauthSecret>"); } setPropsFromMap(propMap, connectionUrl); }
static ForceOAuthConnectionInfo loadFromName(String connectionName) throws IOException { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromName(connectionName); if (propMap == null) return null; ForceOAuthConnectionInfo connInfo = new ForceOAuthConnectionInfo(); connInfo.setPropsFromMap(propMap, connectionName); return connInfo; }
/** * Sets the Force.com authentication endpoint. * <p> * The authEndpoint parameter may be a fully qualified, * versioned Force.com API endpoint. If it is not, this * {@code ForceConnectorConfig} will attempt to build * a qualified Force.com API endpoint and bind the version * to the API version used in the Force.com SDK. * <p> * * @param authEndpoint representation of a Force.com authentication endpoint * (This endpoint may be a fully qualified Force.com API * endpoint, but need not be) * */ @Override public void setAuthEndpoint(String authEndpoint) { // We allow non-fully qualified API endpoints. In that // case, we should automatically bind to the API version // found in the API dependencies super.setAuthEndpoint(ForceConnectorUtils.buildForceApiEndpoint(authEndpoint)); initCacheId(); }
/** * Parses the connection url and sets the values pulled from it. * * @param connectionUrl String */ public void setConnectionUrl(String connectionUrl) { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromUrl(connectionUrl); if (propMap == null || propMap.size() < MIN_CONN_URL_PROPS) { throw new IllegalArgumentException("The connection url (" + connectionUrl + ") must contain at least three parts. " + "It should be in the form " + "force://<endPoint>?oauth_key=<oauthKey>&oauth_secret=<oauthSecret>"); } setPropsFromMap(propMap, connectionUrl); }
static ForceConnectorConfig loadFromName(String connectionName) throws IOException { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromName(connectionName); if (propMap == null) return null; ForceConnectorConfig config = new ForceConnectorConfig(); config.setPropsFromMap(propMap, connectionName); return config; }
/** * Sets the Force.com authentication endpoint. * <p> * The authEndpoint parameter may be a fully qualified, * versioned Force.com API endpoint. If it is not, this * {@code ForceConnectorConfig} will attempt to build * a qualified Force.com API endpoint and bind the version * to the API version used in the Force.com SDK. * <p> * * @param authEndpoint representation of a Force.com authentication endpoint * (This endpoint may be a fully qualified Force.com API * endpoint, but need not be) * */ @Override public void setAuthEndpoint(String authEndpoint) { // We allow non-fully qualified API endpoints. In that // case, we should automatically bind to the API version // found in the API dependencies super.setAuthEndpoint(ForceConnectorUtils.buildForceApiEndpoint(authEndpoint)); initCacheId(); }
/** * Looks into system variable and environment variables if url is in ${...} format. * @return Connection URL */ @Override public String getConnectionURL() { String connectionUrl = super.getConnectionURL(); if (ForceConnectorUtils.isInjectable(connectionUrl)) { connectionUrl = ForceConnectorUtils.extractValue(connectionUrl); if (connectionUrl == null || connectionUrl.equals("")) { throw new IllegalArgumentException("Unable to load ForceConnectorConfig from environment or system property " + super.getConnectionURL()); } } return connectionUrl; }
if ((connectionUrl = System.getenv(envVarName)) != null) { LOGGER.info("Connection : Creating " + connectionName + " from environment variable: " + envVarName); return cache(connectionName, loadConnectorPropsFromUrl(connectionUrl)); if ((connectionUrl = System.getProperty(sysPropName)) != null) { LOGGER.info("Connection : Creating " + connectionName + " from Java system property: " + sysPropName); return cache(connectionName, loadConnectorPropsFromUrl(connectionUrl)); if ((propsFileUrl = ForceConnectorUtils.class.getResource("/" + connectionName + ".properties")) != null) { LOGGER.info("Connection : Creating " + connectionName + " from classpath properties file: " + propsFileUrl); return cache(connectionName, loadConnectorPropsFromFile(propsFileUrl)); return cache(connectionName, loadConnectorPropsFromUrl(cliforceConnUrls.getProperty(connectionName)));
/** * Parses a Force.com connection URL and sets the connection * properties found within. * * @param connectionUrl A Force.com connection URL * @throws IllegalArgumentException if the Force.com connection URL does not * contain a parseable endpoint, username, and password * @throws IllegalArgumentException if any of the connection property values are not valid * @see ForceConnectionProperty */ public void setConnectionUrl(String connectionUrl) { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromUrl(connectionUrl); if (propMap == null || propMap.size() < MIN_CONN_URL_PROPS) { throw new IllegalArgumentException("The connection url (" + connectionUrl + ") must contain at least three parts. " + "It should be in the form force://<endPoint>?user=<user>&password=<password>"); } setPropsFromMap(propMap, connectionUrl); }
static ForceOAuthConnectionInfo loadFromName(String connectionName) throws IOException { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromName(connectionName); if (propMap == null) return null; ForceOAuthConnectionInfo connInfo = new ForceOAuthConnectionInfo(); connInfo.setPropsFromMap(propMap, connectionName); return connInfo; }
session, ForceConnectorUtils.buildForceApiEndpoint(instanceUrl), refresh);
if (ForceConnectorUtils.isInjectable(connectionUrl)) { connectionUrl = ForceConnectorUtils.extractValue(connectionUrl); if (connectionUrl == null || connectionUrl.equals("")) { throw new IllegalArgumentException("Unable to load ForceConnectorConfig from environment or system property " if(config.getInitParameter("secure-key-config-var") != null) { LOGGER.info("Setting encryption key based on config var: " + config.getInitParameter("secure-key-config-var")); String key = ForceConnectorUtils.extractValue(config.getInitParameter("secure-key-config-var")); cookieStore.setKey(key); } else {
/** * Parses a Force.com connection URL and sets the connection * properties found within. * * @param connectionUrl A Force.com connection URL * @throws IllegalArgumentException if the Force.com connection URL does not * contain a parseable endpoint, username, and password * @throws IllegalArgumentException if any of the connection property values are not valid * @see ForceConnectionProperty */ public void setConnectionUrl(String connectionUrl) { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromUrl(connectionUrl); if (propMap == null || propMap.size() < MIN_CONN_URL_PROPS) { throw new IllegalArgumentException("The connection url (" + connectionUrl + ") must contain at least three parts. " + "It should be in the form force://<endPoint>?user=<user>&password=<password>"); } setPropsFromMap(propMap, connectionUrl); }
static ForceConnectorConfig loadFromName(String connectionName) throws IOException { Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromName(connectionName); if (propMap == null) return null; ForceConnectorConfig config = new ForceConnectorConfig(); config.setPropsFromMap(propMap, connectionName); return config; }
session, ForceConnectorUtils.buildForceApiEndpoint(instanceUrl), refresh);
if (ForceConnectorUtils.isInjectable(connectionUrl)) { connectionUrl = ForceConnectorUtils.extractValue(connectionUrl); if (connectionUrl == null || connectionUrl.equals("")) { throw new IllegalArgumentException("Unable to load ForceConnectorConfig from environment or system property " if(config.getInitParameter("secure-key-config-var") != null) { LOGGER.info("Setting encryption key based on config var: " + config.getInitParameter("secure-key-config-var")); String key = ForceConnectorUtils.extractValue(config.getInitParameter("secure-key-config-var")); cookieStore.setKey(key); } else {
static Map<ForceConnectionProperty, String> loadConnectorPropsFromFile(URL fileUrl) throws IOException { if (fileUrl == null) throw new IllegalArgumentException("Connector property file cannot be null."); Properties connectorProps = new Properties(); InputStream is = null; try { is = fileUrl.openStream(); connectorProps.load(is); } finally { if (is != null) is.close(); } if (connectorProps.containsKey("url")) { return loadConnectorPropsFromUrl(connectorProps.getProperty("url")); } Map<ForceConnectionProperty, String> connectorPropMap = new HashMap<ForceConnectionProperty, String>(connectorProps.size()); for (String propName : connectorProps.stringPropertyNames()) { ForceConnectionProperty connProp = ForceConnectionProperty.fromPropertyName(propName); if (connProp != null) { connectorPropMap.put(connProp, connectorProps.getProperty(propName)); } } return connectorPropMap; }
static Map<ForceConnectionProperty, String> loadConnectorPropsFromFile(URL fileUrl) throws IOException { if (fileUrl == null) throw new IllegalArgumentException("Connector property file cannot be null."); Properties connectorProps = new Properties(); InputStream is = null; try { is = fileUrl.openStream(); connectorProps.load(is); } finally { if (is != null) is.close(); } if (connectorProps.containsKey("url")) { return loadConnectorPropsFromUrl(connectorProps.getProperty("url")); } Map<ForceConnectionProperty, String> connectorPropMap = new HashMap<ForceConnectionProperty, String>(connectorProps.size()); for (String propName : connectorProps.stringPropertyNames()) { ForceConnectionProperty connProp = ForceConnectionProperty.fromPropertyName(propName); if (connProp != null) { connectorPropMap.put(connProp, connectorProps.getProperty(propName)); } } return connectorPropMap; }