You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/09/01 02:13:27 UTC
svn commit: r439111 [2/2] - in /incubator/activemq/trunk: activemq-core/
activemq-core/src/main/java/org/apache/activemq/
activemq-core/src/main/java/org/apache/activemq/broker/
activemq-core/src/main/java/org/apache/activemq/broker/util/ activemq-core...
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java Thu Aug 31 17:13:23 2006
@@ -24,7 +24,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.transport.CommandJoiner;
import org.apache.activemq.transport.InactivityMonitor;
@@ -40,6 +39,7 @@
import org.apache.activemq.util.IOExceptionSupport;
import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.URISupport;
+import org.apache.activemq.wireformat.WireFormat;
public class UdpTransportFactory extends TransportFactory {
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayInputStream.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,100 @@
+/**
+ *
+ * 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 org.apache.activemq.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+
+/**
+ * Very similar to the java.io.ByteArrayInputStream but this version
+ * is not thread safe.
+ */
+public class ByteArrayInputStream extends InputStream {
+
+ byte buffer[];
+ int limit;
+ int pos;
+ int mark;
+
+ public ByteArrayInputStream(byte data[]) {
+ this(data, 0, data.length);
+ }
+
+ public ByteArrayInputStream(ByteSequence sequence) {
+ this(sequence.getData(), sequence.getOffset(), sequence.getLength());
+ }
+
+ public ByteArrayInputStream(byte data[], int offset, int size) {
+ this.buffer = data;
+ this.mark= this.pos = offset;
+ this.limit = offset+size;
+ }
+
+ public int read() throws IOException {
+ if( pos < limit )
+ return buffer[pos++] & 0xff;
+ else
+ return -1;
+ }
+
+ public int read(byte[] b) throws IOException {
+ return read(b, 0, b.length);
+ }
+
+ public int read(byte b[], int off, int len) {
+ if (pos < limit) {
+ len = Math.min(len, limit-pos);
+ if (len > 0) {
+ System.arraycopy(buffer, pos, b, off, len);
+ pos += len;
+ }
+ return len;
+ } else {
+ return -1;
+ }
+ }
+
+ public long skip(long len) throws IOException {
+ if (pos < limit) {
+ len = Math.min(len, limit-pos);
+ if (len > 0) {
+ pos += len;
+ }
+ return len;
+ } else {
+ return -1;
+ }
+ }
+
+ public int available() {
+ return limit - pos;
+ }
+
+ public boolean markSupported() {
+ return true;
+ }
+
+ public void mark(int markpos) {
+ mark = pos;
+ }
+
+ public void reset() {
+ pos = mark;
+ }
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayOutputStream.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayOutputStream.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteArrayOutputStream.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,83 @@
+/**
+ *
+ * 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 org.apache.activemq.util;
+
+import java.io.OutputStream;
+
+
+/**
+ * Very similar to the java.io.ByteArrayOutputStream but this version
+ * is not thread safe and the resulting data is returned in a ByteSequence
+ * to avoid an extra byte[] allocation.
+ */
+public class ByteArrayOutputStream extends OutputStream {
+
+ byte buffer[];
+ int size;
+
+ public ByteArrayOutputStream() {
+ this(512);
+ }
+ public ByteArrayOutputStream(int capacity) {
+ buffer = new byte[capacity];
+ }
+
+ public void write(int b) {
+ int newsize = size + 1;
+ checkCapacity(newsize);
+ buffer[size] = (byte) b;
+ size = newsize;
+ }
+
+ public void write(byte b[], int off, int len) {
+ int newsize = size + len;
+ checkCapacity(newsize);
+ System.arraycopy(b, off, buffer, size, len);
+ size = newsize;
+ }
+
+ /**
+ * Ensures the the buffer has at least the minimumCapacity specified.
+ * @param i
+ */
+ private void checkCapacity(int minimumCapacity) {
+ if (minimumCapacity > buffer.length) {
+ byte b[] = new byte[Math.max(buffer.length << 1, minimumCapacity)];
+ System.arraycopy(buffer, 0, b, 0, size);
+ buffer = b;
+ }
+ }
+
+ public void reset() {
+ size = 0;
+ }
+
+ public ByteSequence toByteSequence() {
+ return new ByteSequence(buffer, 0, size);
+ }
+
+ public byte[] toByteArray() {
+ byte rc[] = new byte[size];
+ System.arraycopy(buffer, 0, rc, 0, size);
+ return rc;
+ }
+
+ public int size() {
+ return size;
+ }
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequence.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequence.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequence.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequence.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,58 @@
+/**
+ *
+ * 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 org.apache.activemq.util;
+
+public class ByteSequence {
+
+ public byte[] data;
+ public int offset;
+ public int length;
+
+ public ByteSequence(byte data[]) {
+ this.data = data;
+ this.offset = 0;
+ this.length = data.length;
+ }
+
+ public ByteSequence(byte data[], int offset, int length) {
+ this.data = data;
+ this.offset = offset;
+ this.length = length;
+ }
+
+ public byte[] getData() {
+ return data;
+ }
+ public int getLength() {
+ return length;
+ }
+ public int getOffset() {
+ return offset;
+ }
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+ public void setLength(int length) {
+ this.length = length;
+ }
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+}
\ No newline at end of file
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,267 @@
+/**
+ *
+ * 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 org.apache.activemq.util;
+
+import java.io.IOException;
+
+
+/**
+ * Used to write and read primitives to and from a ByteSequence.
+ */
+final public class ByteSequenceData {
+
+
+ public static byte[] toByteArray(ByteSequence packet) {
+ if( packet.offset==0 && packet.length == packet.data.length )
+ return packet.data;
+
+ byte rc[] = new byte[packet.length];
+ System.arraycopy(packet.data, packet.offset, rc, 0, packet.length);
+ return rc;
+ }
+
+ private static void spaceNeeded(ByteSequence packet, int i) {
+ assert packet.offset+i <= packet.length;
+ }
+
+ public static int remaining(ByteSequence packet) {
+ return packet.length - packet.offset;
+ }
+
+ public static int read(ByteSequence packet) {
+ return packet.data[packet.offset++] & 0xff;
+ }
+
+
+ public static void readFully(ByteSequence packet, byte[] b) throws IOException {
+ readFully(packet, b, 0, b.length);
+ }
+
+ public static void readFully(ByteSequence packet, byte[] b, int off, int len) throws IOException {
+ spaceNeeded(packet, len);
+ System.arraycopy(packet.data, packet.offset, b, off, len);
+ packet.offset += len;
+ }
+
+ public static int skipBytes(ByteSequence packet, int n) throws IOException {
+ int rc = Math.min(n, remaining(packet));
+ packet.offset += rc;
+ return rc;
+ }
+
+ public static boolean readBoolean(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 1);
+ return read(packet) != 0;
+ }
+
+ public static byte readByte(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 1);
+ return (byte) read(packet);
+ }
+
+ public static int readUnsignedByte(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 1);
+ return read(packet);
+ }
+
+ public static short readShortBig(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return (short) ((read(packet) << 8) + (read(packet) << 0));
+ }
+ public static short readShortLittle(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return (short) ((read(packet) << 0) + (read(packet) << 8) );
+ }
+
+ public static int readUnsignedShortBig(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return ((read(packet) << 8) + (read(packet) << 0));
+ }
+ public static int readUnsignedShortLittle(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return ((read(packet) << 0) + (read(packet) << 8) );
+ }
+
+ public static char readCharBig(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return (char) ((read(packet) << 8) + (read(packet) << 0));
+ }
+ public static char readCharLittle(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 2);
+ return (char) ((read(packet) << 0) + (read(packet) << 8) );
+ }
+
+ public static int readIntBig(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 4);
+ return ((read(packet) << 24) +
+ (read(packet) << 16) +
+ (read(packet) << 8) +
+ (read(packet) << 0));
+ }
+ public static int readIntLittle(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 4);
+ return ((read(packet) << 0) +
+ (read(packet) << 8) +
+ (read(packet) << 16) +
+ (read(packet) << 24));
+ }
+
+ public static long readLongBig(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 8);
+ return (((long) read(packet) << 56) +
+ ((long) read(packet) << 48) +
+ ((long) read(packet) << 40) +
+ ((long) read(packet) << 32) +
+ ((long) read(packet) << 24) +
+ ((read(packet)) << 16) +
+ ((read(packet)) << 8) +
+ ((read(packet)) << 0));
+ }
+ public static long readLongLittle(ByteSequence packet) throws IOException {
+ spaceNeeded(packet, 8);
+ return ((read(packet) << 0) +
+ (read(packet) << 8) +
+ (read(packet) << 16) +
+ ((long) read(packet) << 24) +
+ ((long) read(packet) << 32) +
+ ((long) read(packet) << 40) +
+ ((long) read(packet) << 48) +
+ ((long) read(packet) << 56));
+ }
+
+ public static double readDoubleBig(ByteSequence packet) throws IOException {
+ return Double.longBitsToDouble(readLongBig(packet));
+ }
+ public static double readDoubleLittle(ByteSequence packet) throws IOException {
+ return Double.longBitsToDouble(readLongLittle(packet));
+ }
+
+ public static float readFloatBig(ByteSequence packet) throws IOException {
+ return Float.intBitsToFloat(readIntBig(packet));
+ }
+ public static float readFloatLittle(ByteSequence packet) throws IOException {
+ return Float.intBitsToFloat(readIntLittle(packet));
+ }
+
+ public static void write(ByteSequence packet, int b) throws IOException {
+ spaceNeeded(packet, 1);
+ packet.data[packet.offset++] = (byte) b;
+ }
+
+ public static void write(ByteSequence packet, byte[] b) throws IOException {
+ write(packet, b, 0, b.length);
+ }
+ public static void write(ByteSequence packet, byte[] b, int off, int len) throws IOException {
+ spaceNeeded(packet, len);
+ System.arraycopy(b, off, packet.data, packet.offset, len);
+ packet.offset += len;
+ }
+ public static void writeBoolean(ByteSequence packet, boolean v) throws IOException {
+ spaceNeeded(packet, 1);
+ write(packet,v ? 1 : 0);
+ }
+ public static void writeByte(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 1);
+ write(packet,v);
+ }
+ public static void writeShortBig(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 2);
+ write(packet,(v >>> 8) & 0xFF);
+ write(packet,(v >>> 0) & 0xFF);
+ }
+ public static void writeShortLittle(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 2);
+ write(packet,(v >>> 0) & 0xFF);
+ write(packet,(v >>> 8) & 0xFF);
+ }
+ public static void writeCharBig(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 2);
+ write(packet,(v >>> 8) & 0xFF);
+ write(packet,(v >>> 0) & 0xFF);
+ }
+ public static void writeCharLittle(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 2);
+ write(packet,(v >>> 0) & 0xFF);
+ write(packet,(v >>> 8) & 0xFF);
+ }
+ public static void writeIntBig(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 4);
+ write(packet,(v >>> 24) & 0xFF);
+ write(packet,(v >>> 16) & 0xFF);
+ write(packet,(v >>> 8) & 0xFF);
+ write(packet,(v >>> 0) & 0xFF);
+ }
+ public static void writeIntLittle(ByteSequence packet, int v) throws IOException {
+ spaceNeeded(packet, 4);
+ write(packet,(v >>> 0) & 0xFF);
+ write(packet,(v >>> 8) & 0xFF);
+ write(packet,(v >>> 16) & 0xFF);
+ write(packet,(v >>> 24) & 0xFF);
+ }
+ public static void writeLongBig(ByteSequence packet, long v) throws IOException {
+ spaceNeeded(packet, 8);
+ write(packet,(int) (v >>> 56) & 0xFF);
+ write(packet,(int) (v >>> 48) & 0xFF);
+ write(packet,(int) (v >>> 40) & 0xFF);
+ write(packet,(int) (v >>> 32) & 0xFF);
+ write(packet,(int) (v >>> 24) & 0xFF);
+ write(packet,(int) (v >>> 16) & 0xFF);
+ write(packet,(int) (v >>> 8) & 0xFF);
+ write(packet,(int) (v >>> 0) & 0xFF);
+ }
+ public static void writeLongLittle(ByteSequence packet, long v) throws IOException {
+ spaceNeeded(packet, 8);
+ write(packet,(int) (v >>> 0) & 0xFF);
+ write(packet,(int) (v >>> 8) & 0xFF);
+ write(packet,(int) (v >>> 16) & 0xFF);
+ write(packet,(int) (v >>> 24) & 0xFF);
+ write(packet,(int) (v >>> 32) & 0xFF);
+ write(packet,(int) (v >>> 40) & 0xFF);
+ write(packet,(int) (v >>> 48) & 0xFF);
+ write(packet,(int) (v >>> 56) & 0xFF);
+ }
+
+ public static void writeDoubleBig(ByteSequence packet, double v) throws IOException {
+ writeLongBig(packet, Double.doubleToLongBits(v));
+ }
+ public static void writeDoubleLittle(ByteSequence packet, double v) throws IOException {
+ writeLongLittle(packet, Double.doubleToLongBits(v));
+ }
+
+ public static void writeFloatBig(ByteSequence packet, float v) throws IOException {
+ writeIntBig(packet, Float.floatToIntBits(v));
+ }
+ public static void writeFloatLittle(ByteSequence packet, float v) throws IOException {
+ writeIntLittle(packet, Float.floatToIntBits(v));
+ }
+
+ public static void writeRawDoubleBig(ByteSequence packet, double v) throws IOException {
+ writeLongBig(packet, Double.doubleToRawLongBits(v));
+ }
+ public static void writeRawDoubleLittle(ByteSequence packet, double v) throws IOException {
+ writeLongLittle(packet, Double.doubleToRawLongBits(v));
+ }
+
+ public static void writeRawFloatBig(ByteSequence packet, float v) throws IOException {
+ writeIntBig(packet, Float.floatToRawIntBits(v));
+ }
+ public static void writeRawFloatLittle(ByteSequence packet, float v) throws IOException {
+ writeIntLittle(packet, Float.floatToRawIntBits(v));
+ }
+
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ClassLoadingAwareObjectInputStream.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package org.apache.activemq.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+
+public class ClassLoadingAwareObjectInputStream extends ObjectInputStream {
+
+ private static final ClassLoader FALLBACK_CLASS_LOADER = ClassLoadingAwareObjectInputStream.class.getClassLoader();
+
+ public ClassLoadingAwareObjectInputStream(InputStream in) throws IOException {
+ super(in);
+ }
+
+ protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ return load(classDesc.getName(), cl);
+ }
+
+ protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++)
+ cinterfaces[i] = load(interfaces[i], cl);
+
+ try {
+ return Proxy.getProxyClass(cinterfaces[0].getClassLoader(), cinterfaces);
+ } catch (IllegalArgumentException e) {
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+
+ private Class load(String className, ClassLoader cl) throws ClassNotFoundException {
+ try {
+ return ClassLoading.loadClass(className, cl);
+ } catch ( ClassNotFoundException e ) {
+ return ClassLoading.loadClass(className, FALLBACK_CLASS_LOADER);
+ }
+ }
+
+}
\ No newline at end of file
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,106 @@
+/**
+ *
+ * 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 org.apache.activemq.util;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
+
+
+public class FactoryFinder {
+
+ private final String path;
+ private final ConcurrentHashMap classMap = new ConcurrentHashMap();
+
+ public FactoryFinder(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Creates a new instance of the given key
+ *
+ * @param key is the key to add to the path to find a text file
+ * containing the factory name
+ * @return a newly created instance
+ */
+ public Object newInstance(String key)
+ throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException
+ {
+ return newInstance(key, null);
+ }
+
+ public Object newInstance(String key, String propertyPrefix)
+ throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException
+ {
+ if (propertyPrefix == null)
+ propertyPrefix = "";
+
+ Class clazz = (Class) classMap.get(propertyPrefix + key);
+ if (clazz == null) {
+ clazz = newInstance(doFindFactoryProperies(key), propertyPrefix);
+ classMap.put(propertyPrefix + key, clazz);
+ }
+ return clazz.newInstance();
+ }
+
+ private Class newInstance(Properties properties, String propertyPrefix) throws ClassNotFoundException, IOException {
+
+ String className = properties.getProperty(propertyPrefix + "class");
+ if (className == null) {
+ throw new IOException("Expected property is missing: " + propertyPrefix + "class");
+ }
+ Class clazz;
+ try {
+ clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ clazz = FactoryFinder.class.getClassLoader().loadClass(className);
+ }
+
+ return clazz;
+ }
+
+ private Properties doFindFactoryProperies(String key) throws IOException {
+ String uri = path + key;
+
+ // lets try the thread context class loader first
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
+ if (in == null) {
+ in = FactoryFinder.class.getClassLoader().getResourceAsStream(uri);
+ if (in == null) {
+ throw new IOException("Could not find factory class for resource: " + uri);
+ }
+ }
+
+ // lets load the file
+ BufferedInputStream reader = null;
+ try {
+ reader = new BufferedInputStream(in);
+ Properties properties = new Properties();
+ properties.load(reader);
+ return properties;
+ } finally {
+ try {
+ reader.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+}
\ No newline at end of file
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/ObjectStreamWireFormat.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/ObjectStreamWireFormat.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/ObjectStreamWireFormat.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/ObjectStreamWireFormat.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,75 @@
+/**
+ *
+ * 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 org.apache.activemq.wireformat;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import org.apache.activemq.util.ByteArrayInputStream;
+import org.apache.activemq.util.ByteArrayOutputStream;
+import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.util.ClassLoadingAwareObjectInputStream;
+
+/**
+ * A simple implementation which uses Object Stream serialization.
+ *
+ * @version $Revision: 1.1 $
+ */
+public class ObjectStreamWireFormat implements WireFormat {
+
+ public ByteSequence marshal(Object command) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream ds = new DataOutputStream(baos);
+ marshal(command, ds);
+ ds.close();
+ return baos.toByteSequence();
+ }
+
+ public Object unmarshal(ByteSequence packet) throws IOException {
+ return unmarshal(new DataInputStream(new ByteArrayInputStream(packet)));
+ }
+
+ public void marshal(Object command, DataOutputStream ds) throws IOException {
+ ObjectOutputStream out = new ObjectOutputStream(ds);
+ out.writeObject(command);
+ out.flush();
+ out.reset();
+ }
+
+ public Object unmarshal(DataInputStream ds) throws IOException {
+ try {
+ ClassLoadingAwareObjectInputStream in = new ClassLoadingAwareObjectInputStream(ds);
+ Object command;
+ command = in.readObject();
+ in.close();
+ return command;
+ } catch (ClassNotFoundException e) {
+ throw (IOException)new IOException("unmarshal failed: "+e).initCause(e);
+ }
+ }
+
+ public void setVersion(int version) {
+ }
+
+ public int getVersion() {
+ return 0;
+ }
+
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormat.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,65 @@
+/**
+ *
+ * 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 org.apache.activemq.wireformat;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.activemq.util.ByteSequence;
+
+
+/**
+ * Provides a mechanism to marshal commands into and out of packets
+ * or into and out of streams, Channels and Datagrams.
+ *
+ * @version $Revision: 1.1 $
+ */
+public interface WireFormat {
+
+ /**
+ * Packet based marshaling
+ */
+ ByteSequence marshal(Object command) throws IOException;
+
+ /**
+ * Packet based un-marshaling
+ */
+ Object unmarshal(ByteSequence packet) throws IOException;
+
+ /**
+ * Stream based marshaling
+ */
+ void marshal(Object command, DataOutputStream out) throws IOException;
+
+ /**
+ * Packet based un-marshaling
+ */
+ Object unmarshal(DataInputStream in) throws IOException;
+
+ /**
+ * @param the version of the wire format
+ */
+ public void setVersion(int version);
+
+ /**
+ * @return the version of the wire format
+ */
+ public int getVersion();
+
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormatFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormatFactory.java?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormatFactory.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/WireFormatFactory.java Thu Aug 31 17:13:23 2006
@@ -0,0 +1,22 @@
+/**
+ *
+ * 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 org.apache.activemq.wireformat;
+
+public interface WireFormatFactory {
+ WireFormat createWireFormat();
+}
Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/package.html
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/package.html?rev=439111&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/package.html (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/wireformat/package.html Thu Aug 31 17:13:23 2006
@@ -0,0 +1,27 @@
+<!--
+ 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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+<p>
+An API for WireFormats which are used to turn object into bytes and bytes into objects.
+</p>
+
+</body>
+</html>
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java Thu Aug 31 17:13:23 2006
@@ -21,10 +21,10 @@
import junit.framework.Test;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.Response;
import org.apache.activemq.openwire.OpenWireFormat;
+import org.apache.activemq.wireformat.WireFormat;
/**
* Runs against the broker but marshals all request and response commands.
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java Thu Aug 31 17:13:23 2006
@@ -28,10 +28,10 @@
import junit.framework.TestCase;
-import org.apache.activeio.command.WireFormat;
-import org.apache.activeio.packet.ByteSequence;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.state.CommandVisitor;
+import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.wireformat.WireFormat;
/**
* @version $Revision$
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQTextMessageTest.java Thu Aug 31 17:13:23 2006
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
import junit.textui.TestRunner;
-import org.apache.activeio.packet.ByteSequence;
+import org.apache.activemq.util.ByteSequence;
/**
* @version $Revision$
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/DataStructureTestSupport.java Thu Aug 31 17:13:23 2006
@@ -25,10 +25,10 @@
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import org.apache.activeio.command.WireFormat;
-import org.apache.activeio.packet.Packet;
import org.apache.activemq.CombinationTestSupport;
import org.apache.activemq.openwire.OpenWireFormat;
+import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.wireformat.WireFormat;
public abstract class DataStructureTestSupport extends CombinationTestSupport {
public boolean cacheEnabled;
@@ -158,7 +158,7 @@
}
protected Object marshalAndUnmarshall(Object original, WireFormat wireFormat) throws IOException {
- Packet packet = wireFormat.marshal(original);
+ ByteSequence packet = wireFormat.marshal(original);
return wireFormat.unmarshal(packet);
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/MessageSendTest.java Thu Aug 31 17:13:23 2006
@@ -21,7 +21,7 @@
import junit.framework.Test;
-import org.apache.activeio.packet.ByteSequence;
+import org.apache.activemq.util.ByteSequence;
public class MessageSendTest extends DataStructureTestSupport {
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java Thu Aug 31 17:13:23 2006
@@ -22,8 +22,6 @@
import junit.framework.TestCase;
-import org.apache.activeio.command.DefaultWireFormat;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.region.policy.FixedSizedSubscriptionRecoveryPolicy;
@@ -43,6 +41,8 @@
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.activemq.transport.activeio.ActiveIOTransportServer;
import org.apache.activemq.transport.tcp.TcpTransportServer;
+import org.apache.activemq.wireformat.ObjectStreamWireFormat;
+import org.apache.activemq.wireformat.WireFormat;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -132,7 +132,7 @@
assertTrue("Should have created an EmbeddedDataSource",
((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource);
assertTrue("Should have created a DefaultWireFormat",
- ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof DefaultWireFormat);
+ ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof ObjectStreamWireFormat);
log.info("Success");
} finally {
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java Thu Aug 31 17:13:23 2006
@@ -35,7 +35,6 @@
import java.util.HashSet;
import java.util.Set;
-import org.apache.activeio.packet.ByteSequence;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTextMessage;
@@ -57,6 +56,7 @@
import org.apache.activemq.openwire.v1.BrokerInfoTest;
import org.apache.activemq.openwire.v1.MessageAckTest;
import org.apache.activemq.test.TestSupport;
+import org.apache.activemq.util.ByteSequence;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java Thu Aug 31 17:13:23 2006
@@ -60,13 +60,13 @@
{
byte data[] = "Content:11".getBytes();
- info.setContent(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
+ info.setContent(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
{
byte data[] = "MarshalledProperties:12".getBytes();
- info.setMarshalledProperties(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
+ info.setMarshalledProperties(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
info.setDataStructure(createDataStructure("DataStructure:13"));
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java Thu Aug 31 17:13:23 2006
@@ -55,7 +55,7 @@
{
byte data[] = "MarshalledProperties:1".getBytes();
- info.setMarshalledProperties(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
+ info.setMarshalledProperties(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageTestSupport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageTestSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/MessageTestSupport.java Thu Aug 31 17:13:23 2006
@@ -1 +1 @@
-/**
*
* 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 org.apache.activemq.openwire.v2;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.a
pache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for Message
*
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the modify the groovy scripts in the
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
* @version $Revision: $
*/
public abstract class MessageTestSupport extends BaseCommandTestSupport {
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
Message info = (Message) object;
info.setProducerId(createProducerId("ProducerId:1"));
info.setDestination(createActiveMQDestination("Destination:2"));
info.setTransactionId(createTransactionId("TransactionId:3"));
info.setOriginalDestination(createActiveMQDestination("OriginalDestination:4"));
info.setMessageId(createMessageId("MessageId:5"));
info.setOriginalTransactionId(cr
eateTransactionId("OriginalTransactionId:6"));
info.setGroupID("GroupID:7");
info.setGroupSequence(1);
info.setCorrelationId("CorrelationId:8");
info.setPersistent(true);
info.setExpiration(1);
info.setPriority((byte) 1);
info.setReplyTo(createActiveMQDestination("ReplyTo:9"));
info.setTimestamp(2);
info.setType("Type:10");
{
byte data[] = "Content:11".getBytes();
info.setContent(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
}
{
byte data[] = "MarshalledProperties:12".getBytes();
info.setMarshalledProperties(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
}
info.setDataStructure(createDataStructure("DataStructure:13"));
info.setTargetConsumerId(createConsumerId("TargetConsumerId:14"));
info.setCompressed(false);
info.setRedeliveryCounter(2);
{
BrokerId value[] = new BrokerId[2];
for( int i=0; i < 2; i++ ) {
value[i] = createBrokerId("BrokerPath:15");
}
info.setBrokerPath(value);
}
info.setArrival(3);
info.setUserID("UserID:16");
info.setRecievedByDFBridge(true);
}
}
\ No newline at end of file
+/**
*
* 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 org.apache.activemq.openwire.v2;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.a
pache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for Message
*
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the modify the groovy scripts in the
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
* @version $Revision: $
*/
public abstract class MessageTestSupport extends BaseCommandTestSupport {
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
Message info = (Message) object;
info.setProducerId(createProducerId("ProducerId:1"));
info.setDestination(createActiveMQDestination("Destination:2"));
info.setTransactionId(createTransactionId("TransactionId:3"));
info.setOriginalDestination(createActiveMQDestination("OriginalDestination:4"));
info.setMessageId(createMessageId("MessageId:5"));
info.setOriginalTransactionId(cr
eateTransactionId("OriginalTransactionId:6"));
info.setGroupID("GroupID:7");
info.setGroupSequence(1);
info.setCorrelationId("CorrelationId:8");
info.setPersistent(true);
info.setExpiration(1);
info.setPriority((byte) 1);
info.setReplyTo(createActiveMQDestination("ReplyTo:9"));
info.setTimestamp(2);
info.setType("Type:10");
{
byte data[] = "Content:11".getBytes();
info.setContent(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
{
byte data[] = "MarshalledProperties:12".getBytes();
info.setMarshalledProperties(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
info.setDataStructure(createDataStructure("DataStructure:13"));
info.setTargetConsumerId(createConsumerId("TargetConsumerId:14"));
info.setCompressed(false);
info.setRedeliveryCounter(2);
{
BrokerId value[] = new BrokerId[2];
for( int i=0; i < 2; i++ ) {
value[i] = createBrokerId("BrokerPath:15");
}
info.setBrokerPath(value);
}
info.setArrival(3);
info.setUserID("UserID:16");
info.setRecievedByDFBridge(true);
}
}
\ No newline at end of file
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v2/WireFormatInfoTest.java Thu Aug 31 17:13:23 2006
@@ -1 +1 @@
-/**
*
* 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 org.apache.activemq.openwire.v2;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.a
pache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for WireFormatInfo
*
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the modify the groovy scripts in the
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
* @version $Revision: $
*/
public class WireFormatInfoTest extends DataFileGeneratorTestSupport {
public static WireFormatInfoTest SINGLETON = new WireFormatInfoTest();
public Object createObject() throws Exception {
WireFormatInfo info = new WireFormatInfo();
populateObject(info);
return info;
}
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
WireFormatInfo info = (WireFormatInfo) object;
info.setVersion(1);
{
byte data[] = "MarshalledProperties:1".getBytes();
info.setMarshalledPropertie
s(new org.apache.activeio.packet.ByteSequence(data,0,data.length));
}
}
}
\ No newline at end of file
+/**
*
* 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 org.apache.activemq.openwire.v2;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.a
pache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for WireFormatInfo
*
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the modify the groovy scripts in the
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
* @version $Revision: $
*/
public class WireFormatInfoTest extends DataFileGeneratorTestSupport {
public static WireFormatInfoTest SINGLETON = new WireFormatInfoTest();
public Object createObject() throws Exception {
WireFormatInfo info = new WireFormatInfo();
populateObject(info);
return info;
}
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
WireFormatInfo info = (WireFormatInfo) object;
info.setVersion(1);
{
byte data[] = "MarshalledProperties:1".getBytes();
info.setMarshalledPropertie
s(new org.apache.activemq.util.ByteSequence(data,0,data.length));
}
}
}
\ No newline at end of file
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java Thu Aug 31 17:13:23 2006
@@ -26,6 +26,7 @@
import org.apache.activemq.command.Response;
import org.apache.activemq.transport.FutureResponse;
import org.apache.activemq.transport.util.TextWireFormat;
+import org.apache.activemq.util.ByteArrayInputStream;
import org.apache.activemq.util.IOExceptionSupport;
import org.apache.activemq.util.IdGenerator;
import org.apache.activemq.util.ServiceStopper;
@@ -73,7 +74,10 @@
PostMethod httpMethod = new PostMethod(getRemoteUrl().toString());
configureMethod(httpMethod);
- httpMethod.setRequestBody(getTextWireFormat().toString(command));
+ String data = getTextWireFormat().marshalText(command);
+ byte[] bytes = data.getBytes("UTF-8");
+ httpMethod.setRequestBody(new ByteArrayInputStream(bytes));
+
try {
HttpClient client = getSendHttpClient();
@@ -126,9 +130,8 @@
}
else {
// checkSession(httpMethod);
- DataInputStream stream = new DataInputStream(httpMethod.getResponseBodyAsStream());
-
- Command command = getTextWireFormat().readCommand(stream);
+ DataInputStream stream = new DataInputStream(httpMethod.getResponseBodyAsStream());
+ Command command = (Command) getTextWireFormat().unmarshal(stream);
if (command == null) {
log.warn("Received null command from url: " + remoteUrl);
} else {
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpSpringEmbeddedTunnelServlet.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpSpringEmbeddedTunnelServlet.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpSpringEmbeddedTunnelServlet.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpSpringEmbeddedTunnelServlet.java Thu Aug 31 17:13:23 2006
@@ -29,7 +29,10 @@
* @version $Revision$
*/
public class HttpSpringEmbeddedTunnelServlet extends HttpEmbeddedTunnelServlet {
- /**
+
+ private static final long serialVersionUID = -6568661997192814908L;
+
+ /**
* Factory method to create a new broker
*/
protected BrokerService createBroker() throws Exception {
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java Thu Aug 31 17:13:23 2006
@@ -17,24 +17,26 @@
*/
package org.apache.activemq.transport.http;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
import org.apache.activemq.command.Command;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.transport.util.TextWireFormat;
+import org.apache.activemq.util.ByteArrayOutputStream;
+import org.apache.activemq.util.ByteSequence;
import org.apache.activemq.util.Callback;
import org.apache.activemq.util.IOExceptionSupport;
import org.apache.activemq.util.ServiceStopper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-
/**
* @version $Revision$
*/
@@ -66,7 +68,7 @@
}
HttpURLConnection connection = getSendConnection();
- String text = getTextWireFormat().toString(command);
+ String text = getTextWireFormat().marshalText(command);
Writer writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(text);
writer.flush();
@@ -98,7 +100,18 @@
}
else {
// checkSession(connection);
- Command command = getTextWireFormat().readCommand(new DataInputStream(connection.getInputStream()));
+
+ // Create a String for the UTF content
+ InputStream is = connection.getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(connection.getContentLength()>0?connection.getContentLength():1024);
+ int c=0;
+ while( (c=is.read())>= 0 ) {
+ baos.write(c);
+ }
+ ByteSequence sequence = baos.toByteSequence();
+ String data = new String(sequence.data, sequence.offset, sequence.length, "UTF-8");
+
+ Command command = (Command) getTextWireFormat().unmarshalText(data);
if (command == null) {
log.warn("Received null packet from url: " + remoteUrl);
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java Thu Aug 31 17:13:23 2006
@@ -21,13 +21,13 @@
import java.net.URI;
import java.util.Map;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportFactory;
import org.apache.activemq.transport.TransportLogger;
import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.transport.util.TextWireFormat;
import org.apache.activemq.transport.xstream.XStreamWireFormat;
+import org.apache.activemq.wireformat.WireFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java Thu Aug 31 17:13:23 2006
@@ -99,7 +99,7 @@
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Read the command directly from the reader
- Command command = wireFormat.readCommand(request.getReader());
+ Command command = (Command) wireFormat.unmarshalText(request.getReader());
if (command instanceof WireFormatInfo) {
WireFormatInfo info = (WireFormatInfo) command;
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java Thu Aug 31 17:13:23 2006
@@ -21,10 +21,10 @@
import java.net.MalformedURLException;
import java.net.URI;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.transport.Transport;
import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.transport.http.HttpTransportFactory;
+import org.apache.activemq.wireformat.WireFormat;
/**
* Factory of HTTPS based transports
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java Thu Aug 31 17:13:23 2006
@@ -18,11 +18,14 @@
package org.apache.activemq.transport.util;
import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Reader;
-import org.apache.activeio.command.WireFormat;
-import org.apache.activemq.command.Command;
+import org.apache.activemq.util.ByteArrayInputStream;
+import org.apache.activemq.util.ByteArrayOutputStream;
+import org.apache.activemq.util.ByteSequence;
+import org.apache.activemq.wireformat.WireFormat;
/**
* Adds the extra methods available to text based wire format implementations
@@ -31,14 +34,31 @@
*/
public abstract class TextWireFormat implements WireFormat {
- public abstract Command readCommand(String text);
-
- public abstract Command readCommand(Reader reader);
+ public abstract Object unmarshalText(String text);
+ public abstract Object unmarshalText(Reader reader);
+ public abstract String marshalText(Object command);
- public abstract String toString(Command command);
+ public void marshal(Object command, DataOutputStream out) throws IOException {
+ out.writeUTF(marshalText(command));
+ }
- public Command readCommand(DataInputStream in) throws IOException {
+ public Object unmarshal(DataInputStream in) throws IOException {
String text = in.readUTF();
- return readCommand(text);
+ return unmarshalText(text);
+ }
+
+ public ByteSequence marshal(Object command) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ marshal(command, dos);
+ dos.close();
+ return baos.toByteSequence();
}
+
+ public Object unmarshal(ByteSequence packet) throws IOException {
+ ByteArrayInputStream stream = new ByteArrayInputStream(packet);
+ DataInputStream dis = new DataInputStream(stream);
+ return unmarshal(dis);
+ }
+
}
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java Thu Aug 31 17:13:23 2006
@@ -17,19 +17,11 @@
*/
package org.apache.activemq.transport.xstream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
import java.io.Reader;
-import javax.jms.JMSException;
-
-import org.apache.activeio.command.WireFormat;
-import org.apache.activeio.packet.Packet;
import org.apache.activemq.command.Command;
import org.apache.activemq.transport.util.TextWireFormat;
+import org.apache.activemq.wireformat.WireFormat;
import com.thoughtworks.xstream.XStream;
@@ -44,23 +36,6 @@
private XStream xStream;
private int version;
- public void marshal(Object command, DataOutputStream out) throws IOException {
- String text = getXStream().toXML(command);
- out.writeUTF(text);
- }
-
- public Packet marshal(Object command) throws IOException {
- return null;
- }
-
- public Object unmarshal(DataInputStream arg0) throws IOException {
- return null;
- }
-
- public Object unmarshal(Packet arg0) throws IOException {
- return null;
- }
-
public int getVersion() {
return version;
}
@@ -69,43 +44,21 @@
this.version = version;
}
- public Packet readPacket(DataInput in) throws IOException {
- String text = in.readUTF();
- return (Packet) getXStream().fromXML(text);
- }
-
- public Packet readPacket(int firstByte, DataInput in) throws IOException {
- String text = in.readUTF();
- return (Packet) getXStream().fromXML(text);
- }
-
- public Packet writePacket(Packet packet, DataOutput out) throws IOException, JMSException {
- String text = getXStream().toXML(packet);
- out.writeUTF(text);
- return null;
- }
public WireFormat copy() {
return new XStreamWireFormat();
}
- public String toString(Packet packet) {
- return getXStream().toXML(packet);
- }
-
- public Packet fromString(String xml) {
- return (Packet) getXStream().fromXML(xml);
- }
- public Command readCommand(String text) {
+ public Object unmarshalText(String text) {
return (Command) getXStream().fromXML(text);
}
- public Command readCommand(Reader reader) {
+ public Object unmarshalText(Reader reader) {
return (Command) getXStream().fromXML(reader);
}
- public String toString(Command command) {
+ public String marshalText(Object command) {
return getXStream().toXML(command);
}
@@ -146,4 +99,5 @@
return new XStream();
}
+
}
Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormatFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormatFactory.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormatFactory.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormatFactory.java Thu Aug 31 17:13:23 2006
@@ -17,8 +17,8 @@
*/
package org.apache.activemq.transport.xstream;
-import org.apache.activeio.command.WireFormat;
-import org.apache.activeio.command.WireFormatFactory;
+import org.apache.activemq.wireformat.WireFormat;
+import org.apache.activemq.wireformat.WireFormatFactory;
/**
*
Modified: incubator/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java (original)
+++ incubator/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java Thu Aug 31 17:13:23 2006
@@ -17,9 +17,9 @@
*/
package org.apache.activemq.transport.xstream;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.MessageTest;
+import org.apache.activemq.wireformat.WireFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,7 +34,7 @@
public void assertBeanMarshalls(Object original) throws IOException {
super.assertBeanMarshalls(original);
- String xml = getXStreamWireFormat().toString((Command) original);
+ String xml = getXStreamWireFormat().marshalText((Command) original);
log.info(original.getClass().getName() + " as XML is:");
log.info(xml);
}
Modified: incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java (original)
+++ incubator/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java Thu Aug 31 17:13:23 2006
@@ -16,8 +16,8 @@
*/
package org.apache.activemq.web;
-import org.apache.activeio.util.FactoryFinder;
import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.util.FactoryFinder;
import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.web.view.MessageRenderer;
Modified: incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java?rev=439111&r1=439110&r2=439111&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java (original)
+++ incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java Thu Aug 31 17:13:23 2006
@@ -22,8 +22,6 @@
import junit.framework.TestCase;
-import org.apache.activeio.command.DefaultWireFormat;
-import org.apache.activeio.command.WireFormat;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.region.policy.FixedSizedSubscriptionRecoveryPolicy;
@@ -43,6 +41,8 @@
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.activemq.transport.activeio.ActiveIOTransportServer;
import org.apache.activemq.transport.tcp.TcpTransportServer;
+import org.apache.activemq.wireformat.ObjectStreamWireFormat;
+import org.apache.activemq.wireformat.WireFormat;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -132,7 +132,7 @@
assertTrue("Should have created an EmbeddedDataSource",
((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource);
assertTrue("Should have created a DefaultWireFormat",
- ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof DefaultWireFormat);
+ ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof ObjectStreamWireFormat);
log.info("Success");
} finally {