Examples of BPELProcessDefinition


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

     * @return
     * @throws IOException
     * @throws XMLStreamException
     */
    protected BPELProcessDefinition indexRead(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);
            int eventType = reader.getEventType();
            while (true) {
                if (eventType == XMLStreamConstants.START_ELEMENT) {
                    QName elementName = reader.getName();
                    if (BPEL_PROCESS_DEFINITION.equals(elementName) || BPEL_EXECUTABLE_DEFINITION.equals(elementName) ) {
                        QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE), getString(reader, NAME_ELEMENT));
                        processDefinition.setName(processName);
                        break;
                    }
                }
                if (reader.hasNext()) {
                    eventType = reader.next();
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, ModelFactoryExtensionPoint 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, 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())) {
                            completed = true;
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, context);
            //resolveBPELImports(processDefinition, resolver);
            if(processDefinition.isUnresolved()) {
              error(context.getMonitor(), "BPELProcessNotFound", implementation, processDefinition.getName());
            } else {           
                implementation.setProcessDefinition(processDefinition);
           
                // Get the component type from the process definition
                generateComponentType( implementation, context.getMonitor() );
View Full Code Here

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

    } // end write

    private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
        QName processName = impl.getProcess();
        BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
        processDefinition.setName(processName);
        processDefinition.setUnresolved(true);
       
        return resolver.resolveModel(BPELProcessDefinition.class, processDefinition, context);
    } // end resolveBPELProcessDefinition
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.