Package org.apache.axis2.util

Examples of org.apache.axis2.util.MetaDataEntry


            Iterator itMeta = metaMessageContextMap.keySet().iterator();

            while (itMeta.hasNext()) {
                String keyM = (String) itMeta.next();

                MetaDataEntry valueM = (MetaDataEntry) metaMessageContextMap.get(keyM);
                String valueM_ID;

                if (valueM != null) {
                    valueM_ID = valueM.getQNameAsString();

                    if (msgID.equals(valueM_ID)) {
                        String label = valueM.getExtraName();

                        if (messageContexts == null) {
                            messageContexts = new HashMap();
                        }
View Full Code Here


            while (i.hasNext()) {
                Object obj = i.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 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 (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***BEFORE OBJ WRITE*** executionChain entry class [" +
                            objClass + "] qname [" + qnameAsString + "]");
                }

                ObjectStateUtils.writeObject(out, mdEntry, logCorrelationIDString +
                        ".executionChain:entry class [" + objClass + "] qname [" + qnameAsString +
                        "]");

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

                if (LoggingControl.debugLoggingAllowed && 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);

            ObjectStateUtils.writeObject(out, lastEntry,
                                         logCorrelationIDString + ".executionChain:  last entry ");
            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.writeUTF(execChainDesc);
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);

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

        //---------------------------------------------------------
        // LinkedList inboundExecutedPhases
        //---------------------------------------------------------
        // 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
        //---------------------------------------------------------
        String inExecListDesc = logCorrelationIDString + ".inboundExecutedPhases";

        int inExecListSize = 0;

        if (inboundExecutedPhases != null) {
            inExecListSize = inboundExecutedPhases.size();
        }

        if (inExecListSize > 0) {
            // start writing data to the output stream
            out.writeUTF(inExecListDesc);
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            out.writeInt(inExecListSize);

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

            int inExecNextIndex = 0;

            Iterator inIterator = inboundExecutedPhases.iterator();

            while (inIterator.hasNext()) {
                Object inObj = inIterator.next();
                String inObjClass = inObj.getClass().getName();
                // start the meta data entry for this object
                MetaDataEntry inMdEntry = new MetaDataEntry();
                inMdEntry.setClassName(inObjClass);

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

                if (inObj instanceof Phase) {
                    Phase inPhaseObj = (Phase) inObj;
                    inQnameAsString = inPhaseObj.getName();

                    // add the list of handlers to the meta data
                    setupPhaseList(inPhaseObj, inMdEntry);
                } else if (inObj instanceof Handler) {
                    Handler inHandlerObj = (Handler) inObj;
                    inQnameAsString = inHandlerObj.getName();
                } else {
                    // TODO: will there be any other kinds of objects in the list
                    inQnameAsString = "NULL";
                }

                inMdEntry.setQName(inQnameAsString);


                if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***BEFORE Inbound Executed List OBJ WRITE*** inboundExecutedPhases entry class [" +
                            inObjClass + "] qname [" + inQnameAsString + "]");
                }

                ObjectStateUtils.writeObject(out, inMdEntry, logCorrelationIDString +
                        ".inboundExecutedPhases:entry class [" + inObjClass + "] qname [" +
                        inQnameAsString + "]");

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

                if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString + ":writeExternal(): " +
                            "***AFTER Inbound Executed List OBJ WRITE*** " +
                            "inboundExecutedPhases entry class [" + inObjClass + "] " +
                            "qname [" + inQnameAsString + "]");
                }
            } // end while entries in execution chain

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

            ObjectStateUtils.writeObject(out, inLastEntry, logCorrelationIDString +
                    ".inboundExecutedPhases:  last entry ");
            inExecNextIndex++;

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

        } else {
            // general case: handle "null" or "empty"

            out.writeUTF(inExecListDesc);
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(
                        logCorrelationIDString + ":writeExternal(): inboundExecutedPhases is NULL");
            }
        }

        //---------------------------------------------------------
        // LinkedList outboundExecutedPhases
        //---------------------------------------------------------
        // 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
        //---------------------------------------------------------
        String outExecListDesc = logCorrelationIDString + ".outboundExecutedPhases";

        int outExecListSize = 0;

        if (outboundExecutedPhases != null) {
            outExecListSize = outboundExecutedPhases.size();
        }

        if (outExecListSize > 0) {
            // start writing data to the output stream
            out.writeUTF(outExecListDesc);
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            out.writeInt(outExecListSize);

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

            int outExecNextIndex = 0;

            Iterator outIterator = outboundExecutedPhases.iterator();

            while (outIterator.hasNext()) {
                Object outObj = outIterator.next();
                String outObjClass = outObj.getClass().getName();
                // start the meta data entry for this object
                MetaDataEntry outMdEntry = new MetaDataEntry();
                outMdEntry.setClassName(outObjClass);

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

                if (outObj instanceof Phase) {
                    Phase outPhaseObj = (Phase) outObj;
                    outQnameAsString = outPhaseObj.getName();

                    // add the list of handlers to the meta data
                    setupPhaseList(outPhaseObj, outMdEntry);
                } else if (outObj instanceof Handler) {
                    Handler outHandlerObj = (Handler) outObj;
                    outQnameAsString = outHandlerObj.getName();
                } else {
                    // TODO: will there be any other kinds of objects in the list
                    outQnameAsString = "NULL";
                }

                outMdEntry.setQName(outQnameAsString);

                if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***BEFORE Outbound Executed List OBJ WRITE*** outboundExecutedPhases entry class [" +
                            outObjClass + "] qname [" + outQnameAsString + "]");
                }

                ObjectStateUtils.writeObject(out, outMdEntry, logCorrelationIDString +
                        ".outboundExecutedPhases:entry class [" + outObjClass + "] qname [" +
                        outQnameAsString + "]");

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

                if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                    log.trace(logCorrelationIDString +
                            ":writeExternal(): ***AFTER Outbound Executed List OBJ WRITE*** outboundExecutedPhases entry class [" +
                            outObjClass + "] qname [" + outQnameAsString + "]");
                }

            } // end while entries

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

            ObjectStateUtils.writeObject(out, outLastEntry, logCorrelationIDString +
                    ".outboundExecutedPhases:  last entry ");
            outExecNextIndex++;

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

        } else {
            // general case: handle "null" or "empty"

            out.writeUTF(outExecListDesc);
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":writeExternal(): outboundExecutedPhases is NULL");
            }
        }

        //---------------------------------------------------------
        // options
        //---------------------------------------------------------
        // before saving the Options, make sure there is a message ID
        String tmpID = getMessageID();
        if (tmpID == null) {
            // get an id to use when restoring this object
            tmpID = UUIDGenerator.getUUID();
            setMessageID(tmpID);
        }

        if (log.isInfoEnabled()) {
            log.info(logCorrelationIDString + ":writeExternal():   message ID [" + tmpID + "]");
        }

        ObjectStateUtils.writeObject(out, options, logCorrelationIDString + ".options   for  [" +
                options.getLogCorrelationIDString() + "]");

        //---------------------------------------------------------
        // operation
        //---------------------------------------------------------
        // axis operation
        //---------------------------------------------------------
        String axisOpMarker = logCorrelationIDString + ".axisOperation";
        ObjectStateUtils.writeString(out, axisOpMarker, axisOpMarker);

        if (axisOperation == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            // TODO: may need to include the meta data for the axis service that is
            //       the parent of the axis operation

            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);

            // make sure the axis operation has a name associated with it
            QName aoTmpQName = axisOperation.getName();

            if (aoTmpQName == null) {
                aoTmpQName = new QName(ObjectStateUtils.EMPTY_MARKER);
                axisOperation.setName(aoTmpQName);
            }

            metaAxisOperation = new MetaDataEntry(axisOperation.getClass().getName(),
                                                  axisOperation.getName().toString());
            ObjectStateUtils.writeObject(out, metaAxisOperation,
                                         logCorrelationIDString + ".metaAxisOperation");
        }

        //---------------------------------------------------------
        // operation context
        //---------------------------------------------------------
        // The OperationContext has pointers to MessageContext objects.
        // In order to avoid having multiple copies of the object graph
        // being saved at different points in the serialization,
        // it is important to isolate this message context object.
        String oc_desc = logCorrelationIDString + ".operationContext";
        if (operationContext != null) {
            operationContext.isolateMessageContext(this);
            oc_desc = oc_desc + "  for  [" + operationContext.getLogCorrelationIDString() + "]";
        }

        // NOTE: expect this to be the parent of the message context
        ObjectStateUtils.writeObject(out, operationContext, oc_desc);

        //---------------------------------------------------------
        // service
        //---------------------------------------------------------
        // axis service
        //-------------------------
        // this is expected to be the parent of the axis operation object
        String axisServMarker = logCorrelationIDString + ".axisService";
        ObjectStateUtils.writeString(out, axisServMarker, axisServMarker);

        if (axisService == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            metaAxisService =
                    new MetaDataEntry(axisService.getClass().getName(), axisService.getName());
            ObjectStateUtils
                    .writeObject(out, metaAxisService, logCorrelationIDString + ".metaAxisService");
        }

        //-------------------------
        // serviceContextID string
        //-------------------------
        ObjectStateUtils
                .writeString(out, serviceContextID, logCorrelationIDString + ".serviceContextID");

        //-------------------------
        // serviceContext
        //-------------------------
        // is this the same as the parent of the OperationContext?
        boolean isParent = false;

        if (operationContext != null) {
            ServiceContext opctxParent = operationContext.getServiceContext();

            if (serviceContext != null) {
                if (serviceContext.equals(opctxParent)) {
                    // the ServiceContext is the parent of the OperationContext
                    isParent = true;
                }
            }
        }

        String servCtxMarker = logCorrelationIDString + ".serviceContext";
        ObjectStateUtils.writeString(out, servCtxMarker, servCtxMarker);

        if (serviceContext == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            out.writeBoolean(isParent);

            // only write out the object if it is not the parent
            if (!isParent) {
                ObjectStateUtils.writeObject(out, serviceContext,
                                             logCorrelationIDString + ".serviceContext");
            }
        }

        //---------------------------------------------------------
        // axisServiceGroup
        //---------------------------------------------------------

        String axisServGrpMarker = logCorrelationIDString + ".axisServiceGroup";
        ObjectStateUtils.writeString(out, axisServGrpMarker, axisServGrpMarker);

        if (axisServiceGroup == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            metaAxisServiceGroup = new MetaDataEntry(axisServiceGroup.getClass().getName(),
                                                     axisServiceGroup.getServiceGroupName());
            ObjectStateUtils.writeObject(out, metaAxisServiceGroup,
                                         logCorrelationIDString + ".metaAxisServiceGroup");
        }

        //-----------------------------
        // serviceGroupContextId string
        //-----------------------------
        ObjectStateUtils.writeString(out, serviceGroupContextId,
                                     logCorrelationIDString + ".serviceGroupContextId");

        //-------------------------
        // serviceGroupContext
        //-------------------------

        // is this the same as the parent of the ServiceContext?
        isParent = false;

        if (serviceContext != null) {
            ServiceGroupContext srvgrpctxParent = (ServiceGroupContext) serviceContext.getParent();

            if (serviceGroupContext != null) {
                if (serviceGroupContext.equals(srvgrpctxParent)) {
                    // the ServiceGroupContext is the parent of the ServiceContext
                    isParent = true;
                }
            }
        }

        String servGrpCtxMarker = logCorrelationIDString + ".serviceGroupContext";
        ObjectStateUtils.writeString(out, servGrpCtxMarker, servGrpCtxMarker);

        if (serviceGroupContext == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            out.writeBoolean(isParent);

            // only write out the object if it is not the parent
            if (!isParent) {
                ObjectStateUtils.writeObject(out, serviceGroupContext,
                                             logCorrelationIDString + ".serviceGroupContext");
            }
        }

        //---------------------------------------------------------
        // axis message
        //---------------------------------------------------------
        String axisMsgMarker = logCorrelationIDString + ".axisMessage";
        ObjectStateUtils.writeString(out, axisMsgMarker, axisMsgMarker);

        if (axisMessage == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            // This AxisMessage is expected to belong to the AxisOperation
            // that has already been recorded for this MessageContext.
            // If an AxisMessage associated with this Messagecontext is
            // associated with a different AxisOperation, then more
            // meta information would need to be saved

            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);

            // make sure the axis message has a name associated with it
            String amTmpName = axisMessage.getName();

            if (amTmpName == null) {
                amTmpName = ObjectStateUtils.EMPTY_MARKER;
                axisMessage.setName(amTmpName);
            }

            // get the element name if there is one
            QName amTmpElementQName = axisMessage.getElementQName();
            String amTmpElemQNameString = null;

            if (amTmpElementQName != null) {
                amTmpElemQNameString = amTmpElementQName.toString();
            }

            metaAxisMessage = new MetaDataEntry(axisMessage.getClass().getName(),
                                                axisMessage.getName(), amTmpElemQNameString);

            ObjectStateUtils
                    .writeObject(out, metaAxisMessage, logCorrelationIDString + ".metaAxisMessage");
        }

        //---------------------------------------------------------
        // configuration context
        //---------------------------------------------------------

        // NOTE: Currently, there does not seem to be any
        //       runtime data important to this message context
        //       in the configuration context.
        //       if so, then need to save that runtime data and reconcile
        //       it with the configuration context on the system when
        //       this message context object is restored

        //---------------------------------------------------------
        // session context
        //---------------------------------------------------------
        ObjectStateUtils
                .writeObject(out, sessionContext, logCorrelationIDString + ".sessionContext");

        //---------------------------------------------------------
        // transport
        //---------------------------------------------------------

        //------------------------------
        // incomingTransportName string
        //------------------------------
        ObjectStateUtils.writeString(out, incomingTransportName,
                                     logCorrelationIDString + ".incomingTransportName");

        // TransportInDescription transportIn
        if (transportIn != null) {
            metaTransportIn = new MetaDataEntry(null, transportIn.getName().toString());
        } else {
            metaTransportIn = null;
        }
        ObjectStateUtils.writeObject(out, metaTransportIn, logCorrelationIDString + ".transportIn");

        // TransportOutDescription transportOut
        if (transportOut != null) {
            metaTransportOut = new MetaDataEntry(null, transportOut.getName().toString());
        } else {
            metaTransportOut = null;
        }
        ObjectStateUtils
                .writeObject(out, metaTransportOut, logCorrelationIDString + ".transportOut");
View Full Code Here

                Object tmpObj = ObjectStateUtils
                        .readObject(in, "MessageContext.metaExecutionChain MetaDataEntry");

                count++;

                MetaDataEntry mdObj = (MetaDataEntry) tmpObj;

                // get the class name, then add it to the list
                String tmpClassNameStr;
                String tmpQNameAsStr;
                String tmpHasList = "no list";

                if (mdObj != null) {
                    tmpClassNameStr = mdObj.getClassName();

                    if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) {
                        // this is the last entry
                        keepGoing = false;
                    } else {
                        // add the entry to the meta data list
                        metaExecutionChain.add(mdObj);

                        tmpQNameAsStr = mdObj.getQNameAsString();

                        if (!mdObj.isListEmpty()) {
                            tmpHasList = "has list";
                        }

                        if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                            log.trace(logCorrelationIDString +
                                    ":readExternal(): meta data class [" + tmpClassNameStr +
                                    "] qname [" + tmpQNameAsStr + "]  index [" + count + "]   [" +
                                    tmpHasList + "]");
                        }
                    }
                } else {
                    // some error occurred
                    keepGoing = false;
                }

            } // end while keep going

            int adjustedNumberEntries = in.readInt();

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): adjusted number of entries ExecutionChain [" +
                        adjustedNumberEntries + "]    ");
            }
        }

        if ((metaExecutionChain == null) || (metaExecutionChain.isEmpty())) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): meta data for Execution Chain is NULL");
            }
        }

        //---------------------------------------------------------
        // LinkedList inboundExecutedPhases
        //---------------------------------------------------------
        // Restore the metadata about each member of the list
        // and the order of the list.
        // This metadata will be used 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
        //                        not including the last entry marker
        //    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
        //---------------------------------------------------------

        // the local chain is not enabled until the
        // list has been reconstituted
        inboundExecutedPhases = null;
        metaInboundExecuted = null;

        in.readUTF();
        boolean gotInExecList = in.readBoolean();

        if (gotInExecList == ObjectStateUtils.ACTIVE_OBJECT) {
            int expectedNumberInExecList = in.readInt();

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): inbound executed phases:  expected number of entries [" +
                        expectedNumberInExecList + "]");
            }

            // setup the list
            metaInboundExecuted = new LinkedList();

            // process the objects
            boolean keepGoing = true;
            int count = 0;

            while (keepGoing) {
                // stop when we get to the end-of-list marker

                // get the object
                Object tmpObj = ObjectStateUtils
                        .readObject(in, "MessageContext.metaInboundExecuted MetaDataEntry");

                count++;

                MetaDataEntry mdObj = (MetaDataEntry) tmpObj;

                // get the class name, then add it to the list
                String tmpClassNameStr;
                String tmpQNameAsStr;
                String tmpHasList = "no list";

                if (mdObj != null) {
                    tmpClassNameStr = mdObj.getClassName();

                    if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) {
                        // this is the last entry
                        keepGoing = false;
                    } else {
                        // add the entry to the meta data list
                        metaInboundExecuted.add(mdObj);

                        tmpQNameAsStr = mdObj.getQNameAsString();

                        if (!mdObj.isListEmpty()) {
                            tmpHasList = "has list";
                        }

                        if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                            log.trace(logCorrelationIDString +
                                    ":readExternal(): meta data class [" + tmpClassNameStr +
                                    "] qname [" + tmpQNameAsStr + "]  index [" + count + "]   [" +
                                    tmpHasList + "]");
                        }
                    }
                } else {
                    // some error occurred
                    keepGoing = false;
                }

            } // end while keep going

            int adjustedNumberInExecList = in.readInt();

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): adjusted number of entries InboundExecutedPhases [" +
                        adjustedNumberInExecList + "]    ");
            }
        }

        if ((metaInboundExecuted == null) || (metaInboundExecuted.isEmpty())) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): meta data for InboundExecutedPhases list is NULL");
            }
        }

        //---------------------------------------------------------
        // LinkedList outboundExecutedPhases
        //---------------------------------------------------------
        // Restore the metadata about each member of the list
        // and the order of the list.
        // This metadata will be used 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
        //                        not including the last entry marker
        //    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
        //---------------------------------------------------------

        // the local chain is not enabled until the
        // list has been reconstituted
        outboundExecutedPhases = null;
        metaOutboundExecuted = null;

        in.readUTF();
        boolean gotOutExecList = in.readBoolean();

        if (gotOutExecList == ObjectStateUtils.ACTIVE_OBJECT) {
            int expectedNumberOutExecList = in.readInt();

            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString +
                        ":readExternal(): outbound executed phases:  expected number of entries [" +
                        expectedNumberOutExecList + "]");
            }

            // setup the list
            metaOutboundExecuted = new LinkedList();

            // process the objects
            boolean keepGoing = true;
            int count = 0;

            while (keepGoing) {
                // stop when we get to the end-of-list marker

                // get the object
                Object tmpObj = ObjectStateUtils
                        .readObject(in, "MessageContext.metaOutboundExecuted MetaDataEntry");

                count++;

                MetaDataEntry mdObj = (MetaDataEntry) tmpObj;

                // get the class name, then add it to the list
                String tmpClassNameStr;
                String tmpQNameAsStr;
                String tmpHasList = "no list";

                if (mdObj != null) {
                    tmpClassNameStr = mdObj.getClassName();

                    if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) {
                        // this is the last entry
                        keepGoing = false;
                    } else {
                        // add the entry to the meta data list
                        metaOutboundExecuted.add(mdObj);

                        tmpQNameAsStr = mdObj.getQNameAsString();

                        if (!mdObj.isListEmpty()) {
                            tmpHasList = "has list";
                        }

                        if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                            log.trace(logCorrelationIDString +
View Full Code Here

            while (i.hasNext()) {
                Object obj = i.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) {
                    // 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;
                    qnameAsString = handlerObj.getName();
                } else {
                    // TODO: will there be any other kinds of objects
                    // in the list?
                    qnameAsString = "NULL";
                }

                mdEntry.setQName(qnameAsString);

                // done with setting up the meta data for the list entry
                // so add it to the parent
                mdPhase.addToList(mdEntry);
View Full Code Here

        System.out.println("ObjectSaveTest:testObjectSerializable():  BEGIN ---------------");

        // ---------------------------------------------------------
        // setup an object to use
        // ---------------------------------------------------------
        MetaDataEntry obj = new MetaDataEntry("object_1", "object_1");

        // ---------------------------------------------------------
        // setup a temporary file to use
        // ---------------------------------------------------------
        try {
            theFile = File.createTempFile("objectTest", null);
            theFilename = theFile.getName();
            System.out.println(
                    "ObjectSaveTest:testObjectSerializable(): temp file = [" + theFilename + "]");
        }
        catch (Exception ex) {
            System.out.println(
                    "ObjectSaveTest:testObjectSerializable(): error creating temp file = [" +
                            ex.getMessage() + "]");
            theFile = null;
        }

        if (theFile != null) {
            // ---------------------------------------------------------
            // save to the temporary file
            // ---------------------------------------------------------
            try {
                // setup an output stream to a physical file
                FileOutputStream outStream = new FileOutputStream(theFile);

                // attach a stream capable of writing objects to the
                // stream connected to the file
                ObjectOutputStream outObjStream = new ObjectOutputStream(outStream);

                // try to save
                System.out.println("ObjectSaveTest:testObjectSerializable(): saving .....");
                saved = false;
                ObjectStateUtils.writeObject(outObjStream, obj, "testObject:Serializable");

                // close out the streams
                outObjStream.flush();
                outObjStream.close();
                outStream.flush();
                outStream.close();

                saved = true;
                System.out.println(
                        "ObjectSaveTest:testObjectSerializable(): ....save operation completed.....");

                long filesize = theFile.length();
                System.out.println(
                        "ObjectSaveTest:testObjectSerializable(): file size after save [" +
                                filesize + "]   temp file = [" + theFilename + "]");
            }
            catch (Exception ex2) {
                System.out.println("ObjectSaveTest:testObjectSerializable(): error during save [" +
                        ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
                ex2.printStackTrace();
            }

            assertTrue(saved);

            // ---------------------------------------------------------
            // restore from the temporary file
            // ---------------------------------------------------------
            try {
                // setup an input stream to the file
                FileInputStream inStream = new FileInputStream(theFile);

                // attach a stream capable of reading objects from the
                // stream connected to the file
                ObjectInputStream inObjStream = new ObjectInputStream(inStream);

                // try to restore the options
                System.out.println("ObjectSaveTest:testObjectSerializable(): restoring .....");
                restored = false;
                MetaDataEntry restored_obj = (MetaDataEntry) ObjectStateUtils
                        .readObject(inObjStream, "testObject:serializable");
                inObjStream.close();
                inStream.close();

                restored = true;
View Full Code Here

    private LinkedHashMap getObjectGraphInfo(MessageContext msgCtx) {
        if (msgCtx == null) {
            return null;
        }

        MetaDataEntry metaMC = null;
        MetaDataEntry metaOC = null;
        MetaDataEntry metaSC = null;
        MetaDataEntry metaSGC = null;
        MetaDataEntry metaCC = null;
        MetaDataEntry metaAO = null;
        MetaDataEntry metaAS = null;
        MetaDataEntry metaASG = null;
        MetaDataEntry metaAC = null;

        String keyMC = null;
        String keyOC = null;
        String keySC = null;
        String keySGC = null;
        String keyCC = null;
        String keyAO = null;
        String keyAS = null;
        String keyASG = null;
        String keyAC = null;

        LinkedHashMap objInfo = new LinkedHashMap();

        // get the identification info about the primary objects in the object graph
        //     class name
        //     name string
        //     hashcode string

        // message context
        keyMC = msgCtx.getClass().getName();
        metaMC = new MetaDataEntry(keyMC, msgCtx.getMessageID(), "[" + msgCtx.hashCode() + "]");
        objInfo.put(keyMC, metaMC);

        // operation context
        OperationContext oc = msgCtx.getOperationContext();
        keyOC = oc.getClass().getName();
        metaOC = new MetaDataEntry(keyOC, oc.getOperationName(), "[" + oc.hashCode() + "]");
        objInfo.put(keyOC, metaOC);

        // service context
        ServiceContext sc = msgCtx.getServiceContext();
        keySC = sc.getClass().getName();
        metaSC = new MetaDataEntry(keySC, sc.getName(), "[" + sc.hashCode() + "]");
        objInfo.put(keySC, metaSC);

        // service group context
        ServiceGroupContext sgc = msgCtx.getServiceGroupContext();
        keySGC = sgc.getClass().getName();
        metaSGC = new MetaDataEntry(keySGC, sgc.getId(), "[" + sgc.hashCode() + "]");
        objInfo.put(keySGC, metaSGC);

        // configuration context
        ConfigurationContext cc = msgCtx.getConfigurationContext();
        keyCC = cc.getClass().getName();
        metaCC = new MetaDataEntry(keyCC, null, "[" + cc.hashCode() + "]");
        objInfo.put(keyCC, metaCC);

        // axis operation
        AxisOperation ao = msgCtx.getAxisOperation();
        keyAO = ao.getClass().getName();
        metaAO = new MetaDataEntry(keyAO, ao.getName().toString(), "[" + ao.hashCode() + "]");
        objInfo.put(keyAO, metaAO);

        // axis service
        AxisService as = msgCtx.getAxisService();
        keyAS = as.getClass().getName();
        metaAS = new MetaDataEntry(keyAS, as.getName(), "[" + as.hashCode() + "]");
        objInfo.put(keyAS, metaAS);

        // axis service group
        AxisServiceGroup asg = msgCtx.getAxisServiceGroup();
        keyASG = asg.getClass().getName();
        metaASG = new MetaDataEntry(keyASG, asg.getServiceGroupName(), "[" + asg.hashCode() + "]");
        objInfo.put(keyASG, metaASG);

        // axis configuration
        AxisConfiguration ac = cc.getAxisConfiguration();
        keyAC = ac.getClass().getName();
        metaAC = new MetaDataEntry(keyAC, null, "[" + ac.hashCode() + "]");
        objInfo.put(keyAC, metaAC);

        return objInfo;
    }
View Full Code Here

                        (key.indexOf("ConfigurationContext") == -1) &&
                        (key.indexOf("AxisConfiguration") == -1)
                        ) {
                    // the class names listed above were not found
                    // so we're dealing with the other objects
                    MetaDataEntry value1 = (MetaDataEntry) map1.get(key);
                    MetaDataEntry value2 = (MetaDataEntry) map2.get(key);

                    if ((value1 != null) && (value2 != null)) {
                        // check the object identification
                        String name1 = value1.getName();
                        String name2 = value2.getName();

                        if ((name1 != null) && (name2 != null)) {
                            if (name1.equals(name2) == false) {
                                System.out.println(title + "name1 [" + name1 + "]  !=   name2 [" +
                                        name2 + "]");
                                return false;
                            }
                        } else if ((name1 == null) && (name2 == null)) {
                            // ok
                        } else {
                            // mismatch
                            System.out.println(
                                    title + "name1 [" + name1 + "]  !=   name2 [" + name2 + "]");
                            return false;
                        }

                        // Strict testing means checking the object hashcodes.
                        // Use this option when you expect the same
                        // objects in the map.
                        if (strict) {
                            String code1 = value1.getExtraName();
                            String code2 = value2.getExtraName();

                            if ((code1 != null) && (code2 != null)) {
                                if (code1.equals(code2) == false) {
                                    System.out.println(title + "name [" + name1 + "]  code1 [" +
                                            code1 + "]  !=   code2 [" + code2 + "]");
View Full Code Here

        Iterator it = map.keySet().iterator();

        while (it.hasNext()) {
            String metaClassName = (String) it.next();
            MetaDataEntry meta = (MetaDataEntry) map.get(metaClassName);

            if (meta != null) {
                String classname = meta.getClassName();
                String name = meta.getName();
                String hashcode = meta.getExtraName();

                System.out.println(
                        "class[" + classname + "]  id[" + name + "]  hashcode" + hashcode + " ");
            }
View Full Code Here

        if (axisService == null) {
            out.writeBoolean(ObjectStateUtils.EMPTY_OBJECT);
        } else {
            out.writeBoolean(ObjectStateUtils.ACTIVE_OBJECT);
            metaAxisService =
                    new MetaDataEntry(axisService.getClass().getName(), axisService.getName());
            ObjectStateUtils.writeObject(out, metaAxisService, "ServiceContext.metaAxisService");
        }

        //---------------------------------------------------------
        // parent
View Full Code Here

            // so just consume the exception for now
        }

        // TransportListener listener
        if (listener != null) {
            metaListener = new MetaDataEntry(listener.getClass().getName(), null);
        } else {
            metaListener = null;
        }
        ObjectStateUtils.writeObject(out, metaListener, logCorrelationIDString + ".listener");

        // TransportInDescription transportIn
        if (transportIn != null) {
            metaTransportIn = new MetaDataEntry(null, transportIn.getName().toString());
        } else {
            metaTransportIn = null;
        }
        ObjectStateUtils.writeObject(out, metaTransportIn, logCorrelationIDString + ".transportIn");

        // TransportOutDescription transportOut
        if (transportOut != null) {
            metaTransportOut = new MetaDataEntry(null, transportOut.getName().toString());
        } else {
            metaTransportOut = null;
        }
        ObjectStateUtils
                .writeObject(out, metaTransportOut, logCorrelationIDString + ".transportOut");
View Full Code Here

TOP

Related Classes of org.apache.axis2.util.MetaDataEntry

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.