本文整理汇总了Java中org.mule.api.ConnectionException类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionException类的具体用法?Java ConnectionException怎么用?Java ConnectionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionException类属于org.mule.api包,在下文中一共展示了ConnectionException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: connectToApi
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Opens the API connection and validates the service, else throws
* a {@link ConnectionException} for Mulesoft.
*
* @throws ConnectionException
*/
protected synchronized void connectToApi() throws ConnectionException {
Service service;
// Connect to the Anaplan API.
try {
service = apiConn.openConnection();
} catch (AnaplanConnectionException e) {
throw new org.mule.api.ConnectionException(
ConnectionExceptionCode.INCORRECT_CREDENTIALS, null,
e.getMessage(), e);
}
if (service == null) {
throw new org.mule.api.ConnectionException(
ConnectionExceptionCode.UNKNOWN, null, "No service "
+ "object acquired after opening connStrategy to Anaplan "
+ "API!", null);
} else {
logger.info("Successfully connected to Anaplan API!");
}
}
开发者ID:anaplaninc,项目名称:anaplan-mulesoft,代码行数:27,代码来源:BaseConnectionStrategy.java
示例2: login
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Logs in into the NEst service and captures session information
*
* @throws ConnectionException if the credentials are incorrect
* @throws IOException if the response date cannot be parsed
*/
@Start
public void login() throws ConnectionException, IOException
{
httpClient.addFilter(new LoggingFilter());
MultivaluedMap<String, String> map = new MultivaluedMapImpl();
map.putSingle("username", getUsername());
map.putSingle("password", getPassword());
WebResource webResource = httpClient.resource("https://home.nest.com/user/login");
ClientResponse response = webResource.type("application/x-www-form-urlencoded")
.post(ClientResponse.class, map);
if (response.getStatus()> 399)
{
throw new ConnectionException(ConnectionExceptionCode.INCORRECT_CREDENTIALS, "unauthorized user", response.toString());
}
String res = response.getEntity(String.class);
System.out.println("Login: " + res);
login = mapper.readValue(res, Login.class);
baseUri = login.getUrls().getTransportUrl();
getMetaData();
}
开发者ID:mulesoft-labs,项目名称:nest-connector,代码行数:32,代码来源:NestConnector.java
示例3: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Connect
*
* @param username A username
* @param password A password
* @throws ConnectionException
*/
@Connect
public void connect(@ConnectionKey String username, @Password String password)
throws ConnectionException {
/*
* CODE FOR ESTABLISHING A CONNECTION GOES HERE
*/
}
开发者ID:berndruecker,项目名称:mule-camunda-24,代码行数:15,代码来源:camundaConnector.java
示例4: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Establishes the database connection using the given bucket name and password.
*
* @param bucketName The bucket name in the cluster you wish to use.
* @param password The password for the bucket. Default is empty.
* @throws ConnectionException
*/
@Connect
public void connect(@ConnectionKey String bucketName, String password) throws ConnectionException {
this.BucketName = bucketName;
List<URI> uris = new LinkedList<URI>();
uris.add(URI.create(this.Uri));
try {
client = new CouchbaseClient(uris, bucketName, password);
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:ryan1234,项目名称:mule-couchbase,代码行数:21,代码来源:CouchbaseConnector.java
示例5: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Connect to the DynamoDB service
*
* @param accessKey
* the access key provided to you through your Amazon AWS account
* @param secretKey
* the secret key provided to you through your Amazon AWS account
*/
@Connect
// TODO: try this => @Default (value = Query.MILES) @Optional String unit
public void connect(@ConnectionKey String accessKey, String secretKey) throws ConnectionException {
if (StringUtils.isNotEmpty(accessKey) && StringUtils.isNotEmpty(secretKey)) {
createDynamoDBClient(accessKey, secretKey);
} else {
createDynamoDBClient();
}
Region regionEnum = Region.getRegion(getRegionAsEnum());
getDynamoDBClient().setRegion(regionEnum);
}
开发者ID:sporcina,项目名称:dynamodb-connector,代码行数:22,代码来源:DynamoDBConnector.java
示例6: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
@Connect
public void connect(@ConnectionKey String username, @Password String password)
throws ConnectionException
{
this.client = DrupalClientFactory.getClient(endpoint, new CookieAuthenticationStrategy(
username, password, endpoint + "/user"));
}
开发者ID:ryandcarter,项目名称:drupal8-connector,代码行数:8,代码来源:Drupal8Connector.java
示例7: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Connect to KissMetrics.
*
* @param apiKey The API Key from your KissMetrics settings screen.
* @throws ConnectionException
*/
@Connect
@TestConnectivity(active=false)
public void connect(@ConnectionKey String apiKey)
throws ConnectionException {
this.apiKey = apiKey;
final ClientConfig clientConfig = new ClientConfig();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JacksonJsonProvider jsonProvider = new JacksonJsonProvider(mapper);
clientConfig.register(JacksonJsonProvider.class);
this.client = ClientBuilder.newClient(clientConfig);
}
开发者ID:mulesoft,项目名称:kissmetrics-connector,代码行数:21,代码来源:KissMetricsConnector.java
示例8: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Connect to Nuxeo Server via Automation java client
*
* @param username Nuxeo user name
* @param password Nuxeo password
* @throws ConnectionException
*/
@Connect
public void connect(@ConnectionKey
String username, @Password
String password) throws ConnectionException {
AutomationClient client = new HttpAutomationClient(getServerUrl());
session = client.getSession(username, password);
session.setDefaultSchemas(defaultSchemas);
docService = session.getAdapter(DocumentService.class);
logger.info("Connect Nuxeo Connector");
}
开发者ID:tiry,项目名称:nuxeo-mule-connector,代码行数:19,代码来源:NuxeoConnector.java
示例9: connect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Connect
*
* @throws ConnectionException
*/
@Start
public void connect() throws ConnectionException
{
String res = httpClient.resource(getBaseUri()).get(String.class);
if (res.contains("error"))
{
throw new ConnectionException(ConnectionExceptionCode.INCORRECT_CREDENTIALS, "unauthorized user", res);
}
}
开发者ID:mulesoft-labs,项目名称:hue-connector,代码行数:15,代码来源:HueConnector.java
示例10: disconnect
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Disconnect
*
* @throws ConnectionException
*/
@Disconnect
public void disconnect() throws ConnectionException
{
}
开发者ID:ryandcarter,项目名称:drupal8-connector,代码行数:11,代码来源:Drupal8Connector.java
示例11: createDynamoDBClient
import org.mule.api.ConnectionException; //导入依赖的package包/类
/**
* Creates a DynamoDB client using the security values passed in
*
* @param accessKey
* the access key provided to you through your Amazon AWS account
* @param secretKey
* the secret key provided to you through your Amazon AWS account
*
* @throws ConnectionException
*/
private void createDynamoDBClient(String accessKey, String secretKey) throws ConnectionException {
try {
AWSCredentials credentialsProvider = new BasicAWSCredentials(accessKey, secretKey);
setDynamoDBClient(new AmazonDynamoDBClient(credentialsProvider));
} catch (Exception e) {
throw new ConnectionException(ConnectionExceptionCode.UNKNOWN, null, e.getMessage(), e);
}
}
开发者ID:sporcina,项目名称:dynamodb-connector,代码行数:19,代码来源:DynamoDBConnector.java
注:本文中的org.mule.api.ConnectionException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论