Examples of BPELProcessDefinition


Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    public Class<BPELProcessDefinition> getModelType() {
        return BPELProcessDefinition.class;
    }

    public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        BPELProcessDefinition processDefinition = null;
        try {
            //for now we are just using process name
            //and relying on componentType file for service definition
            //so it's OK to set resolved for now
            processDefinition = indexRead2(artifactURL);
            processDefinition.setURI(artifactURI);
            processDefinition.setUnresolved(false);
        } catch (Exception e) {
          ContributionReadException ce = new ContributionReadException(e);
          error("ContributionReadException", artifactURL, ce);
            //throw ce;
        }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    } // end findPartnerLinkType
   
   

    protected BPELProcessDefinition indexRead2(URL doc) throws Exception {
        BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
        processDefinition.setUnresolved(true);
        processDefinition.setLocation(doc);

        InputStream is = doc.openStream();
        XMLStreamReader reader = null;
        try {
            reader = inputFactory.createXMLStreamReader(is);
            /*
             * The principle here is to look for partnerLink elements, which form either services
             * or references.  A partnerLink can be EITHER - the algorithm for deciding is:
             * 1) Explicit marking with sca:reference or sca:service attribute
             * 2) "first use" of the partnerLink by specific BPEL activity elements:
             * <onEvent../>, <receive../> or <pick../> elements imply a service
             * <invoke../> implies a reference
             */
            // TODO - need to handle <scope../> elements as kind of "nested" processes
            // - and scopes introduce the possibility of partnerLinks with the same name at
            // different levels of scope.... (yuk!!)
            boolean completed = false;
            while (!completed) {
                switch (reader.next()) {
                    case START_ELEMENT:
                        QName qname = reader.getName();
                        //System.out.println("BPEL TypeLoader - found element with name: " + qname.toString());
                        if (BPEL_PROCESS_DEFINITION.equals(qname) ||
                          BPEL_EXECUTABLE_DEFINITION.equals(qname)) {
                            QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE),
                                                      getString(reader, NAME_ELEMENT));
                            processDefinition.setName(processName);
                    } else if (PARTNERLINK_ELEMENT.equals(qname)) {
                            processDefinition.getPartnerLinks().add(processPartnerLinkElement( reader ));
                        } else if (ONEVENT_ELEMENT.equals(qname) ||
                               RECEIVE_ELEMENT.equals(qname) ||
                               ONMESSAGE_ELEMENT.equals(qname) ) {
                          processPartnerLinkAsService( reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks() );
                        } else if (INVOKE_ELEMENT.equals(qname)) {
                          processPartnerLinkAsReference( reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks() );
                        } else if (IMPORT_ELEMENT.equals(qname)) {
                          processDefinition.getImports().add( processImportElement( reader ) );
                        } // end if
                        break;
                    case END_ELEMENT:
                        if (PROCESS_ELEMENT.equals(reader.getName())) {
                            //System.out.println("BPEL TypeLoader - finished read of process file");
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

       
      if( implementation != null && implementation.isUnresolved())
      {
          implementation.setModelResolver(resolver);
         
            BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(implementation, resolver);
            if(processDefinition.isUnresolved()) {
              error("BPELProcessNotFound", implementation, processDefinition.getName());
            } else {           
                implementation.setProcessDefinition(processDefinition);
           
                // Get the component type from the process definition
                generateComponentType( implementation );
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    } // end write

    private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
        QName processName = impl.getProcess();
        BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
        processDefinition.setName(processName);
        processDefinition.setUnresolved(true);
       
        return resolver.resolveModel(BPELProcessDefinition.class, processDefinition);
    } // end resolveBPELProcessDefinition
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

        impl.setComponentType(componentType);

        // Each partner link in the process represents either a service or a
        // reference
        // - or both, in the sense of involving a callback
        BPELProcessDefinition theProcess = impl.getProcessDefinition();
        List<BPELPartnerLinkElement> partnerLinks = theProcess.getPartnerLinks();

        for (BPELPartnerLinkElement pLink : partnerLinks) {

            // check that the partner link has been designated as service or
            // reference in SCA terms
            if (pLink.isSCATyped()) {
                String scaName = pLink.getSCAName();
                if (pLink.querySCAType().equals("reference")) {
                    componentType.getReferences().add(generateReference(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces()));
                } else {
                    componentType.getServices().add(generateService(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces()));
                } // end if
            } // end if
        } // end for

    } // end getComponentType
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    public BPELDocumentModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) {
        this.contribution = contribution;
    }

    public void addModel(Object resolved) {
        BPELProcessDefinition process = (BPELProcessDefinition)resolved;
        map.put(process.getName(), process);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

        return map.remove(((BPELProcessDefinition)resolved).getName());
    }
   
    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
       
      BPELProcessDefinition resolved = null;
      QName qname = ((BPELProcessDefinition)unresolved).getName();
     
      // Lookup a definition for the given namespace, from imports
      List<String> locations = new ArrayList<String>();
        // Collection of namespace imports with location
        Map<String, NamespaceImport> locationMap = new HashMap<String, NamespaceImport>();
        for (Import import_ : this.contribution.getImports()) {
            if (import_ instanceof NamespaceImport) {
                NamespaceImport namespaceImport = (NamespaceImport)import_;
                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
                    if (namespaceImport.getLocation() == null) {
                      // Delegate the resolution to the import resolver
                      resolved = namespaceImport.getModelResolver().resolveModel(BPELProcessDefinition.class, (BPELProcessDefinition)unresolved);
                      if (!resolved.isUnresolved()) {
                          return modelClass.cast(resolved);
                      }
                    } else {
                      // We might have multiple imports for the same namespace,
                    // need to search them in lexical order.
                    locations.add(namespaceImport.getLocation());
                    }
                }
            }
        }
        // Search namespace imports with locations in lexical order
        Collections.sort(locations);
        for (String location : locations) {
          NamespaceImport namespaceImport = (NamespaceImport)locationMap.get(location);
          // Delegate the resolution to the namespace import resolver
            resolved =
                namespaceImport.getModelResolver().resolveModel(BPELProcessDefinition.class, (BPELProcessDefinition)unresolved);
            if (!resolved.isUnresolved()) {
                return modelClass.cast(resolved);
            }
        }
       
       
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    public Class<BPELProcessDefinition> getModelType() {
        return BPELProcessDefinition.class;
    }

    public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        BPELProcessDefinition processDefinition = null;
        try {
            // for now we are just using process name
            // and relying on componentType file for service definition
            // so it's OK to set resolved for now
            processDefinition = readProcessDefinition(artifactURL);
            processDefinition.setURI(artifactURI.toString());
            processDefinition.setUnresolved(false);
        } catch (Exception e) {
            ContributionReadException ce = new ContributionReadException(e);
            error("ContributionReadException", artifactURL, ce);
        }
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

     * @param doc
     * @return
     * @throws Exception
     */
    private BPELProcessDefinition readProcessDefinition(URL doc) throws Exception {
        BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
        processDefinition.setUnresolved(true);
        processDefinition.setLocation(doc.toString());

        InputStream is = doc.openStream();
        XMLStreamReader reader = null;
        try {
            reader = inputFactory.createXMLStreamReader(is);

            /*
             * The principle here is to look for partnerLink elements, which
             * form either services or references. A partnerLink can be EITHER -
             * the algorithm for deciding is: 1) Explicit marking with
             * sca:reference or sca:service attribute 2) "first use" of the
             * partnerLink by specific BPEL activity elements: <onEvent../>,
             * <receive../> or <pick../> elements imply a service <invoke../>
             * implies a reference
             */

            // TODO - need to handle <scope../> elements as kind of "nested" processes
            // - and scopes introduce the possibility of partnerLinks with the
            // same name at different levels of scope.... (yuk!!)
            boolean completed = false;
            while (!completed) {
                switch (reader.next()) {
                    case START_ELEMENT:
                        QName qname = reader.getName();
                        if (PROCESS_ELEMENT.equals(qname) || PROCESS_ELEMENT_20.equals(qname)) {
                            QName processName = new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME_ELEMENT));
                            processDefinition.setName(processName);
                        } else if (PARTNERLINK_ELEMENT.equals(qname) || PARTNERLINK_ELEMENT_20.equals(qname)) {
                            processDefinition.getPartnerLinks().add(processPartnerLinkElement(reader));
                        } else if (ONEVENT_ELEMENT.equals(qname) || RECEIVE_ELEMENT.equals(qname) || ONMESSAGE_ELEMENT.equals(qname) ||
                               ONEVENT_ELEMENT_20.equals(qname) || RECEIVE_ELEMENT_20.equals(qname) || ONMESSAGE_ELEMENT_20.equals(qname)) {
                            processPartnerLinkAsService(reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks());
                        } else if (INVOKE_ELEMENT.equals(qname) || INVOKE_ELEMENT_20.equals(qname)) {
                            processPartnerLinkAsReference(reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks());
                        } else if (IMPORT_ELEMENT.equals(qname) || IMPORT_ELEMENT_20.equals(qname)) {
                            processDefinition.getImports().add(processImportElement(reader));
                        } // end if
                        break;
                    case END_ELEMENT:
                      qname = reader.getName();
                      if (PROCESS_ELEMENT.equals(qname) || PROCESS_ELEMENT_20.equals(qname)) {
View Full Code Here

Examples of org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition

    public Class<BPELProcessDefinition> getModelType() {
        return BPELProcessDefinition.class;
    }

    public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        BPELProcessDefinition processDefinition = null;
        try {
            // for now we are just using process name
            // and relying on componentType file for service definition
            // so it's OK to set resolved for now
            processDefinition = readProcessDefinition(artifactURL);
            processDefinition.setURI(artifactURI.toString());
            processDefinition.setUnresolved(false);
        } catch (Exception e) {
            ContributionReadException ce = new ContributionReadException(e);
            error("ContributionReadException", artifactURL, ce);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.