You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2017/04/16 22:32:05 UTC
[14/72] [abbrv] [partial] flex-blazeds git commit: - Major code scrub
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/io/amfx/AmfxOutput.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/io/amfx/AmfxOutput.java b/core/src/flex/messaging/io/amfx/AmfxOutput.java
deleted file mode 100644
index b416e51..0000000
--- a/core/src/flex/messaging/io/amfx/AmfxOutput.java
+++ /dev/null
@@ -1,1086 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.io.amfx;
-
-import flex.messaging.MessageException;
-
-import flex.messaging.io.amf.ASObject;
-import flex.messaging.io.amf.AbstractAmfOutput;
-import flex.messaging.io.amf.Amf3Types;
-import flex.messaging.io.PagedRowSet;
-import flex.messaging.io.PropertyProxy;
-import flex.messaging.io.PropertyProxyRegistry;
-import flex.messaging.io.SerializationContext;
-import flex.messaging.io.SerializationDescriptor;
-import flex.messaging.io.StatusInfoProxy;
-import flex.messaging.io.amf.TraitsInfo;
-import flex.messaging.io.amf.Amf3Output;
-import flex.messaging.io.ArrayCollection;
-import flex.messaging.io.BeanProxy;
-import flex.messaging.util.Hex;
-import flex.messaging.util.Trace;
-
-import org.w3c.dom.Document;
-
-import java.io.IOException;
-import java.io.Externalizable;
-import java.io.ByteArrayOutputStream;
-import java.lang.reflect.Array;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import javax.sql.RowSet;
-
-/**
- * Serializes Java types to ActionScript 3 types via AMFX, an XML
- * based representation of AMF 3.
- * <p>
- * XML is formatted using using UTF-8 encoding.
- * </p>
- *
- * @see AmfxMessageSerializer
- * @see AmfxInput
- */
-public class AmfxOutput extends AbstractAmfOutput implements AmfxTypes
-{
- /**
- * A mapping of object instances to their serialization numbers
- * for storing object references on the stream.
- */
- protected IdentityHashMap objectTable;
- protected HashMap traitsTable;
- protected HashMap stringTable;
-
- public AmfxOutput(SerializationContext context)
- {
- super(context);
-
- objectTable = new IdentityHashMap(64);
- traitsTable = new HashMap(10);
- stringTable = new HashMap(64);
- }
-
- public void reset()
- {
- super.reset();
- objectTable.clear();
- traitsTable.clear();
- stringTable.clear();
- }
-
- /**
- * Creates a new Amf3Output instance which is initialized with the
- * current SerializationContext, OutputStream and debug trace settings
- * to switch the version of the AMF protocol mid-stream.
- */
- protected Amf3Output createAMF3Output()
- {
- return new Amf3Output(context);
- }
-
- //
- // java.io.ObjectOutput IMPLEMENTATIONS
- //
-
- public void writeObject(Object o) throws IOException
- {
- if (o == null)
- {
- writeAMFNull();
- return;
- }
-
- if (!context.legacyExternalizable && o instanceof Externalizable)
- {
- writeCustomObject(o);
- }
- else if (o instanceof String || o instanceof Character)
- {
- String s = o.toString();
- writeString(s);
- }
- else if (o instanceof Number)
- {
- if (o instanceof Integer || o instanceof Short || o instanceof Byte)
- {
- int i = ((Number)o).intValue();
- writeAMFInt(i);
- }
- else if (!context.legacyBigNumbers &&
- (o instanceof BigInteger || o instanceof BigDecimal))
- {
- // Using double to write big numbers such as BigInteger or
- // BigDecimal can result in information loss so we write
- // them as String by default...
- writeString(o.toString());
- }
- else
- {
- double d = ((Number)o).doubleValue();
- writeAMFDouble(d);
- }
- }
- else if (o instanceof Boolean)
- {
- writeAMFBoolean(((Boolean)o).booleanValue());
- }
- // We have a complex type...
- else if (o instanceof Date)
- {
- writeDate((Date)o);
- }
- else if (o instanceof Calendar)
- {
- writeDate(((Calendar)o).getTime());
- }
- else if (o instanceof Document)
- {
- String xml = documentToString(o);
-
- int len = xml.length() + 15; // <xml>...</xml>
-
- StringBuffer sb = new StringBuffer(len);
- sb.append(XML_OPEN_TAG);
- writeEscapedString(sb, xml);
- sb.append(XML_CLOSE_TAG);
-
- writeUTF(sb);
-
- if (isDebug)
- trace.writeString(xml);
- }
- // If there is a proxy for this,write it as a custom object so the default
- // behavior can be overriden.
- else if (o instanceof Enum && PropertyProxyRegistry.getRegistry().getProxy(o.getClass()) == null)
- {
- Enum<?> enumValue = (Enum<?>)o;
- writeString(enumValue.name());
- }
- else
- {
- //We have an Object or Array type...
- Class cls = o.getClass();
-
- if (o instanceof Map && context.legacyMap && !(o instanceof ASObject))
- {
- writeMapAsECMAArray((Map)o);
- }
- else if (!context.legacyDictionary && o instanceof Dictionary)
- {
- writeDictionary((Dictionary)o);
- }
- else if (o instanceof Collection)
- {
- if (context.legacyCollection)
- writeCollection((Collection)o, null);
- else
- writeArrayCollection((Collection)o, null);
- }
- else if (cls.isArray())
- {
- writeAMFArray(o, cls.getComponentType());
- }
- else
- {
- //Special Case: wrap RowSet in PageableRowSet for Serialization
- if (o instanceof RowSet)
- {
- o = new PagedRowSet((RowSet)o, Integer.MAX_VALUE, false);
- }
- else if (o instanceof Throwable && context.legacyThrowable)
- {
- o = new StatusInfoProxy((Throwable)o);
- }
-
- writeCustomObject(o);
- }
- }
- }
-
- public void writeObjectTraits(TraitsInfo ti) throws IOException
- {
- String className = ti.getClassName();
-
- if (className == null || className.length() == 0)
- {
- writeUTF(OBJECT_OPEN_TAG);
- }
- else
- {
- int len = 127; // <object type="...">
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(OBJECT_TYPE).append(" type=\"");
- sb.append(className);
- sb.append("\">");
-
- writeUTF(sb);
- }
-
- if (isDebug)
- trace.startAMFObject(className, objectTable.size() - 1);
-
- // We treat an empty anonymous Object as a special case
- // of <traits/> and thus do not serialize by reference.
- if (ti.length() == 0 && className == null)
- {
- writeUTF(EMPTY_TRAITS_TAG);
- }
- else if (!byReference(ti))
- {
- // We assume all Java objects are not dynamic
- //boolean dynamic = ti.isDynamic();
- if (ti.isExternalizable())
- {
- writeUTF(TRAITS_EXTERNALIZALBE_TAG);
- }
- else
- {
- int count = ti.getProperties().size();
-
- if (count <= 0)
- {
- writeUTF(EMPTY_TRAITS_TAG);
- }
- else
- {
- writeUTF(TRAITS_OPEN_TAG);
-
- for (int i = 0; i < count; i++)
- {
- String propName = ti.getProperty(i);
- writeString(propName, true);
- }
-
- writeUTF(TRAITS_CLOSE_TAG);
- }
- }
- }
- }
-
-
- public void writeObjectProperty(String name, Object value) throws IOException
- {
- if (isDebug)
- trace.namedElement(name);
-
- writeObject(value);
- }
-
- public void writeObjectEnd() throws IOException
- {
- writeUTF(OBJECT_CLOSE_TAG);
-
- if (isDebug)
- trace.endAMFObject();
- }
-
- //
- // java.io.DataOutput IMPLEMENTATIONS
- //
-
- public void writeUTF(String s) throws IOException
- {
- byte[] bytes = s.getBytes(UTF_8);
- out.write(bytes);
- }
-
- //
- // AMF SPECIFIC SERIALIZATION IMPLEMENTATIONS
- //
-
- /**
- *
- */
- protected void writeAMFBoolean(boolean b) throws IOException
- {
- if (b)
- writeUTF(TRUE_TAG); // <true/>
- else
- writeUTF(FALSE_TAG); // <false/>
-
- if (isDebug)
- trace.write(b);
- }
-
- /**
- *
- */
- protected void writeAMFDouble(double d) throws IOException
- {
- int buflen = 40; // <double>...</double>
- StringBuffer sb = new StringBuffer(buflen);
- sb.append(DOUBLE_OPEN_TAG);
- sb.append(d);
- sb.append(DOUBLE_CLOSE_TAG);
-
- writeUTF(sb);
-
- if (isDebug)
- trace.write(d);
- }
-
- /**
- *
- */
- protected void writeAMFInt(int i) throws IOException
- {
- if (i >= Amf3Types.INT28_MIN_VALUE && i <= Amf3Types.INT28_MAX_VALUE)
- {
- int buflen = 25; // <int>...</int>
- StringBuffer sb = new StringBuffer(buflen);
- sb.append(INTEGER_OPEN_TAG);
- sb.append(i);
- sb.append(INTEGER_CLOSE_TAG);
-
- writeUTF(sb);
-
- if (isDebug)
- trace.write(i);
- }
- else
- {
- // Promote large int to a double; technically not needed for AMFX
- // but doing it for consistency with AMF.
- writeAMFDouble(i);
- }
- }
-
- /**
- *
- */
- protected void writeByteArray(byte[] ba) throws IOException
- {
- int length = ba.length * 2;
-
- int len = 23 + length; // <bytearray>number of bytes * 2 for encoding</bytearray>
- StringBuffer sb = new StringBuffer(len);
- sb.append(BYTE_ARRAY_OPEN_TAG);
- writeUTF(sb);
-
- Hex.Encoder encoder = new Hex.Encoder(ba.length * 2);
- encoder.encode(ba);
- String encoded = encoder.drain();
- writeUTF(encoded);
-
- writeUTF(BYTE_ARRAY_CLOSE_TAG);
-
- if (isDebug)
- trace.startByteArray(objectTable.size() - 1, ba.length);
- }
-
- /**
- *
- */
- protected void writeByteArray(Byte[] ba) throws IOException
- {
- int length = ba.length;
- byte[] bytes = new byte[length];
-
- for (int i = 0; i < length; i++)
- {
- Byte b = ba[i];
- if (b == null)
- bytes[i] = 0;
- else
- bytes[i] = ba[i].byteValue();
- }
-
- writeByteArray(bytes);
- }
-
- /**
- *
- */
- public void writeUTF(StringBuffer sb) throws IOException
- {
- byte[] bytes = sb.toString().getBytes(UTF_8);
- out.write(bytes);
- }
-
- /**
- *
- */
- protected void writeDate(Date d) throws IOException
- {
- if (!byReference(d))
- {
- int buflen = 30; // <date>...</date>
- long time = d.getTime();
- StringBuffer sb = new StringBuffer(buflen);
- sb.append(DATE_OPEN_TAG);
- sb.append(time);
- sb.append(DATE_CLOSE_TAG);
-
- writeUTF(sb);
-
- if (isDebug)
- trace.write(d);
- }
- }
-
- protected void writeDictionary(Dictionary dictionary) throws IOException
- {
- StringBuffer sb = new StringBuffer(25);
- sb.append("<").append(DICTIONARY_TYPE).append(" length=\"");
- sb.append(dictionary.size());
- sb.append("\">");
- writeUTF(sb);
-
- if (isDebug) trace.startAMFDictionary(objectTable.size() - 1);
-
- Enumeration keys = dictionary.keys();
- while (keys.hasMoreElements())
- {
- if (isDebug) trace.startDictionaryElement();
- Object key = keys.nextElement();
- writeObject(key);
- if (isDebug) trace.addDictionaryEquals();
- Object value = dictionary.get(key);
- writeObject(value);
- }
-
- writeUTF(DICTIONARY_CLOSE_TAG);
-
- if (isDebug)
- trace.endAMFDictionary();
- }
-
- /**
- *
- */
- protected void writeMapAsECMAArray(Map map) throws IOException
- {
- int len = 20; // <array ecma="true">
-
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(ARRAY_TYPE).append(" ecma=\"true\">");
- writeUTF(sb);
-
- if (isDebug)
- trace.startAMFArray(objectTable.size() - 1);
-
- Iterator it = map.keySet().iterator();
- while (it.hasNext())
- {
- Object key = it.next();
- if (key != null)
- {
- String propName = key.toString();
- sb = new StringBuffer();
-
- // For now, all keys will be named items
- sb.append("<").append(ITEM_TYPE).append(" name=\"").append(propName).append("\">");
- writeUTF(sb);
-
- if (isDebug)
- trace.namedElement(propName);
-
- writeObject(map.get(key));
-
- writeUTF(ITEM_CLOSE_TAG);
- }
- }
-
- writeUTF(ARRAY_CLOSE_TAG);
-
- if (isDebug)
- trace.endAMFArray();
- }
-
- /**
- *
- */
- protected void writeAMFNull() throws IOException
- {
- writeUTF(NULL_TAG);
-
- if (isDebug)
- trace.writeNull();
- }
-
- /**
- *
- */
- protected void writeString(String s) throws IOException
- {
- writeString(s, false);
-
- if (isDebug)
- trace.writeString(s);
- }
-
- //
- // PRIVATE SERIALIZATION HELPER METHODS
- //
-
- /**
- *
- */
- protected void writeAMFArray(Object o, Class componentType) throws IOException
- {
- if (componentType.isPrimitive())
- {
- writePrimitiveArray(o);
- }
- else if (componentType.equals(Byte.class))
- {
- writeByteArray((Byte[])o);
- }
- else if (componentType.equals(Character.class))
- {
- writeCharArrayAsString((Character[])o);
- }
- else
- {
- writeObjectArray((Object[])o, null);
- }
- }
-
- /**
- *
- */
- protected void writeArrayCollection(Collection col, SerializationDescriptor desc) throws IOException
- {
- if (!byReference(col))
- {
- ArrayCollection ac;
-
- if (col instanceof ArrayCollection)
- {
- ac = (ArrayCollection)col;
- // TODO: QUESTION: Pete, ignoring the descriptor here... not sure if
- // we should modify the user's AC as that could cause corruption?
- }
- else
- {
- // Wrap any Collection in an ArrayCollection
- ac = new ArrayCollection(col);
- if (desc != null)
- ac.setDescriptor(desc);
- }
-
- // Then wrap ArrayCollection in PropertyProxy for bean-like serialization
- PropertyProxy proxy = PropertyProxyRegistry.getProxy(ac);
- writePropertyProxy(proxy, ac);
- }
- }
-
- /**
- *
- */
- protected void writeCustomObject(Object o) throws IOException
- {
- PropertyProxy proxy = null;
-
- if (o instanceof PropertyProxy)
- {
- proxy = (PropertyProxy)o;
- o = proxy.getDefaultInstance();
-
- // The proxy may wrap a null default instance, if so, short circuit here.
- if (o == null)
- {
- writeAMFNull();
- return;
- }
- // HACK: Short circuit and unwrap if PropertyProxy is wrapping an Array
- // or Collection type since we don't yet have the ability to proxy multiple
- // AMF types. We write an AMF Array directly instead of an AMF Object
- else if (o instanceof Collection)
- {
- if (context.legacyCollection)
- writeCollection((Collection)o, proxy.getDescriptor());
- else
- writeArrayCollection((Collection)o, proxy.getDescriptor());
- return;
- }
- else if (o.getClass().isArray())
- {
- writeObjectArray((Object[])o, proxy.getDescriptor());
- return;
- }
- else if (context.legacyMap && o instanceof Map && !(o instanceof ASObject))
- {
- writeMapAsECMAArray((Map)o);
- return;
- }
- }
-
- if (!byReference(o))
- {
- if (proxy == null)
- {
- proxy = PropertyProxyRegistry.getProxyAndRegister(o);
- }
-
- writePropertyProxy(proxy, o);
- }
- }
-
- /**
- *
- */
- protected void writePropertyProxy(PropertyProxy pp, Object instance) throws IOException
- {
- /*
- * At this point we substitute the instance we want to serialize.
- */
- Object newInst = pp.getInstanceToSerialize(instance);
- if (newInst != instance)
- {
- // We can't use writeAMFNull here I think since we already added this object
- // to the object table on the server side. The player won't have any way
- // of knowing we have this reference mapped to null.
- if (newInst == null)
- throw new MessageException("PropertyProxy.getInstanceToSerialize class: " + pp.getClass() + " returned null for instance class: " + instance.getClass().getName());
-
- // Grab a new proxy if necessary for the new instance
- pp = PropertyProxyRegistry.getProxyAndRegister(newInst);
- instance = newInst;
- }
-
- List propertyNames = null;
- boolean externalizable = pp.isExternalizable(instance);
-
- if (!externalizable)
- {
- propertyNames = pp.getPropertyNames(instance);
- // filter write-only properties
- if (pp instanceof BeanProxy)
- {
- BeanProxy bp = (BeanProxy) pp;
- Iterator it = propertyNames.iterator();
- while (it.hasNext())
- {
- String propName = (String) it.next();
- if (bp.isWriteOnly(instance, propName))
- it.remove();
- }
- }
- }
-
- TraitsInfo ti = new TraitsInfo(pp.getAlias(instance), pp.isDynamic(), externalizable, propertyNames);
- writeObjectTraits(ti);
-
- if (externalizable)
- {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- Amf3Output objOut = createAMF3Output();
- objOut.setOutputStream(bout);
- //objOut.setDebugTrace(trace);
- ((Externalizable)instance).writeExternal(objOut);
- writeByteArray(bout.toByteArray());
- }
- else if (propertyNames != null)
- {
- Iterator it = propertyNames.iterator();
- while (it.hasNext())
- {
- String propName = (String)it.next();
- Object value = pp.getValue(instance, propName);
- writeObjectProperty(propName, value);
- }
- }
-
- writeObjectEnd();
- }
-
- /**
- *
- */
- protected void writeString(String s, boolean isTrait) throws IOException
- {
- if (s.length() == 0)
- {
- writeUTF(EMPTY_STRING_TAG);
- }
- else if (!byReference(s))
- {
- int len = s.length() + 35; // <string>...</string> + <![CDATA[ ]]>
-
- StringBuffer sb = new StringBuffer(len);
- sb.append(STRING_OPEN_TAG);
-
- // Traits won't contain chars that need escaping
- if (!isTrait)
- writeEscapedString(sb, s);
- else
- sb.append(s);
-
- sb.append(STRING_CLOSE_TAG);
-
- writeUTF(sb);
- }
- }
-
- /**
- * XML defines the following set as valid characters to appear in a document:
- * U+0009, U+000A, U+000D, [U+0020-U+D7FF], [U+E000-U+FFFD], and [U+10000-U+10FFFF].
- *
- * Java only supports characters up to 0xFFFE so codepoints beyond the BMP are
- * not considered.
- *
- * Characters not in this set will be escaped using a numerical character reference
- * in hexadecimal form, i.e. &#xFFFF.
- *
- * A CDATA section is not used because numerical character references cannot be
- * used in such a context.
- *
- * @param sb The StringBuffer to which the escaped String should be written.
- * @param s The source String to escape for XML.
- *
- */
- protected void writeEscapedString(StringBuffer sb, String s)
- {
- StringBuffer temp = new StringBuffer(s.length());
-
- char[] chars = s.toCharArray();
- for (int i = 0; i < chars.length; i++)
- {
- char c = chars[i];
- if (c >= 0x0020)
- {
- if (c == '&')
- {
- temp.append("&");
- }
- else if (c == '<')
- {
- temp.append("<");
- }
- else if (c > 0xD7FF && (c < 0xE000 || c > 0xFFFD))
- {
- temp.append("&#x").append(Integer.toHexString(c)).append(";");
- }
- else
- {
- temp.append(c);
- }
- }
- else if (c == 0x0009 || c == 0x000A || c == 0x000D)
- {
- temp.append(c);
- }
- else
- {
- temp.append("&#x").append(Integer.toHexString(c)).append(";");
- }
- }
-
- sb.append(temp); //Use temp.toString() if JDK 1.3 or earlier
- }
-
- /**
- *
- */
- protected void writeCharArrayAsString(Character[] ca) throws IOException
- {
- int length = ca.length;
- char[] chars = new char[length];
-
- for (int i = 0; i < length; i++)
- {
- Character c = ca[i];
- if (c == null)
- chars[i] = 0;
- else
- chars[i] = ca[i].charValue();
- }
- writeCharArrayAsString(chars);
- }
-
- /**
- *
- */
- protected void writeCharArrayAsString(char[] ca) throws IOException
- {
- String str = new String(ca);
- writeString(str);
- }
-
- /**
- *
- */
- protected void writeCollection(Collection c, SerializationDescriptor descriptor) throws IOException
- {
- if (!byReference(c))
- {
- writeObjectArrayDirectly(c.toArray(), descriptor);
- }
- }
-
- /**
- *
- */
- protected void writeObjectArray(Object[] values, SerializationDescriptor descriptor) throws IOException
- {
- if (!byReference(values))
- {
- writeObjectArrayDirectly(values, descriptor);
- }
- }
-
- /**
- *
- */
- protected void writeObjectArrayDirectly(Object[] values, SerializationDescriptor descriptor) throws IOException
- {
- int len = 25; // <array length="...">
-
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(ARRAY_TYPE).append(" length=\"");
- sb.append(values.length);
- sb.append("\">");
- writeUTF(sb);
-
- if (isDebug)
- trace.startAMFArray(objectTable.size() - 1);
-
- for (int i = 0; i < values.length; ++i)
- {
- if (isDebug)
- trace.arrayElement(i);
-
- writeObject(values[i]);
- }
-
- writeUTF(ARRAY_CLOSE_TAG);
-
- if (isDebug)
- trace.endAMFArray();
- }
-
-
- /**
- * Serialize an array of primitives.
- * <p>
- * Primitives include the following:
- * boolean, char, double, float, long, int, short, byte
- * </p>
- *
- * @param obj An array of primitives
- *
- */
- protected void writePrimitiveArray(Object obj) throws IOException
- {
- Class aType = obj.getClass().getComponentType();
-
- if (aType.equals(Character.TYPE))
- {
- //Treat char[] as a String
- char[] c = (char[])obj;
- writeCharArrayAsString(c);
- }
- else if (aType.equals(Byte.TYPE))
- {
- writeByteArray((byte[])obj);
- }
- else if (!byReference(obj))
- {
- int length = Array.getLength(obj);
-
- int buflen = 25; // <array length="...">
- StringBuffer sb = new StringBuffer(buflen);
- sb.append("<").append(ARRAY_TYPE).append(" length=\"");
- sb.append(length);
- sb.append("\">");
- writeUTF(sb);
-
- if (isDebug)
- trace.startAMFArray(objectTable.size() - 1);
-
- if (aType.equals(Boolean.TYPE))
- {
- boolean[] b = (boolean[])obj;
-
- for (int i = 0; i < b.length; i++)
- {
- if (isDebug)
- trace.arrayElement(i);
-
- writeAMFBoolean(b[i]);
- }
- }
- else if (aType.equals(Integer.TYPE) || aType.equals(Short.TYPE))
- {
- //We have a primitive number, either an int or short
- //We write all of these as Integers...
- for (int i = 0; i < length; i++)
- {
- if (isDebug)
- trace.arrayElement(i);
-
- int v = Array.getInt(obj, i);
- writeAMFInt(v);
- }
- }
- else
- {
- //We have a primitive number, either a double, float, or long
- //We write all of these as doubles...
- for (int i = 0; i < length; i++)
- {
- if (isDebug)
- trace.arrayElement(i);
-
- double v = Array.getDouble(obj, i);
- writeAMFDouble(v);
- }
- }
-
- writeUTF(ARRAY_CLOSE_TAG);
-
- if (isDebug)
- trace.endAMFArray();
- }
- }
-
-
- /**
- * Attempts to serialize the object as a reference.
- * If the object cannot be serialized as a reference, it is stored
- * in the reference collection for potential future encounter.
- *
- * @return Success/failure indicator as to whether the object could be
- * serialized as a reference.
- *
- */
- protected boolean byReference(Object o) throws IOException
- {
- Object ref = objectTable.get(o);
-
- if (ref != null)
- {
- try
- {
- int refNum = ((Integer)ref).intValue();
-
- int len = 20; // <ref id="..."/>
-
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(REF_TYPE).append(" id=\"");
- sb.append(refNum);
- sb.append("\"/>");
-
- writeUTF(sb);
-
- if (isDebug)
- trace.writeRef(refNum);
- }
- catch (ClassCastException e)
- {
- throw new IOException("Object reference is not an Integer");
- }
- }
- else
- {
- objectTable.put(o, new Integer(objectTable.size()));
- }
-
- return (ref != null);
- }
-
- /**
- *
- */
- protected boolean byReference(String s) throws IOException
- {
- Object ref = stringTable.get(s);
-
- if (ref != null)
- {
- try
- {
- int refNum = ((Integer)ref).intValue();
-
- int len = 20; // <string id="..."/>
-
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(STRING_TYPE).append(" id=\"");
- sb.append(refNum);
- sb.append("\"/>");
-
- writeUTF(sb);
-
- if (Trace.amf && isDebug)
- trace.writeStringRef(refNum);
- }
- catch (ClassCastException e)
- {
- throw new IOException("String reference is not an Integer");
- }
- }
- else
- {
- stringTable.put(s, new Integer(stringTable.size()));
- }
-
- return (ref != null);
- }
-
- /**
- *
- */
- protected boolean byReference(TraitsInfo ti) throws IOException
- {
- // We treat an empty anonymous Object as a special case
- // of <traits/> and thus do not serialize by reference.
- if (ti.length() == 0 && ti.getClassName() == null)
- return false;
-
- Object ref = traitsTable.get(ti);
-
- if (ref != null)
- {
- try
- {
- int refNum = ((Integer)ref).intValue();
-
- int len = 20; // <traits id="..."/>
-
- StringBuffer sb = new StringBuffer(len);
- sb.append("<").append(TRAITS_TYPE).append(" id=\"");
- sb.append(refNum);
- sb.append("\"/>");
-
- writeUTF(sb);
-
- if (Trace.amf && isDebug)
- trace.writeTraitsInfoRef(refNum);
- }
- catch (ClassCastException e)
- {
- throw new IOException("Traits reference is not an Integer");
- }
- }
- else
- {
- traitsTable.put(ti, new Integer(traitsTable.size()));
- }
-
- return (ref != null);
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/io/amfx/AmfxTypes.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/io/amfx/AmfxTypes.java b/core/src/flex/messaging/io/amfx/AmfxTypes.java
deleted file mode 100644
index 82ffed0..0000000
--- a/core/src/flex/messaging/io/amfx/AmfxTypes.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.io.amfx;
-
-/**
- * AMFX is an XML representation of AMF 3.
- */
-public interface AmfxTypes
-{
- // AMFX Packet Structure
- String AMFX_TYPE = "amfx";
- String HEADER_TYPE = "header";
- String BODY_TYPE = "body";
-
- // AMFX ActionScript types
- String UNDEFINED_TYPE = "undefined";
- String NULL_TYPE = "null";
- String FALSE_TYPE = "false";
- String TRUE_TYPE = "true";
- String INTEGER_TYPE = "int";
- String ITEM_TYPE = "item";
- String DOUBLE_TYPE = "double";
- String STRING_TYPE = "string";
- String XML_TYPE = "xmldocument";
- String DATE_TYPE = "date";
- String DICTIONARY_TYPE = "dictionary";
- String ARRAY_TYPE = "array";
- String OBJECT_TYPE = "object";
- String AVM_PLUS_XML_TYPE = "xml";
- String BYTE_ARRAY_TYPE = "bytearray";
-
- // Special metadata types
- String REF_TYPE = "ref";
- String TRAITS_TYPE = "traits";
-
-
- // AMFX special tag constants
- String EMPTY_STRING_TAG = "<string/>";
- String FALSE_TAG = "<false/>";
- String NULL_TAG = "<null/>";
- String TRUE_TAG = "<true/>";
- String UNDEFINED_TAG = "<undefined/>";
-
- String EMPTY_TRAITS_TAG = "<traits/>";
-
- // AMFX tag constants
- String AMFX_OPEN_TAG = "<amfx>";
- String AMFX_CLOSE_TAG = "</amfx>";
- String HEADER_OPEN_TAG = "<header>";
- String HEADER_CLOSE_TAG = "</header>";
- String BODY_OPEN_TAG = "<body>";
- String BODY_CLOSE_TAG = "</body>";
-
-
- String ARRAY_OPEN_TAG = "<array>";
- String ARRAY_CLOSE_TAG = "</array>";
- String BYTE_ARRAY_OPEN_TAG = "<bytearray>";
- String BYTE_ARRAY_CLOSE_TAG = "</bytearray>";
- String DATE_OPEN_TAG = "<date>";
- String DATE_CLOSE_TAG = "</date>";
- String DICTIONARY_CLOSE_TAG = "</dictionary>";
- String DOUBLE_OPEN_TAG = "<double>";
- String DOUBLE_CLOSE_TAG = "</double>";
- String INTEGER_OPEN_TAG = "<int>";
- String INTEGER_CLOSE_TAG = "</int>";
- String ITEM_OPEN_TAG = "<item>";
- String ITEM_CLOSE_TAG = "</item>";
- String OBJECT_OPEN_TAG = "<object>";
- String OBJECT_CLOSE_TAG = "</object>";
- String STRING_OPEN_TAG = "<string>";
- String STRING_CLOSE_TAG = "</string>";
- String XML_OPEN_TAG = "<xml>";
- String XML_CLOSE_TAG = "</xml>";
- String XML_DOC_OPEN_TAG = "<xmldocument>";
- String XML_DOC_CLOSE_TAG = "</xmldocument>";
-
- String TRAITS_OPEN_TAG = "<traits>";
- String TRAITS_CLOSE_TAG = "</traits>";
-
- String TRAITS_EXTERNALIZALBE_TAG = "<traits externalizable=\"true\" />";
-
- // AMFX Strings always use UTF-8
- String UTF_8 = "UTF-8";
-
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/io/amfx/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/io/amfx/package-info.java b/core/src/flex/messaging/io/amfx/package-info.java
deleted file mode 100644
index de3678e..0000000
--- a/core/src/flex/messaging/io/amfx/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.io.amfx;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/io/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/io/package-info.java b/core/src/flex/messaging/io/package-info.java
deleted file mode 100644
index 86929ac..0000000
--- a/core/src/flex/messaging/io/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.io;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/log/HTTPRequestLog.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/log/HTTPRequestLog.java b/core/src/flex/messaging/log/HTTPRequestLog.java
deleted file mode 100644
index f065680..0000000
--- a/core/src/flex/messaging/log/HTTPRequestLog.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.log;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.Enumeration;
-
-
-/**
- * Static class to log HTTP request data when it is wrapped by our LoggingHttpServletRequestWrapper.
- */
-public class HTTPRequestLog
-{
- /**
- * Request attribute for storing error info.
- */
- public static final String HTTP_ERROR_INFO = "org.apache.flex.blazeds.internal._exception_info";
-
- // Default file name
- private static String filename;
-
- /**
- * Called to set up filename for HTTP request logging.
- * If the init parameter <b>HttpErrorLog</b> is set in the servlet context, its value is set as the output filename
- *@param context the ServletContext object
- * @return true if request logging is enabled.
- */
- public static boolean init(ServletContext context)
- {
- // Get the HttpRequest log file information.
- String logfile = context.getInitParameter("HttpErrorLog");
- if (logfile == null || logfile.length() == 0)
- {
- return false;
- }
- filename = logfile;
- return true;
- }
-
- /**
- * Change the output file name.
- *
- * @param fileName the file name
- */
- public static void setFileName(String fileName)
- {
- if (fileName != null)
- {
- filename = fileName;
- }
- }
-
- /**
- * Get the file name.
- * @return String the file name
- */
- public static String getFileName()
- {
- return filename;
- }
-
- /**
- * Log the HTTP request if logging turned on and we have a filename.
- * @param header the header name
- * @param httpReq the HttpServletRequest
- */
- public static synchronized void outputRequest(String header, HttpServletRequest httpReq)
- {
- // If things aren't set up, do nothing.
- if (!(httpReq instanceof LoggingHttpServletRequestWrapper) || filename == null)
- {
- return;
- }
-
- LoggingHttpServletRequestWrapper req = (LoggingHttpServletRequestWrapper) httpReq;
- FileWriter fw = null;
- try
- {
- // Open the file
- fw = new FileWriter(filename, true);
- fw.write("#===== Request Client Infomation =====#" + "\n");
- if (header != null)
- {
- fw.write("Error : " + header + "\n");
- }
- fw.write("Timestamp : " + new Date(System.currentTimeMillis()).toString() + "\n");
- fw.write("Client IP Address : " + req.getRemoteAddr() + "\n");
- fw.write("Client FQDN : " + req.getRemoteHost() + "\n");
- fw.write("Body size : " + req.getContentLength() + "\n");
-
- fw.write("#===== HTTP Headers =====#" + "\n");
- outputHeaders(fw, req);
-
- fw.write("#===== HTTP Body =====#" + "\n");
- outputBody(fw, req);
-
- fw.close();
- }
- catch (IOException ex)
- {
- if (fw != null)
- {
- try { fw.close(); } catch (IOException e) { /* ignore */ }
- }
- System.out.println("Unable to write HTTP request data to file " + filename + ": " + ex.toString());
- }
- }
-
- /**
- * Output 1 line message (Auto file open).
- * @param message the message to print
- */
- public static void outputPrint(String message)
- {
- FileWriter fw = null;
- try
- {
- fw = new FileWriter(filename, true);
- fw.write(message + "\n");
- fw.close();
- }
- catch (IOException ex)
- {
- if (fw != null)
- {
- try { fw.close(); } catch (IOException e) { /* ignore */ }
- }
- System.out.println("Unable to log message '" + message + "' to file " + filename + " : " + ex.toString());
- }
- }
-
-
- /**
- * Display the request header.
- */
- private static void outputHeaders(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException
- {
- // Get the header
- Enumeration reqHeaderNum = req.getHeaderNames();
-
- // Do nothing if there is no header
- if (reqHeaderNum == null)
- {
- fw.write("No headers" + "\n");
- return;
- }
-
- // Repeat the header element
- while (reqHeaderNum.hasMoreElements())
- {
- // Get the key
- String key = (String) reqHeaderNum.nextElement();
-
- // Output the header information
- outputHeaderElements(fw, req, key);
- }
- }
-
- /**
- * Output header information.
- */
- private static void outputHeaderElements(FileWriter fw, LoggingHttpServletRequestWrapper req, String key) throws IOException
- {
- // Output the header information
- Enumeration e = req.getHeaders(key);
- String keyname = key;
-
- while (e.hasMoreElements())
- {
- fw.write(keyname + " : " + e.nextElement() + "\n");
- // Output key name only for the first time
- keyname = " ";
- }
- }
-
- /**
- * Output the body information.
- */
- private static void outputBody(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException
- {
- // Get the body size
- int leng = req.getContentLength();
- // Do nothing if there is no body
- if (leng <= 0) return;
-
- // Buffer to read
- byte rbuf[] = new byte[leng];
-
- // Put data
- InputStream in = req.getInputStream();
- if (in.read(rbuf, 0, leng) > 0)
- {
- // Output data
- outputBinary(fw, rbuf);
- }
- }
-
- /**
- * Output body information.
- */
- private static void outputBinary(FileWriter fw, byte buf[]) throws IOException
- {
-
- int adrs = 0;
-
- // Do every 16 bytes
- for (int j = 0; j < buf.length; j += 16)
- {
-
- // Change the number to hex.
- String adrsStr = "00000000" + Integer.toHexString(adrs);
- adrsStr = adrsStr.substring(adrsStr.length() - 8, adrsStr.length());
- fw.write("\n" + adrsStr + " : ");
- // Add address by 16
- adrs += 16;
-
- // Output in hex.
- for (int i = 0; i < 16; i++)
- {
-
- // If it is out of the limit, display in white space
- if (i + j >= buf.length)
- {
- fw.write(" ");
- }
- else
- {
- int n = (int) buf[i + j];
- if (n < 0) n += 256;
- // Change the data into hex
- String s = "00" + Integer.toHexString(n);
- s = s.substring(s.length() - 2, s.length());
- fw.write(s + " ");
- }
- }
-
- // Output in string
- fw.write(" ");
- for (int i = 0; i < 16; i++)
- {
-
- // If it is out of limit, break.
- if (i + j >= buf.length) break;
-
- // If it is a special character, output "."
- if (buf[i + j] < 0x20 ||
- (buf[i + j] & 0xff) > 0xde ||
- (buf[i + j] > 0x7e && (buf[i + j] & 0xff) < 0xa1))
- {
- fw.write(".");
- }
- // Output string
- else
- {
- String s = String.valueOf((char) buf[i + j]);
- fw.write(s);
- }
- }
- }
- fw.write("\n");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/log/LoggingHttpServletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/log/LoggingHttpServletRequestWrapper.java b/core/src/flex/messaging/log/LoggingHttpServletRequestWrapper.java
deleted file mode 100644
index e5fa369..0000000
--- a/core/src/flex/messaging/log/LoggingHttpServletRequestWrapper.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.log;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Theis class wraps the servlet request so we can capture the body bytes
- * and log them if an unexpected error occurs in the request.
- */
-public class LoggingHttpServletRequestWrapper extends HttpServletRequestWrapper
-{
- /**
- * Body data.
- */
- private byte[] _bodyInfoData;
-
- /**
- * Constructor.
- * @param parent the parent HttpServletRequest to wrap
- */
- public LoggingHttpServletRequestWrapper(HttpServletRequest parent)
- {
- super(parent);
- }
-
- /**
- * Read the body and store it.
- *
- * @throws IOException if there is a problem reading the request data
- */
- public void doReadBody() throws IOException
- {
-
- // Get length of the content
- int length = super.getContentLength();
-
- if (length > 0)
- {
- // Instantiate ByteArrayOutputStream
- ByteArrayOutputStream out = new ByteArrayOutputStream(length);
- InputStream in = super.getInputStream();
- // Create for body of the message
- byte[] bodyByte = new byte[length];
-
- // -------------------------------
- // To process the body message
- // -------------------------------
- int remain = length;
- while (remain > 0)
- {
- // Keep the data
- int readLen = in.read(bodyByte);
- if (readLen <= 0)
- {
- break;
- }
- // Write the body information
- out.write(bodyByte, 0, readLen);
- remain -= readLen;
- }
-
- // Store the data
- this._bodyInfoData = out.toByteArray();
-
- // Release
- out.close();
- }
- }
-
- /**
- * Returns an input stream backed by the saved body data.
- * @return ServletInputStream the Servlet input stream object
- * @throws IOException if we can not get the Servlet input stream
- */
- public ServletInputStream getInputStream() throws IOException
- {
- if (this._bodyInfoData != null)
- {
- return new ExServletInputStream(new ByteArrayInputStream(this._bodyInfoData));
- }
- return super.getInputStream();
- }
-
-
- /**
- * An extension of the <tt>ServletInputStream</tt> that is backed by an input stream
- * provided at construction.
- * <p>
- * Used to allow the servlet request wrapper to return a stream backed by the already consumed body data.</p>
- */
- private static class ExServletInputStream extends ServletInputStream
- {
- /**
- * InputStream Object.
- */
- private InputStream _inputStream;
-
- /**
- * Constructor.
- * @param inputStream the input stream
- */
- ExServletInputStream(InputStream inputStream)
- {
- this._inputStream = inputStream;
- }
-
-
- // --------------------------------
- // The following methods are overridden.
- // --------------------------------
- public int readLine(byte[] b, int off, int len) throws IOException
- {
- throw new UnsupportedOperationException("This method is not extended");
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- return this._inputStream.read(b, off, len);
- }
-
- public int read(byte[] b) throws IOException
- {
- return this._inputStream.read(b);
- }
-
- public void mark(int readlimit)
- {
- this._inputStream.mark(readlimit);
- }
-
- public long skip(long n) throws IOException
- {
- return this._inputStream.skip(n);
- }
-
- public void reset() throws IOException
- {
- this._inputStream.reset();
- }
-
- public int read() throws IOException
- {
- return this._inputStream.read();
- }
-
- public boolean markSupported()
- {
- return _inputStream.markSupported();
- }
-
- public void close() throws IOException
- {
- this._inputStream.close();
- }
-
- public int available() throws IOException
- {
- return this._inputStream.available();
- }
- // --------------------------------
- // This is the end of the modification.
- // --------------------------------
- } // end inner class
-
-} // end class
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/log/ServletLogTarget.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/log/ServletLogTarget.java b/core/src/flex/messaging/log/ServletLogTarget.java
deleted file mode 100644
index ca867b9..0000000
--- a/core/src/flex/messaging/log/ServletLogTarget.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.log;
-
-import javax.servlet.ServletContext;
-
-/**
- * This is a log target which uses the servlet context in order to log
- * messages.
- */
-public class ServletLogTarget extends LineFormattedTarget
-{
- static ServletContext context;
-
- /**
- * This method must be called during startup to give this target a reference
- * to the ServletContext.
- * @param ctx the servlet context
- *
- */
- public static void setServletContext(ServletContext ctx)
- {
- context = ctx;
- }
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Default constructor.
- */
- public ServletLogTarget()
- {
- super();
- }
-
- boolean warned = false;
-
- /**
- * Log a message via the servlet context.
- * @param message the message to log.
- */
- @Override
- protected void internalLog(String message)
- {
- if (context == null)
- {
- if (!warned)
- {
- System.out.println("**** No servlet context set in ServletLogTarget - logging disabled.");
- warned = true;
- }
- }
- else
- {
- context.log(message);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/log/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/log/package-info.java b/core/src/flex/messaging/log/package-info.java
deleted file mode 100644
index 991a05b..0000000
--- a/core/src/flex/messaging/log/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.log;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/AbstractMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/AbstractMessage.java b/core/src/flex/messaging/messages/AbstractMessage.java
deleted file mode 100644
index a9f43db..0000000
--- a/core/src/flex/messaging/messages/AbstractMessage.java
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.IdentityHashMap;
-
-import flex.messaging.log.LogCategories;
-import flex.messaging.log.Log;
-import flex.messaging.util.StringUtils;
-import flex.messaging.util.UUIDUtils;
-import flex.messaging.util.ExceptionUtil;
-
-/**
- * This is the default implementation of Message, which
- * provides a convenient base for behavior and associations
- * common to all endpoints.
- */
-public abstract class AbstractMessage implements Message, Cloneable
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = -834697863344344313L;
-
- // Serialization constants
- protected static final short HAS_NEXT_FLAG = 128;
- protected static final short BODY_FLAG = 1;
- protected static final short CLIENT_ID_FLAG = 2;
- protected static final short DESTINATION_FLAG = 4;
- protected static final short HEADERS_FLAG = 8;
- protected static final short MESSAGE_ID_FLAG = 16;
- protected static final short TIMESTAMP_FLAG = 32;
- protected static final short TIME_TO_LIVE_FLAG = 64;
- protected static final short CLIENT_ID_BYTES_FLAG = 1;
- protected static final short MESSAGE_ID_BYTES_FLAG = 2;
-
- protected Object clientId;
- protected String destination;
- protected String messageId;
- protected long timestamp;
- protected long timeToLive;
-
- protected Map headers;
- protected Object body;
-
- protected byte[] clientIdBytes;
- protected byte[] messageIdBytes;
-
- /**
- * Returns the client id.
- *
- * @return The client id.
- */
- public Object getClientId()
- {
- return clientId;
- }
-
- /**
- * Sets the client id.
- *
- * @param clientId The client id.
- */
- public void setClientId(Object clientId)
- {
- this.clientId = clientId;
- clientIdBytes = null;
- }
-
- /**
- * Returns the message id.
- *
- * @return The message id.
- */
- public String getMessageId()
- {
- return messageId;
- }
-
- /**
- * Sets the message id.
- *
- * @param messageId The message id.
- */
- public void setMessageId(String messageId)
- {
- this.messageId = messageId;
- messageIdBytes = null;
- }
-
- /**
- * Returns the timestamp.
- *
- * @return The timestamp.
- */
- public long getTimestamp()
- {
- return timestamp;
- }
-
- /**
- * Sets the timestamp.
- *
- * @param timestamp The timestamp.
- */
- public void setTimestamp(long timestamp)
- {
- this.timestamp = timestamp;
- }
-
- /**
- * Returns the time to live.
- *
- * @return The time to live.
- */
- public long getTimeToLive()
- {
- return timeToLive;
- }
-
- /**
- * Sets the time to live.
- *
- * @param timeToLive The time to live.
- */
- public void setTimeToLive(long timeToLive)
- {
- this.timeToLive = timeToLive;
- }
-
- /**
- * Returns the body.
- *
- * @return the body.
- */
- public Object getBody()
- {
- return body;
- }
-
-
- /**
- * Sets the body.
- *
- * @param body The body.
- */
- public void setBody(Object body)
- {
- this.body = body;
- }
-
- /**
- * Returns the destination id.
- *
- * @return The destination id.
- */
- public String getDestination()
- {
- return destination;
- }
-
- /**
- * Sets the destination id.
- *
- * @param destination The destination id.
- */
- public void setDestination(String destination)
- {
- this.destination = destination;
- }
-
- /**
- * Returns the headers.
- *
- * @return The headers.
- */
- public Map getHeaders()
- {
- if (headers == null)
- {
- headers = new HashMap();
- }
- return headers;
- }
-
- /**
- * Sets the headers.
- *
- * @param newHeaders The new headers to set.
- */
- public void setHeaders(Map newHeaders)
- {
- for (Iterator iter = newHeaders.entrySet().iterator(); iter.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) iter.next();
- String propName = (String) entry.getKey();
- setHeader(propName, entry.getValue());
- }
- }
-
- /**
- * Returns the header value associated with the header name, or null.
- * @param headerName the header name
- * @return The header value associaged with the header name.
- */
- public Object getHeader(String headerName)
- {
- return headers != null? headers.get(headerName) : null;
- }
-
- /**
- * Sets the header name and value.
- *
- * @param headerName The header name.
- * @param value The header value.
- */
- public void setHeader(String headerName, Object value)
- {
- if (headers == null)
- headers = new HashMap();
-
- if (value == null)
- headers.remove(headerName);
- else
- headers.put(headerName, value);
- }
-
- /**
- * Determines whether the header exists.
- * @param headerName the header name
- * @return True if the header exists.
- */
- public boolean headerExists(String headerName)
- {
- return (headers != null && headers.containsKey(headerName));
- }
-
- public boolean equals(Object o)
- {
- if (o instanceof Message)
- {
- if (messageId == null)
- return this == o;
-
- Message m = (Message) o;
- if (m.getMessageId().equals(this.getMessageId()))
- {
- return true;
- }
- }
- return false;
- }
-
- public int hashCode()
- {
- if (messageId == null)
- return super.hashCode();
- return messageId.hashCode();
- }
-
- /**
- * Returns a category to use when logging against this message type.
- * @return String the log category
- */
- public String logCategory()
- {
- return LogCategories.MESSAGE_GENERAL;
- }
-
- public String toString()
- {
- return toString(1);
- }
-
- public String toString(int indent)
- {
- return toStringHeader(indent) + toStringFields(indent+1);
- }
-
- /**
- *
- *
- * While this class itself does not implement java.io.Externalizable,
- * SmallMessage implementations will typically use Externalizable to
- * serialize themselves in a smaller form. This method supports this
- * functionality by implementing Externalizable.readExternal(ObjectInput) to
- * deserialize the properties for this abstract base class.
- */
- public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
- {
- short[] flagsArray = readFlags(input);
-
- for (int i = 0; i < flagsArray.length; i++)
- {
- short flags = flagsArray[i];
- short reservedPosition = 0;
-
- if (i == 0)
- {
- if ((flags & BODY_FLAG) != 0)
- readExternalBody(input);
-
- if ((flags & CLIENT_ID_FLAG) != 0)
- clientId = input.readObject();
-
- if ((flags & DESTINATION_FLAG) != 0)
- destination = (String)input.readObject();
-
- if ((flags & HEADERS_FLAG) != 0)
- headers = (Map)input.readObject();
-
- if ((flags & MESSAGE_ID_FLAG) != 0)
- messageId = (String)input.readObject();
-
- if ((flags & TIMESTAMP_FLAG) != 0)
- timestamp = ((Number)input.readObject()).longValue();
-
- if ((flags & TIME_TO_LIVE_FLAG) != 0)
- timeToLive = ((Number)input.readObject()).longValue();
-
- reservedPosition = 7;
- }
- else if (i == 1)
- {
- if ((flags & CLIENT_ID_BYTES_FLAG) != 0)
- {
- clientIdBytes = (byte[])input.readObject();
- clientId = UUIDUtils.fromByteArray(clientIdBytes);
- }
-
- if ((flags & MESSAGE_ID_BYTES_FLAG) != 0)
- {
- messageIdBytes = (byte[])input.readObject();
- messageId = UUIDUtils.fromByteArray(messageIdBytes);
- }
-
- reservedPosition = 2;
- }
-
- // For forwards compatibility, read in any other flagged objects to
- // preserve the integrity of the input stream...
- if ((flags >> reservedPosition) != 0)
- {
- for (short j = reservedPosition; j < 6; j++)
- {
- if (((flags >> j) & 1) != 0)
- {
- input.readObject();
- }
- }
- }
- }
- }
-
- /**
- *
- *
- * While this class itself does not implement java.io.Externalizable,
- * SmallMessage implementations will typically use Externalizable to
- * serialize themselves in a smaller form. This method supports this
- * functionality by implementing Externalizable.writeExternal(ObjectOutput)
- * to efficiently serialize the properties for this abstract base class.
- */
- public void writeExternal(ObjectOutput output) throws IOException
- {
- short flags = 0;
-
- if (clientIdBytes == null && clientId != null && clientId instanceof String)
- clientIdBytes = UUIDUtils.toByteArray((String)clientId);
-
- if (messageIdBytes == null && messageId != null)
- messageIdBytes = UUIDUtils.toByteArray(messageId);
-
- if (body != null)
- flags |= BODY_FLAG;
-
- if (clientId != null && clientIdBytes == null)
- flags |= CLIENT_ID_FLAG;
-
- if (destination != null)
- flags |= DESTINATION_FLAG;
-
- if (headers != null)
- flags |= HEADERS_FLAG;
-
- if (messageId != null && messageIdBytes == null)
- flags |= MESSAGE_ID_FLAG;
-
- if (timestamp != 0)
- flags |= TIMESTAMP_FLAG;
-
- if (timeToLive != 0)
- flags |= TIME_TO_LIVE_FLAG;
-
- if (clientIdBytes != null || messageIdBytes != null)
- flags |= HAS_NEXT_FLAG;
-
- output.writeByte(flags);
-
- flags = 0;
-
- if (clientIdBytes != null)
- flags |= CLIENT_ID_BYTES_FLAG;
-
- if (messageIdBytes != null)
- flags |= MESSAGE_ID_BYTES_FLAG;
-
- if (flags != 0)
- output.writeByte(flags);
-
- if (body != null)
- writeExternalBody(output);
-
- if (clientId != null && clientIdBytes == null)
- output.writeObject(clientId);
-
- if (destination != null)
- output.writeObject(destination);
-
- if (headers != null)
- output.writeObject(headers);
-
- if (messageId != null && messageIdBytes == null)
- output.writeObject(messageId);
-
- if (timestamp != 0)
- output.writeObject(new Long(timestamp));
-
- if (timeToLive != 0)
- output.writeObject(new Long(timeToLive));
-
- if (clientIdBytes != null)
- output.writeObject(clientIdBytes);
-
- if (messageIdBytes != null)
- output.writeObject(messageIdBytes);
- }
-
- public Object clone()
- {
- AbstractMessage m = null;
- try
- {
- m = (AbstractMessage) super.clone();
-
- /* NOTE: this is not cloning the body - just the headers */
- if (headers != null)
- m.headers = (HashMap) ((HashMap) headers).clone();
- }
- catch (CloneNotSupportedException exc)
- {
- // can't happen..
- }
- return m;
- }
-
- /**
- * Implements Comparable. Compares this message with the other message,
- * according to the message priority header value (if one exists).
- * @param otherMessage the message to compare with
- * @return int return 1 if the priority is lower than the other message, 0 if equal and -1 if higher
- */
- public int compareTo(Message otherMessage)
- {
- Object priorityHeader = getHeader(PRIORITY_HEADER);
- int thisPriority = priorityHeader == null? DEFAULT_PRIORITY : ((Integer)priorityHeader).intValue();
- priorityHeader = otherMessage.getHeader(PRIORITY_HEADER);
- int otherPriority = priorityHeader == null? DEFAULT_PRIORITY : ((Integer)priorityHeader).intValue();
- // Note that lower priority goes last.
- return (thisPriority < otherPriority? 1 : (thisPriority == otherPriority? 0 : -1));
- }
-
- static final String [] indentLevels =
- {"", " ", " ", " ", " "," "};
-
- protected String getIndent(int indentLevel)
- {
- if (indentLevel < indentLevels.length) return indentLevels[indentLevel];
- StringBuffer sb = new StringBuffer();
- sb.append(indentLevels[indentLevels.length-1]);
- indentLevel -= indentLevels.length - 1;
- for (int i = 0; i < indentLevel; i++)
- sb.append(" ");
- return sb.toString();
- }
-
- protected String getFieldSeparator(int indentLevel)
- {
- String indStr = getIndent(indentLevel);
- if (indentLevel > 0)
- indStr = StringUtils.NEWLINE + indStr;
- else
- indStr = " ";
- return indStr;
- }
-
- protected String toStringHeader(int indentLevel)
- {
- String s = "Flex Message";
- s += " (" + getClass().getName() + ") ";
- return s;
- }
-
- protected String toStringFields(int indentLevel)
- {
- if (headers != null)
- {
- String sep = getFieldSeparator(indentLevel);
- StringBuilder sb = new StringBuilder();
- for (Iterator i = headers.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry e = (Map.Entry) i.next();
- String key = e.getKey().toString();
- sb.append(sep).append("hdr(").append(key).append(") = ");
- if (Log.isExcludedProperty(key))
- sb.append(Log.VALUE_SUPRESSED);
- else
- sb.append(bodyToString(e.getValue(), indentLevel+1));
- }
- return sb.toString();
- }
- return "";
- }
-
- /**
- * This is usually an array so might as well format it nicely in
- * this case.
- */
- protected final String bodyToString(Object body, int indentLevel)
- {
- return bodyToString(body, indentLevel, null);
- }
-
- /**
- * This is usually an array so might as well format it nicely in
- * this case.
- */
- protected final String bodyToString(Object body, int indentLevel, Map visited)
- {
- try
- {
- indentLevel = indentLevel + 1;
- if (visited == null && indentLevel > 18)
- return StringUtils.NEWLINE + getFieldSeparator(indentLevel) + "<..max-depth-reached..>";
- return internalBodyToString(body, indentLevel, visited);
- }
- catch (RuntimeException exc)
- {
- return "Exception in body toString: " + ExceptionUtil.toString(exc);
- }
- }
-
- protected String internalBodyToString(Object body, int indentLevel)
- {
- return internalBodyToString(body, indentLevel, null);
- }
-
- protected String internalBodyToString(Object body, int indentLevel, Map visited)
- {
- if (body instanceof Object[])
- {
- if ((visited = checkVisited(visited, body)) == null)
- return "<--";
-
- String sep = getFieldSeparator(indentLevel);
- StringBuffer sb = new StringBuffer();
- Object [] arr = (Object[]) body;
- sb.append(getFieldSeparator(indentLevel-1));
- sb.append("[");
- sb.append(sep);
- for (int i = 0; i < arr.length; i++)
- {
- if (i != 0)
- {
- sb.append(",");
- sb.append(sep);
- }
- sb.append(bodyToString(arr[i],indentLevel,visited));
- }
- sb.append(getFieldSeparator(indentLevel-1));
- sb.append("]");
- return sb.toString();
- }
- // This is here so we can format maps with Object[] as values properly
- // and with the proper indent
- else if (body instanceof Map)
- {
- if ((visited = checkVisited(visited, body)) == null)
- return "<--";
- Map bodyMap = (Map) body;
- StringBuffer buf = new StringBuffer();
- buf.append("{");
- Iterator it = bodyMap.entrySet().iterator();
- while(it.hasNext())
- {
- Map.Entry e = (Map.Entry) it.next();
- Object key = e.getKey();
- Object value = e.getValue();
- buf.append(key == this ? "(recursive Map as key)" : key);
- buf.append("=");
- if (value == this)
- buf.append("(recursive Map as value)");
- else if (Log.isExcludedProperty(key.toString()))
- buf.append(Log.VALUE_SUPRESSED);
- else
- buf.append(bodyToString(value, indentLevel + 1, visited));
-
- if (it.hasNext())
- buf.append(", ");
- }
- buf.append("}");
- return buf.toString();
- }
- else if (body instanceof AbstractMessage)
- {
- return ((AbstractMessage)body).toString(indentLevel);
- }
- else if (body != null)
- return body.toString();
- else return "null";
- }
-
- /**
- *
- * Used by the readExtenral method to read the body.
- *
- * @param input Object input.
- * @throws IOException
- * @throws ClassNotFoundException
- */
- protected void readExternalBody(ObjectInput input) throws IOException, ClassNotFoundException
- {
- body = input.readObject();
- }
-
- /**
- *
- * To support efficient serialization for SmallMessage implementations,
- * this utility method reads in the property flags from an ObjectInput
- * stream. Flags are read in one byte at a time. Flags make use of
- * sign-extension so that if the high-bit is set to 1 this indicates that
- * another set of flags follows.
- *
- * @return The array of property flags.
- */
- protected short[] readFlags(ObjectInput input) throws IOException
- {
- boolean hasNextFlag = true;
- short[] flagsArray = new short[2];
- int i = 0;
-
- while (hasNextFlag)
- {
- short flags = (short)input.readUnsignedByte();
- if (i == flagsArray.length)
- {
- short[] tempArray = new short[i*2];
- System.arraycopy(flagsArray, 0, tempArray, 0, flagsArray.length);
- flagsArray = tempArray;
- }
-
- flagsArray[i] = flags;
-
- hasNextFlag = (flags & HAS_NEXT_FLAG) != 0;
-
- i++;
- }
-
- return flagsArray;
- }
-
- /**
- *
- * Used by writeExternal method to write the body.
- *
- * @param output The object output.
- * @throws IOException
- */
- protected void writeExternalBody(ObjectOutput output) throws IOException
- {
- output.writeObject(body);
- }
-
- private Map checkVisited(Map visited, Object obj)
- {
- if (visited == null)
- visited = new IdentityHashMap();
- else if (visited.get(obj) != null)
- return null;
-
- visited.put(obj, Boolean.TRUE);
-
- return visited;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/AcknowledgeMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/AcknowledgeMessage.java b/core/src/flex/messaging/messages/AcknowledgeMessage.java
deleted file mode 100644
index 0466ae5..0000000
--- a/core/src/flex/messaging/messages/AcknowledgeMessage.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import flex.messaging.util.UUIDUtils;
-
-/**
- *
- * This is the type of message returned by the MessageBroker
- * to endpoints after the broker has routed an endpoint's message
- * to a service.
- */
-public class AcknowledgeMessage extends AsyncMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = 228072709981643313L;
-
- /**
- * Default constructor.
- */
- public AcknowledgeMessage()
- {
- this.messageId = UUIDUtils.createUUID(false);
- this.timestamp = System.currentTimeMillis();
- }
-
- /**
- *
- */
- public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
- {
- super.readExternal(input);
-
- short[] flagsArray = readFlags(input);
- for (int i = 0; i < flagsArray.length; i++)
- {
- short flags = flagsArray[i];
- short reservedPosition = 0;
-
- // For forwards compatibility, read in any other flagged objects
- // to preserve the integrity of the input stream...
- if ((flags >> reservedPosition) != 0)
- {
- for (short j = reservedPosition; j < 6; j++)
- {
- if (((flags >> j) & 1) != 0)
- {
- input.readObject();
- }
- }
- }
- }
- }
-
- /**
- *
- */
- public Message getSmallMessage()
- {
- if (getClass() == AcknowledgeMessage.class)
- return new AcknowledgeMessageExt(this);
- return null;
- }
-
- /**
- *
- */
- public void writeExternal(ObjectOutput output) throws IOException
- {
- super.writeExternal(output);
-
- short flags = 0;
- output.writeByte(flags);
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/AcknowledgeMessageExt.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/AcknowledgeMessageExt.java b/core/src/flex/messaging/messages/AcknowledgeMessageExt.java
deleted file mode 100644
index 9c6e40a..0000000
--- a/core/src/flex/messaging/messages/AcknowledgeMessageExt.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutput;
-
-import flex.messaging.io.ClassAlias;
-
-/**
- *
- */
-public class AcknowledgeMessageExt extends AcknowledgeMessage implements
- Externalizable, ClassAlias
-{
- private static final long serialVersionUID = -8764729006642310394L;
- public static final String CLASS_ALIAS = "DSK";
-
- public AcknowledgeMessageExt()
- {
- this(null);
- }
-
- public AcknowledgeMessageExt(AcknowledgeMessage message)
- {
- super();
- _message = message;
- }
-
- public String getAlias()
- {
- return CLASS_ALIAS;
- }
-
- public void writeExternal(ObjectOutput output) throws IOException
- {
- if (_message != null)
- _message.writeExternal(output);
- else
- super.writeExternal(output);
- }
-
- private AcknowledgeMessage _message;
-
-}