本文整理汇总了Java中com.sforce.ws.ConnectorConfig类的典型用法代码示例。如果您正苦于以下问题:Java ConnectorConfig类的具体用法?Java ConnectorConfig怎么用?Java ConnectorConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectorConfig类属于com.sforce.ws包,在下文中一共展示了ConnectorConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSalesForcePasswordExpired
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
@Test(expected = ConnectionException.class)
public void testSalesForcePasswordExpired() throws ConnectionException {
SalesforceSourceOrSink salesforceSourceOrSink = new SalesforceSourceOrSink();
TSalesforceInputProperties properties = (TSalesforceInputProperties) new TSalesforceInputProperties(null).init();
salesforceSourceOrSink.initialize(null, properties);
ConnectorConfig config = new ConnectorConfig();
config.setUsername(StringUtils.strip(USER_ID_EXPIRED, "\""));
String password = StringUtils.strip(PASSWORD_EXPIRED, "\"");
String securityKey = StringUtils.strip(SECURITY_KEY_EXPIRED, "\"");
if (StringUtils.isNotEmpty(securityKey)) {
password = password + securityKey;
}
config.setPassword(password);
PartnerConnection connection = null;
try {
connection = salesforceSourceOrSink.doConnection(config, true);
} catch (LoginFault ex) {
Assert.fail("Must be an exception related to expired password, not the Login Fault.");
} finally {
if (null != connection) {
connection.logout();
}
}
}
开发者ID:Talend,项目名称:components,代码行数:27,代码来源:SalesforceSourceOrSinkTestIT.java
示例2: createPartnerConnection
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private PartnerConnection createPartnerConnection() throws Exception {
ConnectorConfig config = new ConnectorConfig();
LOG.debug("Connecting SF Partner Connection using " + username);
config.setUsername(username);
config.setPassword(password);
String authEndpoint = getAuthEndpoint(loginURL);
LOG.info("loginURL : " + authEndpoint);
config.setAuthEndpoint(authEndpoint);
config.setServiceEndpoint(authEndpoint);
try {
return Connector.newConnection(config);
} catch (ConnectionException ce) {
LOG.error("Exception while creating connection", ce);
throw new Exception(ce);
}
}
开发者ID:springml,项目名称:salesforce-wave-api,代码行数:18,代码来源:SFConfig.java
示例3: 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);
}
开发者ID:mikoto2000,项目名称:embulk-input-salesforce_bulk,代码行数:17,代码来源:SalesforceBulkWrapper.java
示例4: createConnection
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private PartnerConnection createConnection() {
if (connection == null) {
PartnerConnectionConnectorConfig pcConnectorConfig = new PartnerConnectionConnectorConfig();
ConnectorConfig config = pcConnectorConfig.createConfig();
LOG.debug("creating connection for : " + CommandLineArguments.getUsername() + " "
+ CommandLineArguments.getOrgUrl() + " "
+ config.getUsername() + " " + config.getAuthEndpoint());
try {
connection = Connector.newConnection(config);
setSessionIdFromConnectorConfig(config);
LOG.debug("Partner Connection established with the org!! \n SESSION ID IN createPartnerConn: "
+ sessionIdFromConnectorConfig);
} catch (ConnectionException connEx) {
ApexUnitUtils.shutDownWithDebugLog(connEx, ConnectionHandler
.logConnectionException(connEx, connection));
}
}
return connection;
}
开发者ID:forcedotcom,项目名称:ApexUnit,代码行数:21,代码来源:ConnectionHandler.java
示例5: setProxy
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private synchronized void setProxy(ConnectorConfig config) {
final ProxyPropertiesRuntimeHelper proxyHelper = new ProxyPropertiesRuntimeHelper(
properties.getConnectionProperties().proxy);
resetAuthenticator();
if (proxyHelper.getProxyHost() != null) {
if (proxyHelper.getSocketProxy() != null) {
config.setProxy(proxyHelper.getSocketProxy());
} else {
config.setProxy(proxyHelper.getProxyHost(), Integer.parseInt(proxyHelper.getProxyPort()));
}
if (proxyHelper.getProxyUser() != null && proxyHelper.getProxyUser().length() > 0) {
config.setProxyUsername(proxyHelper.getProxyUser());
if (proxyHelper.getProxyPwd() != null && proxyHelper.getProxyPwd().length() > 0) {
config.setProxyPassword(proxyHelper.getProxyPwd());
setAuthenticator(proxyHelper.getProxyUser(), proxyHelper.getProxyPwd());
}
}
}
}
开发者ID:Talend,项目名称:components,代码行数:25,代码来源:SalesforceSourceOrSink.java
示例6: login
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
public void login(ConnectorConfig connect) {
switch (connection.oauth2FlowType.getValue()) {
case JWT_Flow:
JsonNode accessToken = new SalesforceJwtConnection(connection.oauth2JwtFlow, url).getAccessToken();
connect.setServiceEndpoint(getSOAPEndpoint(accessToken.get(Oauth2JwtClient.KEY_ID).asText(), //
accessToken.get(Oauth2JwtClient.KEY_TOKEN_TYPE).asText(), //
accessToken.get(Oauth2JwtClient.KEY_ACCESS_TOKEN).asText(), //
apiVersion));
connect.setSessionId(accessToken.get(Oauth2JwtClient.KEY_ACCESS_TOKEN).asText());
break;
case Implicit_Flow:
SalesforceOAuthAccessTokenResponse token = new SalesforceImplicitConnection(connection.oauth, url).getToken();
connect.setServiceEndpoint(getSOAPEndpoint(token.getID(), token.getTokenType(), token.getAccessToken(), apiVersion));
connect.setSessionId(token.getAccessToken());
break;
default:
break;
}
}
开发者ID:Talend,项目名称:components,代码行数:22,代码来源:SalesforceOAuthConnection.java
示例7: getConnection
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
/**
* Ges the Connection to SalesForce using the WSC wrapper
*
* @param _session
* @param argStruct
* @return
* @throws cfmRunTimeException
* @throws ConnectionException
*/
protected PartnerConnection getConnection(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException, ConnectionException {
String email = getNamedStringParam(argStruct, "email", null );
if ( email == null )
throwException( _session, "email was not properly defined" );
String passwordtoken = getNamedStringParam(argStruct, "passwordtoken", null );
if ( passwordtoken == null )
throwException( _session, "passwordtoken was not properly defined" );
// Make the connection to SalesForce
ConnectorConfig config = new ConnectorConfig();
config.setUsername(email);
config.setPassword(passwordtoken);
int timeout = getNamedIntParam(argStruct, "timeout", -1 );
if ( timeout > 0 )
config.setReadTimeout(timeout);
return Connector.newConnection(config);
}
开发者ID:OpenBD,项目名称:openbd-core,代码行数:30,代码来源:SalesForceBaseFunction.java
示例8: fetchSFDCinfo
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
/**
* Fetching the Salesforce UserInfo along with session id.
* @return
*/
public static SFDCInfo fetchSFDCinfo() {
App.logInfo("Fetching SalesForce Data");
if(App.sfdcInfo.getSessionId() != null) return App.sfdcInfo;
try {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(App.getUserName());
config.setPassword(App.getUserPassword() + App.getSecurityToken());
config.setAuthEndpoint(App.getPartnerUrl());
partnerConnection = Connector.newConnection(config);
GetUserInfoResult userInfo = partnerConnection.getUserInfo();
App.sfdcInfo.setOrg(userInfo.getOrganizationId());
App.sfdcInfo.setUserId(userInfo.getUserId());
App.sfdcInfo.setSessionId(config.getSessionId());
String sept = config.getServiceEndpoint();
sept = sept.substring(0, sept.indexOf(".com") + 4);
App.sfdcInfo.setEndpoint(sept);
App.logInfo("SDCF Info:\n" + App.sfdcInfo.toString());
return App.sfdcInfo;
} catch (ConnectionException ce) {
ce.printStackTrace();
return null;
}
}
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:30,代码来源:SFDCUtil.java
示例9: errorExecuteAnonymousResult
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private static ExecuteAnonymousResult errorExecuteAnonymousResult(ConnectorConfig apexCfg, Exception exception) {
ExecuteAnonymousResult er = new ExecuteAnonymousResult();
er.setCompiled(true);
er.setSuccess(false);
String msg = ForceExceptionUtils.getConnectionCauseExceptionMessage(apexCfg, exception);
er.setExceptionMessage(msg);
if (Utils.isNotEmpty(exception.getStackTrace())) {
StackTraceElement[] stackTraces = exception.getStackTrace();
StringBuffer trace = new StringBuffer();
for (StackTraceElement element : stackTraces) {
trace.append(element.getClassName()).append(".").append(element.getMethodName()).append(" line ")
.append(element.getLineNumber()).append("\n");
}
er.setExceptionStackTrace(trace.toString());
}
return er;
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:18,代码来源:ApexService.java
示例10: getConnectionCauseExceptionMessage
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
public static String getConnectionCauseExceptionMessage(ConnectorConfig connectorConfig, Throwable th) {
StringBuffer strBuff = null;
if (connectorConfig != null && Utils.isNotEmpty(connectorConfig.getServiceEndpoint())) {
strBuff =
new StringBuffer(Messages.getString("General.ConnectionError.Server.message", new String[] { Utils
.getServerNameFromUrl(connectorConfig.getServiceEndpoint()) }));
} else {
strBuff = new StringBuffer(Messages.getString("General.ConnectionError.message"));
}
strBuff.append(":");
if (th.getCause() instanceof UnknownHostException && connectorConfig != null) {
return getUnknownHostExceptionMessage(strBuff, connectorConfig, th);
}
if(th.getCause() != null) {
strBuff.append("\n\n").append(th.getCause().getClass().getSimpleName()).append(": ").append(
getStrippedRootCauseMessage(th.getCause()));
}
return strBuff.toString();
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:21,代码来源:ForceExceptionUtils.java
示例11: 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());
}
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:27,代码来源:Connection.java
示例12: login
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
public void login(@NotNull InstanceCredentials instanceCredentials, boolean traceMessages) {
clearAllConnections();
ConnectorConfig loginConfig = createConnectorConfig(instanceCredentials, traceMessages);
try {
// Create the Enterprise Connection which will log into Salesforce
enterpriseConnection = Connector.newConnection(loginConfig);
// Setup the Metadata Connection which will use the session Id from the Enterprise Connection
ConnectorConfig metadataConfig = createConnectorConfig(instanceCredentials, traceMessages);
metadataConfig.setSessionId(enterpriseConnection.getConfig().getSessionId());
metadataConfig.setServiceEndpoint(enterpriseConnection.getConfig().getServiceEndpoint().replace("services/Soap/c", "services/Soap/m"));
metadataConnection = com.sforce.soap.metadata.Connector.newConnection(metadataConfig);
// Setup the Apex Connection which will use the session Id from the Enterprise Connection
ConnectorConfig apexConfig = createConnectorConfig(instanceCredentials, traceMessages);
apexConfig.setSessionId(enterpriseConnection.getConfig().getSessionId());
apexConfig.setServiceEndpoint(enterpriseConnection.getConfig().getServiceEndpoint().replace("services/Soap/c", "services/Soap/s"));
apexConnection = com.sforce.soap.apex.Connector.newConnection(apexConfig);
} catch (ConnectionException e) {
logger.error("Unable to login to Salesforce", e);
}
}
开发者ID:polyglot-mark,项目名称:salesforce-plugin,代码行数:23,代码来源:SoapClient.java
示例13: login
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
public boolean login(String username, String password, String endpoint) {
boolean success = false;
String authEndPoint = (endpoint != null) ? endpoint : DEFAULT_ENDPOINT;
try {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthEndpoint(authEndPoint);
config.setTraceMessage(true);
config.setPrettyPrintXml(true);
conn = new PartnerConnection(config);
success = true;
} catch (ConnectionException ce) {
logger.log(Level.SEVERE, null, ce);
}
return success;
}
开发者ID:PDI-DGS-Protolab,项目名称:esper-salesforce,代码行数:25,代码来源:SalesforceClient.java
示例14: testConnect
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private void testConnect( String password ) throws Exception {
LogChannelInterface logInterface = mock( LogChannelInterface.class );
String url = "http://localhost/services/Soap/u/37.0";
String username = "MySampleUsername";
SalesforceConnection connection;
connection = spy( new SalesforceConnection( logInterface, url, username, password ) );
ArgumentCaptor<ConnectorConfig> captorConfig = ArgumentCaptor.forClass( ConnectorConfig.class );
ConnectorConfig mockConfig = mock( ConnectorConfig.class );
doReturn( UUID.randomUUID().toString() ).when( mockConfig ).getUsername();
doReturn( UUID.randomUUID().toString() ).when( mockConfig ).getPassword();
doReturn( mockConfig ).when( bindingStub ).getConfig();
doReturn( mock( LoginResult.class ) ).when( bindingStub ).login( anyString(), anyString() );
try {
connection.connect();
} catch ( KettleException e ) {
// The connection should fail
// We just want to see the generated ConnectorConfig
}
verify( connection ).createBinding( captorConfig.capture() );
assertEquals( username, captorConfig.getValue().getUsername() );
// Password is unchanged (not decrypted) when setting in ConnectorConfig
assertEquals( password, captorConfig.getValue().getPassword() );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:SalesforceConnectionIT.java
示例15: 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;
}
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:9,代码来源:SalesforceService.java
示例16: 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());
}
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:38,代码来源:SalesforceService.java
示例17: 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);
}
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:36,代码来源:SalesforceService.java
示例18: 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));
}
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:33,代码来源:SalesforceService.java
示例19: createMetadataConnection
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private static MetadataConnection createMetadataConnection(
final LoginResult loginResult) throws ConnectionException {
final ConnectorConfig config = new ConnectorConfig();
config.setServiceEndpoint(loginResult.getMetadataServerUrl());
config.setSessionId(loginResult.getSessionId());
return new MetadataConnection(config);
}
开发者ID:shankar-ray,项目名称:mload,代码行数:8,代码来源:PartnerLogin.java
示例20: loginToSalesforce
import com.sforce.ws.ConnectorConfig; //导入依赖的package包/类
private static LoginResult loginToSalesforce(
final String username,
final String password,
final String loginUrl) throws ConnectionException {
final ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint(loginUrl);
config.setServiceEndpoint(loginUrl);
config.setManualLogin(true);
return (new PartnerConnection(config)).login(username, password);
}
开发者ID:shankar-ray,项目名称:mload,代码行数:11,代码来源:PartnerLogin.java
注:本文中的com.sforce.ws.ConnectorConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论