You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/05/14 20:35:02 UTC
svn commit: r1103180 [5/23] - in
/incubator/airavata/donations/ogce-donation: ./ modules/ modules/utils/
modules/utils/schemas/ modules/utils/schemas/gfac-schema-utils/
modules/utils/schemas/gfac-schema-utils/generated/
modules/utils/schemas/gfac-schem...
Added: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenUtil.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenUtil.java Sat May 14 18:34:50 2011
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2002-2004 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the licence.
+ *
+ * $Id: ServiceMapUtil.java,v 1.1.2.7 2006/08/10 13:21:46 hperera Exp $
+ */
+
+
+/**
+ * @version $Revision: 1.1.2.6 $
+ * @author Gopi Kandaswamy [mailto:gkandasw@cs.indiana.edu]
+ */
+
+package org.ogce.schemas.gfac.wsdl;
+
+import java.util.Vector;
+import org.apache.xmlbeans.XmlObject;
+import org.ogce.schemas.gfac.documents.InputParameterType;
+import org.ogce.schemas.gfac.documents.MethodType;
+import org.ogce.schemas.gfac.documents.OutputParameterType;
+import org.ogce.schemas.gfac.documents.ParameterValueType;
+import org.ogce.schemas.gfac.documents.PortTypeType;
+import org.ogce.schemas.gfac.documents.ServiceMapType;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+
+import xsul.XmlConstants;
+
+public class WSDLGenUtil
+{
+ private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+
+ public static Vector getMethodDescriptions(ServiceMapType serviceMap)
+ {
+ PortTypeType[] portTypes = serviceMap.getPortTypeArray();
+ Vector methodDescs = new Vector();
+ for (int i = 0; i < portTypes.length; ++i)
+ {
+ MethodType[] methods = portTypes[i].getMethodArray();
+ for (int j = 0; j < methods.length; ++j)
+ {
+ String desc = methods[j].getMethodDescription();
+ if(desc == null || desc == "") desc = "Method description not available";
+ methodDescs.add(desc);
+ }
+ }
+ return methodDescs;
+ }
+
+ public static Vector getOutParams(ServiceMapType serviceMap,
+ String methodName)
+ {
+
+ PortTypeType[] portTypes = serviceMap.getPortTypeArray();
+ Vector params = new Vector();
+
+ for (int i = 0; i < portTypes.length; ++i)
+ {
+ MethodType[] methods = portTypes[i].getMethodArray();
+
+ for (int j = 0; j < methods.length; ++j)
+ {
+
+ if (methods[j].getMethodName().equals(methodName))
+ {
+ OutputParameterType[] outputParams = methods[j].getOutputParameterArray();
+ if (outputParams != null)
+ {
+ for (int k = 0; k < outputParams.length; ++k)
+ {
+ OutParamObj outParam = new OutParamObj();
+ outParam.setName(outputParams[k].getParameterName());
+ outParam.setDescription(outputParams[k].getParameterDescription());
+ outParam.setDataType(outputParams[k].getParameterType().toString());
+ XmlObject output = outputParams[k].getAnyMetadata();
+ if(output != null){
+ outParam.setMetadata(output.getDomNode());
+// GfacUtils.writeDOM((Element)output.getDomNode());
+ }
+
+ if (outputParams[k].getRegExp() != null)
+ {
+ outParam.setRegExp(outputParams[k].getRegExp());
+ }
+
+ params.add(outParam);
+ }
+ return params;
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static Vector getInParams(ServiceMapType serviceMap,
+ String methodName)
+ {
+ PortTypeType[] portTypes = serviceMap.getPortTypeArray();
+ Vector params = new Vector();
+ for (int i = 0; i < portTypes.length; ++i)
+ {
+ MethodType[] methods = portTypes[i].getMethodArray();
+ for (int j = 0; j < methods.length; ++j)
+ {
+ if (methods[j].getMethodName().equals(methodName))
+ {
+ InputParameterType[] inputParams = methods[j]
+ .getInputParameterArray();
+
+ for (int k = 0; k < inputParams.length; ++k)
+ {
+ InputParameterType param = inputParams[k];
+ InParamObj obj = new InParamObj();
+ obj.setName(param.getParameterName());
+ obj.setDescription(param.getParameterDescription());
+ obj.setDataType(param.getParameterType().toString());
+ XmlObject input = param.getAnyMetadata();
+ if(input != null){
+ obj.setMetadata(input.getDomNode());
+ }
+
+ if (param.getDisplayAs() != null)
+ {
+ obj.setDisplayAs(param.getDisplayAs().toString());
+ }
+ params.add(obj);
+ }
+ break;
+ }
+ }
+ }
+ return params;
+ }
+
+ public static ParamValueObj getInParamValues(ServiceMapType serviceMap,
+ String methodName, String paramName)
+ {
+ PortTypeType[] portTypes = serviceMap.getPortTypeArray();
+ for (int i = 0; i < portTypes.length; ++i)
+ {
+ MethodType[] methods = portTypes[i].getMethodArray();
+ for (int j = 0; j < methods.length; ++j)
+ {
+ if (methods[j].getMethodName().equals(methodName))
+ {
+ InputParameterType[] inputParams = methods[j]
+ .getInputParameterArray();
+ for (int k = 0; k < inputParams.length; ++k)
+ {
+ if (inputParams[k].getParameterName().equals(paramName))
+ {
+ ParameterValueType[] paramValueType = inputParams[k]
+ .getParameterValueArray();
+ if (paramValueType != null)
+ {
+ ParamValueObj obj = new ParamValueObj();
+ String[] values = new String[paramValueType.length];
+ String[] desc = new String[paramValueType.length];
+ for (int l = 0; l < paramValueType.length; ++l)
+ {
+ values[l] = paramValueType[l].getValue();
+ desc[l] = paramValueType[l].getDescription();
+ }
+ obj.setValues(values);
+ obj.setDescriptions(desc);
+ return obj;
+ }
+ else
+ return null;
+ }
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+}
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ *
+ * Copyright (c) 2002-2004 The Trustees of Indiana University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1) All redistributions of source code must retain the above
+ * copyright notice, the list of authors in the original source
+ * code, this list of conditions and the disclaimer listed in this
+ * license;
+ *
+ * 2) All redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the disclaimer
+ * listed in this license in the documentation and/or other
+ * materials provided with the distribution;
+ *
+ * 3) Any documentation included with all redistributions must include
+ * the following acknowledgement:
+ *
+ * "This product includes software developed by the Indiana
+ * University Extreme! Lab. For further information please visit
+ * http://www.extreme.indiana.edu/"
+ *
+ * Alternatively, this acknowledgment may appear in the software
+ * itself, and wherever such third-party acknowledgments normally
+ * appear.
+ *
+ * 4) The name "Indiana University" or "Indiana University
+ * Extreme! Lab" shall not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ *
+ * 5) Products derived from this software may not use "Indiana
+ * University" name nor may "Indiana University" appear in their name,
+ * without prior written permission of the Indiana University.
+ *
+ * Indiana University provides no reassurances that the source code
+ * provided does not infringe the patent or any other intellectual
+ * property rights of any other entity. Indiana University disclaims any
+ * liability to any recipient for claims brought by any other entity
+ * based on infringement of intellectual property rights or otherwise.
+ *
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
+ * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
+ * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
+ * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
+ * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
+ * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
+ * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE
+ * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
+ * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
+ * SOFTWARE.
+ */
Propchange: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenUtil.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenerator.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenerator.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenerator.java Sat May 14 18:34:50 2011
@@ -0,0 +1,721 @@
+/*
+ * Copyright (c) 2002-2004 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the licence.
+ *
+ * $Id: WSDLGenerator.java,v 1.1.2.1 2006/05/30 01:43:41 gkandasw Exp $
+ */
+
+
+/**
+ * @version $Revision: 1.1.2.1 $
+ * @author Gopi Kandaswamy [mailto:gkandasw@cs.indiana.edu]
+ */
+
+package org.ogce.schemas.gfac.wsdl;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Random;
+import java.util.UUID;
+import java.util.Vector;
+import java.util.logging.Logger;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.OperationType;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.ogce.schemas.gfac.beans.utils.GFacSchemaException;
+import org.ogce.schemas.gfac.documents.MethodType;
+import org.ogce.schemas.gfac.documents.PortTypeType;
+import org.ogce.schemas.gfac.documents.ServiceMapType;
+import org.ogce.schemas.gfac.utils.GFacConstants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+
+import xsul.XmlConstants;
+
+import com.ibm.wsdl.BindingInputImpl;
+import com.ibm.wsdl.BindingOutputImpl;
+import com.ibm.wsdl.InputImpl;
+import com.ibm.wsdl.MessageImpl;
+import com.ibm.wsdl.OperationImpl;
+import com.ibm.wsdl.OutputImpl;
+import com.ibm.wsdl.PartImpl;
+import com.ibm.wsdl.PortImpl;
+import com.ibm.wsdl.PortTypeImpl;
+import com.ibm.wsdl.ServiceImpl;
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
+import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
+
+public class WSDLGenerator implements WSDLConstants
+{
+ public static final String WSA_PREFIX = "wsa";
+ public static final String CROSSCUT_PREFIX = "crosscutns";
+ private static Logger logger = Logger.getLogger(GFacConstants.LOGGER_NAME);
+ private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+ public Hashtable generateWSDL(String serviceLocation,
+ QName wsdlQName_,
+ String security,
+ ServiceMapType serviceMap,
+ boolean abstractWSDL) throws GFacSchemaException
+ {
+ Hashtable table = new Hashtable();
+ QName wsdlQName = null;
+ String wsdlString = null;
+ String serviceName = serviceMap.getService().getServiceName().getStringValue();
+ String nameSpaceURI = serviceMap.getService().getServiceName().getTargetNamespace();
+ QName serviceQName = new QName(nameSpaceURI, serviceName);
+
+ if(wsdlQName_ != null && !abstractWSDL)
+ {
+ wsdlQName = wsdlQName_;
+ }
+ else if(wsdlQName_ == null && !abstractWSDL)
+ {
+ String date = (new Date()).toString();
+ date = date.replaceAll(" ", "_");
+ date = date.replaceAll(":", "_");
+ Random rand = new Random();
+ int rdint = rand.nextInt(1000000);
+ wsdlQName = new QName(nameSpaceURI, serviceName + "_" + date +"_" + rdint);
+ }
+
+ PortTypeType[] portTypes = serviceMap.getPortTypeArray();
+ MethodType[] methods = portTypes[0].getMethodArray();
+ QName portTypeName = serviceQName;
+
+ String portName = portTypeName.getLocalPart();
+
+ try
+ {
+ WSDLFactory fac = WSDLFactory.newInstance();
+ WSDLWriter wsWriter = fac.newWSDLWriter();
+
+ // =========== start of wsdl definition ===========
+ Definition def = fac.newDefinition();
+
+ String typens = nameSpaceURI + "/" + portName + "/" + "xsd";
+ String globalTypens = nameSpaceURI + "/" + "xsd";
+
+ if (abstractWSDL)
+ {
+ def.setQName(serviceQName);
+ logger.info("Service QName set to = " + serviceQName);
+ }
+ else
+ {
+ def.setQName(wsdlQName);
+ logger.info("WSDL QName set to = " + wsdlQName);
+ }
+
+ //FIXME: this need to be in configration=========== start of wsdl namespaces ===========
+ def.setTargetNamespace(nameSpaceURI);
+ def.addNamespace(WSDLNS, nameSpaceURI);
+ def.addNamespace(TYPENS, typens);
+ def.addNamespace(GLOBAL_TYPENS, globalTypens);
+ def.addNamespace(SOAP, SOAP_NAMESPACE);
+ def.addNamespace(XSD, XSD_NAMESPACE);
+ def.addNamespace(CROSSCUT_PREFIX,"http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/");
+ def.addNamespace(WSA_PREFIX,"http://www.w3.org/2005/08/addressing");
+
+ if(GFacConstants.TRANSPORT_LEVEL.equals(security) || GFacConstants.MESSAGE_SIGNATURE.equals(security))
+ {
+ def.addNamespace(WSA_PREFIX, WSA_NAMESPACE);
+ def.addNamespace("wsp", WSP_NAMESPACE);
+ def.addNamespace("wsu", WSU_NAMESPACE);
+ def.addNamespace("wspe", WSPE_NAMESPACE);
+ def.addNamespace("sp", SP_NAMESPACE);
+ def.addNamespace("wss10", WSS10_NAMESPACE);
+
+ def.addNamespace("sp", SP_NAMESPACE);
+ def.addNamespace("wst", WST_NAMESPACE);
+ }
+ // =========== end of wsdl namespaces ===========
+
+
+
+
+
+ javax.xml.parsers.DocumentBuilderFactory domfactory =
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ javax.xml.parsers.DocumentBuilder builder = null;
+
+ try
+ {
+ builder = domfactory.newDocumentBuilder();
+ }
+ catch (javax.xml.parsers.ParserConfigurationException e)
+ {
+ throw new GFacSchemaException("Parser configuration exception: " + e.getMessage());
+ }
+
+ DOMImplementation dImpl = builder.getDOMImplementation();
+
+ String policyID = portName + "_Policy";
+ String inputPolicyID = portName + "_operationPolicy";
+
+ UnknownExtensibilityElement serviceLevelPolicRef = null;
+ UnknownExtensibilityElement opLevelPolicRef = null;
+
+ String namespace = GFacConstants.GFAC_NAMESPACE;
+ Document doc = dImpl.createDocument(namespace, "factoryServices", null);
+
+
+ //TODO this is boken fix it
+ String description = serviceMap.getService().getServiceDescription();
+ if(description != null){
+
+ Element documentation = doc.createElementNS("http://schemas.xmlsoap.org/wsdl/","wsdl:documentation");
+ documentation.appendChild(doc.createTextNode(description));
+ def.setDocumentationElement(documentation);
+ }
+
+
+ if(GFacConstants.TRANSPORT_LEVEL.equals(security))
+ {
+ def.addExtensibilityElement(createTransportLevelPolicy(dImpl, policyID));
+ serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
+ }
+ else if (GFacConstants.MESSAGE_SIGNATURE.equals(security))
+ {
+ def.addExtensibilityElement(WSPolicyGenerator.createServiceLevelPolicy(dImpl, policyID));
+ def.addExtensibilityElement(WSPolicyGenerator.createOperationLevelPolicy(dImpl, "inputPolicy", inputPolicyID));
+ serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
+ opLevelPolicRef = createWSPolicyRef(dImpl, inputPolicyID);
+ }
+
+ // Create types
+ Types types = TypesGenerator.addTypes(def, dImpl, serviceMap, typens, globalTypens, methods);
+ def.setTypes(types);
+
+// if(!abstractWSDL)
+// {
+// table = createMessageTable(serviceMap, typens, methods);
+// }
+
+ // Create port types (only first port type)
+ PortTypeImpl portType = addPortTypes(def, dImpl, portTypes, serviceQName);
+ Binding binding = addBinding(def, nameSpaceURI, portType, serviceLevelPolicRef,dImpl);
+
+ Vector methodDesc = WSDLGenUtil.getMethodDescriptions(serviceMap);
+ for(int i = 0; i < methods.length; ++i)
+ {
+ String methodName = methods[i].getMethodName();
+ Vector outParams = WSDLGenUtil.getOutParams(serviceMap, methodName);
+
+
+ OperationImpl operation = addOperation(def, dImpl, methodName, (String) methodDesc.get(i),typens,outParams);
+ portType.addOperation(operation);
+
+ if(!abstractWSDL)
+ {
+ UnknownExtensibilityElement wsInPolicyRef = null;
+ UnknownExtensibilityElement wsOutPolicyRef = null;
+
+ BindingInputImpl bindingInput = addBindingInput(def, methodName, wsInPolicyRef);
+ BindingOutputImpl bindingOutput = addBindingOutput(def, methodName, outParams, wsOutPolicyRef);
+ BindingOperation bindingOperation = addBindingOperation(def, operation,dImpl);
+ bindingOperation.setBindingInput(bindingInput);
+ bindingOperation.setBindingOutput(bindingOutput);
+ binding.addBindingOperation(bindingOperation);
+
+ if(opLevelPolicRef != null)
+ {
+ binding.addExtensibilityElement(opLevelPolicRef); }
+
+ }
+ }
+ def.addPortType(portType);
+
+ // =========== end of wsdl binding ===========
+
+// FIXME: This is done as factory information is not needed
+// if(abstractWSDL)
+// {
+//
+//
+// Element factoryServices = doc.createElement("n:factoryServices");
+// factoryServices.setAttribute("xmlns:n", namespace);
+// Element factoryService = doc.createElement("n:factoryService");
+// factoryService.setAttribute("location", "http://rainier.extreme.indiana.edu:12345");
+// factoryService.setAttribute("portType", "n:GenericFactory");
+// factoryService.setAttribute("operation", "n:CreateService");
+// factoryServices.appendChild(factoryService);
+// UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+// elem.setElement(factoryServices);
+// def.addExtensibilityElement(elem);
+// }
+
+ if (!abstractWSDL)
+ {
+ def.addBinding(binding);
+ ServiceImpl service = (ServiceImpl) def.createService();
+ service.setQName(wsdlQName);
+
+ PortImpl port = (PortImpl) def.createPort();
+ port.setName(wsdlQName.getLocalPart() + WSDL_PORT_SUFFIX);
+ port.setBinding(binding);
+ service.addPort(port);
+
+ SOAPAddressImpl soapAddress = new SOAPAddressImpl();
+ soapAddress.setLocationURI(serviceLocation);
+ port.addExtensibilityElement(soapAddress);
+ def.addService(service);
+ }
+
+ if(!abstractWSDL)
+ {
+ table.put(WSDL_QNAME, wsdlQName);
+ }
+
+ table.put(SERVICE_QNAME, serviceQName);
+
+ ByteArrayOutputStream bs = new ByteArrayOutputStream();
+ wsWriter.writeWSDL(def, bs);
+ wsdlString = bs.toString();
+ }
+ catch (WSDLException e)
+ {
+ throw new GFacSchemaException("Error generating WSDL: " + e.getMessage());
+ }
+
+ Reader reader = new StringReader(wsdlString);
+ Writer writer = new StringWriter();
+ try {
+ RoundTrip.roundTrip(reader, writer, " ");
+ } catch (XmlPullParserException e) {
+ throw new GFacSchemaException(e);
+ } catch (IOException e) {
+ throw new GFacSchemaException(e);
+ }
+ wsdlString = writer.toString();
+
+ if (abstractWSDL)
+ {
+ table.put(AWSDL, wsdlString);
+ }
+ else
+ {
+ table.put(WSDL, wsdlString);
+ }
+ return table;
+ }
+
+ private UnknownExtensibilityElement createWSPolicyRef(DOMImplementation dImpl,
+ String id)
+ {
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "wsp:PolicyReference", null);
+ Element policyRef = doc.getDocumentElement();
+ policyRef.setAttribute("URI", "#"+id);
+ UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+ elem.setElement(policyRef);
+ elem.setElementType(new QName(WSP_NAMESPACE, "PolicyReference"));
+ return elem;
+ }
+ private UnknownExtensibilityElement createTransportLevelPolicy(DOMImplementation dImpl,
+ String policyID)
+ {
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "wsp:Policy", null);
+
+ Element policy = doc.getDocumentElement();
+ policy.setAttribute("wsu:Id", policyID);
+ Element exactlyOne = doc.createElement("wsp:ExactlyOne");
+ Element all = doc.createElement("wsp:All");
+
+ Element transportBinding = doc.createElement("sp:TransportBinding");
+ transportBinding.setAttribute("xmlns:sp", SP_NAMESPACE);
+ Element policy1 = doc.createElement("wsp:Policy");
+
+ Element transportToken = doc.createElement("sp:TransportToken");
+ Element policy2 = doc.createElement("wsp:Policy");
+ Element httpsToken = doc.createElement("sp:HttpsToken");
+ httpsToken.setAttribute("RequireClientCertificate", "true");
+ policy2.appendChild(httpsToken);
+ transportToken.appendChild(policy2);
+ policy1.appendChild(transportToken);
+
+ /*
+ Element algorithmSuite = doc.createElement("sp:AlgorithmSuite");
+ Element policy3 = doc.createElement("wsp:Policy");
+ Element base256 = doc.createElement("sp:Base256");
+ policy3.appendChild(base256);
+ algorithmSuite.appendChild(policy3);
+ policy1.appendChild(algorithmSuite);
+
+
+ Element layout = doc.createElement("sp:Layout");
+ Element policy4 = doc.createElement("wsp:Policy");
+ Element lax = doc.createElement("sp:Lax");
+ policy4.appendChild(lax);
+ layout.appendChild(policy4);
+ policy1.appendChild(layout);
+
+ Element includeTimestamp = doc.createElement("sp:includeTimestamp");
+ policy1.appendChild(includeTimestamp);
+ */
+
+ /*
+ Element signedSupportingTokens = doc.createElement("sp:SignedSupportingTokens");
+ policy2 = doc.createElement("wsp:Policy");
+ Element usernameToken = doc.createElement("sp:UsernameToken");
+ usernameToken.setAttribute("sp:IncludeToken", "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient");
+ policy2.appendChild(usernameToken);
+ signedSupportingTokens.appendChild(policy2);
+ policy1.appendChild(signedSupportingTokens);
+ */
+
+ Element signedEndorsingSupportingTokens = doc.createElement("sp:SignedEndorsingSupportingTokens");
+ policy2 = doc.createElement("wsp:Policy");
+ Element x509V3Token = doc.createElement("sp:X509V3Token");
+ //x509V3Token.setAttribute("sp:IncludeToken", "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once");
+ policy2.appendChild(x509V3Token);
+ signedEndorsingSupportingTokens.appendChild(policy2);
+ policy1.appendChild(signedEndorsingSupportingTokens);
+
+ transportBinding.appendChild(policy1);
+ all.appendChild(transportBinding);
+
+ /*
+ Element wss10 = doc.createElement("sp:wss10");
+ Element requireSignatureConfirmation = doc.createElement("sp:RequireSignatureConfirmation");
+ wss10.appendChild(requireSignatureConfirmation);
+ all.appendChild(wss10);
+ */
+
+ exactlyOne.appendChild(all);
+ policy.appendChild(exactlyOne);
+
+ UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+ elem.setElement(policy);
+ elem.setElementType(new QName(WSP_NAMESPACE, "wsp:Policy"));
+ return elem;
+ }
+
+
+ private PortTypeImpl addPortTypes(Definition def,
+ DOMImplementation dImpl,
+ PortTypeType[] portTypes,
+ QName serviceQName)
+ {
+ // create port type
+ PortTypeImpl portType = (PortTypeImpl) def.createPortType();
+ portType.setQName(serviceQName);
+ portType.setUndefined(false);
+
+ // create documentation for this port type
+ Document doc = dImpl.createDocument(WSDL_NAMEPSPACE, WSDL_DOCUMENTATION, null);
+ Element documentation = doc.getDocumentElement();
+ documentation.appendChild(doc.createTextNode(portTypes[0].getPortDescription()));
+ portType.setDocumentationElement(documentation);
+ return portType;
+ }
+
+ private OperationImpl addOperation(Definition def,
+ DOMImplementation dImpl,
+ String methodName,
+ String methodDesc,
+ String typens,
+ Vector outputparameter)
+ {
+ OperationImpl operation = (OperationImpl) def.createOperation();
+ operation.setUndefined(false);
+ operation.setName(methodName);
+ if(outputparameter.size() == 0)
+ {
+ operation.setStyle(OperationType.ONE_WAY);
+ }else{
+ operation.setStyle(OperationType.REQUEST_RESPONSE);
+ }
+
+ Document doc = dImpl.createDocument(WSDL_NAMEPSPACE, WSDL_DOCUMENTATION, null);
+ Element documentation = doc.createElement(WSDL_DOCUMENTATION);
+ documentation.appendChild(doc.createTextNode(methodDesc));
+ operation.setDocumentationElement(documentation);
+
+
+ MessageImpl inputMessage = (MessageImpl) def.createMessage();
+ String inputMessageName = methodName + GFacConstants.SERVICE_REQ_MSG_SUFFIX+"_" +UUID.randomUUID();
+
+ inputMessage.setQName(new QName(def.getTargetNamespace(), inputMessageName));
+ inputMessage.setUndefined(false);
+
+ PartImpl inPart = (PartImpl) def.createPart();
+ inPart.setName(PART_NAME);
+ String inputElementName = methodName + GFacConstants.SERVICE_IN_PARAMS_SUFFIX;
+ inPart.setElementName(new QName(typens, inputElementName));
+ inputMessage.addPart(inPart);
+
+ def.addMessage(inputMessage);
+ InputImpl ip = (InputImpl) def.createInput();
+ ip.setName(inputMessageName);
+ ip.setMessage(inputMessage);
+
+ operation.setInput(ip);
+
+ if(outputparameter.size() > 0){
+ MessageImpl outputMessage = (MessageImpl) def.createMessage();
+ String outputMessageName = methodName + GFacConstants.SERVICE_RESP_MSG_SUFFIX +"_" +UUID.randomUUID();
+ outputMessage.setQName(new QName(def.getTargetNamespace(),outputMessageName));
+ outputMessage.setUndefined(false);
+
+ PartImpl part = (PartImpl) def.createPart();
+ part.setName(PART_NAME);
+ String outputElementName = methodName + GFacConstants.SERVICE_OUT_PARAMS_SUFFIX;
+
+ part.setElementName(new QName(typens, outputElementName));
+ outputMessage.addPart(part);
+ def.addMessage(outputMessage);
+
+ OutputImpl op = (OutputImpl) def.createOutput();
+ op.setName(outputMessageName);
+ op.setMessage(outputMessage);
+ operation.setOutput(op);
+ }
+ return operation;
+ }
+
+ private BindingInputImpl addBindingInput(Definition def,
+ String methodName,
+ UnknownExtensibilityElement wsPolicyRef)
+ {
+
+
+
+ BindingInputImpl bindingInput = (BindingInputImpl) def.createBindingInput();
+ bindingInput.setName(methodName + GFacConstants.SERVICE_REQ_MSG_SUFFIX);
+ if(wsPolicyRef != null)
+ {
+ logger.info("policy info is not null");
+ bindingInput.addExtensibilityElement(wsPolicyRef);
+ }
+ SOAPBodyImpl inputExtension = new SOAPBodyImpl();
+ inputExtension.setUse(LITERAL);
+ bindingInput.addExtensibilityElement(inputExtension);
+ return bindingInput;
+ }
+
+ private static BindingOutputImpl addBindingOutput(Definition def,
+ String methodName,
+ Vector outParams,
+ UnknownExtensibilityElement wsPolicyRef)
+ {
+ // specify output only if there are output parameters
+ BindingOutputImpl bindingOutput = null;
+ if(outParams.size() > 0)
+ {
+ bindingOutput = (BindingOutputImpl) def.createBindingOutput();
+ bindingOutput.setName(methodName+ GFacConstants.SERVICE_RESP_MSG_SUFFIX);
+ if(wsPolicyRef != null)
+ {
+ logger.info("policy info is not null");
+ bindingOutput.addExtensibilityElement(wsPolicyRef);
+ }
+ SOAPBodyImpl outputExtension = new SOAPBodyImpl();
+ outputExtension.setUse(LITERAL);
+ bindingOutput.addExtensibilityElement(outputExtension);
+ }
+ return bindingOutput;
+ }
+
+ private BindingOperation addBindingOperation(Definition def,OperationImpl operation,DOMImplementation dImpl)
+ {
+ BindingOperation bindingOperation = def.createBindingOperation();
+ bindingOperation.setName(operation.getName());
+ SOAPOperation soapOperation = new SOAPOperationImpl();
+ bindingOperation.addExtensibilityElement(soapOperation);
+ bindingOperation.setOperation(operation);
+
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "Misc", null);
+
+ UnknownExtensibilityElement exEle = new UnknownExtensibilityElement();
+ Element anonymousEle = doc.createElementNS("http://www.w3.org/2006/05/addressing/wsdl","wsaw:Anonymous");
+ anonymousEle.appendChild(doc.createTextNode("optional"));
+ exEle.setElement(anonymousEle);
+ exEle.setElementType(new QName("http://www.w3.org/2006/05/addressing/wsdl","wsaw:Anonymous"));
+ bindingOperation.addExtensibilityElement(exEle);
+ return bindingOperation;
+ }
+
+ private Binding addBinding(Definition def,
+ String nameSpaceURI,
+ PortTypeImpl portType,
+ UnknownExtensibilityElement wsPolicyRef,DOMImplementation dImpl)
+ {
+ String portName = portType.getQName().getLocalPart();
+
+ Binding binding = def.createBinding();
+ binding.setQName(new QName(nameSpaceURI, portName + WSDL_SOAP_BINDING_SUFFIX));
+ binding.setUndefined(false);
+ binding.setPortType(portType);
+
+ SOAPBindingImpl soapBindingImpl = new SOAPBindingImpl();
+ soapBindingImpl.setStyle(DOCUMENT);
+ soapBindingImpl.setTransportURI(SOAP_HTTP_NAMESPACE);
+ binding.addExtensibilityElement(soapBindingImpl);
+ if(wsPolicyRef != null)
+ {
+ logger.info("policy info is not null");
+ binding.addExtensibilityElement(wsPolicyRef);
+ }
+
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "Misc", null);
+
+ UnknownExtensibilityElement exEle = new UnknownExtensibilityElement();
+ exEle.setElement(doc.createElementNS("http://www.w3.org/2006/05/addressing/wsdl","wsaw:UsingAddressing"));
+ exEle.setElementType(new QName("http://www.w3.org/2006/05/addressing/wsdl","wsaw:UsingAddressing"));
+ binding.addExtensibilityElement(exEle);
+
+ return binding;
+ }
+
+
+
+
+
+
+ public static void createMetadata(InParamObj inparam,Document doc, Element annotation){
+ if(inparam.getMetadata() != null){
+ unwrapMetadata(doc,annotation,(Element)inparam.getMetadata());
+ }
+ }
+
+ public static void createMetadata(OutParamObj outparam,Document doc, Element annotation){
+ if(outparam.getMetadata() != null){
+ // GfacUtils.writeDOM((Element)outparam.getMetadata());
+ unwrapMetadata(doc,annotation,(Element)outparam.getMetadata());
+ }
+ }
+
+
+ private static void unwrapMetadata(Document doc, Element annotation,Element base){
+ Element appInfo = doc.createElementNS(XSD_NAMESPACE,"appinfo");
+ annotation.appendChild(appInfo);
+
+ NodeList childs = base.getChildNodes();
+ for(int i = 0;i< childs.getLength();i++){
+ if(childs.item(i) instanceof Element){
+ appInfo.appendChild(cloneElement(doc,(Element)childs.item(i)));
+ }
+ }
+ }
+
+
+
+ private static Element cloneElement(Document doc, Element base){
+ //Element copy = doc.createElementNS(tagretNamespace,prefix+ ":" + base.getLocalName());
+ Element copy = doc.createElementNS(base.getNamespaceURI(),base.getTagName());
+
+ NodeList nodes = base.getChildNodes();
+ for(int i = 0;i<nodes.getLength();i++){
+ Node node = nodes.item(i);
+ switch(node.getNodeType()){
+ case Node.COMMENT_NODE:
+ Comment comment = (Comment)node;
+ copy.appendChild(doc.createComment(comment.getData()));
+ break;
+ case Node.ELEMENT_NODE:
+ copy.appendChild(cloneElement(doc,(Element)node));
+ break;
+ case Node.ATTRIBUTE_NODE:
+ Attr attr = (Attr)node;
+ Attr attrCopy = doc.createAttributeNS(attr.getNamespaceURI(),attr.getPrefix()+ ":"+attr.getName());
+ attrCopy.setValue(attr.getValue());
+ copy.appendChild(attrCopy);
+ break;
+ case Node.TEXT_NODE:
+ copy.appendChild(doc.createTextNode(((Text)node).getNodeValue()));
+ break;
+ default:
+ break;
+ }
+ }
+ return copy;
+
+ }
+
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ *
+ * Copyright (c) 2002-2004 The Trustees of Indiana University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1) All redistributions of source code must retain the above
+ * copyright notice, the list of authors in the original source
+ * code, this list of conditions and the disclaimer listed in this
+ * license;
+ *
+ * 2) All redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the disclaimer
+ * listed in this license in the documentation and/or other
+ * materials provided with the distribution;
+ *
+ * 3) Any documentation included with all redistributions must include
+ * the following acknowledgement:
+ *
+ * "This product includes software developed by the Indiana
+ * University Extreme! Lab. For further information please visit
+ * http://www.extreme.indiana.edu/"
+ *
+ * Alternatively, this acknowledgment may appear in the software
+ * itself, and wherever such third-party acknowledgments normally
+ * appear.
+ *
+ * 4) The name "Indiana University" or "Indiana University
+ * Extreme! Lab" shall not be used to endorse or promote
+ * products derived from this software without prior written
+ * permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ *
+ * 5) Products derived from this software may not use "Indiana
+ * University" name nor may "Indiana University" appear in their name,
+ * without prior written permission of the Indiana University.
+ *
+ * Indiana University provides no reassurances that the source code
+ * provided does not infringe the patent or any other intellectual
+ * property rights of any other entity. Indiana University disclaims any
+ * liability to any recipient for claims brought by any other entity
+ * based on infringement of intellectual property rights or otherwise.
+ *
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
+ * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
+ * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
+ * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
+ * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
+ * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
+ * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE
+ * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
+ * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
+ * SOFTWARE.
+ */
Propchange: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSDLGenerator.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSPolicyGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSPolicyGenerator.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSPolicyGenerator.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSPolicyGenerator.java Sat May 14 18:34:50 2011
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2002-2004 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the licence.
+ *
+ * $Id: WSPolicyGenerator.java,v 1.1.2.3 2006/05/30 16:00:48 gkandasw Exp $
+ */
+
+/**
+ * @version $Revision: 1.1.2.3 $
+ * @author Gopi Kandaswamy [mailto:gkandasw@cs.indiana.edu]
+ */
+
+package org.ogce.schemas.gfac.wsdl;
+
+import java.util.logging.Logger;
+
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+
+import org.ietf.jgss.GSSCredential;
+import org.ogce.schemas.gfac.utils.GFacConstants;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+
+import xsul.XmlConstants;
+
+public class WSPolicyGenerator implements WSDLConstants {
+ private static Logger logger = Logger.getLogger(GFacConstants.LOGGER_NAME);
+
+ private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+ public static UnknownExtensibilityElement createOperationLevelPolicy(DOMImplementation dImpl,
+ String policyLocalPart, String policyID) {
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, policyLocalPart, null);
+
+ Element policy = doc.createElement("wsp:Policy");
+ policy.setAttribute("wsu:Id", policyID);
+ Element exactlyOne = doc.createElement("wsp:ExactlyOne");
+ Element all = doc.createElement("wsp:All");
+
+ Element signedParts = doc.createElement("sp:SignedParts");
+ Element body = doc.createElement("sp:Body");
+
+ signedParts.appendChild(body);
+ all.appendChild(signedParts);
+
+ /*
+ * <sp:IssuedToken
+ * sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ * <sp:Issuer>
+ * <wsa:EndpointReference>http://rainer.extreme.indiana.edu:5556/capman</wsa:EndpointReference>
+ * </sp:Issuer> <sp:RequestSecurityTokenTemplate>
+ * <wst:TokenType>urn:oasis:names:tc:SAML:1.1</wst:TokenType>
+ * <wst:KeyType>http://schemas.xmlsoap.org/ws/2004/04/trust/PublicKey</wst:KeyType>
+ * </sp:RequestSecurityTokenTemplate> </sp:IssuedToken>
+ */
+ Element issuedToken = doc.createElement("sp:IssuedToken");
+ issuedToken
+ .setAttribute("sp:IncludeToken",
+ "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient");
+
+ // issuedToken.appendChild(createElementHierachy("sp:Issuer",new
+ // String[]{"wsa:EndpointReference"},new
+ // String[]{"http://rainer.extreme.indiana.edu:5556/capman"},doc));
+ issuedToken
+ .appendChild(createElementHierachy(
+ "sp:Issuer",
+ new String[] { "wsa:EndpointReference" },
+ new String[] { "http://linbox3.extreme.indiana.edu:5556/axis2/services/STS" },
+ doc));
+
+ issuedToken.appendChild(createElementHierachy("sp:RequestSecurityTokenTemplate",
+ new String[] { "wst:TokenType", "wst:KeyType" }, new String[] {
+ "urn:oasis:names:tc:SAML:1.1",
+ "http://schemas.xmlsoap.org/ws/2004/04/trust/PublicKey" }, doc));
+ all.appendChild(issuedToken);
+
+ exactlyOne.appendChild(all);
+ policy.appendChild(exactlyOne);
+
+ UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+ elem.setElement(policy);
+ elem.setElementType(new QName(WSP_NAMESPACE, policyLocalPart));
+ return elem;
+ }
+
+ public static UnknownExtensibilityElement createServiceLevelPolicy(DOMImplementation dImpl,
+ String policyID) {
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "wsp:Policy", null);
+
+ Element policy = doc.getDocumentElement();
+ policy.setAttribute("wsu:Id", policyID);
+ Element exactlyOne = doc.createElement("wsp:ExactlyOne");
+ Element all = doc.createElement("wsp:All");
+
+ /*
+ * Element policyEncoding =
+ * doc.createElement("wspe:Utf816FFFECharacterEncoding");
+ * all.appendChild(policyEncoding);
+ */
+
+ Element asymmBinding = doc.createElement("sp:AsymmetricBinding");
+ asymmBinding.setAttribute("xmlns:sp", SP_NAMESPACE);
+ Element policy1 = doc.createElement("wsp:Policy");
+
+ Element initiatorToken = doc.createElement("sp:InitiatorToken");
+ Element policy2 = doc.createElement("wsp:Policy");
+ Element x509Token = doc.createElement("sp:X509Token");
+ x509Token
+ .setAttribute("sp:IncludeToken",
+ "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient");
+
+ Element policy3 = doc.createElement("wsp:Policy");
+ Element x509V3Token10 = doc.createElement("sp:WssX509V3Token10");
+ policy3.appendChild(x509V3Token10);
+ x509Token.appendChild(policy3);
+ policy2.appendChild(x509Token);
+ initiatorToken.appendChild(policy2);
+ policy1.appendChild(initiatorToken);
+
+ // <sp:RecipientToken>
+ // <wsp:Policy>
+ // <sp:X509Token
+ // sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ // <wsp:Policy>
+ // <sp:WssX509V3Token10/>
+ // </wsp:Policy>
+ // </sp:X509Token>
+ // </wsp:Policy>
+ // </sp:RecipientToken>
+
+ Element recipientToken = doc.createElement("sp:RecipientToken");
+ policy2 = doc.createElement("wsp:Policy");
+ x509Token = doc.createElement("sp:X509Token");
+ // x509Token.setAttribute(
+ // "sp:IncludeToken","http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never");
+ x509Token
+ .setAttribute("sp:IncludeToken",
+ "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient");
+ x509Token.appendChild(createEmptyElementHierachy("wsp:Policy",
+ new String[] { "sp:WssX509V3Token10" }, doc));
+ policy2.appendChild(x509Token);
+ recipientToken.appendChild(policy2);
+
+ policy1.appendChild(recipientToken);
+
+ Element algorithmSuite = doc.createElement("sp:AlgorithmSuite");
+ algorithmSuite.appendChild(createEmptyElementHierachy("wsp:Policy", new String[] {
+ "sp:Basic256", "sp:InclusiveC14N" }, doc));
+ policy1.appendChild(algorithmSuite);
+
+ Element layout = doc.createElement("sp:Layout");
+ layout.appendChild(createEmptyElementHierachy("wsp:Policy", new String[] { "sp:Strict" },
+ doc));
+ policy1.appendChild(layout);
+ // Element ts = doc.createElement("sp:IncludeTimestamp");
+ // policy1.appendChild(ts);
+ asymmBinding.appendChild(policy1);
+
+ all.appendChild(asymmBinding);
+
+ /*
+ * <sp:Wss10
+ * xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ * <wsp:Policy> <sp:MustSupportRefKeyIdentifier/>
+ * <sp:MustSupportRefIssuerSerial/> </wsp:Policy> </sp:Wss10>
+ */
+
+ Element wss10 = doc.createElement("sp:Wss10");
+ wss10.appendChild(createEmptyElementHierachy("wsp:Policy", new String[] {
+ "sp:MustSupportRefKeyIdentifier", "sp:MustSupportRefIssuerSerial" }, doc));
+ all.appendChild(wss10);
+
+ exactlyOne.appendChild(all);
+ policy.appendChild(exactlyOne);
+
+ UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+ elem.setElement(policy);
+ elem.setElementType(new QName(WSP_NAMESPACE, "wsp:Policy"));
+ return elem;
+ }
+
+ private static Element createEmptyElementHierachy(String parent, String[] childern, Document doc) {
+ Element parentEle = doc.createElement(parent);
+ for (int x = 0; x < childern.length; x++) {
+ parentEle.appendChild(doc.createElement(childern[x]));
+ }
+ return parentEle;
+ }
+
+ private static Element createElementHierachy(String parent, String[] childern, String[] values,
+ Document doc) {
+ Element parentEle = doc.createElement(parent);
+ for (int x = 0; x < childern.length; x++) {
+ Element temp = doc.createElement(childern[x]);
+ temp.appendChild(doc.createTextNode(values[x]));
+ parentEle.appendChild(temp);
+ }
+ return parentEle;
+ }
+
+ private static UnknownExtensibilityElement createWSPolicyRef(DOMImplementation dImpl, String id) {
+ Document doc = dImpl.createDocument(WSP_NAMESPACE, "wsp:PolicyReference", null);
+ Element policyRef = doc.getDocumentElement();
+ policyRef.setAttribute("URI", "#" + id);
+ UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
+ elem.setElement(policyRef);
+ elem.setElementType(new QName(WSP_NAMESPACE, "PolicyReference"));
+ return elem;
+ }
+
+}
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ *
+ * Copyright (c) 2002-2004 The Trustees of Indiana University. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ *
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ *
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ *
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ *
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ *
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ *
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ *
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ *
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */
Propchange: incubator/airavata/donations/ogce-donation/modules/utils/schemas/gfac-schema-utils/src/main/java/org/ogce/schemas/gfac/wsdl/WSPolicyGenerator.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/utils/schemas/workflow_execution_context/workflow_execution_context.xsd
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/utils/schemas/workflow_execution_context/workflow_execution_context.xsd?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/utils/schemas/workflow_execution_context/workflow_execution_context.xsd (added)
+++ incubator/airavata/donations/ogce-donation/modules/utils/schemas/workflow_execution_context/workflow_execution_context.xsd Sat May 14 18:34:50 2011
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema targetNamespace="http://ogce.org/namespaces/2010/08/30/workflow-context-header"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wec="http://ogce.org/namespaces/2010/08/30/workflow-context-header"
+ attributeFormDefault="qualified" elementFormDefault="qualified">
+
+ <element name="security-context">
+ <annotation>
+ <documentation xml:lang="en"> Security context for execution of the workflow
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="grid-proxy" type="base64Binary">
+ <annotation>
+ <documentation xml:lang="en"> Security context for Grid Security
+ Infrastructure X509 Proxy with trusted chain. </documentation>
+ </annotation>
+ </element>
+ <element name="grid-myproxy-repository">
+ <annotation>
+ <documentation xml:lang="en"> Security context for Grid Security MyProxy
+ Service </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="myproxy-server" type="string">
+ <annotation>
+ <documentation xml:lang="en"> MyProxy Server. </documentation>
+ </annotation>
+ </element>
+ <element name="username" type="string">
+ <annotation>
+ <documentation xml:lang="en"> MyProxy User Name.
+ </documentation>
+ </annotation>
+ </element>
+ <element name="password" type="string">
+ <annotation>
+ <documentation xml:lang="en"> MyProxy Password. </documentation>
+ </annotation>
+ </element>
+ <element name="life-time-inhours" type="int">
+ <annotation>
+ <documentation xml:lang="en"> MyProxy Proxy Life time.
+ </documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ssh-authentication">
+ <annotation>
+ <documentation xml:lang="en"> Security context for execution of the workflow
+ on SSH accessed resources.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="access-key-id" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Amazon Web Services Public Access
+ Key ID used to contact the AWS API's. </documentation>
+ </annotation>
+ </element>
+ <element name="secret-access-key" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Amazon Web Services AWS Private
+ Secret Access Key. </documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="credential-management-service">
+ <annotation>
+ <documentation xml:lang="en"> Security context for execution of the workflow
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="scms-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of the SCMS (Session
+ Credential Management Service). </documentation>
+ </annotation>
+ </element>
+ <element name="execution-session-id" type="string">
+ <annotation>
+ <documentation xml:lang="en"> The ID of the session credential
+ to be used for executing grid operations as needed by the
+ workflow. </documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="amazon-webservices">
+ <annotation>
+ <documentation xml:lang="en"> Security context for execution of the workflow
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="access-key-id" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Amazon Web Services Public Access
+ Key ID used to contact the AWS API's. </documentation>
+ </annotation>
+ </element>
+ <element name="secret-access-key" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Amazon Web Services AWS Private
+ Secret Access Key. </documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="workflow-monitoring-context">
+ <annotation>
+ <documentation xml:lang="en">Workflow context for execution of a instance used to
+ relate the specific activity in the context of workflow and used for monitoring
+ and illustarting the workflow progress.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="experiment-id" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Experiment ID (REQUIRED in context), Defines
+ the context of the workflow. </documentation>
+ </annotation>
+ </element>
+ <element name="workflow-instance-id" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> URI that identifies workflow instance that
+ originated the message. (optional) </documentation>
+ </annotation>
+ </element>
+ <element name="workflow-template-id" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> URI that identifies workflow template that was
+ used to create the workflow instance. (optional) </documentation>
+ </annotation>
+ </element>
+ <element name="workflow-node-id" type="string">
+ <annotation>
+ <documentation xml:lang="en"> String that identifies uniqueley a node in
+ workflow graph that originated that message. (optional) </documentation>
+ </annotation>
+ </element>
+
+ <element name="workflow-time-step" type="int">
+ <annotation>
+ <documentation xml:lang="en"> Increasing integer representing time in the
+ workflow execution when the message originated. (optional)
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="service-instance-id" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> URI that identifies service instance that
+ originated that message. (optional) </documentation>
+ </annotation>
+ </element>
+
+ <element name="service-replica-id" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> URI that identifies the replica of service
+ instance that originated that message, primarly used by Fault Tolerance
+ service to overprovision. (optional) </documentation>
+ </annotation>
+ </element>
+
+ <element name="event-sink-epr">
+ <annotation>
+ <documentation xml:lang="en"> EPR for WS-Eventing sink where to send event. (optional)
+ NOTE: currently any XML is accepted as there are many versions of WS-Addressing.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+
+
+ <element name="error-sink-epr">
+ <annotation>
+ <documentation xml:lang="en"> EPR for WS-Eventing sink where to send errors (optional)
+ NOTE: designed good for debugging and system level warnings, errors, etc
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+
+
+ <element name="scheduling-context">
+ <complexType>
+ <simpleContent>
+ <extension base="string">
+ <annotation><documentation xml:lang="en">
+ Element text contains host name for the resource.
+ </documentation></annotation>
+
+ <attribute name="workflow-node-id" type="string">
+ <annotation><documentation xml:lang="en">
+ This is workflow node ID that is mapped to a resource.
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="service-id" type="anyURI" use="optional">
+ <annotation><documentation xml:lang="en">
+ This is service ID.
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="host-name" type="anyURI" use="optional">
+ <annotation><documentation xml:lang="en">
+ head node of the resource
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="wsgram-preferred" type="boolean" use="optional">
+ <annotation><documentation xml:lang="en">
+ If true then wsgram will be used, false pre-wsgram will be used.
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="gatekeeper-epr" type="anyURI" use="optional">
+ <annotation><documentation xml:lang="en">
+ GRAM EPR of the resource
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="job-manager" type="string">
+ <annotation><documentation xml:lang="en">
+ LRM job manager on the resource, ex: PBS, LSF.
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="cpu-count" type="int" use="optional">
+ <annotation><documentation xml:lang="en">
+ number of CPU's allocated on the compute cluster
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="node-count" type="int" use="optional">
+ <annotation><documentation xml:lang="en">
+ number of nodes allocated on the compute cluster
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="queue-name" type="string">
+ <annotation><documentation xml:lang="en">
+ Job queue name if any.
+ </documentation></annotation>
+ </attribute>
+
+ <attribute name="max-wall-time" type="int" use="optional">
+ <annotation><documentation xml:lang="en">
+ number of CPU's allocated on the compute cluster
+ </documentation></annotation>
+ </attribute>
+ </extension>
+ </simpleContent>
+ </complexType>
+ </element>
+
+ <element name="workflow-scheduling">
+ <annotation><documentation xml:lang="en">
+ Element that contains service specific resource scheduling information sent
+ inside workflow context. The purpose of this context is to schedule individual
+ activities on a different resource.
+ </documentation></annotation>
+ <complexType>
+ <sequence>
+ <element minOccurs="1" maxOccurs="unbounded" ref="wec:scheduling-context"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="gfac-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of GFac factory service to use. (optional)
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="registry-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of Registry service to use. (optional)
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="dsc-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of DSC service to use. (optional)
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="resource-scheduler" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Resource Scheduler to use among LEAD, VGRADS and SPRUCE.
+ (optional) </documentation>
+ </annotation>
+ </element>
+
+ <element name="data-agent-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of the Data Agent </documentation>
+ </annotation>
+ </element>
+
+ <element name="metadata-catalog-url" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> Location of the Metadata Catalog </documentation>
+ </annotation>
+ </element>
+
+ <element name="user-dn" type="string">
+ <annotation>
+ <documentation xml:lang="en"> String that identifies user running this experiment.
+ (REQUIRED in context </documentation>
+ </annotation>
+ </element>
+
+ <element name="URGENCY" type="string">
+ <annotation>
+ <documentation xml:lang="en"> Spruce urgency parameter </documentation>
+ </annotation>
+ </element>
+
+ <element name="ForceFileStagingToWorkDir" type="string">
+ <annotation>
+ <documentation xml:lang="en"> ForceFileStagingToWorkDir (optinal) </documentation>
+ </annotation>
+ </element>
+
+ <element name="OUTPUT_DATA_DIRECTORY" type="anyURI">
+ <annotation>
+ <documentation xml:lang="en"> GFac output data staging directory. (optional)
+ </documentation>
+ </annotation>
+ </element>
+</schema>
Propchange: incubator/airavata/donations/ogce-donation/modules/utils/schemas/workflow_execution_context/workflow_execution_context.xsd
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/build.xml?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/build.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/build.xml Sat May 14 18:34:50 2011
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="jar.client">
+ <!--Auto generated ant build file-->
+ <property environment="env"/>
+ <property name="axis2.home" value="${env.AXIS2_HOME}"/>
+ <property name="project.base.dir" value="."/>
+ <property name="maven.class.path" value=""/>
+ <property name="name" value="WorkflowInterpretor"/>
+ <property name="src" value="${project.base.dir}/src"/>
+ <property name="test" value="${project.base.dir}/test"/>
+ <property name="build" value="${project.base.dir}/build"/>
+ <property name="classes" value="${build}/classes"/>
+ <property name="lib" value="${build}/lib"/>
+ <property name="resources" value="${project.base.dir}/resources"/>
+ <property value="" name="jars.ok"/>
+ <path id="axis2.class.path">
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${maven.class.path}"/>
+ <fileset dir="${axis2.home}">
+ <include name="lib/*.jar"/>
+ </fileset>
+ </path>
+ <target name="init">
+ <mkdir dir="${build}"/>
+ <mkdir dir="${classes}"/>
+ <mkdir dir="${lib}"/>
+ </target>
+ <target depends="init" name="pre.compile.test">
+ <!--Test the classpath for the availability of necesary classes-->
+ <available classpathref="axis2.class.path" property="stax.available" classname="javax.xml.stream.XMLStreamReader"/>
+ <available classpathref="axis2.class.path" property="axis2.available" classname="org.apache.axis2.engine.AxisEngine"/>
+ <condition property="jars.ok">
+ <and>
+ <isset property="stax.available"/>
+ <isset property="axis2.available"/>
+ </and>
+ </condition>
+ <!--Print out the availabilities-->
+ <echo message="Stax Availability= ${stax.available}"/>
+ <echo message="Axis2 Availability= ${axis2.available}"/>
+ </target>
+ <target depends="pre.compile.test" name="compile.src" if="jars.ok">
+ <javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true" destdir="${classes}" srcdir="${src}">
+ <classpath refid="axis2.class.path"/>
+ </javac>
+ </target>
+ <target depends="compile.src" name="compile.test" if="jars.ok">
+ <javac debug="on" memoryMaximumSize="256m" memoryInitialSize="256m" fork="true" destdir="${classes}">
+ <src path="${test}"/>
+ <classpath refid="axis2.class.path"/>
+ </javac>
+ </target>
+ <target depends="pre.compile.test" name="echo.classpath.problem" unless="jars.ok">
+ <echo message="The class path is not set right! Please make sure the following classes are in the classpath 1. XmlBeans 2. Stax 3. Axis2 "/>
+ </target>
+ <target depends="jar.server, jar.client" name="jar.all"/>
+ <target depends="compile.src,echo.classpath.problem" name="jar.server" if="jars.ok">
+ <copy toDir="${classes}/META-INF" failonerror="false">
+ <fileset dir="${resources}">
+ <include name="*.xml"/>
+ <include name="*.wsdl"/>
+ <include name="*.xsd"/>
+ </fileset>
+ </copy>
+ <jar destfile="${lib}/${name}.aar">
+ <fileset excludes="**/Test.class" dir="${classes}"/>
+ </jar>
+ </target>
+ <target if="jars.ok" name="jar.client" depends="compile.src">
+ <jar destfile="${lib}/${name}-test-client.jar">
+ <fileset dir="${classes}">
+ <exclude name="**/META-INF/*.*"/>
+ <exclude name="**/lib/*.*"/>
+ <exclude name="**/*MessageReceiver.class"/>
+ <exclude name="**/*Skeleton.class"/>
+ </fileset>
+ </jar>
+ </target>
+ <target if="jars.ok" depends="jar.server" name="make.repo">
+ <mkdir dir="${build}/repo/"/>
+ <mkdir dir="${build}/repo/services"/>
+ <copy file="${build}/lib/${name}.aar" toDir="${build}/repo/services/"/>
+ </target>
+ <target if="jars.ok" depends="make.repo" name="start.server">
+ <java fork="true" classname="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <arg value="${build}/repo"/>
+ <classpath refid="axis2.class.path"/>
+ </java>
+ </target>
+ <target if="jars.ok" depends="compile.test" name="run.test">
+ <path id="test.class.path">
+ <pathelement location="${lib}/${name}-test-client.jar"/>
+ <path refid="axis2.class.path"/>
+ <pathelement location="${classes}"/>
+ </path>
+ <mkdir dir="${build}/test-reports/"/>
+ <junit haltonfailure="yes" printsummary="yes">
+ <classpath refid="test.class.path"/>
+ <formatter type="plain"/>
+ <batchtest fork="yes" toDir="${build}/test-reports/">
+ <fileset dir="${test}">
+ <include name="**/*Test*.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+ <target name="clean">
+ <delete dir="${build}"/>
+ </target>
+</project>
Added: incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/Main.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/Main.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/Main.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/Main.java Sat May 14 18:34:50 2011
@@ -0,0 +1,73 @@
+package edu.indiana.extreme.xbaya;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.rmi.RemoteException;
+
+import org.apache.axis2.AxisFault;
+
+import edu.indiana.extreme.xbaya.WorkflowInterpretorStub.NameValue;
+import edu.indiana.extreme.xbaya.component.ComponentException;
+import edu.indiana.extreme.xbaya.graph.GraphException;
+import edu.indiana.extreme.xbaya.wf.Workflow;
+
+public class Main {
+ public static final String XREGISTRY = "xregistry";
+ public static final String PROXYSERVER = "proxyserver";
+ public static final String MYLEAD = "mylead";
+ public static final String MSGBOX = "msgbox";
+ public static final String GFAC = "gfac";
+ public static final String DSC = "dsc";
+ public static final String BROKER = "broker";
+
+ public static void main(String[] args) throws AxisFault, RemoteException, GraphException, ComponentException {
+
+ String workflowAsString = getWorkflow();
+ Workflow workflow = new Workflow(workflowAsString);
+
+ NameValue[] configurations = new NameValue[2];
+ configurations[0] = new NameValue();
+ configurations[0].setName(Main.GFAC);
+ configurations[0].setValue(XBayaConstants.DEFAULT_GFAC_URL.toString());
+ configurations[1] = new NameValue();
+ configurations[1].setName(Main.XREGISTRY);
+ configurations[1].setValue(XBayaConstants.DEFAULT_XREGISTRY_URL.toString());
+ //set more like dsc ets look at constants in Main
+
+ NameValue[] inputs = new NameValue[1];
+ inputs[0] = new NameValue();
+ inputs[0].setName("input");
+ inputs[0].setValue("myechoString");
+
+
+
+
+ new WorkflowInterpretorStub("http://silktree.cs.indiana.edu:18080/axis2/services/WorkflowInterpretor?wsdl").launchWorkflow(workflowAsString, "mytopic", "changeme", "chathura", inputs , configurations);
+ }
+
+
+ private static String getWorkflow() {
+ File file = new File(
+ "/nfs/mneme/home/users/cherath/projects/test/extremeWorkspace/xbaya/workflows/1-concrete-echo.xwf");
+ String workflowAsString = "";
+ try {
+ BufferedReader in = new BufferedReader(new FileReader(file));
+ String line = in.readLine();
+
+ while (null != line) {
+ workflowAsString += line;
+ line = in.readLine();
+ }
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return workflowAsString;
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/WorkflowInterpretorCallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/WorkflowInterpretorCallbackHandler.java?rev=1103180&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/WorkflowInterpretorCallbackHandler.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/workflow-interpreter/client/src/edu/indiana/extreme/xbaya/WorkflowInterpretorCallbackHandler.java Sat May 14 18:34:50 2011
@@ -0,0 +1,66 @@
+
+/**
+ * WorkflowInterpretorCallbackHandler.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.4 Built on : Apr 26, 2008 (06:24:30 EDT)
+ */
+
+ package edu.indiana.extreme.xbaya;
+
+ /**
+ * WorkflowInterpretorCallbackHandler Callback class, Users can extend this class and implement
+ * their own receiveResult and receiveError methods.
+ */
+ public abstract class WorkflowInterpretorCallbackHandler{
+
+
+
+ protected Object clientData;
+
+ /**
+ * User can pass in any object that needs to be accessed once the NonBlocking
+ * Web service call is finished and appropriate method of this CallBack is called.
+ * @param clientData Object mechanism by which the user can pass in user data
+ * that will be avilable at the time this callback is called.
+ */
+ public WorkflowInterpretorCallbackHandler(Object clientData){
+ this.clientData = clientData;
+ }
+
+ /**
+ * Please use this constructor if you don't want to set any clientData
+ */
+ public WorkflowInterpretorCallbackHandler(){
+ this.clientData = null;
+ }
+
+ /**
+ * Get the client data
+ */
+
+ public Object getClientData() {
+ return clientData;
+ }
+
+
+ /**
+ * auto generated Axis2 call back method for launchWorkflow method
+ * override this method for handling normal response from launchWorkflow operation
+ */
+ public void receiveResultlaunchWorkflow(
+ java.lang.String result
+ ) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ * override this method for handling error response from launchWorkflow operation
+ */
+ public void receiveErrorlaunchWorkflow(java.lang.Exception e) {
+ }
+
+
+
+ }
+
\ No newline at end of file