use of org.wso2.carbon.databridge.commons.exception.TransportException in project carbon-apimgt by wso2.
the class AbstractEventPublisherAction method initDataPublisher.
public final void initDataPublisher(String type, String receiverURLSet, String authURLSet, String username, String password, String configPath) throws DataEndpointAuthenticationException, DataEndpointAgentConfigurationException, TransportException, DataEndpointException, DataEndpointConfigurationException {
AgentHolder.setConfigPath(configPath);
dataPublisher = new DataPublisher(type, receiverURLSet, authURLSet, username, password);
}
use of org.wso2.carbon.databridge.commons.exception.TransportException in project carbon-apimgt by wso2.
the class Init method execute.
@Override
public BValue execute(Context context) {
BConnector bConnector = (BConnector) getRefArgument(context, 0);
BMap optionMap = (BMap) bConnector.getRefField(0);
BMap sharedMap = (BMap) bConnector.getRefField(1);
System.setProperty("javax.net.ssl.trustStore", System.getProperty("ballerina.home") + File.separator + "bre" + File.separator + "security" + File.separator + "wso2carbon.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
String type = optionMap.get(Constants.TYPE).stringValue();
String receiverURLSet = optionMap.get(Constants.RECEIVER_URL_SET).stringValue();
String authURLSet = optionMap.get(Constants.AUTH_URL_SET).stringValue();
String username = optionMap.get(Constants.USERNAME).stringValue();
String password = optionMap.get(Constants.PASSWORD).stringValue();
String configPath = optionMap.get(Constants.CONFIG_PATH).stringValue();
configPath = System.getProperty("ballerina.home") + File.separator + configPath;
try {
initDataPublisher(type, receiverURLSet, authURLSet, username, password, configPath);
sharedMap.put(Constants.PUBLISHER_INSTANCE, this);
} catch (DataEndpointAuthenticationException e) {
log.error("Error occurred while authenticating.", e);
} catch (DataEndpointAgentConfigurationException e) {
log.error("Error occurred while configuring the publisher.", e);
} catch (TransportException e) {
log.error("Transport level exception occurred.", e);
} catch (DataEndpointException e) {
log.error("Data endpoint exception occurred.", e);
} catch (DataEndpointConfigurationException e) {
log.error("Data endpoint configuration exception occurred.", e);
}
return null;
}
Aggregations