本文整理汇总了Java中com.sforce.ws.ConnectorConfig.setCompression方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectorConfig.setCompression方法的具体用法?Java ConnectorConfig.setCompression怎么用?Java ConnectorConfig.setCompression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sforce.ws.ConnectorConfig
的用法示例。
在下文中一共展示了ConnectorConfig.setCompression方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBulkConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private BulkConnection createBulkConnection(ConnectorConfig partnerConfig)
throws AsyncApiException {
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
String soapEndpoint = partnerConfig.getServiceEndpoint();
String restEndpoint = soapEndpoint.substring(
0, soapEndpoint.indexOf("Soap/")) + "async/" + API_VERSION;
config.setRestEndpoint(restEndpoint);
config.setCompression(isCompression);
config.setTraceMessage(false);
return new BulkConnection(config);
}
示例2: initializeConnectorConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void initializeConnectorConfig(ConnectorConfig connectorConfig) {
if (forceProject == null) {
throw new IllegalArgumentException("Object containing connection details cannot be null");
}
connectorConfig.setCompression(true);
if (Utils.isEmpty(forceProject.getSessionId())) {
connectorConfig.setManualLogin(true);
connectorConfig.setUsername(forceProject.getUserName());
connectorConfig.setPassword(forceProject.getPassword() + forceProject.getToken());
} else {
connectorConfig.setManualLogin(false);
connectorConfig.setSessionId(forceProject.getSessionId());
}
connectorConfig.setReadTimeout(forceProject.getReadTimeoutMillis());
connectorConfig.setConnectionTimeout(forceProject.getReadTimeoutMillis());
if (Utils.isNotEmpty(forceProject.getEndpointServer())) {
final String endpointUrl =
salesforceEndpoints.getFullEndpointUrl(forceProject.getEndpointServer(),
forceProject.isHttpsProtocol());
connectorConfig.setAuthEndpoint(endpointUrl);
connectorConfig.setServiceEndpoint(connectorConfig.getAuthEndpoint());
}
}
示例3: getConnectorConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private static ConnectorConfig getConnectorConfig(String serverUrl, String sessionId)
{
ConnectorConfig config = new ConnectorConfig();
config.setServiceEndpoint(serverUrl);
config.setSessionId(sessionId);
config.setCompression(true);
return config;
}
示例4: createMetadataConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createMetadataConnection()
throws ConnectionException, AsyncApiException
{
Utils.log("SalesforceService::createMetadataConnection() entered");
// check if connection has already been created
if (getMetadataConnection() != null)
{
// connection already created
return;
}
ConnectorConfig config = getConnectorConfig(getServerUrl(), getSessionId());
config.setServiceEndpoint(getMetadataUrl());
// check if tracing is enabled
if (getenv(SALESFORCE_TRACE_METADATA) != null && getenv(SALESFORCE_TRACE_METADATA).equalsIgnoreCase("1"))
{
// set this to true to see HTTP requests and responses on stdout
config.setTraceMessage(true);
config.setPrettyPrintXml(true);
// this should only be false when doing debugging.
config.setCompression(false);
}
setMetadataConnection(new MetadataConnection(config));
// allow partial success
getMetadataConnection().setAllOrNoneHeader(false);
// print the endpoint
Utils.log(
"\n\tSession ID: " + getSessionId() +
"\n\tEndpoint: " + getServerUrl() +
"\n\tConnection Session ID: " + _mConn.getConfig().getSessionId() +
"\n\tAuth Endpoint: " + _mConn.getConfig().getAuthEndpoint());
}
示例5: createPartnerConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createPartnerConnection() throws ConnectionException
{
// check if connection has already been created
if (getPartnerConnection() != null)
{
// connection already created
return;
}
// print the info we will use to build the connection
Utils.log("SalesforceService::createPartnerConnection() entered" + "\n\tSession ID: "
+ getSessionId() + "\n\tPartner Endpoint: " + getServerUrl());
// create partner connector configuration
ConnectorConfig partnerConfig = getConnectorConfig(getServerUrl(), getSessionId());
// check if tracing is enabled
if (getenv(SALESFORCE_TRACE_PARTNER) != null && getenv(SALESFORCE_TRACE_PARTNER).equalsIgnoreCase("1"))
{
// set this to true to see HTTP requests and responses on stdout
partnerConfig.setTraceMessage(true);
partnerConfig.setPrettyPrintXml(true);
// this should only be false when doing debugging.
partnerConfig.setCompression(false);
}
setPartnerConnection(new PartnerConnection(partnerConfig));
// allow partial success
getPartnerConnection().setAllOrNoneHeader(false);
// truncate fields that are too long
getPartnerConnection().setAllowFieldTruncationHeader(true);
}
示例6: createBulkConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
private void createBulkConnection() throws AsyncApiException
{
// check if connection has already been created
if (getBulkConnection() != null)
{
// connection already created
return;
}
// print the info we will use to build the connection
Utils.log("SalesforceService::createBulkConnection() entered" + "\n\tSession ID: " + getSessionId()
+ "\n\tBulk Endpoint: " + getBulkEndpoint());
// create partner connector configuration
ConnectorConfig bulkConfig = getConnectorConfig(getServerUrl(), getSessionId());
bulkConfig.setSessionId(getSessionId());
bulkConfig.setRestEndpoint(getBulkEndpoint());
bulkConfig.setCompression(true);
// check if tracing is enabled
if (getenv(SALESFORCE_TRACE_BULK) != null && getenv(SALESFORCE_TRACE_BULK).equalsIgnoreCase("1"))
{
// set this to true to see HTTP requests and responses on stdout
bulkConfig.setTraceMessage(true);
bulkConfig.setPrettyPrintXml(true);
// this should only be false when doing debugging.
bulkConfig.setCompression(false);
}
setBulkConnection(new BulkConnection(bulkConfig));
}
示例7: getPartnerConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static ConnectorConfig getPartnerConfig(ForceConfigBean conf, SessionRenewer sessionRenewer) throws StageException {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(conf.username.get());
config.setPassword(conf.password.get());
config.setAuthEndpoint("https://"+conf.authEndpoint+"/services/Soap/u/"+conf.apiVersion);
config.setCompression(conf.useCompression);
config.setTraceMessage(conf.showTrace);
config.setSessionRenewer(sessionRenewer);
setProxyConfig(conf, config);
return config;
}
示例8: getBulkConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public static BulkConnection getBulkConnection(
ConnectorConfig partnerConfig,
ForceConfigBean conf
) throws ConnectionException, AsyncApiException, StageException, URISyntaxException {
// When PartnerConnection is instantiated, a login is implicitly
// executed and, if successful,
// a valid session is stored in the ConnectorConfig instance.
// Use this key to initialize a BulkConnection:
ConnectorConfig config = conf.mutualAuth.useMutualAuth
? new MutualAuthConnectorConfig(conf.mutualAuth.getUnderlyingConfig().getSslContext())
: new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
// The endpoint for the Bulk API service is the same as for the normal
// SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
String soapEndpoint = partnerConfig.getServiceEndpoint();
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/"))
+ "async/" + conf.apiVersion;
config.setRestEndpoint(restEndpoint);
config.setCompression(conf.useCompression);
config.setTraceMessage(conf.showTrace);
config.setSessionRenewer(partnerConfig.getSessionRenewer());
setProxyConfig(conf, config);
BulkConnection bulkConnection = new BulkConnection(config);
if (conf.mutualAuth.useMutualAuth) {
setupMutualAuthBulk(config, conf.mutualAuth);
}
return bulkConnection;
}
示例9: createConfig
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public ConnectorConfig createConfig() {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(CommandLineArguments.getUsername());
config.setPassword(CommandLineArguments.getPassword());
config.setCompression(true);
if (CommandLineArguments.getProxyHost() != null && CommandLineArguments.getProxyPort() != null) {
LOG.debug("Setting proxy configuraiton to " + CommandLineArguments.getProxyHost() + " on port "
+ CommandLineArguments.getProxyPort());
config.setProxy(CommandLineArguments.getProxyHost(), CommandLineArguments.getProxyPort());
}
return config;
}
示例10: connectBulk
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
protected BulkConnection connectBulk(ConnectorConfig config) throws ComponentException {
/*
* When PartnerConnection is instantiated, a login is implicitly executed and, if successful, a valid session is
* stored in the ConnectorConfig instance. Use this key to initialize a BulkConnection:
*/
ConnectorConfig bulkConfig = new ConnectorConfig();
bulkConfig.setSessionId(config.getSessionId());
// For session renew
bulkConfig.setSessionRenewer(config.getSessionRenewer());
bulkConfig.setUsername(config.getUsername());
bulkConfig.setPassword(config.getPassword());
/*
* The endpoint for the Bulk API service is the same as for the normal SOAP uri until the /Soap/ part. From here
* it's '/async/versionNumber'
*/
String soapEndpoint = config.getServiceEndpoint();
// set it by a default property file
String api_version = "34.0";
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + api_version;
bulkConfig.setRestEndpoint(restEndpoint);
bulkConfig.setCompression(true);// This should only be false when doing debugging.
bulkConfig.setTraceMessage(false);
bulkConfig.setValidateSchema(false);
try {
return new BulkConnection(bulkConfig);
} catch (AsyncApiException e) {
throw new ComponentException(e);
}
}
示例11: connectBulk
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
protected BulkConnection connectBulk(ConnectorConfig config) throws ComponentException {
final SalesforceConnectionProperties connProps = getConnectionProperties();
/*
* When PartnerConnection is instantiated, a login is implicitly executed and, if successful, a valid session id is
* stored in the ConnectorConfig instance. Use this key to initialize a BulkConnection:
*/
ConnectorConfig bulkConfig = new ConnectorConfig();
setProxy(bulkConfig);
bulkConfig.setSessionId(config.getSessionId());
// For session renew
bulkConfig.setSessionRenewer(config.getSessionRenewer());
bulkConfig.setUsername(config.getUsername());
bulkConfig.setPassword(config.getPassword());
/*
* The endpoint for the Bulk API service is the same as for the normal SOAP uri until the /Soap/ part. From here
* it's '/async/versionNumber'
*/
String soapEndpoint = config.getServiceEndpoint();
// Service endpoint should be like this:
// https://ap1.salesforce.com/services/Soap/u/37.0/00D90000000eSq3
String apiVersion = soapEndpoint.substring(soapEndpoint.lastIndexOf("/services/Soap/u/") + 17);
apiVersion = apiVersion.substring(0, apiVersion.indexOf("/"));
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
bulkConfig.setRestEndpoint(restEndpoint);
// This should only be false when doing debugging.
bulkConfig.setCompression(connProps.needCompression.getValue());
bulkConfig.setTraceMessage(connProps.httpTraceMessage.getValue());
bulkConfig.setValidateSchema(false);
try {
return new BulkConnection(bulkConfig);
} catch (AsyncApiException e) {
throw new ComponentException(e);
}
}
示例12: getBulkConnection
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
* Create the BulkConnection used to call Bulk API operations.
*/
private BulkConnection getBulkConnection(String userName, String password)
throws ConnectionException, AsyncApiException {
ConnectorConfig partnerConfig = new ConnectorConfig();
partnerConfig.setUsername(userName);
partnerConfig.setPassword(password);
partnerConfig.setAuthEndpoint("https://login.salesforce.com/services/Soap/u/34.0");
// Creating the connection automatically handles login and stores
// the session in partnerConfig
partnerConnection = new PartnerConnection(partnerConfig);
// When PartnerConnection is instantiated, a login is implicitly
// executed and, if successful,
// a valid session is stored in the ConnectorConfig instance.
// Use this key to initialize a BulkConnection:
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
// The endpoint for the Bulk API service is the same as for the normal
// SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
String soapEndpoint = partnerConfig.getServiceEndpoint();
String apiVersion = "34.0";
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/"))
+ "async/" + apiVersion;
config.setRestEndpoint(restEndpoint);
// This should only be false when doing debugging.
config.setCompression(true);
// Set this to true to see HTTP requests and responses on stdout
config.setTraceMessage(false);
BulkConnection connection = new BulkConnection(config);
return connection;
}
示例13: bulkApiLogin
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
* Login to salesforce
* @return login status
*/
public boolean bulkApiLogin() throws Exception {
this.log.info("Authenticating salesforce bulk api");
boolean success = false;
String hostName = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME);
String apiVersion = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_VERSION);
if (Strings.isNullOrEmpty(apiVersion)) {
apiVersion = "29.0";
}
String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion;
try {
ConnectorConfig partnerConfig = new ConnectorConfig();
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
partnerConfig.setUsername(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME));
partnerConfig.setPassword(PasswordManager.getInstance(this.workUnit)
.readPassword(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD)));
partnerConfig.setAuthEndpoint(soapAuthEndPoint);
PartnerConnection connection = new PartnerConnection(partnerConfig);
String soapEndpoint = partnerConfig.getServiceEndpoint();
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
config.setRestEndpoint(restEndpoint);
config.setCompression(true);
config.setTraceFile("traceLogs.txt");
config.setTraceMessage(false);
config.setPrettyPrintXml(true);
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
this.bulkConnection = new BulkConnection(config);
success = true;
} catch (Exception e) {
throw new Exception("Failed to connect to salesforce bulk api; error - " + e.getMessage(), e);
}
return success;
}
示例14: connect
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
ConnectionHolder connect(RuntimeContainer container) throws IOException {
SalesforceRuntimeCommon.enableTLSv11AndTLSv12ForJava7();
final ConnectionHolder ch = new ConnectionHolder();
ConnectorConfig config = new ConnectorConfig();
config.setUsername(datastore.userId.getValue());
String password = datastore.password.getValue();
String securityKey = datastore.securityKey.getValue();
if (!StringUtils.isEmpty(securityKey)) {
password = password + securityKey;
}
config.setPassword(password);
// Notes on how to test this
// http://thysmichels.com/2014/02/15/salesforce-wsc-partner-connection-session-renew-when-session-timeout/
config.setSessionRenewer(new SessionRenewer() {
@Override
public SessionRenewalHeader renewSession(ConnectorConfig connectorConfig) throws ConnectionException {
LOG.debug("renewing session...");
SessionRenewalHeader header = new SessionRenewalHeader();
connectorConfig.setSessionId(null);
PartnerConnection connection = doConnection(connectorConfig);
// update the connection session header
ch.connection.setSessionHeader(connection.getSessionHeader().getSessionId());
header.name = new QName("urn:partner.soap.sforce.com", "SessionHeader");
header.headerElement = connection.getSessionHeader();
LOG.debug("session renewed!");
return header;
}
});
config.setConnectionTimeout(timeout);
config.setCompression(true);// This should only be false when doing debugging.
config.setUseChunkedPost(true);
config.setValidateSchema(false);
try {
ch.connection = doConnection(config);
ch.bulkConnection = connectBulk(ch.connection.getConfig());
return ch;
} catch (ConnectionException e) {
throw new IOException(e);
}
}
示例15: bulkApiLogin
import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
* Login to salesforce
* @return login status
*/
public boolean bulkApiLogin() throws Exception {
log.info("Authenticating salesforce bulk api");
boolean success = false;
String hostName = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME);
String apiVersion = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_VERSION);
if (Strings.isNullOrEmpty(apiVersion)) {
apiVersion = "29.0";
}
String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion;
try {
ConnectorConfig partnerConfig = new ConnectorConfig();
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
String securityToken = this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_SECURITY_TOKEN);
String password = PasswordManager.getInstance(this.workUnitState)
.readPassword(this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD));
partnerConfig.setUsername(this.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME));
partnerConfig.setPassword(password + securityToken);
partnerConfig.setAuthEndpoint(soapAuthEndPoint);
new PartnerConnection(partnerConfig);
String soapEndpoint = partnerConfig.getServiceEndpoint();
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
config.setRestEndpoint(restEndpoint);
config.setCompression(true);
config.setTraceFile("traceLogs.txt");
config.setTraceMessage(false);
config.setPrettyPrintXml(true);
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
this.bulkConnection = new BulkConnection(config);
success = true;
} catch (RuntimeException e) {
throw new RuntimeException("Failed to connect to salesforce bulk api; error - " + e, e);
}
return success;
}