http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java deleted file mode 100644 index e59c150..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/GenericInvoker.java +++ /dev/null @@ -1,529 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.invoker; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.xml.namespace.QName; - -import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder; -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.schemas.wec.ContextHeaderDocument; -import org.apache.airavata.workflow.model.exceptions.WorkflowException; -import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException; -import org.apache.airavata.xbaya.invoker.factory.InvokerFactory; -import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable; -import org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.v1.builder.XmlElement; - -import xsul.wsdl.WsdlDefinitions; -import xsul.wsdl.WsdlException; -import xsul.wsdl.WsdlResolver; -import xsul.wsif.WSIFMessage; -import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler; -import xsul.xwsif_runtime.WSIFClient; - -public class GenericInvoker implements Invoker { - - private static final Logger logger = LoggerFactory.getLogger(GenericInvoker.class); - - private String nodeID; - - private QName portTypeQName; - - private String wsdlLocation; - - private String serviceInformation; - - private String messageBoxURL; - - private String gfacURL; - - private Invoker invoker; - - private Future<Boolean> result; - - private ServiceNotifiable notifier; - - private ContextHeaderDocument.ContextHeader contextHeader; - - private String topic; - - /** - * used for notification - */ - private List<Object> inputValues = new ArrayList<Object>(); - - /** - * used for notification - */ - private List<String> inputNames = new ArrayList<String>(); - - boolean failerSent; - - private WsdlDefinitions wsdlDefinitionObject; - - /** - * Creates an InvokerWithNotification. - * - * @param portTypeQName - * - * @param wsdlLocation - * The URL of WSDL of the service to invoke - * @param nodeID - * The ID of the service - * @param notifier - * The notification sender - */ - public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, WorkflowNotifiable notifier) { - this(portTypeQName, wsdlLocation, nodeID, null, notifier); - } - - /** - * Creates an InvokerWithNotification. - * - * @param portTypeQName - * - * @param wsdlLocation - * The URL of WSDL of the service to invoke - * @param nodeID - * The ID of the service - * @param gfacURL - * The URL of GFac service. - * @param notifier - * The notification sender - */ - public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String gfacURL, - WorkflowNotifiable notifier) { - this(portTypeQName, wsdlLocation, nodeID, null, gfacURL, notifier); - } - - /** - * Creates an InvokerWithNotification. - * - * @param portTypeQName - * - * @param wsdlLocation - * The URL of WSDL of the service to invoke - * @param nodeID - * The ID of the service - * @param messageBoxURL - * @param gfacURL - * The URL of GFac service. - * @param notifier - * The notification sender - */ - public GenericInvoker(QName portTypeQName, String wsdlLocation, String nodeID, String messageBoxURL, - String gfacURL, WorkflowNotifiable notifier) { - this.nodeID = nodeID; - this.portTypeQName = portTypeQName; - this.wsdlLocation = wsdlLocation; - this.serviceInformation = wsdlLocation; - this.messageBoxURL = messageBoxURL; - this.gfacURL = gfacURL; - this.notifier = notifier.createServiceNotificationSender(nodeID); - this.failerSent = false; - this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader()); - this.topic = notifier.getTopic(); - } - - /** - * - * @param portTypeQName - * @param wsdl - * @param nodeID - * @param messageBoxURL - * @param gfacURL - * @param notifier - */ - public GenericInvoker(QName portTypeQName, WsdlDefinitions wsdl, String nodeID, String messageBoxURL, - String gfacURL, WorkflowNotifiable notifier) { - final String wsdlStr = xsul.XmlConstants.BUILDER.serializeToString(wsdl); - this.nodeID = nodeID; - this.portTypeQName = portTypeQName; - this.wsdlDefinitionObject = wsdl; - this.messageBoxURL = messageBoxURL; - this.serviceInformation = wsdlStr; - this.gfacURL = gfacURL; - this.notifier = notifier.createServiceNotificationSender(nodeID); - this.failerSent = false; - this.contextHeader = WorkflowContextHeaderBuilder.removeOtherSchedulingConfig(nodeID,WorkflowContextHeaderBuilder.getCurrentContextHeader()); - this.topic = notifier.getTopic(); - } - - /** - * - * @throws WorkflowException - */ - public void setup() throws WorkflowException { - try { - WsdlDefinitions definitions = null; - if (this.wsdlLocation != null && !this.wsdlLocation.equals("")) { - WsdlResolver resolver = WsdlResolver.getInstance(); - definitions = resolver.loadWsdl(new File(".").toURI(), new URI(this.wsdlLocation)); - } else { - definitions = this.wsdlDefinitionObject; - } - - setup(definitions); - - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - this.notifier.invocationFailed(e.getMessage(), e); - throw e; - } catch (URISyntaxException e) { - logger.error(e.getMessage(), e); - String message = "The location of the WSDL has to be a valid URL or file path: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (WsdlException e) { - logger.error(e.getMessage(), e); - String message = "Error in processing the WSDL: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in processing the WSDL: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - }catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - private void setup(WsdlDefinitions definitions) throws WorkflowException { - - // Set LEAD context header. - WorkflowContextHeaderBuilder builder; - if(contextHeader == null){ - builder = new WorkflowContextHeaderBuilder(this.notifier.getEventSink() - .getAddress(), this.gfacURL, null, this.topic, - "xbaya-experiment", this.messageBoxURL); - }else{ - builder = new WorkflowContextHeaderBuilder(contextHeader); - } - if(builder.getWorkflowMonitoringContext() == null){ - builder.addWorkflowMonitoringContext(this.notifier.getEventSink().getAddress(), - this.topic,this.nodeID,this.messageBoxURL); - } else { - builder.getWorkflowMonitoringContext().setWorkflowInstanceId(this.notifier.getWorkflowID().toASCIIString()); - } - builder.getWorkflowMonitoringContext().setWorkflowNodeId(this.nodeID); - builder.getWorkflowMonitoringContext().setServiceInstanceId(this.nodeID); - builder.getWorkflowMonitoringContext().setWorkflowTimeStep(1); - builder.setUserIdentifier("xbaya-user"); - //todo write a UI component to collect this information and pass it through Header -// builder.setGridMyProxyRepository("myproxy.nersc.gov","$user","$passwd",14000); - StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-workflowcontext-header", builder.getXml()); - // Create Invoker - this.invoker = InvokerFactory.createInvoker(this.portTypeQName, definitions, this.gfacURL, this.messageBoxURL, - builder, true); - this.invoker.setup(); - - WSIFClient client = this.invoker.getClient(); - client.addHandler(handler); - - WsdlResolver resolver = WsdlResolver.getInstance(); - // Get the concrete WSDL from invoker.setup() and set it to the - // notifier. - - this.notifier.setServiceID(this.nodeID); - // if (this.wsdlLocation != null) { - // this.notifier.setServiceID(this.nodeID); - // } else { - // String name = this.portTypeQName.getLocalPart(); - // this.notifier.setServiceID(name); - // } - } - - /** - * - * @param operationName - * The name of the operation - * @throws WorkflowException - */ - public void setOperation(String operationName) throws WorkflowException { - try { - this.invoker.setOperation(operationName); - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - this.notifier.invocationFailed(e.getMessage(), e); - throw e; - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "The WSDL does not conform to the invoking service: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - /** - * - * @param name - * The name of the input parameter - * @param value - * The value of the input parameter - * @throws WorkflowException - */ - public void setInput(String name, Object value) throws WorkflowException { - try { - if (value instanceof XmlElement) { - logger.debug("value: " + XMLUtil.xmlElementToString((XmlElement) value)); - } - this.inputNames.add(name); - this.inputValues.add(value); - this.invoker.setInput(name, value); - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - this.notifier.invocationFailed(e.getMessage(), e); - throw e; - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in setting an input. name: " + name + " value: " + value; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - /** - * - * @return - * @throws WorkflowException - */ - public synchronized boolean invoke() throws WorkflowException { - try { - WSIFMessage inputMessage = this.invoker.getInputs(); - logger.debug("inputMessage: " + XMLUtil.xmlElementToString((XmlElement) inputMessage)); - this.notifier.invokingService(inputMessage); - - ExecutorService executor = Executors.newSingleThreadExecutor(); - this.result = executor.submit(new Callable<Boolean>() { - @SuppressWarnings("boxing") - public Boolean call() { - try { - boolean success = GenericInvoker.this.invoker.invoke(); - if (success) { - // Send notification - WSIFMessage outputMessage = GenericInvoker.this.invoker.getOutputs(); - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - logger.debug("outputMessage: " + outputMessage); - GenericInvoker.this.notifier.serviceFinished(outputMessage); - } else { - //if error occurse gfac-axis2 write the error in to output not to the fault - WSIFMessage faultMessage = GenericInvoker.this.invoker.getOutputs(); - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - logger.debug("received fault: " + faultMessage); - GenericInvoker.this.notifier.receivedFault(faultMessage); - GenericInvoker.this.failerSent = true; - } - return success; - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - GenericInvoker.this.notifier.invocationFailed(e.getMessage(), e); - GenericInvoker.this.failerSent = true; - throw new WorkflowRuntimeException(e); - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + GenericInvoker.this.serviceInformation; - GenericInvoker.this.notifier.invocationFailed(message, e); - GenericInvoker.this.failerSent = true; - throw e; - } - } - }); - - // Kill the thread inside of executor. This is necessary for Jython - // script to finish. - executor.shutdown(); - - // Let other threads know that job has been submitted. - notifyAll(); - - // Check if the invocation itself fails. This happens immediately. - try { - this.result.get(100, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } catch (TimeoutException e) { - // The job is probably running fine. - // The normal case. - return true; - } catch (ExecutionException e) { - // The service-failed notification should have been sent - // already. - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - throw new WorkflowException(message, e); - } - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - return true; - } - - /** - * - * @throws WorkflowException - */ - @SuppressWarnings("boxing") - public synchronized void waitToFinish() throws WorkflowException { - try { - while (this.result == null) { - // The job is not submitted yet. - try { - wait(); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } - } - // Wait for the job to finish. - Boolean success = this.result.get(); - if (success == false) { - WSIFMessage faultMessage = this.invoker.getFault(); - String message = "Error in a service: "; - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - message += faultMessage.toString(); - throw new WorkflowException(message); - } - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } catch (ExecutionException e) { - // The service-failed notification should have been sent already. - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - throw new WorkflowException(message, e); - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error while waiting for a service to finish: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - /** - * - * @param name - * The name of the output parameter - * @return - * @throws WorkflowException - */ - public Object getOutput(String name) throws WorkflowException { - try { - waitToFinish(); - Object output = this.invoker.getOutput(name); - if (output instanceof XmlElement) { - logger.debug("output: " + XMLUtil.xmlElementToString((XmlElement) output)); - } - return output; - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - if (!this.failerSent) { - this.notifier.invocationFailed(e.getMessage(), e); - } - throw e; - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error while waiting for a output: " + name; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - /** - * - * @return - * @throws WorkflowException - */ - public WSIFMessage getOutputs() throws WorkflowException { - return this.invoker.getOutputs(); - } - - @Override - public WSIFClient getClient() { - return null; - } - - @Override - public WSIFMessage getInputs() throws WorkflowException { - return null; - } - - @Override - public WSIFMessage getFault() throws WorkflowException { - return null; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java deleted file mode 100644 index 4580587..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/Invoker.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.invoker; - -import org.apache.airavata.workflow.model.exceptions.WorkflowException; - -import xsul.wsif.WSIFMessage; -import xsul.xwsif_runtime.WSIFClient; - -public interface Invoker { - - /** - * Sets up the service. - * - * @throws WorkflowException - */ - public void setup() throws WorkflowException; - - /** - * @return The WSIFClient. - */ - public WSIFClient getClient(); - - /** - * Sets the operation name to invoke. - * - * @param operationName - * The name of the operation - * @throws WorkflowException - */ - public void setOperation(String operationName) throws WorkflowException; - - /** - * Sets an input parameter - * - * @param name - * The name of the input parameter - * @param value - * The value of the input parameter - * @throws WorkflowException - */ - public void setInput(String name, Object value) throws WorkflowException; - - /** - * Returns the all input parameters - * - * @return The input parameters - * @throws WorkflowException - */ - public WSIFMessage getInputs() throws WorkflowException; - - /** - * Invokes the service. - * - * @return true if the invocation succeeds; fase otherwise - * @throws WorkflowException - */ - public boolean invoke() throws WorkflowException; - - /** - * Returns the all output parameters - * - * @return The output parameters - * @throws WorkflowException - */ - public WSIFMessage getOutputs() throws WorkflowException; - - /** - * Returns the output of a specified name. - * - * @param name - * The name of the output parameter - * @return The value of the output - * @throws WorkflowException - */ - public Object getOutput(String name) throws WorkflowException; - - /** - * Returns the fault message. - * - * @return The fault message - * @throws WorkflowException - */ - public WSIFMessage getFault() throws WorkflowException; - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java deleted file mode 100644 index a5baa2d..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/MsgBoxWsaResponsesCorrelator.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ -package org.apache.airavata.xbaya.invoker; - -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.axiom.om.OMElement; -import org.apache.axis2.addressing.EndpointReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.v1.builder.XmlDocument; -import org.xmlpull.v1.builder.XmlElement; -import org.xmlpull.v1.builder.XmlInfosetBuilder; -import xsul.MLogger; -import xsul.XmlConstants; -import xsul.XsulException; -import xsul.processor.DynamicInfosetProcessorException; -import xsul.ws_addressing.WsaEndpointReference; -import xsul.ws_addressing.WsaMessageInformationHeaders; -import xsul.wsif.WSIFMessage; -import xsul.wsif.impl.WSIFMessageElement; -import xsul.xwsif_runtime_async.WSIFAsyncResponseListener; -import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator; -import xsul.xwsif_runtime_async.WSIFAsyncWsaResponsesCorrelatorBase; - -import javax.xml.stream.XMLStreamException; -import java.net.URI; -import java.net.URISyntaxException; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class MsgBoxWsaResponsesCorrelator extends WSIFAsyncWsaResponsesCorrelatorBase - implements WSIFAsyncResponsesCorrelator, Runnable -{ - private static final Logger logger = LoggerFactory.getLogger(MsgBoxWsaResponsesCorrelator.class); - private final static XmlInfosetBuilder builder = XmlConstants.BUILDER; - - private String msgBoxServiceLoc; -// private MsgBoxClient msgBoxClient; - EndpointReference msgBoxAddr; - private Thread messageBoxDonwloader; - - private AsynchronousInvoker invoker; - - public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output) - throws DynamicInfosetProcessorException - { - this.invoker = output; - this.msgBoxServiceLoc = msgBoxServiceLoc; -// msgBoxClient = new MsgBoxClient(); - try { -// msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L); - try { - setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress()))); - } catch (URISyntaxException e) { - logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates. - } - messageBoxDonwloader = new Thread(this, Thread.currentThread().getName()+"-async-msgbox-correlator"); - messageBoxDonwloader.setDaemon(true); - messageBoxDonwloader.start(); - } catch (Exception e) { - logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates. - } - } - -// public void setMsgBoxAddr(WsaEndpointReference msgBoxAddr) { -// this.msgBoxAddr = msgBoxAddr; -// } - - - - public void run() { -// while(true) { -// try { -// Iterator<OMElement> omElementIterator = msgBoxClient.takeMessagesFromMsgBox(msgBoxAddr, 5000L); -// List<XmlElement> xmlArrayList = new ArrayList<XmlElement>(); -// while (omElementIterator.hasNext()){ -// OMElement next = omElementIterator.next(); -// String message = next.toStringWithConsume(); -// xmlArrayList.add(XMLUtil.stringToXmlElement3(message)); -// } -// // 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) { -// break; -// } -// } catch (XsulException e) { -// logger.error("could not retrieve messages"); -// break; -// } catch (RemoteException e) { -// logger.error("could not retrieve messages"); -// break; -// } catch (XMLStreamException e) { -// logger.error("could not retrieve messages"); -// break; -// } catch (Exception e){ -// logger.error("could not retrieve messages"); -// break; -// } -// } - } - - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java deleted file mode 100644 index e615dc5..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/SimpleInvoker.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.invoker; - -import java.util.Iterator; - -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.workflow.model.exceptions.WorkflowException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.v1.builder.XmlElement; - -import xsul.wsdl.WsdlDefinitions; -import xsul.wsif.WSIFMessage; -import xsul.wsif.WSIFOperation; -import xsul.wsif.WSIFPort; -import xsul.wsif.WSIFService; -import xsul.wsif.WSIFServiceFactory; -import xsul.wsif.spi.WSIFProviderManager; -import xsul.xwsif_runtime.WSIFClient; -import xsul.xwsif_runtime.WSIFRuntime; - -public class SimpleInvoker implements Invoker { - - private static final Logger log = LoggerFactory.getLogger(GenericInvoker.class); - - protected WSIFClient client; - - private WsdlDefinitions definitions; - - private WSIFOperation operation; - - private WSIFMessage inputMessage; - - private volatile WSIFMessage outputMessage; - - private WSIFMessage faultMessage; - - private boolean lock = false; - - static { - WSIFProviderManager.getInstance().addProvider(new xsul.wsif_xsul_soap_http.Provider()); - } - - /** - * Constructs a SimpleInvoker. - * - * @param definitions - */ - public SimpleInvoker(WsdlDefinitions definitions) { - this.definitions = definitions; - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#setup() - */ - public void setup() throws WorkflowException { - try { - WSIFService service = WSIFServiceFactory.newInstance().getService(this.definitions); - WSIFPort port = service.getPort(); - this.client = WSIFRuntime.getDefault().newClientFor(port); - this.client.setAsyncResponseTimeoutInMs(999999999); - } catch (RuntimeException e) { - String message = "The WSDL is in the wrong format"; - throw new WorkflowException(message, e); - } - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#getClient() - */ - public WSIFClient getClient() { - return this.client; - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#setOperation(java.lang.String) - */ - public void setOperation(String operationName) throws WorkflowException { - try { - WSIFPort port = this.client.getPort(); - this.operation = port.createOperation(operationName); - this.inputMessage = this.operation.createInputMessage(); - this.outputMessage = this.operation.createOutputMessage(); - this.faultMessage = this.operation.createFaultMessage(); - } catch (RuntimeException e) { - String message = "The WSDL does not conform to the invoking service."; - throw new WorkflowException(message, e); - } - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#setInput(java.lang.String, java.lang.Object) - */ - public void setInput(String name, Object value) throws WorkflowException { - try { - if (value instanceof XmlElement) { - // If the value is a complex type, change the name of the - // element to the correct one. - XmlElement valueElement = (XmlElement) value; - valueElement.setName(name); - } else if (value instanceof String) { - if(XMLUtil.isXML((String)value)){ - XmlElement valueElement = XMLUtil.stringToXmlElement3((String) value); - valueElement.setName(name); - value = valueElement; - } - // Simple case. - } else { - // convert int, doule to string. - value = "" + value; - } - this.inputMessage.setObjectPart(name, value); - } catch (RuntimeException e) { - String message = "Error in setting an input. name: " + name + " value: " + value; - throw new WorkflowException(message, e); - } - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#getInputs() - */ - public WSIFMessage getInputs() { - return this.inputMessage; - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#invoke() - */ - public boolean invoke() throws WorkflowException { - try { - boolean success = this.operation.executeRequestResponseOperation(this.inputMessage, this.outputMessage, - this.faultMessage); - while(this.outputMessage == null){ - - } - return success; - } catch (RuntimeException e) { - String message = "Error in invoking a service."; - throw new WorkflowException(message, e); - } - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#getOutputs() - */ - public WSIFMessage getOutputs() { - if (lock) { - try { - wait(); - } catch (InterruptedException e) { - log.error(e.getMessage(), e); - } - } - return this.outputMessage; - } - - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#getOutput(java.lang.String) - */ - public Object getOutput(String name) throws WorkflowException { - try { - // This code doesn't work when the output is a complex type. - // Object output = this.outputMessage.getObjectPart(name); - // return output; - - XmlElement outputElement = (XmlElement) this.outputMessage; - XmlElement valueElement = outputElement.element(null, name); - Iterator childIt = valueElement.children(); - int numberOfChildren = 0; - while (childIt.hasNext()) { - childIt.next(); - numberOfChildren++; - } - if (numberOfChildren == 1) { - Object child = valueElement.children().next(); - if (child instanceof String) { - // Value is a simple type. Return the string. - String value = (String) child; - return value; - } - if (child instanceof XmlElement) { - log.debug("output: " + XMLUtil.xmlElementToString((XmlElement) child)); - Object child1 = ((XmlElement) child).children().next(); - if (child1 instanceof String) { - // Value is a simple type. Return the string. - String value = (String) child1; - return value; - } - } - } - // Value is a complex type. Return the whole XmlElement so that we - // can set it to the next service as it is. - return valueElement; - } catch (RuntimeException e) { - String message = "Error in getting output. name: " + name; - throw new WorkflowException(message, e); - } - } - - /** - * @see org.apache.airavata.xbaya.invoker.Invoker#getFault() - */ - public WSIFMessage getFault() { - return this.faultMessage; - } - - public WsdlDefinitions getDefinitions() { - return definitions; - } - - public WSIFOperation getOperation() { - return operation; - } - - public WSIFMessage getInputMessage() { - return inputMessage; - } - - public synchronized WSIFMessage getOutputMessage() { - return outputMessage; - } - - public WSIFMessage getFaultMessage() { - return faultMessage; - } - - public synchronized void setOutputMessage(WSIFMessage outputMessage) { - log.debug("Setting output message"); - this.outputMessage = outputMessage; - } - - public void setLock(boolean lock) { - this.lock = lock; - } - - public boolean isLock() { - return lock; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java deleted file mode 100644 index 1295c07..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInputUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ -package org.apache.airavata.xbaya.invoker; - -import org.apache.airavata.common.utils.StringUtil; -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.model.appcatalog.appinterface.DataType; -import org.apache.airavata.workflow.model.component.ws.WSComponentPort; -import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException; -import org.apache.airavata.xbaya.XBayaConstants; -import org.apache.airavata.xbaya.lead.LEADTypes; - -import javax.xml.namespace.QName; - -public class WorkflowInputUtil { - - public static String createInputForGFacService(WSComponentPort port,String input){ - DataType paramType = port.getType(); - StringBuffer inputString = new StringBuffer("<"); - if("StringParameterType".equals(paramType) || "URIParameterType".equals(paramType) || - "DoubleParameterType".equals(paramType) || "IntegerParameterType".equals(paramType) - || "FloatParameterType".equals(paramType)|| "BooleanParameterType".equals(paramType) - || "FileParameterType".equals(paramType)){ - inputString.append(port.getName()).append(">"). - append(getValueElement(input)).append("</").append(port.getName()).append(">"); - }else if(paramType.toString().endsWith("ArrayType")){ - inputString.append(port.getName()).append(">"); - String[] valueList = StringUtil.getElementsFromString(input); - for(String inputValue:valueList){ - inputString.append(getValueElement(inputValue)); - } - inputString.append(getValueElement(port.getName())); - } - inputString.append(">"); - return inputString.toString(); - } - - private static String getValueElement(String value){ - return "<value>" + value + "</value>"; - } - public static Object parseValue(WSComponentPort input, String valueString) { - String name = input.getName(); - if (false) { - // Some user wants to pass empty strings, so this check is disabled. - if (valueString.length() == 0) { - throw new WorkflowRuntimeException("Input parameter, " + name + ", cannot be empty"); - } - } - DataType type = input.getType(); - Object value; - value = valueString; - return value; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java deleted file mode 100644 index 9ca5669..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/WorkflowInvokerWrapperForGFacInvoker.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.invoker; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.xml.namespace.QName; - -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.workflow.model.exceptions.WorkflowException; -import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException; -import org.apache.airavata.xbaya.jython.lib.ServiceNotifiable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.v1.builder.XmlElement; - -import xsul.lead.LeadContextHeader; -import xsul.wsif.WSIFMessage; - -public class WorkflowInvokerWrapperForGFacInvoker extends GFacInvoker { - - private static final Logger logger = LoggerFactory.getLogger(WorkflowInvokerWrapperForGFacInvoker.class); - - private ServiceNotifiable notifier; - - private String serviceInformation; - - private Future<Boolean> result; - - protected boolean failerSent = false; - - public WorkflowInvokerWrapperForGFacInvoker(QName portTypeQName, String gfacURL, String messageBoxURL, - LeadContextHeader leadcontext, ServiceNotifiable serviceNotificationSender) { - super(portTypeQName, gfacURL, messageBoxURL, leadcontext); - this.notifier = serviceNotificationSender; - this.serviceInformation = portTypeQName.toString(); - } - - /** - * @see org.apache.airavata.xbaya.invoker.WorkflowInvoker#invoke() - */ - public synchronized boolean invoke() throws WorkflowException { - - try { - WSIFMessage inputMessage = super.getInputs(); - logger.debug("inputMessage: " + XMLUtil.xmlElementToString((XmlElement) inputMessage)); - this.notifier.invokingService(inputMessage); - - ExecutorService executor = Executors.newSingleThreadExecutor(); - this.result = executor.submit(new Callable<Boolean>() { - @SuppressWarnings("boxing") - public Boolean call() { - try { - boolean success = WorkflowInvokerWrapperForGFacInvoker.super.invoke(); - if (success) { - // Send notification - WSIFMessage outputMessage = WorkflowInvokerWrapperForGFacInvoker.super.getOutputs(); - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - logger.debug("outputMessage: " + outputMessage); - WorkflowInvokerWrapperForGFacInvoker.this.notifier.serviceFinished(outputMessage); - } else { - WSIFMessage faultMessage = WorkflowInvokerWrapperForGFacInvoker.super.getFault(); - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - logger.debug("received fault: " + faultMessage); - WorkflowInvokerWrapperForGFacInvoker.this.notifier.receivedFault(faultMessage); - WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true; - } - return success; - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - WorkflowInvokerWrapperForGFacInvoker.this.notifier.invocationFailed(e.getMessage(), e); - WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true; - throw new WorkflowRuntimeException(e); - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " - + WorkflowInvokerWrapperForGFacInvoker.this.serviceInformation; - WorkflowInvokerWrapperForGFacInvoker.this.notifier.invocationFailed(message, e); - WorkflowInvokerWrapperForGFacInvoker.this.failerSent = true; - throw e; - } - } - }); - - // Kill the thread inside of executor. This is necessary for Jython - // script to finish. - executor.shutdown(); - - // Let other threads know that job has been submitted. - notifyAll(); - - // Check if the invocation itself fails. This happens immediately. - try { - this.result.get(100, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } catch (TimeoutException e) { - // The job is probably running fine. - // The normal case. - return true; - } catch (ExecutionException e) { - // The service-failed notification should have been sent - // already. - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - throw new WorkflowException(message, e); - } - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - - boolean success = super.invoke(); - if (!success) { - try { - throw new Exception("Failed invoking GFac"); - } catch (Exception e) { - notifier.invocationFailed(super.getFault().toString(), e); - } - - } else { - notifier.serviceFinished(super.getOutputs()); - } - return success; - } - - public synchronized void waitToFinish() throws WorkflowException { - try { - while (this.result == null) { - // The job is not submitted yet. - try { - wait(); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } - } - // Wait for the job to finish. - Boolean success = this.result.get(); - if (success == false) { - WSIFMessage faultMessage = super.getFault(); - String message = "Error in a service: "; - // An implementation of WSIFMessage, - // WSIFMessageElement, implements toString(), which - // serialize the message XML. - message += faultMessage.toString(); - throw new WorkflowException(message); - } - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } catch (ExecutionException e) { - // The service-failed notification should have been sent already. - logger.error(e.getMessage(), e); - String message = "Error in invoking a service: " + this.serviceInformation; - throw new WorkflowException(message, e); - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error while waiting for a service to finish: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - - public Object getOutput(String name) throws WorkflowException { - try { - waitToFinish(); - Object output = super.getOutput(name); - if (output instanceof XmlElement) { - logger.debug("output: " + XMLUtil.xmlElementToString((XmlElement) output)); - } - return output; - } catch (WorkflowException e) { - logger.error(e.getMessage(), e); - // An appropriate message has been set in the exception. - if (!this.failerSent) { - this.notifier.invocationFailed(e.getMessage(), e); - } - throw e; - } catch (RuntimeException e) { - logger.error(e.getMessage(), e); - String message = "Error while waiting for a output: " + name; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } catch (Error e) { - logger.error(e.getMessage(), e); - String message = "Unexpected error: " + this.serviceInformation; - this.notifier.invocationFailed(message, e); - throw new WorkflowException(message, e); - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java deleted file mode 100644 index c03c756..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/factory/InvokerFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.invoker.factory; - -import javax.xml.namespace.QName; - -import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder; -import org.apache.airavata.common.utils.WSDLUtil; -import org.apache.airavata.workflow.model.exceptions.WorkflowException; -import org.apache.airavata.xbaya.invoker.AsynchronousInvoker; -import org.apache.airavata.xbaya.invoker.GFacInvoker; -import org.apache.airavata.xbaya.invoker.Invoker; -import org.apache.airavata.xbaya.invoker.SimpleInvoker; - -import xsul.lead.LeadContextHeader; -import xsul.wsdl.WsdlDefinitions; - -public class InvokerFactory { - - /** - * @param portTypeQName - * @param definitions - * @param gfacURL - * @param messageBoxURL - * @return The invoker - * @throws WorkflowException - */ - public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL, - String messageBoxURL, LeadContextHeader leadContext) throws WorkflowException { - Invoker invoker = null; - - if (definitions != null && definitions.getServices().iterator().hasNext()) { - // check if this web service supports asynchronous invocation -// if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) { -// invoker = new AsynchronousInvoker(definitions, messageBoxURL); -// } else { - invoker = new SimpleInvoker(definitions); -// } - } else if (gfacURL != null && gfacURL.length() != 0) { - invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, leadContext); - } - - if (invoker == null) { - String message = "Cannot find an appropriate way to invoke the service"; - throw new WorkflowException(message); - } - return invoker; - } - - public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL, - String messageBoxURL, WorkflowContextHeaderBuilder builder, boolean differ) throws WorkflowException { - Invoker invoker = null; - - if (definitions != null && definitions.getServices().iterator().hasNext()) { - // check if this web service supports asynchronous invocation -// if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) { -// invoker = new AsynchronousInvoker(definitions, messageBoxURL); -// } else { - invoker = new SimpleInvoker(definitions); -// } - } else if (gfacURL != null && gfacURL.length() != 0) { - invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, builder); - } - - if (invoker == null) { - String message = "Cannot find an appropriate way to invoke the service"; - throw new WorkflowException(message); - } - return invoker; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java index 41b4389..e2362e8 100644 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java +++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/script/JythonScript.java @@ -49,7 +49,6 @@ import org.apache.airavata.workflow.model.wf.Workflow; import org.apache.airavata.xbaya.XBayaConfiguration; import org.apache.airavata.xbaya.XBayaConstants; import org.apache.airavata.xbaya.XBayaVersion; -import org.apache.airavata.xbaya.invoker.GenericInvoker; public class JythonScript { @@ -73,8 +72,6 @@ public class JythonScript { */ public static final String TOPIC_VARIABLE = "topic"; - private static final String INVOKER_CLASS = StringUtil.getClassName(GenericInvoker.class); - // private static final String NOTIFICATION_CLASS = StringUtil.getClassName(NotificationSender.class); private static final String WORKFLOW_STARTED_METHOD = "workflowStarted"; @@ -337,8 +334,6 @@ public class JythonScript { pw.println("from java.util import Properties"); pw.println("from java.io import FileInputStream"); pw.println("from javax.xml.namespace import QName"); - pw.println("from " + GenericInvoker.class.getPackage().getName() + " import " + INVOKER_CLASS); -// pw.println("from " + NotificationSender.class.getPackage().getName() + " import " + NOTIFICATION_CLASS); pw.println(); } @@ -495,7 +490,7 @@ public class JythonScript { pw.println(TAB + id + QNAME_SUFFIX + " = QName('" + portTypeQName.getNamespaceURI() + "', '" + portTypeQName.getLocalPart() + "')"); pw.println(TAB + wsdlID + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + wsdlID + "')"); - pw.println(TAB + id + INVOKER_SUFFIX + " = " + INVOKER_CLASS + "(" + id + QNAME_SUFFIX + ", " + wsdlID + ", '" + pw.println(TAB + id + INVOKER_SUFFIX + " = " + "(" + id + QNAME_SUFFIX + ", " + wsdlID + ", '" + id + "',"); pw.println(TAB + TAB + MESSAGE_BOX_URL_VARIABLE + ", " + GFAC_VARIABLE + ", " + NOTIFICATION_VARIABLE + ")"); http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java deleted file mode 100644 index dc0b8bc..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LEADTypes.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.lead; - -import javax.xml.namespace.QName; - -import org.apache.airavata.common.utils.WSConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LEADTypes { - - private static final Logger logger = LoggerFactory.getLogger(LEADTypes.class); - - /** - * http://www.extreme.indiana.edu/lead/xsd - */ - public static final String LEAD_XSD_NS_URI = "http://airavata.apache.org/schemas/gfac/2012/12"; - - // Simple types - - /** - * LEADFileIDType - */ - public static final QName LEAD_FILE_ID_TYPE = new QName(LEAD_XSD_NS_URI, "LEADFileIDType"); - - /** - * DATA_ID_TYPE - */ - public static final QName DATA_ID_TYPE = new QName(LEAD_XSD_NS_URI, "DataIDType"); - - /** - * LEADWorkflowIDType - */ - public static final QName LEAD_WORKFLOW_ID_TYPE = new QName(LEAD_XSD_NS_URI, "LEADWorkflowIDType"); - - /** - * LEADNameListFileType - */ - public static final QName LEAD_NAME_LIST_FILE_TYPE = new QName(LEAD_XSD_NS_URI, "LEADNameListFileType"); - - /** - * LEADNameListPropertiesFileType - */ - public static final QName LEAD_NAME_LIST_PROPERTIES_FILE_TYPE = new QName(LEAD_XSD_NS_URI, - "LEADNameListPropertiesFileType"); - - /** - * HostNameType - */ - public static final QName HOST_NAME_TYPE = new QName(LEAD_XSD_NS_URI, "HostNameType"); - - // Array types - - /** - * StringArrayType - */ - public static final QName STRING_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "StringArrayType"); - - /** - * IntegerArrayType - */ - public static final QName INTEGER_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "IntegerArrayType"); - - /** - * FloatArrayType - */ - public static final QName FLOAT_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "FloatArrayType"); - - /** - * DoubleArrayType - */ - public static final QName DOUBLE_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "DoubleArrayType"); - - /** - * BooleanArrayType - */ - public static final QName BOOLEAN_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "BooleanArrayType"); - - /** - * QNameArrayType - */ - public static final QName QNAME_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "QNameArrayType"); - - /** - * URIArrayType - */ - public static final QName URI_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "URIArrayType"); - - /** - * LEADFileIDArrayType - */ - public static final QName LEAD_FILE_ID_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "LEADFileIDArrayType"); - - /** - * DATA_ID_ARRAY_TYPE - */ - public static final QName DATA_ID_ARRAY_TYPE = new QName(LEAD_XSD_NS_URI, "DataIDArrayType"); - - public static final QName STRING_TYPE = new QName(LEAD_XSD_NS_URI, "StringParameterType"); - - /** - * IntegerArrayType - */ - public static final QName INTEGER_TYPE = new QName(LEAD_XSD_NS_URI, "IntegerParameterType"); - - /** - * FloatArrayType - */ - public static final QName FLOAT_TYPE = new QName(LEAD_XSD_NS_URI, "FloatParameterType"); - - /** - * DoubleArrayType - */ - public static final QName DOUBLE_TYPE = new QName(LEAD_XSD_NS_URI, "DoubleParameterType"); - - /** - * BooleanArrayType - */ - public static final QName BOOLEAN_TYPE = new QName(LEAD_XSD_NS_URI, "BooleanParameterType"); - - /** - * URIArrayType - */ - public static final QName URI_TYPE = new QName(LEAD_XSD_NS_URI, "URIParameterType"); - - - /** - * Checks if a specified type is known. If the type is known, the GUI accepts string as a user's input. If not - * known, the GUI accepts XML as the input. - * - * @param type - * @return true if the type is known; otherwise false; - */ - public static boolean isKnownType(QName type) { - if (WSConstants.XSD_ANY_TYPE.equals(type)) { - // we need to input XML directly for xsd:any - return false; - } else if (WSConstants.XSD_NS_URI.equals(type.getNamespaceURI())) { - return true; - } else if (LEAD_FILE_ID_TYPE.equals(type) || DATA_ID_TYPE.equals(type) || LEAD_WORKFLOW_ID_TYPE.equals(type) - || LEAD_NAME_LIST_FILE_TYPE.equals(type) || LEAD_NAME_LIST_PROPERTIES_FILE_TYPE.equals(type) - || HOST_NAME_TYPE.equals(type) || STRING_ARRAY_TYPE.equals(type) || INTEGER_ARRAY_TYPE.equals(type) - || FLOAT_ARRAY_TYPE.equals(type) || DOUBLE_ARRAY_TYPE.equals(type) || BOOLEAN_ARRAY_TYPE.equals(type) - || QNAME_ARRAY_TYPE.equals(type) || URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type) - || DATA_ID_ARRAY_TYPE.equals(type) || STRING_TYPE.equals(type) || URI_TYPE.equals(type) - || INTEGER_TYPE.equals(type) || FLOAT_TYPE.equals(type) || DOUBLE_TYPE.equals(type) - || BOOLEAN_TYPE.equals(type)) { - return true; - } else if (DATA_ID_TYPE.getLocalPart().equals(type.getLocalPart())) { - // XXX temporary hack. - logger.warn("The name space of " + type.getLocalPart() + " should be " + DATA_ID_TYPE.getNamespaceURI() - + ", not " + type.getNamespaceURI() + "."); - return true; - } else { - return false; - } - } - - /** - * @param type - * @return true if type is an uri type; false otherwise. - */ - public static boolean isURIType(QName type) { - if (WSConstants.XSD_ANY_URI.equals(type) || LEAD_NAME_LIST_PROPERTIES_FILE_TYPE.equals(type) - || LEAD_FILE_ID_TYPE.equals(type) || LEAD_NAME_LIST_FILE_TYPE.equals(type) - || LEAD_WORKFLOW_ID_TYPE.equals(type) || URI_TYPE.equals(type)) { - return true; - } else { - return false; - } - } - - /** - * @param type - * @return true if type is an array type; false otherwise. - */ - public static boolean isArrayType(QName type) { - if (STRING_ARRAY_TYPE.equals(type) || INTEGER_ARRAY_TYPE.equals(type) || FLOAT_ARRAY_TYPE.equals(type) - || DOUBLE_ARRAY_TYPE.equals(type) || BOOLEAN_ARRAY_TYPE.equals(type) || QNAME_ARRAY_TYPE.equals(type) - || URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type) - || DATA_ID_ARRAY_TYPE.equals(type)) { - return true; - } else if (LEAD_FILE_ID_ARRAY_TYPE.getLocalPart().equals(type.getLocalPart())) { - // TODO remove this. - // for workflow input message created from workflow template - logger.warn("The name space of " + type.getLocalPart() + " should be " - + LEAD_FILE_ID_ARRAY_TYPE.getNamespaceURI() + ", not " + type.getNamespaceURI() + "."); - return true; - } else { - return false; - } - } - - /** - * @param type - * @return true if type is an uri array type; false otherwise. - */ - public static boolean isURIArrayType(QName type) { - if (URI_ARRAY_TYPE.equals(type) || LEAD_FILE_ID_ARRAY_TYPE.equals(type)) { - return true; - } else { - return false; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java deleted file mode 100644 index d73e00a..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/LeadContextHeaderHelper.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.lead; - -import org.apache.airavata.common.utils.WSDLUtil; -import org.apache.airavata.workflow.model.wf.Workflow; -import org.apache.airavata.xbaya.XBayaConfiguration; -import org.apache.airavata.xbaya.XBayaConstants; -import xsul.lead.LeadContextHeader; - -import java.net.URI; - -public class LeadContextHeaderHelper { - - /** - * DEFAULT_USER - */ - private static final String DEFAULT_USER = "xbaya-user"; - - /** - * DEFAULT_EXPERIMENT - */ - private static final String DEFAULT_EXPERIMENT = "xbaya-experiment"; - - private LeadContextHeader leadContextHeader; - - /** - * Constructs a LeadContextHeaderHelper. - * - */ - public LeadContextHeaderHelper() { - // The default experiment and user will be will be overwritten. - this.leadContextHeader = new LeadContextHeader(DEFAULT_EXPERIMENT, DEFAULT_USER); - } - - /** - * @return The leadContextHeader. - */ - public LeadContextHeader getLeadContextHeader() { - return this.leadContextHeader; - } - - /** - * @param user - */ - public void setUser(String user) { - if (user == null || user.length() == 0) { - user = DEFAULT_USER; - } - this.leadContextHeader.setUserDn(user); - } - - /** - * @param workflowTemplateID - */ - public void setWorkflowTemplateID(URI workflowTemplateID) { - if (workflowTemplateID != null) { - this.leadContextHeader.setWorkflowTemplateId(workflowTemplateID); - } - } - - /** - * @param workflowInstanceID - */ - public void setWorkflowInstanceID(URI workflowInstanceID) { - if (workflowInstanceID != null) { - this.leadContextHeader.setWorkflowInstanceId(workflowInstanceID); - } - } - - /** - * @param brokerURL - * @param topic - */ - public void setEventSink(URI brokerURL, String topic) { - if (brokerURL != null) { - if (topic == null || topic.length() == 0) { - topic = XBayaConstants.DEFAULT_TOPIC; - } - // TODO remove the xsul dependency here to WsaEndpointReference object -// EndpointReference eventSink = WseMsgBrokerClient.createEndpointReference(brokerURL.toString(), topic); -// WsaEndpointReference eprReference = new WsaEndpointReference(URI.create(eventSink.getAddress())); -// this.leadContextHeader.setEventSink(eprReference); - } - } - - /** - * @param gFacURL - */ - public void setGFacURL(URI gFacURL) { - if (gFacURL != null) { - this.leadContextHeader.setGfacUrl(WSDLUtil.appendWSDLQuary(gFacURL)); - } - } - - // - // The followings are higer-level APIs. - // - - /** - * @param workflow - */ - public void setWorkflow(Workflow workflow) { - if (workflow != null) { - setWorkflowTemplateID(workflow.getGPELTemplateID()); - setWorkflowInstanceID(workflow.getGPELInstanceID()); - } - } - - /** - * @param monitorConfiguration - */ -// public void setMonitorConfiguration(MonitorConfiguration monitorConfiguration) { -// setEventSink(monitorConfiguration.getBrokerURL(), monitorConfiguration.getTopic()); -// } - - /** - * This method has to be called before setMonitorConfiguration because this will overwrite some variables. - * - * @param xbayaConfiguration - */ - public void setXBayaConfiguration(XBayaConfiguration xbayaConfiguration) { - - // The followings might overwrite some variables. - setWorkflowTemplateID(xbayaConfiguration.getGPELTemplateID()); - setWorkflowInstanceID(xbayaConfiguration.getGPELInstanceID()); - setEventSink(xbayaConfiguration.getBrokerURL(), xbayaConfiguration.getTopic()); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/382b6c0e/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java ---------------------------------------------------------------------- diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java deleted file mode 100644 index c1c9da0..0000000 --- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/lead/NotificationHandler.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.xbaya.lead; - -import org.apache.airavata.common.utils.XMLUtil; -import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder; -import org.apache.airavata.xbaya.XBayaConstants; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.xmlbeans.XmlObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xmlpull.v1.builder.XmlElement; -import xsul.XmlConstants; -import xsul.invoker.DynamicInfosetInvokerException; -import xsul.lead.LeadContextHeader; -import xsul.message_router.MessageContext; -import xsul.xbeans_util.XBeansUtil; -import xsul.xhandler.BaseHandler; - -import java.net.URI; -import java.net.URISyntaxException; - -public class NotificationHandler extends BaseHandler { - - private static final Logger logger = LoggerFactory.getLogger(NotificationHandler.class); - - private static final String INVOKING_MESSAGE = "Invoking a workflow"; - - private static final String RECEIVE_RESULT_MESSAGE = "A workflow finished successfully."; - - private static final String RECEIVE_FAULT_MESSAGE = "A workflow failed."; - - private LeadContextHeader leadContext; - -// private WorkflowNotifier notifier; - -// private WorkflowTrackingContext context; - -// private InvocationContext invocationContext; - -// private InvocationEntity invocationEntity; - - private WorkflowContextHeaderBuilder builder; - - /** - * Constructs a NotificationHandler. - * - * @param leadContext - */ - public NotificationHandler(LeadContextHeader leadContext) { - super(NotificationHandler.class.getName()); - this.leadContext = leadContext; -// this.notifier = NotifierFactory.createNotifier(); - URI myWorkflowID = null; - URI myServiceID = URI.create(XBayaConstants.APPLICATION_SHORT_NAME); - String userDN = this.leadContext.getUserDn(); - if (userDN != null ){ - if(userDN.trim().length() == 0) { - String serviceIDAsString = XBayaConstants.APPLICATION_SHORT_NAME + ":" + userDN.trim(); - try { - myServiceID = new URI(null, null, serviceIDAsString, null); - } catch (URISyntaxException e) { - logger.error(e.getMessage(), e); - } - } - } - String myNodeID = null; - Integer myTimestep = null; - EndpointReference epr = new EndpointReference(leadContext.getEventSink().getAddress().toString()); -// this.invocationEntity = this.notifier.createEntity(myWorkflowID, myServiceID, myNodeID, myTimestep); -// this.context = this.notifier.createTrackingContext(new Properties(), epr.getAddress().toString(), myWorkflowID, -// myServiceID, myNodeID, myTimestep); - } - - public NotificationHandler(WorkflowContextHeaderBuilder builder) { - super(NotificationHandler.class.getName()); - this.builder = builder; -// this.notifier = NotifierFactory.createNotifier(); - URI myWorkflowID = null; - URI myServiceID = URI.create(XBayaConstants.APPLICATION_SHORT_NAME); - String userDN = this.builder.getUserIdentifier(); - if (userDN != null) { - if (userDN.trim().length() == 0) { - String serviceIDAsString = XBayaConstants.APPLICATION_SHORT_NAME + ":" + userDN.trim(); - try { - myServiceID = new URI(null, null, serviceIDAsString, null); - } catch (URISyntaxException e) { - logger.error(e.getMessage(), e); - } - } - } - String myNodeID = null; - Integer myTimestep = null; - EndpointReference epr = new EndpointReference(builder.getWorkflowMonitoringContext().getEventPublishEpr()); -// this.invocationEntity = this.notifier.createEntity(myWorkflowID, myServiceID, myNodeID, myTimestep); -// this.context = this.notifier.createTrackingContext(new Properties(), epr.getAddress().toString(), myWorkflowID, -// myServiceID, myNodeID, myTimestep); - } - - /** - * @see xsul.xhandler.BaseHandler#processOutgoingXml(org.xmlpull.v1.builder.XmlElement, - * xsul.message_router.MessageContext) - */ - @Override - public boolean processOutgoingXml(XmlElement soapEnvelope, MessageContext context) - throws DynamicInfosetInvokerException { - logger.debug("soapEnvelope: " + XMLUtil.xmlElementToString(soapEnvelope)); - - URI serviceWorkflowID = null; - URI serviceServiceID = URI.create(this.builder.getWorkflowMonitoringContext().getServiceInstanceId()); - if (serviceServiceID == null) { - serviceServiceID = URI.create("NoWorkflowIDSet"); - } -// Integer serviceTimestep = null; -/* String timeStep = Integer.toString(this.builder.getWorkflowMonitoringContext().getWorkflowTimeStep()); - if (timeStep != null) { - try { - serviceTimestep = new Integer(this.builder.getWorkflowMonitoringContext().getWorkflowTimeStep()); - } catch (NumberFormatException e) { - logger.error(e.getMessage(), e); - } - }*/ - XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER); - XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY); - XmlObject headerObject = null; - if (soapHeader != null) { - headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader); - } - XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody); - -// this.invocationContext = this.notifier.invokingService(this.context, this.invocationEntity, headerObject, -// bodyObject, INVOKING_MESSAGE); - return super.processOutgoingXml(soapEnvelope, context); - } - - /** - * @see xsul.xhandler.BaseHandler#processIncomingXml(org.xmlpull.v1.builder.XmlElement, - * xsul.message_router.MessageContext) - */ - @Override - public boolean processIncomingXml(XmlElement soapEnvelope, MessageContext context) - throws DynamicInfosetInvokerException { - logger.info("soapEnvelope: " + XMLUtil.xmlElementToString(soapEnvelope)); - - XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER); - XmlObject headerObject = null; - if (soapHeader != null) { - headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader); - } - - XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY); - XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody); - XmlElement faultElement = soapBody.element(null, "Fault"); - if (faultElement == null) { -// this.notifier.receivedResult(this.context, this.invocationContext, headerObject, bodyObject, -// RECEIVE_RESULT_MESSAGE); - } else { -// this.notifier.receivedFault(this.context, this.invocationContext, headerObject, bodyObject, -// RECEIVE_FAULT_MESSAGE); - } - - return super.processIncomingXml(soapEnvelope, context); - } -} \ No newline at end of file
