/** * Returns a Force.com API {@code PartnerConnection}. * <p> * This connection type can be use to make SOAP API calls to the Force.com * service. The {@code PartnerConnection} will be lazily constructed and * stored in this {@code ForceServiceConnector}'s state. This state * can be cleared with a call to {@code close} * * @return a Force.com API {@code PartnerConnection} from the {@code ForceConnectorConfig} * state found in this {@code ForceServiceConnector} * @throws ConnectionException if the {@code ForceConnectorConfig} state cannot be found * or otherwise constructed * @throws ConnectionException if this {@code ForceServiceConnector} cannot get a connection * to the Force.com service with its {@code ForceConnectorConfig} state * @see ForceServiceConnector#renewSession(ConnectorConfig) * @see ForceServiceConnector#close */ public PartnerConnection getConnection() throws ConnectionException { if (this.connection == null) { initConnection(); } return this.connection; }
/** * Returns a Force.com API {@code PartnerConnection}. * <p> * This connection type can be use to make SOAP API calls to the Force.com * service. The {@code PartnerConnection} will be lazily constructed and * stored in this {@code ForceServiceConnector}'s state. This state * can be cleared with a call to {@code close} * * @return a Force.com API {@code PartnerConnection} from the {@code ForceConnectorConfig} * state found in this {@code ForceServiceConnector} * @throws ConnectionException if the {@code ForceConnectorConfig} state cannot be found * or otherwise constructed * @throws ConnectionException if this {@code ForceServiceConnector} cannot get a connection * to the Force.com service with its {@code ForceConnectorConfig} state * @see ForceServiceConnector#renewSession(ConnectorConfig) * @see ForceServiceConnector#close */ public PartnerConnection getConnection() throws ConnectionException { if (this.connection == null) { initConnection(); } return this.connection; }
private void initBulkConnection() throws ConnectionException, AsyncApiException { if (this.connection == null) { initConnection(); } ConnectorConfig configNew = new ConnectorConfig(); configNew.setSessionId(config.getSessionId()); configNew.setServiceEndpoint(config.getServiceEndpoint()); configNew.setRestEndpoint(RESTAPI_URI_PATTERN.matcher(config.getServiceEndpoint()).replaceFirst("$1/async/$2/")); this.bulkConnection = new BulkConnection(configNew); }
private void initBulkConnection() throws ConnectionException, AsyncApiException { if (this.connection == null) { initConnection(); } ConnectorConfig configNew = new ConnectorConfig(); configNew.setSessionId(config.getSessionId()); configNew.setServiceEndpoint(config.getServiceEndpoint()); configNew.setRestEndpoint(RESTAPI_URI_PATTERN.matcher(config.getServiceEndpoint()).replaceFirst("$1/async/$2/")); this.bulkConnection = new BulkConnection(configNew); }
private void initMetadataConnection() throws ConnectionException { if (this.connection == null) { initConnection(); } ConnectorConfig configNew = new ConnectorConfig(); configNew.setSessionId(config.getSessionId()); configNew.setServiceEndpoint(METADATA_URI_PATTERN.matcher(config.getServiceEndpoint()).replaceFirst("$1/m/$2")); this.metadataConnection = new MetadataConnection(configNew); // Give the metadata connection a client id if we have one if (this.clientId != null) { this.metadataConnection.setCallOptions(this.clientId); } else if (this.externalClientId != null) { // If we've constructed config from ForceServiceConnectionInfo state // then we've saved any client id for use here (see getConfig) this.metadataConnection.setCallOptions(this.externalClientId); } else { this.metadataConnection.setCallOptions(API_USER_AGENT); //just default to sdk version } this.metadataConnection.getConfig().setRequestHeader("User-Agent", API_USER_AGENT); }
private void initMetadataConnection() throws ConnectionException { if (this.connection == null) { initConnection(); } ConnectorConfig configNew = new ConnectorConfig(); configNew.setSessionId(config.getSessionId()); configNew.setServiceEndpoint(METADATA_URI_PATTERN.matcher(config.getServiceEndpoint()).replaceFirst("$1/m/$2")); this.metadataConnection = new MetadataConnection(configNew); // Give the metadata connection a client id if we have one if (this.clientId != null) { this.metadataConnection.setCallOptions(this.clientId); } else if (this.externalClientId != null) { // If we've constructed config from ForceServiceConnectionInfo state // then we've saved any client id for use here (see getConfig) this.metadataConnection.setCallOptions(this.externalClientId); } else { this.metadataConnection.setCallOptions(API_USER_AGENT); //just default to sdk version } this.metadataConnection.getConfig().setRequestHeader("User-Agent", API_USER_AGENT); }