Search in sources :

Example 6 with AnalyticsServerProfile

use of org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile in project carbon-business-process by wso2.

the class AnalyticsPublisherExtensionOperation method getDataPublisher.

private DataPublisher getDataPublisher(ExtensionContext context, int tenantId, String analyticsServerProfileName) throws FaultException {
    DataPublisher dataPublisher = null;
    TenantProcessStore tenantsProcessStore = AnalyticsPublisherServiceComponent.getBPELServer().getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
    String processName = context.getProcessModel().getName().toString();
    dataPublisher = (DataPublisher) tenantsProcessStore.getDataPublisher(processName);
    // Create new DataPublisher if not created already.
    if (dataPublisher == null) {
        AnalyticsServerProfile analyticsServerProfile = getAnalyticsServerProfile(tenantId, analyticsServerProfileName);
        try {
            dataPublisher = new DataPublisher(analyticsServerProfile.getType(), analyticsServerProfile.getReceiverURLSet(), analyticsServerProfile.getAuthURLSet(), analyticsServerProfile.getUserName(), analyticsServerProfile.getPassword());
        } catch (TransportException e) {
            String errorMsg = "Transport layer problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointAuthenticationException e) {
            String errorMsg = "Data endpoint authentication problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointAgentConfigurationException e) {
            String errorMsg = "Data endpoint agent configuration problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointException e) {
            String errorMsg = "Data endpoint problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointConfigurationException e) {
            String errorMsg = "Data endpoint configuration problem.";
            handleException(errorMsg, e);
        }
        if (log.isDebugEnabled()) {
            log.debug("Data Publisher Created : " + analyticsServerProfile.toString());
        }
        if (dataPublisher != null) {
            tenantsProcessStore.addDataPublisher(processName, dataPublisher);
        }
    }
    return dataPublisher;
}
Also used : DataEndpointAuthenticationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException) DataPublisher(org.wso2.carbon.databridge.agent.DataPublisher) DataEndpointAgentConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException) DataEndpointException(org.wso2.carbon.databridge.agent.exception.DataEndpointException) TenantProcessStore(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore) AnalyticsServerProfile(org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile) DataEndpointConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException)

Example 7 with AnalyticsServerProfile

use of org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile in project carbon-business-process by wso2.

the class AnalyticsServerProfileBuilder method parseAnalyticsProfile.

/**
 * Parse Analytics Profile file content and adding content to AnalyticsProfile instance.
 *
 * @param content                Content of Analytics Profile
 * @param analyticsServerProfile AnalyticsServerProfile instance
 */
private void parseAnalyticsProfile(String content, AnalyticsServerProfile analyticsServerProfile) {
    try {
        OMElement resourceElement = new StAXOMBuilder(new ByteArrayInputStream(content.getBytes())).getDocumentElement();
        processAnalyticsServerProfileName(resourceElement, analyticsServerProfile);
        processCredentialElement(resourceElement, analyticsServerProfile);
        processConnectionElement(resourceElement, analyticsServerProfile);
        processStreamsElement(resourceElement, analyticsServerProfile);
    } catch (XMLStreamException e) {
        String errMsg = "Error occurred while creating the OMElement out of Analytics server " + "profile: " + profileLocation;
        handleError(errMsg, e);
    } catch (CryptoException e) {
        String errMsg = "Error occurred while decrypting password in Analytics server profile: " + profileLocation;
        handleError(errMsg, e);
    }
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) ByteArrayInputStream(java.io.ByteArrayInputStream) OMElement(org.apache.axiom.om.OMElement) StAXOMBuilder(org.apache.axiom.om.impl.builder.StAXOMBuilder) CryptoException(org.wso2.carbon.core.util.CryptoException)

Aggregations

AnalyticsServerProfile (org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile)3 DataPublisher (org.wso2.carbon.databridge.agent.DataPublisher)2 RegistryException (org.wso2.carbon.registry.api.RegistryException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 OMElement (org.apache.axiom.om.OMElement)1 StAXOMBuilder (org.apache.axiom.om.impl.builder.StAXOMBuilder)1 TAnalyticsServerProfiles (org.apache.ode.bpel.dd.TAnalyticsServerProfiles)1 AnalyticsServerProfileBuilder (org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfileBuilder)1 AnalyticsStreamConfiguration (org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsStreamConfiguration)1 TenantProcessStore (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore)1 CryptoException (org.wso2.carbon.core.util.CryptoException)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 Registry (org.wso2.carbon.registry.api.Registry)1 Resource (org.wso2.carbon.registry.api.Resource)1