Package org.apache.axis2.engine

Examples of org.apache.axis2.engine.Phase


                // get the correct object-specific name
                String qnameAsString;

                if (obj instanceof Phase) {
                    Phase phaseObj = (Phase) obj;
                    qnameAsString = phaseObj.getName();

                    // add the list of handlers to the meta data
                    setupPhaseList(phaseObj, mdEntry);
                } else if (obj instanceof Handler) {
                    Handler handlerObj = (Handler) obj;
                    qnameAsString = handlerObj.getName();
                } else {
                    // TODO: will there be any other kinds of objects in the execution Chain?
                    qnameAsString = "NULL";
                }

                mdEntry.setQName(qnameAsString);

                // update the index for the entry in the chain

                if (DEBUG_ENABLED && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***BEFORE OBJ WRITE*** executionChain entry class [" +
                            objClass + "] qname [" + qnameAsString + "]");
                }

                out.writeObject(mdEntry);

                // update the index so that the index
                // now indicates the next entry that
                // will be attempted
                nextIndex++;

                if (DEBUG_ENABLED && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***AFTER OBJ WRITE*** executionChain entry class [" +
                            objClass + "] qname [" + qnameAsString + "]");
                }

            } // end while entries in execution chain

            // done with the entries in the execution chain
            // add the end-of-list marker
            MetaDataEntry lastEntry = new MetaDataEntry();
            lastEntry.setClassName(MetaDataEntry.END_OF_LIST);

            out.writeObject(lastEntry);
            nextIndex++;

            // nextIndex also gives us the number of entries
            // that were actually saved as opposed to the
            // number of entries in the executionChain
            out.writeInt(nextIndex);

        } else {
            // general case: handle "null" or "empty"
            out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);

            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString + ":writeExternal(): executionChain is NULL");
            }
        }

        //---------------------------------------------------------
        // LinkedList executedPhases
        //---------------------------------------------------------
        // The strategy is to save some metadata about each
        // member of the list and the order of the list.
        // Then when the message context is re-constituted,
        // try to match up with phases and handlers on the
        // engine.
        //
        // Non-null list:
        //    UTF          - description string
        //    boolean      - active flag
        //    int          - expected number of entries in the list
        //    objects      - MetaDataEntry object per list entry
        //                        last entry will be empty MetaDataEntry
        //                        with MetaDataEntry.LAST_ENTRY marker
        //    int          - adjusted number of entries in the list
        //                        includes the last empty entry
        //
        // Empty list:
        //    UTF          - description string
        //    boolean      - empty flag
        //---------------------------------------------------------
        out.writeUTF("executedPhases");
        if (executedPhases != null && executedPhases.size() > 0) {

            // start writing data to the output stream
            out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
            out.writeInt(executedPhases.size());

            // put the metadata on each member of the list into a buffer

            int execNextIndex = 0;

            Iterator<Handler> iterator = executedPhases.iterator();

            while (iterator.hasNext()) {
                Object obj = iterator.next();
                String objClass = obj.getClass().getName();
                // start the meta data entry for this object
                MetaDataEntry mdEntry = new MetaDataEntry();
                mdEntry.setClassName(objClass);

                // get the correct object-specific name
                String qnameAsString;

                if (obj instanceof Phase) {
                    Phase inPhaseObj = (Phase) obj;
                    qnameAsString = inPhaseObj.getName();

                    // add the list of handlers to the meta data
                    setupPhaseList(inPhaseObj, mdEntry);
                } else if (obj instanceof Handler) {
                    Handler inHandlerObj = (Handler) obj;
View Full Code Here


                // get the correct object-specific name
                String qnameAsString;

                if (obj instanceof Phase) {
                    // nested condition, the phase object contains another phase!
                    Phase phaseObj = (Phase) obj;
                    qnameAsString = phaseObj.getName();

                    // add the list of handlers to the meta data
                    setupPhaseList(phaseObj, mdEntry);
                } else if (obj instanceof Handler) {
                    Handler handlerObj = (Handler) obj;
View Full Code Here

    }

    private void checkAction(MessageContext msgContext) throws AxisFault {

        Phase addPhase = getAddressingPhase(msgContext);

        if (addPhase == null) {
            logger.error("unable to locate addressing phase object");
        }
        if (msgContext != null) {
            if (msgContext.getCurrentPhaseIndex() + 1 == addPhase.getHandlerCount()) {
                if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null)
                    AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
            }
        }
View Full Code Here

        return messageBoxOperation;
    }

    private void checkAction(MessageContext msgContext) throws AxisFault {

        Phase addPhase = getAddressingPhase(msgContext);

        if (addPhase == null) {
            logger.error("unable to locate addressing phase object");
        }
        if (msgContext != null) {
            if (msgContext.getCurrentPhaseIndex() + 1 == addPhase.getHandlerCount()) {
                if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null)
                    AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
            }
        }
    }
View Full Code Here

        /*
         * Add dispatcher and security handler to inFlowPhases
         */
        for (Iterator<Phase> iterator = phases.iterator(); iterator.hasNext();) {
            Phase phase = (Phase) iterator.next();
            if ("Security".equals(phase.getPhaseName())) {
                phase.addHandler(new MyProxySecurityHandler());
                phase.addHandler(new AmazonSecurityHandler());
            } else if ("Dispatch".equals(phase.getPhaseName())) {
                phase.addHandler(new GFacURIBasedDispatcher(), 0);
            }
        }

        initializeRepository(configctx);
    }
View Full Code Here

        /*
         * Add dispatcher and security handler to inFlowPhases
         */
        for (Iterator<Phase> iterator = phases.iterator(); iterator.hasNext();) {
            Phase phase = (Phase) iterator.next();
            if ("Security".equals(phase.getPhaseName())) {
                phase.addHandler(new MyProxySecurityHandler());
                phase.addHandler(new AmazonSecurityHandler());
            } else if ("Dispatch".equals(phase.getPhaseName())) {
                phase.addHandler(new GFacURIBasedDispatcher(), 0);
            }
        }

        initializeRepository(configctx);
    }
View Full Code Here

    }

    public void testDynamicPhase() {
        ArrayList inFlow = axisConfig.getInFlowPhases();
        for (int i = 0; i < inFlow.size(); i++) {
            Phase phase = (Phase) inFlow.get(i);
            if (phase.getName().equals("NewPhase")) {
                assertEquals("Wrong index for NewPhase!", 3, i);
                assertEquals("Wrong # of handlers in NewPhase", 1, phase.getHandlerCount());
                Handler h6 = (Handler)phase.getHandlers().get(0);
                assertTrue("Wrong type for handler", h6 instanceof Handler3);
            }
        }

        inFlow = axisConfig.getInFaultFlowPhases();
        boolean found = false;
        for (int i = 0; i < inFlow.size(); i++) {
            Phase phase = (Phase) inFlow.get(i);
            if (phase.getName().equals("NewPhase")) {
                found = true;
            }
        }
        assertTrue("NewPhase wasn't found in InFaultFlow", found);
    }
View Full Code Here

    // Some shared Handlers and HandlerDescriptions
    // TODO : Factor out shared data for these tests

    public void testBefore() throws AxisFault {
        ArrayList phases = new ArrayList();
        Phase p1 = new Phase("PhaseA");
        phases.add(p1);
        Phase p2 = new Phase("PhaseB");
        phases.add(p2);

        MessageContext msg =
                new ConfigurationContext(new AxisConfiguration()).createMessageContext();
View Full Code Here

        p1.invoke(msg);
    }

    public void testBeforewithNoFirst() throws AxisFault {
        ArrayList phases = new ArrayList();
        Phase p1 = new Phase("PhaseA");
        phases.add(p1);
        Phase p2 = new Phase("PhaseB");
        phases.add(p2);

        MessageContext msg =
                new ConfigurationContext(new AxisConfiguration()).createMessageContext();
        PhaseHolder ph = new PhaseHolder(phases);
View Full Code Here

        p1.invoke(msg);
    }

    public void testBeforeAfter() throws Exception {
        ArrayList phases = new ArrayList();
        Phase p1 = new Phase("PhaseA");
        phases.add(p1);
        Phase p2 = new Phase("PhaseB");
        phases.add(p2);

        PhaseHolder ph = new PhaseHolder(phases);
        HandlerDescription hm = new HandlerDescription();
        hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
View Full Code Here

TOP

Related Classes of org.apache.axis2.engine.Phase

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.