Package xsul5.wsdl.plnk

Examples of xsul5.wsdl.plnk.PartnerLinkType


 

  public XmlElement generate(String workflowName, WsdlDefinitions workflowWSDL, GpelProcess gpelProcess, Map<String, WsdlDefinitions> wsdls) throws GraphException{
   
    Iterator<WsdlService> services = workflowWSDL.services().iterator();
    WsdlService service = null;
    if(services.hasNext()){
      service = services.next();
    }else{
      throw new IllegalStateException("NO Service found in the workflow WSDL:"+workflowName);
    }
   
    Iterator<WsdlPort> ports = service.ports().iterator();
    WsdlPort port = null;
    if(ports.hasNext()){
      port = ports.next();
    }else{
      throw new IllegalStateException("NO Port found in the workflow WSDL:"+workflowName);
    }
    String targetNamespace = gpelProcess.getTargetNamespace();
    String targetNamespacePrefix = "wfns";
   
   
   
    XmlNamespace odeNs = builder.newNamespace("http://www.apache.org/ode/schemas/dd/2007/03");
    XmlElement deploy = builder.newFragment(odeNs, "deploy");
    deploy.declareNamespace(PROCESS, targetNamespace);
    deploy.declareNamespace(targetNamespacePrefix, workflowWSDL.getTargetNamespace());
   
   
    XmlElement process = deploy.addElement(odeNs, PROCESS);
    process.setAttributeValue(NAME, PROCESS+":"+workflowName);
    //active
    XmlElement active = process.addElement(odeNs, "active");
    active.addChild("true");
   
    //provide
    XmlElement provide = process.addElement
    (odeNs, "provide");
    provide.setAttributeValue("partnerLink", "workflowUserPartner");
    XmlElement providerService = provide.addElement(odeNs, "service");
    providerService.setAttributeValue("port", port.getName());
    providerService.setAttributeValue(NAME, targetNamespacePrefix+":"+service.getName());
   
   
   
    org.xmlpull.infoset.XmlElement wsdlXml = workflowWSDL.xml();
    Iterable<org.xmlpull.infoset.XmlElement> partnerLinkTypes = wsdlXml.elements(null, "partnerLinkType");
   
    GpelPartnerLinksContainer partnerLinks = gpelProcess.getPartnerLinks();
    Iterable<GpelPartnerLink> partnerLinkList = partnerLinks.partnerLinks();
   
    HashMap<String, String> newNamespaceMap = new HashMap<String, String>();
   
   
    for (GpelPartnerLink link : partnerLinkList) {
      String partnerRole = link.getPartnerRole();
      if(null != partnerRole){
        //These are the parrtner links that are non providers
        XmlElement invoke = process.addElement(odeNs, "invoke");
        invoke.setAttributeValue("partnerLink", link.getName());
       
        XmlElement invokeService = invoke.addElement(odeNs, "service");
//        invokeService.addAttribute("name", arg1)
        QName partnerLinkTypeQName = link.getPartnerLinkTypeQName();
        Iterator<org.xmlpull.infoset.XmlElement> plIterator = partnerLinkTypes.iterator();
        while(plIterator.hasNext()){
          org.xmlpull.infoset.XmlElement plType = plIterator.next();
          XmlAttribute plTypeName = plType.attribute(NAME);
          if(plTypeName.getValue().equals(partnerLinkTypeQName.getLocalPart())){
            //found the correct partnerlink type
            //now find the porttype
             
            XmlAttribute plPortType = plType.element("role").attribute("portType");
            String portTypeQnameString = plPortType.getValue();
            String[] portTypeSegs = portTypeQnameString.split(":");
            Iterator<org.xmlpull.infoset.XmlNamespace> namespaceIterator = wsdlXml.namespaces().iterator();
            QName portTypeQname = null;
            //find the qname of the porttype
            while (namespaceIterator.hasNext()) {
              org.xmlpull.infoset.XmlNamespace ns = (org.xmlpull.infoset.XmlNamespace) namespaceIterator.next();
              if(ns.getPrefix().equals(portTypeSegs[0])){
                portTypeQname = new QName(ns.getName(), portTypeSegs[1]);
              }
             
            }
           
            //now go through the WSDLS and find the one with the proper port type
            Set<String> keys = wsdls.keySet();
            for (String key : keys) {
              WsdlDefinitions wsdl = wsdls.get(key);
              WsdlPortType portType = wsdl.getPortType(portTypeQname.getLocalPart());
              if(null != portType && portType.getQName().equals(portTypeQname)){
                // this is the right porttype so extract the service and you will be done
                Iterator<WsdlService> svcIterator = wsdl.services().iterator();
                String nsPrefix = null;
                if(svcIterator.hasNext()){
                  WsdlService plService = svcIterator.next();
                  if(null == newNamespaceMap.get(wsdl.getTargetNamespace())){
                    nsPrefix = "p"+newNamespaceMap.size();
                    newNamespaceMap.put(wsdl.getTargetNamespace(), nsPrefix);
                  }else{
                    nsPrefix = newNamespaceMap.get(wsdl.getTargetNamespace());
                  }
                 
                  String portName = null;
                  Iterator<WsdlPort> portItr = plService.ports().iterator();
                  if(portItr.hasNext()){
                    portName = portItr.next().getName();
                  }
                  invokeService.setAttributeValue(NAME, nsPrefix+":"+plService.getName());
                  invokeService.setAttributeValue("port", portName);
                 
                }
              }
            }
View Full Code Here


        }

        GpelAssign assign = new GpelAssign(this.bpelNS, copies);
        sequence.addActivity(assign);

        PartnerLinkRole partnerRoll = this.workflowWSDL
                .getPartnerRoll(portTypeQName);
        if (partnerRoll == null) {
            String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
            String partnerRollName = id + PARTNER_ROLE_SUFFIX;
            partnerRoll = this.workflowWSDL.addPartnerLinkTypeAndRoll(
                    partnerLinkTypeName, partnerRollName, portTypeQName);
        }
        PartnerLinkType partnerLinkType = partnerRoll.getPartnerLinkType();

        // partnerLink
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS,
                partnerLinkType.getName(), null, partnerRoll.getName());

        // Invoke
        GpelInvoke invoke = new GpelInvoke(this.bpelNS, partnerLinkName, namespace,
                portTypeQName.getLocalPart(), operation);
        invoke.setName(INVOKE_NAME_PREFIX + id);
View Full Code Here

    public PartnerLinkRole addPartnerLinkTypeAndRoll(
            String partnerLinkTypeName, String partnerRollName,
            QName servicePortTypeQName) {
        PartnerLinkType partnerLinkType = new PartnerLinkType(
                partnerLinkTypeName);
        PartnerLinkRole partnerRoll = new PartnerLinkRole(partnerRollName,
                servicePortTypeQName);
        partnerLinkType.addRole(partnerRoll);

        declareNamespaceIfNecessary("p",
                servicePortTypeQName.getNamespaceURI(), true);
View Full Code Here

            String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
            String partnerRollName = id + PARTNER_ROLE_SUFFIX;
            partnerRoll = this.workflowWSDL.addPartnerLinkTypeAndRoll(
                    partnerLinkTypeName, partnerRollName, portTypeQName);
        }
        PartnerLinkType partnerLinkType = partnerRoll.getPartnerLinkType();

        // partnerLink
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS,
                partnerLinkType.getName(), null, partnerRoll.getName());

        // Invoke
        GpelInvoke invoke = new GpelInvoke(this.bpelNS, partnerLinkName, namespace,
                portTypeQName.getLocalPart(), operation);
        invoke.setName(INVOKE_NAME_PREFIX + id);
View Full Code Here

     * @return PartnerLinkRole
     */
    public PartnerLinkRole addPartnerLinkTypeAndRoll(
            String partnerLinkTypeName, String partnerRollName,
            QName servicePortTypeQName) {
        PartnerLinkType partnerLinkType = new PartnerLinkType(
                partnerLinkTypeName);
        PartnerLinkRole partnerRoll = new PartnerLinkRole(partnerRollName,
                servicePortTypeQName);
        partnerLinkType.addRole(partnerRoll);

        declareNamespaceIfNecessary("p",
                servicePortTypeQName.getNamespaceURI(), true);
        this.definitions.xml().addElement(partnerLinkType.xml());

        this.partnerLinkRoleMap.put(servicePortTypeQName, partnerRoll);
        return partnerRoll;
    }
View Full Code Here

     * @param servicePortTypeQName
     * @return PartnerLinkRole
     */
    public PartnerLinkRole addPartnerLinkTypeAndRoll(String partnerLinkTypeName, String partnerRollName,
            QName servicePortTypeQName) {
        PartnerLinkType partnerLinkType = new PartnerLinkType(partnerLinkTypeName);
        PartnerLinkRole partnerRoll = new PartnerLinkRole(partnerRollName, servicePortTypeQName);
        partnerLinkType.addRole(partnerRoll);

        declareNamespaceIfNecessary("p", servicePortTypeQName.getNamespaceURI(), true);
        this.definitions.xml().addElement(partnerLinkType.xml());

        this.partnerLinkRoleMap.put(servicePortTypeQName, partnerRoll);
        return partnerRoll;
    }
View Full Code Here

            String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
            String partnerRollName = id + PARTNER_ROLE_SUFFIX;
            partnerRoll = this.workflowWSDL.addPartnerLinkTypeAndRoll(partnerLinkTypeName, partnerRollName,
                    portTypeQName);
        }
        PartnerLinkType partnerLinkType = partnerRoll.getPartnerLinkType();

        // partnerLink
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS, partnerLinkType.getName(), null,
                partnerRoll.getName());

        // Invoke
        GpelInvoke invoke = new GpelInvoke(this.bpelNS, partnerLinkName, namespace, portTypeQName.getLocalPart(),
                operation);
View Full Code Here

            String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
            String partnerRollName = id + PARTNER_ROLE_SUFFIX;
            partnerRoll = this.workflowWSDL.addPartnerLinkTypeAndRoll(partnerLinkTypeName, partnerRollName,
                    portTypeQName);
        }
        PartnerLinkType partnerLinkType = partnerRoll.getPartnerLinkType();

        // partnerLink
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS, partnerLinkType.getName(), null,
                partnerRoll.getName());

        // Invoke
        GpelInvoke invoke = new GpelInvoke(this.bpelNS, partnerLinkName, namespace, portTypeQName.getLocalPart(),
                operation);
View Full Code Here

            String partnerLinkTypeName = id + PARTNER_LINK_TYPE_SUFFIX;
            String partnerRollName = id + PARTNER_ROLE_SUFFIX;
            partnerRoll = this.workflowWSDL.addPartnerLinkTypeAndRoll(partnerLinkTypeName, partnerRollName,
                    portTypeQName);
        }
        PartnerLinkType partnerLinkType = partnerRoll.getPartnerLinkType();

        // partnerLink
        String partnerLinkName = createPartnerLinkName(id);
        XmlNamespace partnerLinkTypeNS = this.targetNamespace;
        this.process.addPartnerLink(partnerLinkName, partnerLinkTypeNS, partnerLinkType.getName(), null,
                partnerRoll.getName());

        // Invoke
        GpelInvoke invoke = new GpelInvoke(this.bpelNS, partnerLinkName, namespace, portTypeQName.getLocalPart(),
                operation);
View Full Code Here

     * @param servicePortTypeQName
     * @return PartnerLinkRole
     */
    public PartnerLinkRole addPartnerLinkTypeAndRoll(String partnerLinkTypeName, String partnerRollName,
            QName servicePortTypeQName) {
        PartnerLinkType partnerLinkType = new PartnerLinkType(partnerLinkTypeName);
        PartnerLinkRole partnerRoll = new PartnerLinkRole(partnerRollName, servicePortTypeQName);
        partnerLinkType.addRole(partnerRoll);

        declareNamespaceIfNecessary("p", servicePortTypeQName.getNamespaceURI(), true);
        this.definitions.xml().addElement(partnerLinkType.xml());

        this.partnerLinkRoleMap.put(servicePortTypeQName, partnerRoll);
        return partnerRoll;
    }
View Full Code Here

TOP

Related Classes of xsul5.wsdl.plnk.PartnerLinkType

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