00001 /* 00002 * ThrowablePofSerializer.hpp 00003 * 00004 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_THROWABLE_POF_SERIALIZER_HPP 00017 #define COH_THROWABLE_POF_SERIALIZER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/PofReader.hpp" 00022 #include "coherence/io/pof/PofWriter.hpp" 00023 #include "coherence/util/Collection.hpp" 00024 00025 COH_OPEN_NAMESPACE3(coherence,io,pof) 00026 00027 using coherence::util::Collection; 00028 00029 00030 /** 00031 * PofSerializer implementation that can serialize and deserialize an 00032 * Exception to/from a POF stream. 00033 * 00034 * This serializer is provides a catch-all mechanism for serializing exceptions. 00035 * Any deserialized exception will loose type information, and simply be 00036 * represented as a PortableException. The basic detail information of the 00037 * exception are retained. 00038 * 00039 * PortableException and this class work asymmetricly to provide the 00040 * serialization routines for exceptions. 00041 * 00042 * @author mf 2008.08.25 00043 */ 00044 class COH_EXPORT ThrowablePofSerializer 00045 : public class_spec<ThrowablePofSerializer, 00046 extends<Object>, 00047 implements<PofSerializer> > 00048 { 00049 friend class factory<ThrowablePofSerializer>; 00050 00051 // ----- constructors --------------------------------------------------- 00052 00053 protected: 00054 /** 00055 * Default constructor. 00056 */ 00057 ThrowablePofSerializer(); 00058 00059 00060 // ----- PofSerializer interface ---------------------------------------- 00061 00062 public: 00063 /** 00064 * {@inheritDoc} 00065 */ 00066 virtual void serialize(PofWriter::Handle hOut, Object::View v) const; 00067 00068 /** 00069 * {@inheritDoc} 00070 */ 00071 virtual Object::Holder deserialize(PofReader::Handle hIn) const; 00072 00073 00074 // ----- helpers -------------------------------------------------------- 00075 00076 public: 00077 /** 00078 * Write the Exception to the specified stream. 00079 * 00080 * @param hOut the stream to write to 00081 * @param ve the Exception to write 00082 */ 00083 static void writeThrowable(PofWriter::Handle hOut, Exception::View ve); 00084 }; 00085 00086 COH_CLOSE_NAMESPACE3 00087 00088 #endif // COH_THROWABLE_POF_SERIALIZER_HPP