/** * 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); }
/** * 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); }
/** * 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); }
/** * 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 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; }
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)); return cache(connectionName, loadConnectorPropsFromUrl(cliforceConnUrls.getProperty(connectionName)));
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)); return cache(connectionName, loadConnectorPropsFromUrl(cliforceConnUrls.getProperty(connectionName)));