Package org.wso2.carbon.event.core

Examples of org.wso2.carbon.event.core.EventBroker


    }

    public byte[] getProcessImage(String processId) {

        QName qName = decode(processId);
        SVGInterface svg = createSVG(qName);
        return svg.toPNGBytes();
    }
View Full Code Here


    private SVGInterface createSVG(QName qName) {

        // generate new
        InputStream in = getBpelDescriptor(qName);

        SVGInterface svg = null;

        try {
            svg = BPEL2SVGUtil.generate(in);

            if (svg == null)
View Full Code Here

   
    protected static SVGImpl generateSVGImpl(java.io.InputStream is) throws java.io.IOException {
      byte[] b=new byte[is.available()];
      is.read(b);
   
      BPELInterface bpel = new BPELImpl();
        OMElement bpelStr = bpel.load(new String(b));
       
        bpel.processBpelString(bpelStr);

        LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager();
        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

   * @param transformer The optional image transformer
   * @throws java.io.IOException Failed to generate the representation
   */
    public static void generate(java.io.InputStream is, java.io.OutputStream os,
                SVGImageTransformer transformer) throws java.io.IOException {
        SVGImpl svg = generateSVGImpl(is);
       
        if (transformer == null) {
          String str=svg.getHeaders()+svg.generateSVGString();
          os.write(str.getBytes());
        } else {
          transformer.transform(svg, os);
        }
    }
View Full Code Here

        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

//
//            ActivityEvent<MessageContext> event = null;
//            event = new ActivityThresholdEvent<MessageContext>(eventMsgCtx);
//            ((ActivityThresholdEvent<MessageContext>) event).setResourcePath(ActivityPublisherConstants.BAM_REG_PATH);
//            EventBrokerService<MessageContext> ebs = PublisherUtils.getEventBrokerService();
            EventBroker eb = PublisherUtils.getEventBroker();
            Message message = new Message();
            message.setMessage(eventBody);

            try {
                SuperTenantCarbonContext.startTenantFlow();
                int tenantId = SuperTenantCarbonContext.getCurrentContext(PublisherUtils.getConfigurationContext()).getTenantId();
                SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
                SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);

                eb.publish(message, ActivityPublisherConstants.BAM_REG_PATH);

            } catch (EventBrokerException e) {
                log.error("Can not publish the message ", e);
            } finally {
                SuperTenantCarbonContext.endTenantFlow();
View Full Code Here

//
//        // Create a new event and publish to the event broker service
//        ActivityThresholdEvent<MessageContext> event = new ActivityThresholdEvent<MessageContext>(eventMsgCtx);
//        event.setResourcePath(ActivityPublisherConstants.BAM_REG_PATH);

        EventBroker eb = ActivityPublisherUtils.getEventBroker();
        Message message = new Message();
        message.setMessage(eventElement);

        try {
            SuperTenantCarbonContext.startTenantFlow();
            int tenantId = SuperTenantCarbonContext.getCurrentContext(ActivityPublisherUtils.getConfigurationContextService().getServerConfigContext()).getTenantId();
            SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
            SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);

            eb.publish(message, ActivityPublisherConstants.BAM_REG_PATH);

        } catch (EventBrokerException e) {
            log.error("Can not publish the message ", e);
        } finally {
            SuperTenantCarbonContext.endTenantFlow();
View Full Code Here

public class EventPublisher implements ServiceStatsProcessor {

    private static Log log = LogFactory.getLog(EventPublisher.class);

    public void process(StatisticData[] statisticData) {
        EventBroker broker = StatisticsServiceComponent.getEventBroker();
        Message message = new Message();

        OMElement eventPayLoad = null;
        for (StatisticData statistic : statisticData) {
            eventPayLoad = constructEventPayLoad(statistic);
            message.setMessage(eventPayLoad);
            try {
                SuperTenantCarbonContext.startTenantFlow();
                int tenantId = SuperTenantCarbonContext.getCurrentContext(StatisticsServiceComponent.getConfigurationContext()).getTenantId();
                SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
                SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);

                broker.publishRobust(message, ServiceStatisticsPublisherConstants.BAM_REG_PATH);

            } catch (EventBrokerException e) {
                log.error("Can not publish the message ", e);
            } finally {
                SuperTenantCarbonContext.endTenantFlow();
View Full Code Here

        //Add static subscription only if bam url is set
        if (serverURL != null) {
            String serviceURL = serverURL + UsageAgentConstants.BAM_SERVER_STAT_SERVICE;

            EventBroker eventBrokerService = getEventBrokerService();
            Subscription subscription = new Subscription();
            // set the subscription end point to the service url
            subscription.setEventSinkURL(serviceURL);
            subscription.setTopicName(UsageAgentConstants.BAM_SERVER_STAT_FILTER);
            subscription.setOwner(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
            subscription.setEventDispatcherName(EventBrokerConstants.WS_EVENT_DISPATCHER_NAME);

            try {
                eventBrokerService.subscribe(subscription);
            } catch (EventBrokerException e) {
                String msg = "Cannot subscribe to the event broker ";
                log.error(msg);
                throw e;
            }
View Full Code Here

            return;
        }

        // get the topic of the event to be published
        String topic = UsageAgentConstants.BANDWIDTH_USAGE_TOPIC;
        EventBroker eventBrokerService = Util.getEventBrokerService();
        // publish the event
        try {
            SuperTenantCarbonContext.startTenantFlow();
            SuperTenantCarbonContext.getCurrentContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
            SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true);
            eventBrokerService.publish(message, topic);
        } catch (EventBrokerException e) {
            log.error("SystemStatisticsHandler - Unable to send notification for stat threshold", e);
        } finally {
            SuperTenantCarbonContext.endTenantFlow();
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.event.core.EventBroker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.