Package org.apache.airavata.workflow.tracking.types

Examples of org.apache.airavata.workflow.tracking.types.BaseNotificationType


import org.apache.xmlbeans.XmlCursor;

public class Test {
    public static void main(String[] args) {
        WorkflowInitializedDocument activity = WorkflowInitializedDocument.Factory.newInstance();
        BaseNotificationType activityType = activity.addNewWorkflowInitialized();

        XmlCursor c = activity.newCursor();
        c.toNextToken();

        System.out.println(c.getObject().getClass());
View Full Code Here


     * {@inheritDoc}
     *
     */
    public void workflowTerminated(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
        WorkflowTerminatedDocument activity = WorkflowTerminatedDocument.Factory.newInstance();
        BaseNotificationType activityType = activity.addNewWorkflowTerminated();
        sendNotification(context, activity, descriptionAndAnnotation,
                "[Workflow is terminated; cannot be invoked anymore]");
    }
View Full Code Here

        sendNotification(context, logMsg, descriptionAndAnnotation, null);
    }

    public void exception(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
        LogExceptionDocument logMsg = LogExceptionDocument.Factory.newInstance();
        BaseNotificationType log = logMsg.addNewLogException();
        sendNotification(context, logMsg, descriptionAndAnnotation, null);
    }
View Full Code Here

        sendNotification(context, logMsg, descriptionAndAnnotation, null);
    }

    public void info(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
        LogInfoDocument logMsg = LogInfoDocument.Factory.newInstance();
        BaseNotificationType log = logMsg.addNewLogInfo();
        // add timestamp and notification source; add description, and
        // annotation if present
        // publish activity
        sendNotification(context, logMsg, descriptionAndAnnotation, null);
    }
View Full Code Here

        sendNotification(context, pubMsg, descriptionAndAnnotation, null);
    }

    public void warning(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
        LogWarningDocument logMsg = LogWarningDocument.Factory.newInstance();
        BaseNotificationType log = logMsg.addNewLogWarning();
        sendNotification(context, logMsg, descriptionAndAnnotation, null);
    }
View Full Code Here

        }, "testTopic");

        // create & publish log message
        {
            LogInfoDocument logMsg = LogInfoDocument.Factory.newInstance();
            BaseNotificationType log = logMsg.addNewLogInfo();
            // add timestamp
            final Calendar cal = new GregorianCalendar();
            cal.setTime(new Date());
            log.setTimestamp(cal);
            // add notification source
            BaseIDType baseID = BaseIDType.Factory.newInstance();
            baseID.setServiceID("http://tempuri.org/test_service");
            log.addNewNotificationSource().set(baseID);
            // add description
            log.setDescription("A test message");

            // publish message as XML Object
            publisher.publish(logMsg);
        }
        // create & publish publishURl message
View Full Code Here

public class XmlBeanUtils {

    public static BaseNotificationType extractBaseNotificationType(XmlObject xmldata) {
        XmlCursor c = xmldata.newCursor();
        c.toNextToken();
        BaseNotificationType type = (BaseNotificationType) c.getObject();
        c.dispose();
        return type;
    }
View Full Code Here

        }
    }

    protected void sendNotification(WorkflowTrackingContext context, XmlObject xmldata,
            String[] descriptionAndAnnotation, String defaultDesc) {
        BaseNotificationType xmlMessage = XmlBeanUtils.extractBaseNotificationType(xmldata);
        NotificationPublisher publisher = publishermap.get(context.getBrokerEpr());
        try {
            if (publisher == null) {
                // if a publisher class name has been defined to override the default WSM publisher, use it
                if (context.getPublisherImpl() != null) {
                    publisher = PublisherFactory.createSomePublisher(context.getPublisherImpl(), context);
                } else {
                    if (context.getTopic() == null) {
                        publisher = new WSMPublisher(100, context.isEnableAsyncPublishing(), context.getBrokerEpr()
                                .getAddress(), false);
                    } else {
                        publisher = new WSMPublisher(100, context.isEnableAsyncPublishing(), context.getBrokerEpr()
                                .getAddress(), context.getTopic());
                    }
                }
                publishermap.put(context.getBrokerEpr(), publisher);
            }

            setIDAndTimestamp(context, xmlMessage, context.getMyself(), activityTimestamp != null ? activityTimestamp
                    : new Date());
            setDescAndAnno(context, xmlMessage, descriptionAndAnnotation, defaultDesc);
            xmlMessage.getNotificationSource().setExperimentID(context.getTopic());
            // System.out.println(xmldata);
            if (log.isDebugEnabled()) {
                log.debug(xmldata.toString());
            }
            publisher.publish(xmldata);
View Full Code Here

        }
    }

    protected void sendNotification(WorkflowTrackingContext context, XmlObject xmldata,
            String[] descriptionAndAnnotation, String defaultDesc) {
        BaseNotificationType xmlMessage = XmlBeanUtils.extractBaseNotificationType(xmldata);
        NotificationPublisher publisher = publishermap.get(context.getBrokerEpr());
        try {
            if (publisher == null) {
                // if a publisher class name has been defined to override the default WSM publisher, use it
                if (context.getPublisherImpl() != null) {
View Full Code Here

     * {@inheritDoc}
     *
     */
    public void workflowTerminated(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
        WorkflowTerminatedDocument activity = WorkflowTerminatedDocument.Factory.newInstance();
        BaseNotificationType activityType = activity.addNewWorkflowTerminated();
        sendNotification(context, activity, descriptionAndAnnotation,
                "[Workflow is terminated; cannot be invoked anymore]");
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.tracking.types.BaseNotificationType

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.