Package org.apache.ode.bpel.o

Examples of org.apache.ode.bpel.o.OCatch


        OScope oscope = _structureStack.topScope();
        oscope.faultHandler = new OFaultHandler(_oprocess);
        if (fh == null) {
            // The default fault handler compensates all child activities
            // AND then rethrows the fault!
            final OCatch defaultCatch = new OCatch(_oprocess, oscope);
            defaultCatch.name = "__defaultFaultHandler:" + oscope.name;
            defaultCatch.faultName = null; // catch any fault
            defaultCatch.faultVariable = null;
            OSequence sequence = new OSequence(_oprocess, defaultCatch);
            sequence.name = "__defaultFaultHandler_sequence:" + oscope.name;
            sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity.");
            ORethrow rethrow = new ORethrow(_oprocess, sequence);
            rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name;
            rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity.");
            sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope));
            sequence.sequence.add(rethrow);

            defaultCatch.activity = sequence;
            oscope.faultHandler.catchBlocks.add(defaultCatch);
            if (__log.isDebugEnabled())
                __log.debug("Compiled default catch block " + defaultCatch + " for " + oscope);

        } else {
            _recoveryContextStack.push(oscope);
            try {

                int i = 0;
                for (final Catch catchSrc : fh.getCatches()) {
                    final OCatch ctch = new OCatch(_oprocess, oscope);
                    ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString());
                    ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name;
                    ctch.faultName = catchSrc.getFaultName();
                    compile(ctch, catchSrc, new Runnable() {
                        public void run() {

                            if (catchSrc.getFaultVariable() != null) {
                                OScope.Variable faultVar;
                                switch (_processDef.getBpelVersion()) {
                                case BPEL11:
                                    faultVar = resolveVariable(catchSrc.getFaultVariable());
                                    if (!(faultVar.type instanceof OMessageVarType))
                                        throw new CompilationException(__cmsgs.errMessageVariableRequired(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    break;
                                case BPEL20_DRAFT:
                                case BPEL20:
                                    if (catchSrc.getFaultVariableMessageType() == null
                                            && catchSrc.getFaultVariableElementType() == null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    if (catchSrc.getFaultVariableMessageType() != null
                                            && catchSrc.getFaultVariableElementType() != null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));

                                    OVarType faultVarType;
                                    if (catchSrc.getFaultVariableMessageType() != null)
                                        faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType());
                                    else if (catchSrc.getFaultVariableElementType() != null)
                                        faultVarType = resolveElementType(catchSrc.getFaultVariableElementType());
                                    else
                                        throw new CompilationException(__cmsgs
                                                .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable()));

                                    faultVar = new OScope.Variable(_oprocess, faultVarType);
                                    faultVar.name = catchSrc.getFaultVariable();
                                    faultVar.declaringScope = _structureStack.topScope();

                                    ctch.addLocalVariable(faultVar);
                                    break;
                                default:
                                    throw new AssertionError("Unexpected BPEL VERSION constatnt: "
                                            + _processDef.getBpelVersion());
                                }
View Full Code Here


        proc.procesScope = new OScope(proc, null);
        OThrow othrow = new OThrow(proc, proc.procesScope);
        othrow.faultName = new QName("foo", "bar");
        proc.procesScope.activity = othrow;
        proc.procesScope.faultHandler = new OFaultHandler(proc);
        OCatch ocatch = new OCatch(proc, proc.procesScope);
        proc.procesScope.faultHandler.catchBlocks.add(ocatch);
        ocatch.activity = new OEmpty(proc, ocatch);
        run(proc);

        assertTrue(_completedOk);
View Full Code Here

        proc.procesScope = new OScope(proc, null);
        OThrow othrow = new OThrow(proc, proc.procesScope);
        othrow.faultName = new QName("foo", "bar");
        proc.procesScope.activity = othrow;
        proc.procesScope.faultHandler = new OFaultHandler(proc);
        OCatch ocatch = new OCatch(proc, proc.procesScope);
        proc.procesScope.faultHandler.catchBlocks.add(ocatch);
        ocatch.activity = new OEmpty(proc, ocatch);
        run(proc);

        assertTrue(_completedOk);
View Full Code Here

    }


    private static OCatch findCatch(OFaultHandler fh, QName faultName, OVarType faultType) {
        OCatch bestMatch = null;
        for (Iterator<OCatch> i = fh.catchBlocks.iterator(); i.hasNext();) {
            OCatch c = i.next();

            // First we try to eliminate this catch block based on fault-name mismatches:
            if (c.faultName != null) {
                if (faultName == null)
                    continue;
View Full Code Here

                } else if (_fault != null) {

                    sendEvent(new ScopeFaultEvent(_fault.getFaultName(), _fault.getFaultLineNo(),_fault.getExplanation()));

                    // Find a fault handler for our fault.
                    OCatch catchBlock = _oscope.faultHandler == null ? null : findCatch(_oscope.faultHandler, _fault.getFaultName(), _fault.getFaultType());

                    // Collect all the compensation data for completed child scopes.
                    assert !!_eventHandlers.isEmpty();
                    assert _child == null;
                    if (catchBlock == null) {
View Full Code Here

        OScope oscope = _structureStack.topScope();
        oscope.faultHandler = new OFaultHandler(_oprocess);
        if (fh == null) {
            // The default fault handler compensates all child activities
            // AND then rethrows the fault!
            final OCatch defaultCatch = new OCatch(_oprocess, oscope);
            defaultCatch.name = "__defaultFaultHandler:" + oscope.name;
            defaultCatch.faultName = null; // catch any fault
            defaultCatch.faultVariable = null;
            OSequence sequence = new OSequence(_oprocess, defaultCatch);
            sequence.name = "__defaultFaultHandler_sequence:" + oscope.name;
            sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity.");
            ORethrow rethrow = new ORethrow(_oprocess, sequence);
            rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name;
            rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity.");
            sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope));
            sequence.sequence.add(rethrow);

            defaultCatch.activity = sequence;
            oscope.faultHandler.catchBlocks.add(defaultCatch);
            if (__log.isDebugEnabled())
                __log.debug("Compiled default catch block " + defaultCatch + " for " + oscope);

        } else {
            _recoveryContextStack.push(oscope);
            try {

                int i = 0;
                for (final Catch catchSrc : fh.getCatches()) {
                    final OCatch ctch = new OCatch(_oprocess, oscope);
                    ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString());
                    ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name;
                    ctch.faultName = catchSrc.getFaultName();
                    compile(ctch, catchSrc, new Runnable() {
                        public void run() {

                            if (catchSrc.getFaultVariable() != null) {
                                OScope.Variable faultVar;
                                switch (_processDef.getBpelVersion()) {
                                case BPEL11:
                                    faultVar = resolveVariable(catchSrc.getFaultVariable());
                                    if (!(faultVar.type instanceof OMessageVarType))
                                        throw new CompilationException(__cmsgs.errMessageVariableRequired(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    break;
                                case BPEL20_DRAFT:
                                case BPEL20:
                                    if (catchSrc.getFaultVariableMessageType() == null
                                            && catchSrc.getFaultVariableElementType() == null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    if (catchSrc.getFaultVariableMessageType() != null
                                            && catchSrc.getFaultVariableElementType() != null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));

                                    OVarType faultVarType;
                                    if (catchSrc.getFaultVariableMessageType() != null)
                                        faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType());
                                    else if (catchSrc.getFaultVariableElementType() != null)
                                        faultVarType = resolveElementType(catchSrc.getFaultVariableElementType());
                                    else
                                        throw new CompilationException(__cmsgs
                                                .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable()));

                                    faultVar = new OScope.Variable(_oprocess, faultVarType);
                                    faultVar.name = catchSrc.getFaultVariable();
                                    faultVar.declaringScope = _structureStack.topScope();

                                    ctch.addLocalVariable(faultVar);
                                    break;
                                default:
                                    throw new AssertionError("Unexpected BPEL VERSION constatnt: "
                                            + _processDef.getBpelVersion());
                                }
View Full Code Here

        proc.procesScope = new OScope(proc, null);
        OThrow othrow = new OThrow(proc, proc.procesScope);
        othrow.faultName = new QName("foo", "bar");
        proc.procesScope.activity = othrow;
        proc.procesScope.faultHandler = new OFaultHandler(proc);
        OCatch ocatch = new OCatch(proc, proc.procesScope);
        proc.procesScope.faultHandler.catchBlocks.add(ocatch);
        ocatch.activity = new OEmpty(proc, ocatch);
        run(proc);

        assertTrue(_completedOk);
View Full Code Here

        OScope oscope = _structureStack.topScope();
        oscope.faultHandler = new OFaultHandler(_oprocess);
        if (fh == null) {
            // The default fault handler compensates all child activities
            // AND then rethrows the fault!
            final OCatch defaultCatch = new OCatch(_oprocess, oscope);
            defaultCatch.name = "__defaultFaultHandler:" + oscope.name;
            defaultCatch.faultName = null; // catch any fault
            defaultCatch.faultVariable = null;
            OSequence sequence = new OSequence(_oprocess, defaultCatch);
            sequence.name = "__defaultFaultHandler_sequence:" + oscope.name;
            sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity.");
            ORethrow rethrow = new ORethrow(_oprocess, sequence);
            rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name;
            rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity.");
            sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope));
            sequence.sequence.add(rethrow);

            defaultCatch.activity = sequence;
            oscope.faultHandler.catchBlocks.add(defaultCatch);
            if (__log.isDebugEnabled())
                __log.debug("Compiled default catch block " + defaultCatch + " for " + oscope);

        } else {
            _recoveryContextStack.push(oscope);
            try {

                int i = 0;
                for (final Catch catchSrc : fh.getCatches()) {
                    final OCatch ctch = new OCatch(_oprocess, oscope);
                    ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString());
                    ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name;
                    ctch.faultName = catchSrc.getFaultName();
                    compile(ctch, catchSrc, new Runnable() {
                        public void run() {

                            if (catchSrc.getFaultVariable() != null) {
                                OScope.Variable faultVar;
                                switch (_processDef.getBpelVersion()) {
                                case BPEL11:
                                    faultVar = resolveVariable(catchSrc.getFaultVariable());
                                    if (!(faultVar.type instanceof OMessageVarType))
                                        throw new CompilationException(__cmsgs.errMessageVariableRequired(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    break;
                                case BPEL20_DRAFT:
                                case BPEL20:
                                    if (catchSrc.getFaultVariableMessageType() == null
                                            && catchSrc.getFaultVariableElementType() == null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));
                                    if (catchSrc.getFaultVariableMessageType() != null
                                            && catchSrc.getFaultVariableElementType() != null)
                                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(
                                                catchSrc.getFaultVariable()).setSource(catchSrc));

                                    OVarType faultVarType;
                                    if (catchSrc.getFaultVariableMessageType() != null)
                                        faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType());
                                    else if (catchSrc.getFaultVariableElementType() != null)
                                        faultVarType = resolveElementType(catchSrc.getFaultVariableElementType());
                                    else
                                        throw new CompilationException(__cmsgs
                                                .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable()));

                                    faultVar = new OScope.Variable(_oprocess, faultVarType);
                                    faultVar.name = catchSrc.getFaultVariable();
                                    faultVar.declaringScope = _structureStack.topScope();

                                    ctch.addLocalVariable(faultVar);
                                    break;
                                default:
                                    throw new AssertionError("Unexpected BPEL VERSION constatnt: "
                                            + _processDef.getBpelVersion());
                                }
View Full Code Here

    }


    private static OCatch findCatch(OFaultHandler fh, QName faultName, OVarType faultType) {
        OCatch bestMatch = null;
        for (OCatch c : fh.catchBlocks) {
            // First we try to eliminate this catch block based on fault-name mismatches:
            if (c.faultName != null) {
                if (faultName == null)
                    continue;
View Full Code Here

                } else if (_fault != null) {

                    sendEvent(new ScopeFaultEvent(_fault.getFaultName(), _fault.getFaultLineNo(),_fault.getExplanation()));

                    // Find a fault handler for our fault.
                    OCatch catchBlock = _oscope.faultHandler == null ? null : findCatch(_oscope.faultHandler, _fault.getFaultName(), _fault.getFaultType());

                    // Collect all the compensation data for completed child scopes.
                    assert !!_eventHandlers.isEmpty();
                    assert _child == null;
                    if (catchBlock == null) {
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.o.OCatch

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.