Examples of BPELProcessDefinition


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

   
    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
       
        // Lookup a definition for the given namespace
        QName qname = ((BPELProcessDefinition)unresolved).getName();
        BPELProcessDefinition resolved = (BPELProcessDefinition) map.get(qname);
        if (resolved != null) {
            return modelClass.cast(resolved);
        }
       
        // No definition found, delegate the resolution to the imports
        for (Import import_ : this.contribution.getImports()) {
            if (import_ instanceof NamespaceImport) {
                NamespaceImport namespaceImport = (NamespaceImport)import_;
                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
                   
                    // Delegate the resolution to the 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 (BPEL_PROCESS_DEFINITION.equals(qname) || BPEL_EXECUTABLE_DEFINITION.equals(qname)) {
                            QName processName = new QName(getString(reader, 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())) {
                            completed = true;
View Full Code Here

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

      this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
        this.contribution = contribution;
    }

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

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

    public Object removeModel(Object resolved, ProcessorContext context) {
        return map.remove(((BPELProcessDefinition)resolved).getName());
    }
   
    public <T> T resolveModel(Class<T> modelClass, T unresolved, ProcessorContext context) {     
      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, context);
                      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, context);
            if (!resolved.isUnresolved()) {
                return modelClass.cast(resolved);
            }
        }
       
       
        // Not found, Lookup a definition for the given namespace, within contribution      
        resolved = (BPELProcessDefinition) map.get(qname);
       
        if(resolved.isUnresolved()) {
          try {
            resolve(resolved, context);
          } catch(Exception e) {
            //FIXME
          }
View Full Code Here

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

        return implementation;
    }

    public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
        if( impl != null && impl.isUnresolved()) {
            BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(impl, resolver);
            if(processDefinition.isUnresolved()) {
                throw new ContributionResolveException("Can't find BPEL Process : " + processDefinition.getName());
            }
           
            impl.setProcessDefinition(processDefinition);
           
            //resolve component type
View Full Code Here

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

        //FIXME Implement
    }

    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);
    }
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 = indexRead(artifactURL);
            processDefinition.setURI(artifactURI);
            processDefinition.setUnresolved(false);
        } catch (Exception e) {
            throw new ContributionReadException(e);
        }
       
        return processDefinition;
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.