Package xsul.wsif.impl

Examples of xsul.wsif.impl.WSIFMessageElement


                    airavataAPI.getApplicationManager().getApplicationDescription(serviceName, registeredHost.getType().getHostName());

            // When we run getInParameters we set the actualParameter object, this has to be fixed
            URL resource = EmbeddedGFacInvoker.class.getClassLoader().getResource("gfac-config.xml");
            OMElement inputMessage = getInParameters();
            Object wsifMessageElement = new WSIFMessageElement(XMLUtil.stringToXmlElement3(inputMessage.toStringWithConsume()));
            this.notifier.invokingService(new WSIFMessageElement((XmlElement) wsifMessageElement));
            Properties configurationProperties = ServerSettings.getProperties();
      GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);

            JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
            //Here we get only the contextheader information sent specific for this node
            //Add security context
            addSecurityContext(registeredHost,configurationProperties,jobExecutionContext,
                    configuration.getContextHeader());

            jobExecutionContext.setContextHeader(WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,configuration.getContextHeader()));


            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_NODE_ID,this.nodeID);
            jobExecutionContext.setProperty(Constants.PROP_TOPIC,this.configuration.getTopic());
            jobExecutionContext.setProperty(Constants.PROP_BROKER_URL,this.configuration.getBrokerURL().toASCIIString());
            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_INSTANCE_ID,this.configuration.getTopic());


            ApplicationContext applicationContext = new ApplicationContext();
            applicationContext.setApplicationDeploymentDescription(applicationDescription);
            applicationContext.setHostDescription(registeredHost);
            applicationContext.setServiceDescription(serviceDescription);

            jobExecutionContext.setApplicationContext(applicationContext);

            jobExecutionContext.setOutMessageContext(getOutParameters(serviceDescription));
            jobExecutionContext.setInMessageContext(new MessageContext(actualParameters));

            GFacAPI gfacAPI1 = new GFacAPI();
            gfacAPI1.submitJob(jobExecutionContext);

            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
            OMElement outputElement = fac.createOMElement("invokeResponse", omNs);
            MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
            Set<String> paramNames = outMessageContext.getParameters().keySet();
            for (String paramName : paramNames) {
                /*
                * Process Output
                */
                String outputString = ((ActualParameter) outMessageContext.getParameter(paramName)).toXML().replaceAll("GFacParameter", paramName);
                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(outputString));
                StAXOMBuilder builder = new StAXOMBuilder(reader);
                outputElement.addChild(builder.getDocumentElement());
            }
            // Send notification
            logger.debug("outputMessage: " + outputElement.toString());
            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
            this.result = true;
            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement) outPut));
            //todo check whether ActualParameter values are set or not, if they are null have to through an error or handle this in gfac level.
//             {
//                // An implementation of WSIFMessage,
//                // WSIFMessageElement, implements toString(), which
//                // serialize the message XML.
View Full Code Here


                // now hard work: find callbacks
                for (int i = 0; i < xmlArrayList.size(); i++) {
                    XmlElement m = xmlArrayList.get(i);
                    try {
                        System.out.println(Thread.currentThread().getName());
                        WSIFMessageElement e = new WSIFMessageElement(m);
                        this.invoker.setOutputMessage(e);
                    } catch (Throwable e) {
                        e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                    }
                }
                try {
                    Thread.currentThread().sleep(1000L); //do not overload msg box service ...
                } catch (InterruptedException e) {}
View Full Code Here

                                StAXOMBuilder builder = new StAXOMBuilder(reader);
                                outputElement.addChild(builder.getDocumentElement());
                            }
                            // Send notification
                            logger.info("outputMessage: " + outputElement.toString());
                            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
                            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement)outPut));
                        } else {
                            // An implementation of WSIFMessage,
                            // WSIFMessageElement, implements toString(), which
                            // serialize the message XML.
                            EmbeddedGFacInvoker.this.notifier.receivedFault(new WSIFMessageElement(XMLUtil.stringToXmlElement3("<Message>Invocation Failed</Message>")));
                            EmbeddedGFacInvoker.this.failerSent = true;
                        }
                        return true;
                    } catch (WorkflowException e) {
                        logger.error(e.getMessage(), e);
View Full Code Here

        for (int i = 0; i < args.length; i++) {
            createMessage((String) args[i][0], args[i][1], inputMsgElem);
        }

        WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);

        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
        if (success) {
            logger.info("" + outputMessage);
            return outputMessage;
View Full Code Here

                    airavataAPI.getApplicationManager().getApplicationDescription(serviceName, registeredHost.getType().getHostName());

            // When we run getInParameters we set the actualParameter object, this has to be fixed
            URL resource = EmbeddedGFacInvoker.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
            OMElement inputMessage = getInParameters();
            Object wsifMessageElement = new WSIFMessageElement(XMLUtil.stringToXmlElement3(inputMessage.toStringWithConsume()));
            this.notifier.invokingService(new WSIFMessageElement((XmlElement) wsifMessageElement));
            Properties configurationProperties = ServerSettings.getProperties();
            GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);

            JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
            //Here we get only the contextheader information sent specific for this node
            //Add security context

            //FIXME - We no longer using job execution context
//            jobExecutionContext.setContextHeader(WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID, configuration.getContextHeader()));


            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_NODE_ID, this.nodeID);
            jobExecutionContext.setProperty(Constants.PROP_TOPIC, this.configuration.getTopic());
            jobExecutionContext.setProperty(Constants.PROP_BROKER_URL, this.configuration.getBrokerURL().toASCIIString());
            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_INSTANCE_ID, this.configuration.getTopic());


            ApplicationContext applicationContext = new ApplicationContext();
            applicationContext.setApplicationDeploymentDescription(applicationDescription);
            applicationContext.setHostDescription(registeredHost);
            applicationContext.setServiceDescription(serviceDescription);

            jobExecutionContext.setApplicationContext(applicationContext);

            jobExecutionContext.setOutMessageContext(getOutParameters(serviceDescription));
            jobExecutionContext.setInMessageContext(new MessageContext(actualParameters));

            addSecurityContext(registeredHost, configurationProperties, jobExecutionContext,
                    configuration.getContextHeader());
            GFacImpl gfacAPI1 = new GFacImpl();
            gfacAPI1.submitJob(jobExecutionContext);

            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
            OMElement outputElement = fac.createOMElement("invokeResponse", omNs);
            MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
            Set<String> paramNames = outMessageContext.getParameters().keySet();
            for (String paramName : paramNames) {
                /*
                * Process Output
                */
                String outputString = ((ActualParameter) outMessageContext.getParameter(paramName)).toXML().replaceAll("GFacParameter", paramName);
                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(outputString));
                StAXOMBuilder builder = new StAXOMBuilder(reader);
                outputElement.addChild(builder.getDocumentElement());
            }
            // Send notification
            logger.debug("outputMessage: " + outputElement.toString());
            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
            this.result = true;
            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement) outPut));
            //todo check whether ActualParameter values are set or not, if they are null have to through an error or handle this in gfac level.
//             {
//                // An implementation of WSIFMessage,
//                // WSIFMessageElement, implements toString(), which
//                // serialize the message XML.
View Full Code Here

                // now hard work: find callbacks
                for (int i = 0; i < xmlArrayList.size(); i++) {
                    XmlElement m = xmlArrayList.get(i);
                    try {
                        logger.debug(Thread.currentThread().getName());
                        WSIFMessageElement e = new WSIFMessageElement(m);
                        this.invoker.setOutputMessage(e);
                        //ideally there are no multiple messages, so we can return from this thread at this point
                        //otherwise this thread will keep running forever for each worfklow node, so there can be large
                        // number of waiting threads in an airavata deployment
                        return;
                    } catch (Throwable e) {
                      logger.error(e.getLocalizedMessage(),e)//To change body of catch statement use File | Settings | File Templates.
                    }
                }
                try {
                    Thread.currentThread().sleep(1000L); //do not overload msg box service ...
                } catch (InterruptedException e) {
View Full Code Here

        for (int i = 0; i < args.length; i++) {
            createMessage((String) args[i][0], args[i][1], inputMsgElem);
        }

        WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);

        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
        if (success) {
            logger.debug("" + outputMessage);
            return outputMessage;
View Full Code Here

        for (int i = 0; i < args.length; i++) {
            createMessage((String) args[i][0], args[i][1], inputMsgElem);
        }

        WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);

        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
        if (success) {
            logger.info("" + outputMessage);
            return outputMessage;
View Full Code Here

                                StAXOMBuilder builder = new StAXOMBuilder(reader);
                                outputElement.addChild(builder.getDocumentElement());
                            }
                            // Send notification
                            logger.info("outputMessage: " + outputElement.toString());
                            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
                            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement)outPut));
                        } else {
                            // An implementation of WSIFMessage,
                            // WSIFMessageElement, implements toString(), which
                            // serialize the message XML.
                            EmbeddedGFacInvoker.this.notifier.receivedFault(new WSIFMessageElement(XMLUtil.stringToXmlElement3("<Message>Invocation Failed</Message>")));
                            EmbeddedGFacInvoker.this.failerSent = true;
                        }
                        return true;
                    } catch (XBayaException e) {
                        logger.error(e.getMessage(), e);
View Full Code Here

                    airavataAPI.getApplicationManager().getApplicationDescription(serviceName, registeredHost.getType().getHostName());

            // When we run getInParameters we set the actualParameter object, this has to be fixed
            URL resource = EmbeddedGFacInvoker.class.getClassLoader().getResource("gfac-config.xml");
            OMElement inputMessage = getInParameters();
            Object wsifMessageElement = new WSIFMessageElement(XMLUtil.stringToXmlElement3(inputMessage.toStringWithConsume()));
            this.notifier.invokingService(new WSIFMessageElement((XmlElement) wsifMessageElement));
            Properties configurationProperties = ServerSettings.getProperties();
            GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties);

            JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName);
            //Here we get only the contextheader information sent specific for this node
            //Add security context

            jobExecutionContext.setContextHeader(WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID, configuration.getContextHeader()));


            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_NODE_ID, this.nodeID);
            jobExecutionContext.setProperty(Constants.PROP_TOPIC, this.configuration.getTopic());
            jobExecutionContext.setProperty(Constants.PROP_BROKER_URL, this.configuration.getBrokerURL().toASCIIString());
            jobExecutionContext.setProperty(Constants.PROP_WORKFLOW_INSTANCE_ID, this.configuration.getTopic());


            ApplicationContext applicationContext = new ApplicationContext();
            applicationContext.setApplicationDeploymentDescription(applicationDescription);
            applicationContext.setHostDescription(registeredHost);
            applicationContext.setServiceDescription(serviceDescription);

            jobExecutionContext.setApplicationContext(applicationContext);

            jobExecutionContext.setOutMessageContext(getOutParameters(serviceDescription));
            jobExecutionContext.setInMessageContext(new MessageContext(actualParameters));

            addSecurityContext(registeredHost, configurationProperties, jobExecutionContext,
                    configuration.getContextHeader());
            GFacAPI gfacAPI1 = new GFacAPI();
            gfacAPI1.submitJob(jobExecutionContext);

            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/xsd", "ns1");
            OMElement outputElement = fac.createOMElement("invokeResponse", omNs);
            MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
            Set<String> paramNames = outMessageContext.getParameters().keySet();
            for (String paramName : paramNames) {
                /*
                * Process Output
                */
                String outputString = ((ActualParameter) outMessageContext.getParameter(paramName)).toXML().replaceAll("GFacParameter", paramName);
                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(outputString));
                StAXOMBuilder builder = new StAXOMBuilder(reader);
                outputElement.addChild(builder.getDocumentElement());
            }
            // Send notification
            logger.debug("outputMessage: " + outputElement.toString());
            outPut = new WSIFMessageElement(XMLUtil.stringToXmlElement3(outputElement.toStringWithConsume()));
            this.result = true;
            EmbeddedGFacInvoker.this.notifier.serviceFinished(new WSIFMessageElement((XmlElement) outPut));
            //todo check whether ActualParameter values are set or not, if they are null have to through an error or handle this in gfac level.
//             {
//                // An implementation of WSIFMessage,
//                // WSIFMessageElement, implements toString(), which
//                // serialize the message XML.
View Full Code Here

TOP

Related Classes of xsul.wsif.impl.WSIFMessageElement

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.