Search in sources :

Example 1 with DataEndpointConfigurationException

use of org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException 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);
}
Also used : DataPublisher(org.wso2.carbon.databridge.agent.DataPublisher)

Example 2 with DataEndpointConfigurationException

use of org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException 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;
}
Also used : BConnector(org.ballerinalang.model.values.BConnector) BMap(org.ballerinalang.model.values.BMap) DataEndpointAuthenticationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException) DataEndpointAgentConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException) DataEndpointException(org.wso2.carbon.databridge.agent.exception.DataEndpointException) TransportException(org.wso2.carbon.databridge.commons.exception.TransportException) DataEndpointConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException)

Aggregations

BConnector (org.ballerinalang.model.values.BConnector)1 BMap (org.ballerinalang.model.values.BMap)1 DataPublisher (org.wso2.carbon.databridge.agent.DataPublisher)1 DataEndpointAgentConfigurationException (org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException)1 DataEndpointAuthenticationException (org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException)1 DataEndpointConfigurationException (org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException)1 DataEndpointException (org.wso2.carbon.databridge.agent.exception.DataEndpointException)1 TransportException (org.wso2.carbon.databridge.commons.exception.TransportException)1