Examples of SafeObjectOutputStream


Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     *
     * @param out The stream to write the object contents to
     * @throws IOException
     */
    public void writeExternal(ObjectOutput o) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        // write out contents of this object

        //---------------------------------------------------------
        // in order to handle future changes to the message
        // context definition, be sure to maintain the
        // object level identifiers
        //---------------------------------------------------------
        // serialization version ID
        out.writeLong(serialVersionUID);

        // revision ID
        out.writeInt(revisionID);

        //---------------------------------------------------------
        // various simple fields
        //---------------------------------------------------------

        out.writeLong(getLastTouchedTime());

        if (id == null) {
            // generate an ID to use when this object is restored
            id = UIDGenerator.generateUID();
        }
        out.writeObject(id);

        //---------------------------------------------------------
        // properties
        //---------------------------------------------------------
        out.writeMap(getProperties());

        //---------------------------------------------------------
        // AxisServiceGroup
        //---------------------------------------------------------
        metaAxisServiceGroup = null;
        if (axisServiceGroup != null) {
            metaAxisServiceGroup = new MetaDataEntry(axisServiceGroup.getClass().getName(),
                                                     axisServiceGroup.getServiceGroupName());
        }
        out.writeObject(metaAxisServiceGroup);

        //---------------------------------------------------------
        // parent
        //---------------------------------------------------------

View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     *
     * @param out The stream to write the object contents to
     * @throws IOException
     */
    public void writeExternal(ObjectOutput o) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        // write out contents of this object

        //---------------------------------------------------------
        // in order to handle future changes to the message
        // context definition, be sure to maintain the
        // object level identifiers
        //---------------------------------------------------------
        // serialization version ID
        out.writeLong(serialVersionUID);

        // revision ID
        out.writeInt(revisionID);

        //---------------------------------------------------------
        // collection of parameters
        //---------------------------------------------------------
        out.writeMap(parameters);

    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     *
     * @param out The stream to write the object contents to
     * @throws IOException
     */
    public void writeExternal(ObjectOutput o) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        // write out contents of this object

        //---------------------------------------------------------
        // in order to handle future changes to the message
        // context definition, be sure to maintain the
        // object level identifiers
        //---------------------------------------------------------
        // serialization version ID
        out.writeLong(serialVersionUID);

        // revision ID
        out.writeInt(revisionID);

        //---------------------------------------------------------
        // various simple fields
        //---------------------------------------------------------
        out.writeObject(className);
        out.writeObject(qnameAsString);
        out.writeObject(extraName);
        out.writeList(children);

    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     *
     * @param out The stream to write the object contents to
     * @throws IOException
     */
    public void writeExternal(ObjectOutput o) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        //---------------------------------------------------------
        // in order to handle future changes to the message
        // context definition, be sure to maintain the
        // object level identifiers
        //---------------------------------------------------------
        // serialization version ID
        out.writeLong(serialVersionUID);

        // revision ID
        out.writeInt(revisionID);

        //---------------------------------------------------------
        // various simple fields
        //---------------------------------------------------------

        out.writeLong(getLastTouchedTime());

        out.writeBoolean(isComplete);
        out.writeObject(key);
        out.writeObject(logCorrelationIDString);

        //---------------------------------------------------------
        // properties
        //---------------------------------------------------------
        out.writeUTF("properties")// write marker
        out.writeMap(getProperties());

        //---------------------------------------------------------
        // AxisOperation axisOperation
        //---------------------------------------------------------
        out.writeUTF("metaAxisOperation"); // write marker
        metaAxisOperation = null;
        if (axisOperation != null) {
            metaAxisOperation = new MetaDataEntry(axisOperation.getClass().getName(),
                                                  axisOperation.getName().toString());
        }
        out.writeObject(metaAxisOperation);

        //---------------------------------------------------------
        // AxisOperation axisService
        //---------------------------------------------------------
        // save the meta data for the corresponding axis service to better
        // match up the axis operation
        out.writeUTF("metaAxisService"); // write marker
        metaAxisService = null;
        AxisService axisService = axisOperation.getAxisService();

        if (axisService != null) {
            String serviceAndPortNames = ActivateUtils.getAxisServiceExternalizeExtraName(axisService);
            // If there is a service & port QName stored on the AxisService then write it out so
            // it can be used during deserialization to hook up the message context to the
            // correct AxisService.
            metaAxisService =
                    new MetaDataEntry(axisService.getClass().getName(), axisService.getName(),
                            serviceAndPortNames);
        }
        out.writeObject(metaAxisService);

        //---------------------------------------------------------
        // parent
        //---------------------------------------------------------
        out.writeUTF("parent"); // write marker
        out.writeObject(this.getServiceContext());

        //---------------------------------------------------------
        // HashMap messageContexts table
        //---------------------------------------------------------

        // NOTES: The assumption is that the table contains message contexts
        // that are in the OperationContext hierarchy.  To reduce overlap
        // of object information that is being saved, extract the
        // message context objects from the hierachy before saving.
        // When the OperationContext is restored, the "slimmed down"
        // message context objects are plugged back into the hierachy
        // using the restored OperationContext as a basis.

        // first deal with the original messageContexts table
        HashMap tmpMsgCtxMap = null;

        if ((messageContexts != null) && (!messageContexts.isEmpty())) {
            // create a table of the non-isolated message contexts
            workingSet = new HashMap();
            tmpMsgCtxMap = new HashMap();

            Set keySet = messageContexts.keySet();
            Iterator itKeys = keySet.iterator();

            while (itKeys.hasNext()) {
                // expect the key to be a string
                String keyObj = (String) itKeys.next();

                // get the message context associated with that label
                MessageContext value = (MessageContext) messageContexts.get(keyObj);

                boolean addToWorkingSet = true;

                // check to see if this message context was isolated
                if (isolatedMessageContexts != null) {
                    if (!isolatedMessageContexts.isEmpty()) {
                        // see if the message context was previously isolated
                        MessageContext valueIsolated =
                                (MessageContext) isolatedMessageContexts.get(keyObj);

                        if (valueIsolated != null) {
                            String idIsol = valueIsolated.getMessageID();

                            if (idIsol != null) {
                                if (idIsol.equals(value.getMessageID())) {
                                    // don't add to working set
                                    addToWorkingSet = false;
                                }
                            }
                        }
                    }
                }

                if (addToWorkingSet) {
                    // put the meta data entry in the list
                    workingSet.put(keyObj, value);
                }

            }

            // now we have a working set

            Set keySet2 = workingSet.keySet();
            Iterator itKeys2 = keySet2.iterator();

            while (itKeys2.hasNext()) {
                // expect the key to be a string
                String keyObj2 = (String) itKeys2.next();

                // get the message context associated with that label
                MessageContext mc = (MessageContext) workingSet.get(keyObj2);

                // construct a copy of the message context
                // that has been extracted from the object hierarchy
                MessageContext copyMC = mc.extractCopyMessageContext();
               
                // Don't persist the message of the other message contexts
                copyMC.setEnvelope(null);

                // put the modified entry in the list
                tmpMsgCtxMap.put(keyObj2, copyMC);

                // trace point
                if (log.isTraceEnabled()) {
                    log.trace(getLogCorrelationIDString() +
                              ":writeExternal():  getting working set entry  key [" + keyObj2 +
                              "]   message context ID[" + copyMC.getMessageID() + "]");
                }
            }

        }

        out.writeUTF("messagecontexts"); // write marker
        out.writeMap(tmpMsgCtxMap);
        out.writeUTF("metaMessageContextMap");
        out.writeMap(metaMessageContextMap);

        //---------------------------------------------------------
        // done
        //---------------------------------------------------------

View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     * @param str The string to write
     * @param desc A text description to use for logging
     * @throws IOException Exception
     */
    public static void writeString(ObjectOutput o, String str, String desc) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        out.writeUTF(desc);
        out.writeObject(str);
    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     * @param obj The object to write
     * @param desc A text description to use for logging
     * @throws IOException Exception
     */
    public static void writeObject(ObjectOutput o, Object obj, String desc) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        out.writeUTF(desc);
        out.writeObject(obj);
    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     * @param desc A text description to use for logging
     * @throws IOException Exception
     */
    public static void writeArrayList(ObjectOutput o, ArrayList al, String desc)
      throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        out.writeUTF(desc);
        out.writeList(al);
    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     * @param map The HashMap to write
     * @param desc A text description to use for logging
     * @throws IOException Exception
     */
    public static void writeHashMap(ObjectOutput o, HashMap map, String desc) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        out.writeUTF(desc);
        out.writeMap(map);
    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     * @param desc A text description to use for logging
     * @throws IOException Exception
     */
    public static void writeLinkedList(ObjectOutput o, LinkedList objlist, String desc)
      throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
        out.writeUTF(desc);
        out.writeList(objlist);

    }
View Full Code Here

Examples of org.apache.axis2.context.externalize.SafeObjectOutputStream

     *
     * @param out The stream to write the object contents to
     * @throws IOException
     */
    public void writeExternal(ObjectOutput o) throws IOException {
        SafeObjectOutputStream out = SafeObjectOutputStream.install(o);
       
        // Don't write out transient parameters
        if (this.isTransient()) {
            return
        }
       
        // write out contents of this object

        //---------------------------------------------------------
        // in order to handle future changes to the message
        // context definition, be sure to maintain the
        // object level identifiers
        //---------------------------------------------------------
        // serialization version ID
        out.writeLong(serialVersionUID);

        // revision ID
        out.writeInt(revisionID);

        //---------------------------------------------------------
        // simple fields
        //---------------------------------------------------------

        out.writeInt(type);
        out.writeBoolean(locked);
        out.writeObject(name);

        //---------------------------------------------------------
        // object fields
        //---------------------------------------------------------

        // TODO: investigate serializing the OMElement more efficiently
        // This currently will basically serialize the given OMElement
        // to a String but will build the OMTree in the memory

        String tmp = null;

        if (parameterElement != null) {
            tmp = parameterElement.toString();
        }
        out.writeObject(tmp); // parameterElement
        out.writeObject(value);
    }
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.