You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(7) |
Dec
(18) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(20) |
Feb
(7) |
Mar
|
Apr
(8) |
May
(9) |
Jun
(7) |
Jul
(23) |
Aug
(3) |
Sep
|
Oct
(16) |
Nov
|
Dec
(3) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(6) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
(2) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(30) |
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
(2) |
Mar
(1) |
Apr
(23) |
May
(4) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ope...@li...> - 2008-02-07 16:41:34
|
Revision: 131 http://openfast.svn.sourceforge.net/openfast/?rev=131&view=rev Author: jacob_northey Date: 2008-02-07 08:41:36 -0800 (Thu, 07 Feb 2008) Log Message: ----------- Fixed mantissa should be stored in long bug. Modified Paths: -------------- trunk/src/main/java/org/openfast/DecimalValue.java trunk/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java trunk/src/main/java/org/openfast/template/operator/Operator.java trunk/src/main/java/org/openfast/template/type/DecimalConverter.java trunk/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java trunk/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java trunk/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java trunk/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java Added Paths: ----------- trunk/src/test/java/org/openfast/submitted/LargeValuesTest.java Modified: trunk/src/main/java/org/openfast/DecimalValue.java =================================================================== --- trunk/src/main/java/org/openfast/DecimalValue.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/DecimalValue.java 2008-02-07 16:41:36 UTC (rev 131) @@ -17,22 +17,23 @@ Contributor(s): Jacob Northey <ja...@la...> Craig Otis <co...@la...> -*/ + */ - package org.openfast; import java.math.BigDecimal; import org.openfast.error.FastConstants; - public class DecimalValue extends NumericValue { private static final long serialVersionUID = 1L; - public final double value; + + public final double value; + public final int exponent; - public final int mantissa; + public final long mantissa; + public DecimalValue(double value) { if (value == 0.0) { this.value = 0.0; @@ -46,7 +47,7 @@ BigDecimal decimalValue = BigDecimal.valueOf(value); int exponent = decimalValue.scale(); - int mantissa = decimalValue.unscaledValue().intValue(); + long mantissa = decimalValue.unscaledValue().longValue(); while (((mantissa % 10) == 0) && (mantissa != 0)) { mantissa /= 10; @@ -57,7 +58,7 @@ this.exponent = -exponent; } - public DecimalValue(int mantissa, int exponent) { + public DecimalValue(long mantissa, int exponent) { this.mantissa = mantissa; this.exponent = exponent; @@ -109,42 +110,42 @@ } public long toLong() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (long) value; } public int toInt() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (int) value; } public short toShort() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (short) value; } public byte toByte() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (byte) value; } - + public double toDouble() { - return value; + return value; } - + public BigDecimal toBigDecimal() { - return new BigDecimal(value); + return new BigDecimal(value); } public String toString() { return String.valueOf(value); } - + public int hashCode() { - return exponent * 37 + mantissa; + return exponent * 37 + (int) mantissa; } } Modified: trunk/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java 2008-02-07 16:41:36 UTC (rev 131) @@ -8,32 +8,33 @@ import org.openfast.template.type.Type; final class DefaultOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - DefaultOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } + DefaultOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (value == null) { - if (field.getDefaultValue().isUndefined()) - return null; - return ScalarValue.NULL; - } - - return value.equals(field.getDefaultValue()) ? null : value; - } + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (value == null) { + if (field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; + } - public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { - return newValue; - } + return value.equals(field.getDefaultValue()) ? null : value; + } - public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (field.getDefaultValue().isUndefined()) return null; - return field.getDefaultValue(); - } + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + return newValue; + } - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (field.getDefaultValue().isUndefined()) + return null; + return field.getDefaultValue(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Modified: trunk/src/main/java/org/openfast/template/operator/Operator.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/Operator.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/template/operator/Operator.java 2008-02-07 16:41:36 UTC (rev 131) @@ -11,105 +11,123 @@ import org.openfast.template.type.Type; public class Operator implements Serializable { - private static final long serialVersionUID = 1L; - private static final Map OPERATOR_NAME_MAP = new HashMap(); - private final String name; + private static final long serialVersionUID = 1L; - public static final Operator NONE = new Operator("none") { - private static final long serialVersionUID = 2L; - public boolean usesDictionary() { - return false; - } - public boolean shouldStoreValue(ScalarValue value) { - return false; - } - }; - public static final Operator CONSTANT = new Operator("constant") { - private static final long serialVersionUID = 1L; + private static final Map OPERATOR_NAME_MAP = new HashMap(); - public void validate(Scalar scalar) { - if (scalar.getDefaultValue().isUndefined()) - Global.handleError(FastConstants.S4_NO_INITIAL_VALUE_FOR_CONST, "The field " + scalar + " must have a default value defined."); - } - - public boolean shouldStoreValue(ScalarValue value) { - return false; - } - - public boolean usesDictionary() { - return false; - } - }; - public static final Operator DEFAULT = new Operator("default") { - private static final long serialVersionUID = 1L; + private final String name; - public void validate(Scalar scalar) { - if (!scalar.isOptional() && scalar.getDefaultValue().isUndefined()) - Global.handleError(FastConstants.S5_NO_INITVAL_MNDTRY_DFALT, "The field " + scalar + " must have a default value defined."); - } - }; - public static final Operator COPY = new Operator("copy") { - private static final long serialVersionUID = 1L; + public static final Operator NONE = new Operator("none") { + private static final long serialVersionUID = 2L; - public OperatorCodec getCodec(Type type) { - return OperatorCodec.COPY_ALL; - } - }; - public static final Operator INCREMENT = new Operator("increment"); - public static final Operator DELTA = new Operator("delta") { - private static final long serialVersionUID = 1L; + public boolean usesDictionary() { + return false; + } - public boolean shouldStoreValue(ScalarValue value) { - return value != null; - } - }; - public static final Operator TAIL = new Operator("tail"); + public boolean shouldStoreValue(ScalarValue value) { + return false; + } + }; - public Operator(String name) { - this.name = name; - OPERATOR_NAME_MAP.put(name, this); - } - - public static Operator getOperator(String name) { - if (!OPERATOR_NAME_MAP.containsKey(name)) - throw new IllegalArgumentException("The operator \"" + name + "\" does not exist."); - return (Operator) OPERATOR_NAME_MAP.get(name); - } - - public OperatorCodec getCodec(Type type) { - return OperatorCodec.getCodec(this, type); - } - - public String toString() { - return name; - } + public static final Operator CONSTANT = new Operator("constant") { + private static final long serialVersionUID = 1L; - public String getName() { - return name; - } + public void validate(Scalar scalar) { + if (scalar.getDefaultValue().isUndefined()) + Global.handleError(FastConstants.S4_NO_INITIAL_VALUE_FOR_CONST, "The field " + scalar + + " must have a default value defined."); + } - public boolean shouldStoreValue(ScalarValue value) { - return true; - } + public boolean shouldStoreValue(ScalarValue value) { + return false; + } - public void validate(Scalar scalar) { - } + public boolean usesDictionary() { + return false; + } + }; - public boolean equals(Object other) { - if (other == this) return true; - if (other == null || !(other instanceof Operator)) return false; - return equals((Operator) other); - } - - private boolean equals(Operator other) { - return name.equals(other.name); - } - - public int hashCode() { - return name.hashCode(); - } + public static final Operator DEFAULT = new Operator("default") { + private static final long serialVersionUID = 1L; - public boolean usesDictionary() { - return true; - } + public void validate(Scalar scalar) { + if (!scalar.isOptional() && scalar.getDefaultValue().isUndefined()) + Global.handleError(FastConstants.S5_NO_INITVAL_MNDTRY_DFALT, "The field " + scalar + + " must have a default value defined."); + } + + public boolean shouldStoreValue(ScalarValue value) { + return value != null; + } + }; + + public static final Operator COPY = new Operator("copy") { + private static final long serialVersionUID = 1L; + + public OperatorCodec getCodec(Type type) { + return OperatorCodec.COPY_ALL; + } + }; + + public static final Operator INCREMENT = new Operator("increment"); + + public static final Operator DELTA = new Operator("delta") { + private static final long serialVersionUID = 1L; + + public boolean shouldStoreValue(ScalarValue value) { + return value != null; + } + }; + + public static final Operator TAIL = new Operator("tail"); + + public Operator(String name) { + this.name = name; + OPERATOR_NAME_MAP.put(name, this); + } + + public static Operator getOperator(String name) { + if (!OPERATOR_NAME_MAP.containsKey(name)) + throw new IllegalArgumentException("The operator \"" + name + "\" does not exist."); + return (Operator) OPERATOR_NAME_MAP.get(name); + } + + public OperatorCodec getCodec(Type type) { + return OperatorCodec.getCodec(this, type); + } + + public String toString() { + return name; + } + + public String getName() { + return name; + } + + public boolean shouldStoreValue(ScalarValue value) { + return true; + } + + public void validate(Scalar scalar) { + } + + public boolean equals(Object other) { + if (other == this) + return true; + if (other == null || !(other instanceof Operator)) + return false; + return equals((Operator) other); + } + + private boolean equals(Operator other) { + return name.equals(other.name); + } + + public int hashCode() { + return name.hashCode(); + } + + public boolean usesDictionary() { + return true; + } } Modified: trunk/src/main/java/org/openfast/template/type/DecimalConverter.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/DecimalConverter.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/template/type/DecimalConverter.java 2008-02-07 16:41:36 UTC (rev 131) @@ -5,24 +5,28 @@ import org.openfast.IntegerValue; import org.openfast.ScalarValue; import org.openfast.template.ComposedValueConverter; +import org.openfast.template.LongValue; public class DecimalConverter implements ComposedValueConverter { - private static final FieldValue[] NULL_SET = new FieldValue[] { null, null }; - private static final FieldValue[] UNDEFINED_SET = new FieldValue[] { ScalarValue.UNDEFINED, ScalarValue.UNDEFINED }; + private static final FieldValue[] NULL_SET = new FieldValue[] { null, null }; - public FieldValue[] split(FieldValue value) { - if (value == null) - return NULL_SET; - else if (value == ScalarValue.UNDEFINED) - return UNDEFINED_SET; - DecimalValue decimal = (DecimalValue) value; - return new FieldValue[] { new IntegerValue(decimal.exponent), new IntegerValue(decimal.mantissa) }; - } + private static final FieldValue[] UNDEFINED_SET = new FieldValue[] { ScalarValue.UNDEFINED, ScalarValue.UNDEFINED }; - public FieldValue compose(FieldValue[] values) { - if (values[0] == null) return null; - if (values[0] == ScalarValue.UNDEFINED) return ScalarValue.UNDEFINED; - return new DecimalValue(((IntegerValue) values[1]).value, ((IntegerValue) values[0]).value); - } + public FieldValue[] split(FieldValue value) { + if (value == null) + return NULL_SET; + else if (value == ScalarValue.UNDEFINED) + return UNDEFINED_SET; + DecimalValue decimal = (DecimalValue) value; + return new FieldValue[] { new IntegerValue(decimal.exponent), new LongValue(decimal.mantissa) }; + } + + public FieldValue compose(FieldValue[] values) { + if (values[0] == null) + return null; + if (values[0] == ScalarValue.UNDEFINED) + return ScalarValue.UNDEFINED; + return new DecimalValue(((ScalarValue)values[1]).toLong(), ((IntegerValue) values[0]).value); + } } Modified: trunk/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java 2008-02-07 16:41:36 UTC (rev 131) @@ -25,18 +25,18 @@ */ package org.openfast.template.type.codec; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + import org.openfast.DecimalValue; import org.openfast.Global; import org.openfast.IntegerValue; import org.openfast.ScalarValue; - import org.openfast.error.FastConstants; +import org.openfast.template.LongValue; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - final class NullableSingleFieldDecimal extends TypeCodec { private static final long serialVersionUID = 1L; @@ -62,7 +62,7 @@ buffer.write(TypeCodec.NULLABLE_INTEGER.encode( new IntegerValue(value.exponent))); - buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.mantissa))); + buffer.write(TypeCodec.INTEGER.encode(new LongValue(value.mantissa))); } catch (IOException e) { throw new RuntimeException(e); } Modified: trunk/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java 2008-02-07 16:41:36 UTC (rev 131) @@ -17,34 +17,35 @@ Contributor(s): Jacob Northey <ja...@la...> Craig Otis <co...@la...> -*/ + */ - /** * */ package org.openfast.template.type.codec; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + import org.openfast.DecimalValue; import org.openfast.Global; import org.openfast.IntegerValue; import org.openfast.ScalarValue; - import org.openfast.error.FastConstants; +import org.openfast.template.LongValue; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - final class SingleFieldDecimal extends TypeCodec { private static final long serialVersionUID = 1L; - SingleFieldDecimal() { } + SingleFieldDecimal() { + } /** * Takes a ScalarValue object, and converts it to a byte array - * @param v The ScalarValue to be encoded + * + * @param v + * The ScalarValue to be encoded * @return Returns a byte array of the passed object */ public byte[] encodeValue(ScalarValue v) { @@ -57,12 +58,11 @@ try { if (Math.abs(value.exponent) > 63) { - Global.handleError(FastConstants.R1_LARGE_DECIMAL, - "Encountered exponent of size " + value.exponent); + Global.handleError(FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + value.exponent); } buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.exponent))); - buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.mantissa))); + buffer.write(TypeCodec.INTEGER.encode(new LongValue(value.mantissa))); } catch (IOException e) { throw new RuntimeException(e); } @@ -72,15 +72,16 @@ /** * Reads in a stream of data and stores it to a decimalValue object - * @param in The InputStream to be decoded + * + * @param in + * The InputStream to be decoded * @return Returns a decimalValue object with the data stream */ public ScalarValue decode(InputStream in) { int exponent = ((IntegerValue) TypeCodec.INTEGER.decode(in)).value; if (Math.abs(exponent) > 63) { - Global.handleError(FastConstants.R1_LARGE_DECIMAL, - "Encountered exponent of size " + exponent); + Global.handleError(FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + exponent); } int mantissa = ((IntegerValue) TypeCodec.INTEGER.decode(in)).value; @@ -90,8 +91,11 @@ } /** - * Convert a string to a DecimalValue object with the string as the passed value - * @param value The value as a string to be converted + * Convert a string to a DecimalValue object with the string as the passed + * value + * + * @param value + * The value as a string to be converted * @return Returns a new DecimalValue object */ public ScalarValue fromString(String value) { @@ -106,7 +110,7 @@ return new DecimalValue(0.0); } - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } } Added: trunk/src/test/java/org/openfast/submitted/LargeValuesTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/LargeValuesTest.java (rev 0) +++ trunk/src/test/java/org/openfast/submitted/LargeValuesTest.java 2008-02-07 16:41:36 UTC (rev 131) @@ -0,0 +1,27 @@ +package org.openfast.submitted; + +import org.openfast.IntegerValue; +import org.openfast.Message; +import org.openfast.QName; +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.operator.Operator; +import org.openfast.test.OpenFastTestCase; +import org.openfast.util.Util; + +public class LargeValuesTest extends OpenFastTestCase { + + public void testLargeDecimal() { + MessageTemplate composed = + template(Util.composedDecimal(new QName("Line1"), Operator.COPY, new IntegerValue(-2), + Operator.COPY, new IntegerValue(94276), true)); + FastEncoder encoder = encoder(composed); + Message message = (Message) composed.createValue(null); + message.setDecimal(1, 987654321.123456); + + byte[] encoded = encoder.encode(message); + FastDecoder decoder = decoder(composed, encoded); + assertEquals(message, decoder.readMessage()); + } +} Modified: trunk/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java 2008-02-07 16:41:36 UTC (rev 131) @@ -1,5 +1,6 @@ package org.openfast.template.operator; +import org.openfast.Context; import org.openfast.IntegerValue; import org.openfast.Message; import org.openfast.QName; @@ -12,25 +13,43 @@ public class DefaultOperatorTest extends OpenFastTestCase { - public void testNullsNoInitialValue() throws Exception { - Scalar field = new Scalar(new QName("mostlyNull"), Type.I32, Operator.DEFAULT, ScalarValue.UNDEFINED, true); - MessageTemplate template = template(field); - FastEncoder encoder = encoder(template); - - Message message = (Message) template.createValue(null); - assertEquals("11000000 10000001", encoder.encode(message)); - assertEquals("10000000", encoder.encode(message)); - } - - public void testNullsWithInitialValue() throws Exception { - Scalar field = new Scalar(new QName("sometimesNull"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); - MessageTemplate template = template(field); - FastEncoder encoder = encoder(template); - - Message message = (Message) template.createValue(null); - assertEquals("11100000 10000001 10000000", encoder.encode(message)); - assertEquals("10100000 10000000", encoder.encode(message)); - message.setInteger(1, 10); - assertEquals("10000000", encoder.encode(message)); - } + public void testNullsNoInitialValue() throws Exception { + Scalar field = new Scalar(new QName("mostlyNull"), Type.I32, Operator.DEFAULT, ScalarValue.UNDEFINED, true); + MessageTemplate template = template(field); + FastEncoder encoder = encoder(template); + + Message message = (Message) template.createValue(null); + assertEquals("11000000 10000001", encoder.encode(message)); + assertEquals("10000000", encoder.encode(message)); + } + + public void testNullsWithInitialValue() throws Exception { + Scalar field = new Scalar(new QName("sometimesNull"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); + MessageTemplate template = template(field); + FastEncoder encoder = encoder(template); + + Message message = (Message) template.createValue(null); + assertEquals("11100000 10000001 10000000", encoder.encode(message)); + assertEquals("10100000 10000000", encoder.encode(message)); + message.setInteger(1, 10); + assertEquals("10000000", encoder.encode(message)); + } + + public void testNullValueDoesntAlterDictionary() { + Scalar copyField = new Scalar(new QName("value"), Type.I32, Operator.COPY, new IntegerValue(10), true); + Scalar field = new Scalar(new QName("value"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); + MessageTemplate copyTemplate = template(copyField); + MessageTemplate template = template(field); + Context context = new Context(); + FastEncoder encoder = new FastEncoder(context); + encoder.registerTemplate(1, template); + encoder.registerTemplate(2, copyTemplate); + Message message = (Message) copyTemplate.createValue(null); + message.setInteger(1, 11); + encoder.encode(message); + assertEquals(11, context.lookup("global", copyTemplate, new QName("value")).toInt()); + message = (Message) template.createValue(null); + encoder.encode(message); + assertEquals(11, context.lookup("global", copyTemplate, new QName("value")).toInt()); + } } Modified: trunk/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java 2008-02-07 16:34:58 UTC (rev 130) +++ trunk/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java 2008-02-07 16:41:36 UTC (rev 131) @@ -10,125 +10,133 @@ import org.openfast.ScalarValue; import org.openfast.template.ComposedScalar; import org.openfast.template.Field; +import org.openfast.template.LongValue; import org.openfast.template.MessageTemplate; import org.openfast.template.operator.Operator; import org.openfast.test.OpenFastTestCase; import org.openfast.util.Util; - public class ComposedDecimalTest extends OpenFastTestCase { - QName name = new QName("Value"); - MessageTemplate template = new MessageTemplate("", new Field[] { }); - - public void testSimple() { - String encoding = "11111110 00111001 01000101 10100011"; - - ComposedScalar scalar = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, ScalarValue.UNDEFINED, true); - - assertEquals(encoding, scalar.encode(d(942755, -2), template, new Context(), new BitVectorBuilder(7))); - assertEquals(d(942755, -2), scalar.decode(bitStream(encoding), template, new Context(), pmapReader("11000000"))); - } - - private BitVectorReader pmapReader(String bits) { - return new BitVectorReader(new BitVector(ByteUtil.convertBitStringToFastByteArray(bits))); - } + QName name = new QName("Value"); - public void testInitialValues() { - Context context = new Context(); - ComposedScalar scalar = Util.composedDecimal(name, Operator.DEFAULT, i(-3), Operator.DELTA, ScalarValue.UNDEFINED, false); - assertEquals("00000101 01100000 11110101", scalar.encode(d(94325, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94300, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); - assertEquals("00000000 11001011", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); - assertEquals("10011001", scalar.encode(d(94375, -3), template, context, new BitVectorBuilder(7))); - assertEquals("10011001", scalar.encode(d(94400, -3), template, context, new BitVectorBuilder(7))); - assertEquals("01111111 10000011", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94250, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94225, -3), template, context, new BitVectorBuilder(7))); - assertEquals("00000000 11111101", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + MessageTemplate template = new MessageTemplate("", new Field[] {}); - context = new Context(); - assertEquals(d(94325, -3), scalar.decode(bitStream("00000101 01100000 11110101"), template, context, pmapReader("10100000"))); - assertEquals(d(94300, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94275, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11001011"), template, context, pmapReader("10100000"))); - assertEquals(d(94375, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); - assertEquals(d(94400, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); - assertEquals(d(94275, -3), scalar.decode(bitStream("01111111 10000011"), template, context, pmapReader("10100000"))); - assertEquals(d(94250, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94225, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11111101"), template, context, pmapReader("10100000"))); - } - - public void testCopyExponentDeltaMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(1), false); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 00000001 00010110 10101100", decimal.encode(d(19245, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111100", decimal.encode(d(19241, -2), template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - } - - public void testCopyExponentDefaultMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DEFAULT, new IntegerValue(1), false); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 00000001 00010110 10101101", decimal.encode(d(19245, -2), template, context , pmapBuilder)); - assertEquals("11100000", pmapBuilder.getBitVector().getBytes()); - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("00000001 00010110 10101001", decimal.encode(d(19241, -2), template, context , pmapBuilder)); - assertEquals("10100000", pmapBuilder.getBitVector().getBytes()); + public void testSimple() { + String encoding = "11111110 00111001 01000101 10100011"; - pmapBuilder = new BitVectorBuilder(7); - assertEquals("10000000", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(2, pmapBuilder.getIndex()); - } + ComposedScalar scalar = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, + ScalarValue.UNDEFINED, true); - public void testOptionalDefaultNullExponent() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.DEFAULT, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(12200), true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - - assertEquals("", decimal.encode(null, template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); // ONLY ONE PMAP BIT SHOULD BE WRITTEN - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 10000001", decimal.encode(d(12201, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); - } - - public void testOptionalConstantExponent() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.CONSTANT, new IntegerValue(-2), Operator.DEFAULT, new IntegerValue(100), true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - - assertEquals("", decimal.encode(d(100, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(2, pmapBuilder.getIndex()); - } - - public void testOptionalDeltaExponentCopyMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.DELTA, ScalarValue.UNDEFINED, Operator.COPY, ScalarValue.UNDEFINED, true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals(encoding, scalar.encode(d(942755, -2), template, new Context(), new BitVectorBuilder(7))); + assertEquals(d(942755, -2), scalar.decode(bitStream(encoding), template, new Context(), pmapReader("11000000"))); + } - assertEquals("10000000", decimal.encode(null, template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(0, pmapBuilder.getIndex()); + private BitVectorReader pmapReader(String bits) { + return new BitVectorReader(new BitVector(ByteUtil.convertBitStringToFastByteArray(bits))); + } - pmapBuilder = new BitVectorBuilder(7); - assertEquals("10000001 10000001", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); - } + public void testInitialValues() { + Context context = new Context(); + ComposedScalar scalar = Util.composedDecimal(name, Operator.DEFAULT, i(-3), Operator.DELTA, ScalarValue.UNDEFINED, false); + assertEquals("00000101 01100000 11110101", scalar.encode(d(94325, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94300, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); + assertEquals("00000000 11001011", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + assertEquals("10011001", scalar.encode(d(94375, -3), template, context, new BitVectorBuilder(7))); + assertEquals("10011001", scalar.encode(d(94400, -3), template, context, new BitVectorBuilder(7))); + assertEquals("01111111 10000011", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94250, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94225, -3), template, context, new BitVectorBuilder(7))); + assertEquals("00000000 11111101", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + + context = new Context(); + assertEquals(d(94325, -3), scalar.decode(bitStream("00000101 01100000 11110101"), template, context, pmapReader("10100000"))); + assertEquals(d(94300, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94275, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11001011"), template, context, pmapReader("10100000"))); + assertEquals(d(94375, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); + assertEquals(d(94400, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); + assertEquals(d(94275, -3), scalar.decode(bitStream("01111111 10000011"), template, context, pmapReader("10100000"))); + assertEquals(d(94250, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94225, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11111101"), template, context, pmapReader("10100000"))); + } + + public void testCopyExponentDeltaMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(1), + false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101100", decimal.encode(d(19245, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111100", decimal.encode(d(19241, -2), template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + } + + public void testCopyExponentDefaultMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DEFAULT, + new LongValue(1), false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101101", decimal.encode(d(19245, -2), template, context, pmapBuilder)); + assertEquals("11100000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("00000001 00010110 10101001", decimal.encode(d(19241, -2), template, context, pmapBuilder)); + assertEquals("10100000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000000", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDefaultNullExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DEFAULT, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue( + 12200), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(null, template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); // ONLY ONE PMAP BIT SHOULD + // BE WRITTEN + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 10000001", decimal.encode(d(12201, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } + + public void testOptionalConstantExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.CONSTANT, new IntegerValue(-2), Operator.DEFAULT, + new LongValue(100), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(d(100, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDeltaExponentCopyMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DELTA, ScalarValue.UNDEFINED, Operator.COPY, + ScalarValue.UNDEFINED, true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("10000000", decimal.encode(null, template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(0, pmapBuilder.getIndex()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000001 10000001", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-02-07 16:34:55
|
Revision: 130 http://openfast.svn.sourceforge.net/openfast/?rev=130&view=rev Author: jacob_northey Date: 2008-02-07 08:34:58 -0800 (Thu, 07 Feb 2008) Log Message: ----------- Started work on Mina Modified Paths: -------------- branches/ext-refactor/core/src/main/java/org/openfast/DecimalValue.java branches/ext-refactor/core/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java branches/ext-refactor/core/src/main/java/org/openfast/template/operator/Operator.java branches/ext-refactor/core/src/main/java/org/openfast/template/type/DecimalConverter.java branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java branches/ext-refactor/core/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java Added Paths: ----------- branches/ext-refactor/core/src/test/java/org/openfast/submitted/LargeValuesTest.java branches/ext-refactor/ext/src/main/java/org/ branches/ext-refactor/ext/src/main/java/org/openfast/ branches/ext-refactor/ext/src/main/java/org/openfast/ext/ branches/ext-refactor/ext/src/main/java/org/openfast/ext/mina/ branches/ext-refactor/ext/src/main/java/org/openfast/ext/mina/MinaFastServer.java Modified: branches/ext-refactor/core/src/main/java/org/openfast/DecimalValue.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/DecimalValue.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/DecimalValue.java 2008-02-07 16:34:58 UTC (rev 130) @@ -17,22 +17,23 @@ Contributor(s): Jacob Northey <ja...@la...> Craig Otis <co...@la...> -*/ + */ - package org.openfast; import java.math.BigDecimal; import org.openfast.error.FastConstants; - public class DecimalValue extends NumericValue { private static final long serialVersionUID = 1L; - public final double value; + + public final double value; + public final int exponent; - public final int mantissa; + public final long mantissa; + public DecimalValue(double value) { if (value == 0.0) { this.value = 0.0; @@ -46,7 +47,7 @@ BigDecimal decimalValue = BigDecimal.valueOf(value); int exponent = decimalValue.scale(); - int mantissa = decimalValue.unscaledValue().intValue(); + long mantissa = decimalValue.unscaledValue().longValue(); while (((mantissa % 10) == 0) && (mantissa != 0)) { mantissa /= 10; @@ -57,7 +58,7 @@ this.exponent = -exponent; } - public DecimalValue(int mantissa, int exponent) { + public DecimalValue(long mantissa, int exponent) { this.mantissa = mantissa; this.exponent = exponent; @@ -109,42 +110,42 @@ } public long toLong() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (long) value; } public int toInt() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (int) value; } public short toShort() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (short) value; } public byte toByte() { - if (exponent < 0) - Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); + if (exponent < 0) + Global.handleError(FastConstants.R5_DECIMAL_CANT_CONVERT_TO_INT, ""); return (byte) value; } - + public double toDouble() { - return value; + return value; } - + public BigDecimal toBigDecimal() { - return new BigDecimal(value); + return new BigDecimal(value); } public String toString() { return String.valueOf(value); } - + public int hashCode() { - return exponent * 37 + mantissa; + return exponent * 37 + (int) mantissa; } } Modified: branches/ext-refactor/core/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/template/operator/DefaultOperatorCodec.java 2008-02-07 16:34:58 UTC (rev 130) @@ -8,32 +8,33 @@ import org.openfast.template.type.Type; final class DefaultOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - DefaultOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } + DefaultOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (value == null) { - if (field.getDefaultValue().isUndefined()) - return null; - return ScalarValue.NULL; - } - - return value.equals(field.getDefaultValue()) ? null : value; - } + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (value == null) { + if (field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; + } - public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { - return newValue; - } + return value.equals(field.getDefaultValue()) ? null : value; + } - public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (field.getDefaultValue().isUndefined()) return null; - return field.getDefaultValue(); - } + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + return newValue; + } - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (field.getDefaultValue().isUndefined()) + return null; + return field.getDefaultValue(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } } \ No newline at end of file Modified: branches/ext-refactor/core/src/main/java/org/openfast/template/operator/Operator.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/template/operator/Operator.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/template/operator/Operator.java 2008-02-07 16:34:58 UTC (rev 130) @@ -11,105 +11,123 @@ import org.openfast.template.type.Type; public class Operator implements Serializable { - private static final long serialVersionUID = 1L; - private static final Map OPERATOR_NAME_MAP = new HashMap(); - private final String name; + private static final long serialVersionUID = 1L; - public static final Operator NONE = new Operator("none") { - private static final long serialVersionUID = 2L; - public boolean usesDictionary() { - return false; - } - public boolean shouldStoreValue(ScalarValue value) { - return false; - } - }; - public static final Operator CONSTANT = new Operator("constant") { - private static final long serialVersionUID = 1L; + private static final Map OPERATOR_NAME_MAP = new HashMap(); - public void validate(Scalar scalar) { - if (scalar.getDefaultValue().isUndefined()) - Global.handleError(FastConstants.S4_NO_INITIAL_VALUE_FOR_CONST, "The field " + scalar + " must have a default value defined."); - } - - public boolean shouldStoreValue(ScalarValue value) { - return false; - } - - public boolean usesDictionary() { - return false; - } - }; - public static final Operator DEFAULT = new Operator("default") { - private static final long serialVersionUID = 1L; + private final String name; - public void validate(Scalar scalar) { - if (!scalar.isOptional() && scalar.getDefaultValue().isUndefined()) - Global.handleError(FastConstants.S5_NO_INITVAL_MNDTRY_DFALT, "The field " + scalar + " must have a default value defined."); - } - }; - public static final Operator COPY = new Operator("copy") { - private static final long serialVersionUID = 1L; + public static final Operator NONE = new Operator("none") { + private static final long serialVersionUID = 2L; - public OperatorCodec getCodec(Type type) { - return OperatorCodec.COPY_ALL; - } - }; - public static final Operator INCREMENT = new Operator("increment"); - public static final Operator DELTA = new Operator("delta") { - private static final long serialVersionUID = 1L; + public boolean usesDictionary() { + return false; + } - public boolean shouldStoreValue(ScalarValue value) { - return value != null; - } - }; - public static final Operator TAIL = new Operator("tail"); + public boolean shouldStoreValue(ScalarValue value) { + return false; + } + }; - public Operator(String name) { - this.name = name; - OPERATOR_NAME_MAP.put(name, this); - } - - public static Operator getOperator(String name) { - if (!OPERATOR_NAME_MAP.containsKey(name)) - throw new IllegalArgumentException("The operator \"" + name + "\" does not exist."); - return (Operator) OPERATOR_NAME_MAP.get(name); - } - - public OperatorCodec getCodec(Type type) { - return OperatorCodec.getCodec(this, type); - } - - public String toString() { - return name; - } + public static final Operator CONSTANT = new Operator("constant") { + private static final long serialVersionUID = 1L; - public String getName() { - return name; - } + public void validate(Scalar scalar) { + if (scalar.getDefaultValue().isUndefined()) + Global.handleError(FastConstants.S4_NO_INITIAL_VALUE_FOR_CONST, "The field " + scalar + + " must have a default value defined."); + } - public boolean shouldStoreValue(ScalarValue value) { - return true; - } + public boolean shouldStoreValue(ScalarValue value) { + return false; + } - public void validate(Scalar scalar) { - } + public boolean usesDictionary() { + return false; + } + }; - public boolean equals(Object other) { - if (other == this) return true; - if (other == null || !(other instanceof Operator)) return false; - return equals((Operator) other); - } - - private boolean equals(Operator other) { - return name.equals(other.name); - } - - public int hashCode() { - return name.hashCode(); - } + public static final Operator DEFAULT = new Operator("default") { + private static final long serialVersionUID = 1L; - public boolean usesDictionary() { - return true; - } + public void validate(Scalar scalar) { + if (!scalar.isOptional() && scalar.getDefaultValue().isUndefined()) + Global.handleError(FastConstants.S5_NO_INITVAL_MNDTRY_DFALT, "The field " + scalar + + " must have a default value defined."); + } + + public boolean shouldStoreValue(ScalarValue value) { + return value != null; + } + }; + + public static final Operator COPY = new Operator("copy") { + private static final long serialVersionUID = 1L; + + public OperatorCodec getCodec(Type type) { + return OperatorCodec.COPY_ALL; + } + }; + + public static final Operator INCREMENT = new Operator("increment"); + + public static final Operator DELTA = new Operator("delta") { + private static final long serialVersionUID = 1L; + + public boolean shouldStoreValue(ScalarValue value) { + return value != null; + } + }; + + public static final Operator TAIL = new Operator("tail"); + + public Operator(String name) { + this.name = name; + OPERATOR_NAME_MAP.put(name, this); + } + + public static Operator getOperator(String name) { + if (!OPERATOR_NAME_MAP.containsKey(name)) + throw new IllegalArgumentException("The operator \"" + name + "\" does not exist."); + return (Operator) OPERATOR_NAME_MAP.get(name); + } + + public OperatorCodec getCodec(Type type) { + return OperatorCodec.getCodec(this, type); + } + + public String toString() { + return name; + } + + public String getName() { + return name; + } + + public boolean shouldStoreValue(ScalarValue value) { + return true; + } + + public void validate(Scalar scalar) { + } + + public boolean equals(Object other) { + if (other == this) + return true; + if (other == null || !(other instanceof Operator)) + return false; + return equals((Operator) other); + } + + private boolean equals(Operator other) { + return name.equals(other.name); + } + + public int hashCode() { + return name.hashCode(); + } + + public boolean usesDictionary() { + return true; + } } Modified: branches/ext-refactor/core/src/main/java/org/openfast/template/type/DecimalConverter.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/template/type/DecimalConverter.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/template/type/DecimalConverter.java 2008-02-07 16:34:58 UTC (rev 130) @@ -5,24 +5,28 @@ import org.openfast.IntegerValue; import org.openfast.ScalarValue; import org.openfast.template.ComposedValueConverter; +import org.openfast.template.LongValue; public class DecimalConverter implements ComposedValueConverter { - private static final FieldValue[] NULL_SET = new FieldValue[] { null, null }; - private static final FieldValue[] UNDEFINED_SET = new FieldValue[] { ScalarValue.UNDEFINED, ScalarValue.UNDEFINED }; + private static final FieldValue[] NULL_SET = new FieldValue[] { null, null }; - public FieldValue[] split(FieldValue value) { - if (value == null) - return NULL_SET; - else if (value == ScalarValue.UNDEFINED) - return UNDEFINED_SET; - DecimalValue decimal = (DecimalValue) value; - return new FieldValue[] { new IntegerValue(decimal.exponent), new IntegerValue(decimal.mantissa) }; - } + private static final FieldValue[] UNDEFINED_SET = new FieldValue[] { ScalarValue.UNDEFINED, ScalarValue.UNDEFINED }; - public FieldValue compose(FieldValue[] values) { - if (values[0] == null) return null; - if (values[0] == ScalarValue.UNDEFINED) return ScalarValue.UNDEFINED; - return new DecimalValue(((IntegerValue) values[1]).value, ((IntegerValue) values[0]).value); - } + public FieldValue[] split(FieldValue value) { + if (value == null) + return NULL_SET; + else if (value == ScalarValue.UNDEFINED) + return UNDEFINED_SET; + DecimalValue decimal = (DecimalValue) value; + return new FieldValue[] { new IntegerValue(decimal.exponent), new LongValue(decimal.mantissa) }; + } + + public FieldValue compose(FieldValue[] values) { + if (values[0] == null) + return null; + if (values[0] == ScalarValue.UNDEFINED) + return ScalarValue.UNDEFINED; + return new DecimalValue(((ScalarValue)values[1]).toLong(), ((IntegerValue) values[0]).value); + } } Modified: branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/NullableSingleFieldDecimal.java 2008-02-07 16:34:58 UTC (rev 130) @@ -25,18 +25,18 @@ */ package org.openfast.template.type.codec; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + import org.openfast.DecimalValue; import org.openfast.Global; import org.openfast.IntegerValue; import org.openfast.ScalarValue; - import org.openfast.error.FastConstants; +import org.openfast.template.LongValue; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - final class NullableSingleFieldDecimal extends TypeCodec { private static final long serialVersionUID = 1L; @@ -62,7 +62,7 @@ buffer.write(TypeCodec.NULLABLE_INTEGER.encode( new IntegerValue(value.exponent))); - buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.mantissa))); + buffer.write(TypeCodec.INTEGER.encode(new LongValue(value.mantissa))); } catch (IOException e) { throw new RuntimeException(e); } Modified: branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/main/java/org/openfast/template/type/codec/SingleFieldDecimal.java 2008-02-07 16:34:58 UTC (rev 130) @@ -17,34 +17,35 @@ Contributor(s): Jacob Northey <ja...@la...> Craig Otis <co...@la...> -*/ + */ - /** * */ package org.openfast.template.type.codec; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + import org.openfast.DecimalValue; import org.openfast.Global; import org.openfast.IntegerValue; import org.openfast.ScalarValue; - import org.openfast.error.FastConstants; +import org.openfast.template.LongValue; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - final class SingleFieldDecimal extends TypeCodec { private static final long serialVersionUID = 1L; - SingleFieldDecimal() { } + SingleFieldDecimal() { + } /** * Takes a ScalarValue object, and converts it to a byte array - * @param v The ScalarValue to be encoded + * + * @param v + * The ScalarValue to be encoded * @return Returns a byte array of the passed object */ public byte[] encodeValue(ScalarValue v) { @@ -57,12 +58,11 @@ try { if (Math.abs(value.exponent) > 63) { - Global.handleError(FastConstants.R1_LARGE_DECIMAL, - "Encountered exponent of size " + value.exponent); + Global.handleError(FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + value.exponent); } buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.exponent))); - buffer.write(TypeCodec.INTEGER.encode(new IntegerValue(value.mantissa))); + buffer.write(TypeCodec.INTEGER.encode(new LongValue(value.mantissa))); } catch (IOException e) { throw new RuntimeException(e); } @@ -72,15 +72,16 @@ /** * Reads in a stream of data and stores it to a decimalValue object - * @param in The InputStream to be decoded + * + * @param in + * The InputStream to be decoded * @return Returns a decimalValue object with the data stream */ public ScalarValue decode(InputStream in) { int exponent = ((IntegerValue) TypeCodec.INTEGER.decode(in)).value; if (Math.abs(exponent) > 63) { - Global.handleError(FastConstants.R1_LARGE_DECIMAL, - "Encountered exponent of size " + exponent); + Global.handleError(FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + exponent); } int mantissa = ((IntegerValue) TypeCodec.INTEGER.decode(in)).value; @@ -90,8 +91,11 @@ } /** - * Convert a string to a DecimalValue object with the string as the passed value - * @param value The value as a string to be converted + * Convert a string to a DecimalValue object with the string as the passed + * value + * + * @param value + * The value as a string to be converted * @return Returns a new DecimalValue object */ public ScalarValue fromString(String value) { @@ -106,7 +110,7 @@ return new DecimalValue(0.0); } - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } } Added: branches/ext-refactor/core/src/test/java/org/openfast/submitted/LargeValuesTest.java =================================================================== --- branches/ext-refactor/core/src/test/java/org/openfast/submitted/LargeValuesTest.java (rev 0) +++ branches/ext-refactor/core/src/test/java/org/openfast/submitted/LargeValuesTest.java 2008-02-07 16:34:58 UTC (rev 130) @@ -0,0 +1,27 @@ +package org.openfast.submitted; + +import org.openfast.IntegerValue; +import org.openfast.Message; +import org.openfast.QName; +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.operator.Operator; +import org.openfast.test.OpenFastTestCase; +import org.openfast.util.Util; + +public class LargeValuesTest extends OpenFastTestCase { + + public void testLargeDecimal() { + MessageTemplate composed = + template(Util.composedDecimal(new QName("Line1"), Operator.COPY, new IntegerValue(-2), + Operator.COPY, new IntegerValue(94276), true)); + FastEncoder encoder = encoder(composed); + Message message = (Message) composed.createValue(null); + message.setDecimal(1, 987654321.123456); + + byte[] encoded = encoder.encode(message); + FastDecoder decoder = decoder(composed, encoded); + assertEquals(message, decoder.readMessage()); + } +} Modified: branches/ext-refactor/core/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java =================================================================== --- branches/ext-refactor/core/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/test/java/org/openfast/template/operator/DefaultOperatorTest.java 2008-02-07 16:34:58 UTC (rev 130) @@ -1,5 +1,6 @@ package org.openfast.template.operator; +import org.openfast.Context; import org.openfast.IntegerValue; import org.openfast.Message; import org.openfast.QName; @@ -12,25 +13,43 @@ public class DefaultOperatorTest extends OpenFastTestCase { - public void testNullsNoInitialValue() throws Exception { - Scalar field = new Scalar(new QName("mostlyNull"), Type.I32, Operator.DEFAULT, ScalarValue.UNDEFINED, true); - MessageTemplate template = template(field); - FastEncoder encoder = encoder(template); - - Message message = (Message) template.createValue(null); - assertEquals("11000000 10000001", encoder.encode(message)); - assertEquals("10000000", encoder.encode(message)); - } - - public void testNullsWithInitialValue() throws Exception { - Scalar field = new Scalar(new QName("sometimesNull"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); - MessageTemplate template = template(field); - FastEncoder encoder = encoder(template); - - Message message = (Message) template.createValue(null); - assertEquals("11100000 10000001 10000000", encoder.encode(message)); - assertEquals("10100000 10000000", encoder.encode(message)); - message.setInteger(1, 10); - assertEquals("10000000", encoder.encode(message)); - } + public void testNullsNoInitialValue() throws Exception { + Scalar field = new Scalar(new QName("mostlyNull"), Type.I32, Operator.DEFAULT, ScalarValue.UNDEFINED, true); + MessageTemplate template = template(field); + FastEncoder encoder = encoder(template); + + Message message = (Message) template.createValue(null); + assertEquals("11000000 10000001", encoder.encode(message)); + assertEquals("10000000", encoder.encode(message)); + } + + public void testNullsWithInitialValue() throws Exception { + Scalar field = new Scalar(new QName("sometimesNull"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); + MessageTemplate template = template(field); + FastEncoder encoder = encoder(template); + + Message message = (Message) template.createValue(null); + assertEquals("11100000 10000001 10000000", encoder.encode(message)); + assertEquals("10100000 10000000", encoder.encode(message)); + message.setInteger(1, 10); + assertEquals("10000000", encoder.encode(message)); + } + + public void testNullValueDoesntAlterDictionary() { + Scalar copyField = new Scalar(new QName("value"), Type.I32, Operator.COPY, new IntegerValue(10), true); + Scalar field = new Scalar(new QName("value"), Type.I32, Operator.DEFAULT, new IntegerValue(10), true); + MessageTemplate copyTemplate = template(copyField); + MessageTemplate template = template(field); + Context context = new Context(); + FastEncoder encoder = new FastEncoder(context); + encoder.registerTemplate(1, template); + encoder.registerTemplate(2, copyTemplate); + Message message = (Message) copyTemplate.createValue(null); + message.setInteger(1, 11); + encoder.encode(message); + assertEquals(11, context.lookup("global", copyTemplate, new QName("value")).toInt()); + message = (Message) template.createValue(null); + encoder.encode(message); + assertEquals(11, context.lookup("global", copyTemplate, new QName("value")).toInt()); + } } Modified: branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java =================================================================== --- branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java 2008-01-29 14:53:07 UTC (rev 129) +++ branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/ComposedDecimalTest.java 2008-02-07 16:34:58 UTC (rev 130) @@ -10,125 +10,133 @@ import org.openfast.ScalarValue; import org.openfast.template.ComposedScalar; import org.openfast.template.Field; +import org.openfast.template.LongValue; import org.openfast.template.MessageTemplate; import org.openfast.template.operator.Operator; import org.openfast.test.OpenFastTestCase; import org.openfast.util.Util; - public class ComposedDecimalTest extends OpenFastTestCase { - QName name = new QName("Value"); - MessageTemplate template = new MessageTemplate("", new Field[] { }); - - public void testSimple() { - String encoding = "11111110 00111001 01000101 10100011"; - - ComposedScalar scalar = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, ScalarValue.UNDEFINED, true); - - assertEquals(encoding, scalar.encode(d(942755, -2), template, new Context(), new BitVectorBuilder(7))); - assertEquals(d(942755, -2), scalar.decode(bitStream(encoding), template, new Context(), pmapReader("11000000"))); - } - - private BitVectorReader pmapReader(String bits) { - return new BitVectorReader(new BitVector(ByteUtil.convertBitStringToFastByteArray(bits))); - } + QName name = new QName("Value"); - public void testInitialValues() { - Context context = new Context(); - ComposedScalar scalar = Util.composedDecimal(name, Operator.DEFAULT, i(-3), Operator.DELTA, ScalarValue.UNDEFINED, false); - assertEquals("00000101 01100000 11110101", scalar.encode(d(94325, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94300, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); - assertEquals("00000000 11001011", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); - assertEquals("10011001", scalar.encode(d(94375, -3), template, context, new BitVectorBuilder(7))); - assertEquals("10011001", scalar.encode(d(94400, -3), template, context, new BitVectorBuilder(7))); - assertEquals("01111111 10000011", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94250, -3), template, context, new BitVectorBuilder(7))); - assertEquals("11100111", scalar.encode(d(94225, -3), template, context, new BitVectorBuilder(7))); - assertEquals("00000000 11111101", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + MessageTemplate template = new MessageTemplate("", new Field[] {}); - context = new Context(); - assertEquals(d(94325, -3), scalar.decode(bitStream("00000101 01100000 11110101"), template, context, pmapReader("10100000"))); - assertEquals(d(94300, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94275, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11001011"), template, context, pmapReader("10100000"))); - assertEquals(d(94375, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); - assertEquals(d(94400, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); - assertEquals(d(94275, -3), scalar.decode(bitStream("01111111 10000011"), template, context, pmapReader("10100000"))); - assertEquals(d(94250, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94225, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); - assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11111101"), template, context, pmapReader("10100000"))); - } - - public void testCopyExponentDeltaMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(1), false); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 00000001 00010110 10101100", decimal.encode(d(19245, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111100", decimal.encode(d(19241, -2), template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - } - - public void testCopyExponentDefaultMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DEFAULT, new IntegerValue(1), false); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 00000001 00010110 10101101", decimal.encode(d(19245, -2), template, context , pmapBuilder)); - assertEquals("11100000", pmapBuilder.getBitVector().getBytes()); - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("00000001 00010110 10101001", decimal.encode(d(19241, -2), template, context , pmapBuilder)); - assertEquals("10100000", pmapBuilder.getBitVector().getBytes()); + public void testSimple() { + String encoding = "11111110 00111001 01000101 10100011"; - pmapBuilder = new BitVectorBuilder(7); - assertEquals("10000000", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(2, pmapBuilder.getIndex()); - } + ComposedScalar scalar = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, + ScalarValue.UNDEFINED, true); - public void testOptionalDefaultNullExponent() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.DEFAULT, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(12200), true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - - assertEquals("", decimal.encode(null, template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); // ONLY ONE PMAP BIT SHOULD BE WRITTEN - - pmapBuilder = new BitVectorBuilder(7); - assertEquals("11111110 10000001", decimal.encode(d(12201, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); - } - - public void testOptionalConstantExponent() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.CONSTANT, new IntegerValue(-2), Operator.DEFAULT, new IntegerValue(100), true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); - - assertEquals("", decimal.encode(d(100, -2), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(2, pmapBuilder.getIndex()); - } - - public void testOptionalDeltaExponentCopyMantissa() { - ComposedScalar decimal = Util.composedDecimal(name, Operator.DELTA, ScalarValue.UNDEFINED, Operator.COPY, ScalarValue.UNDEFINED, true); - Context context = new Context(); - BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals(encoding, scalar.encode(d(942755, -2), template, new Context(), new BitVectorBuilder(7))); + assertEquals(d(942755, -2), scalar.decode(bitStream(encoding), template, new Context(), pmapReader("11000000"))); + } - assertEquals("10000000", decimal.encode(null, template, context , pmapBuilder)); - assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(0, pmapBuilder.getIndex()); + private BitVectorReader pmapReader(String bits) { + return new BitVectorReader(new BitVector(ByteUtil.convertBitStringToFastByteArray(bits))); + } - pmapBuilder = new BitVectorBuilder(7); - assertEquals("10000001 10000001", decimal.encode(d(1, 0), template, context , pmapBuilder)); - assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); - assertEquals(1, pmapBuilder.getIndex()); - } + public void testInitialValues() { + Context context = new Context(); + ComposedScalar scalar = Util.composedDecimal(name, Operator.DEFAULT, i(-3), Operator.DELTA, ScalarValue.UNDEFINED, false); + assertEquals("00000101 01100000 11110101", scalar.encode(d(94325, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94300, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); + assertEquals("00000000 11001011", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + assertEquals("10011001", scalar.encode(d(94375, -3), template, context, new BitVectorBuilder(7))); + assertEquals("10011001", scalar.encode(d(94400, -3), template, context, new BitVectorBuilder(7))); + assertEquals("01111111 10000011", scalar.encode(d(94275, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94250, -3), template, context, new BitVectorBuilder(7))); + assertEquals("11100111", scalar.encode(d(94225, -3), template, context, new BitVectorBuilder(7))); + assertEquals("00000000 11111101", scalar.encode(d(94350, -3), template, context, new BitVectorBuilder(7))); + + context = new Context(); + assertEquals(d(94325, -3), scalar.decode(bitStream("00000101 01100000 11110101"), template, context, pmapReader("10100000"))); + assertEquals(d(94300, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94275, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11001011"), template, context, pmapReader("10100000"))); + assertEquals(d(94375, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); + assertEquals(d(94400, -3), scalar.decode(bitStream("10011001"), template, context, pmapReader("10100000"))); + assertEquals(d(94275, -3), scalar.decode(bitStream("01111111 10000011"), template, context, pmapReader("10100000"))); + assertEquals(d(94250, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94225, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); + assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11111101"), template, context, pmapReader("10100000"))); + } + + public void testCopyExponentDeltaMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(1), + false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101100", decimal.encode(d(19245, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111100", decimal.encode(d(19241, -2), template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + } + + public void testCopyExponentDefaultMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DEFAULT, + new LongValue(1), false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101101", decimal.encode(d(19245, -2), template, context, pmapBuilder)); + assertEquals("11100000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("00000001 00010110 10101001", decimal.encode(d(19241, -2), template, context, pmapBuilder)); + assertEquals("10100000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000000", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDefaultNullExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DEFAULT, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue( + 12200), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(null, template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); // ONLY ONE PMAP BIT SHOULD + // BE WRITTEN + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 10000001", decimal.encode(d(12201, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } + + public void testOptionalConstantExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.CONSTANT, new IntegerValue(-2), Operator.DEFAULT, + new LongValue(100), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(d(100, -2), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDeltaExponentCopyMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DELTA, ScalarValue.UNDEFINED, Operator.COPY, + ScalarValue.UNDEFINED, true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("10000000", decimal.encode(null, template, context, pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(0, pmapBuilder.getIndex()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000001 10000001", decimal.encode(d(1, 0), template, context, pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } } Added: branches/ext-refactor/ext/src/main/java/org/openfast/ext/mina/MinaFastServer.java =================================================================== --- branches/ext-refactor/ext/src/main/java/org/openfast/ext/mina/MinaFastServer.java (rev 0) +++ branches/ext-refactor/ext/src/main/java/org/openfast/ext/mina/MinaFastServer.java 2008-02-07 16:34:58 UTC (rev 130) @@ -0,0 +1,13 @@ +package org.openfast.ext.mina; + +import org.apache.mina.common.ByteBuffer; +import org.apache.mina.common.SimpleByteBufferAllocator; + +public class MinaFastServer { + public static void main(String[] args) { + ByteBuffer.setUseDirectBuffers(false); + ByteBuffer.setAllocator(new SimpleByteBufferAllocator()); + +// IoAcceptor acceptor = new SocketAcceptor(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-29 14:53:06
|
Revision: 129 http://openfast.svn.sourceforge.net/openfast/?rev=129&view=rev Author: thoennes Date: 2008-01-29 06:53:07 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Initial class comment. Modified Paths: -------------- tags/openfast-0.9.6/src/main/java/org/openfast/MessageOutputStream.java Modified: tags/openfast-0.9.6/src/main/java/org/openfast/MessageOutputStream.java =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/MessageOutputStream.java 2008-01-24 14:23:39 UTC (rev 128) +++ tags/openfast-0.9.6/src/main/java/org/openfast/MessageOutputStream.java 2008-01-29 14:53:07 UTC (rev 129) @@ -36,6 +36,12 @@ import org.openfast.template.TemplateRegistry; +/** The MessageOutputStream is designed to write FAST message to + * the underlying Java OutputStream. + * + * @author jacob_northey + * + */ public class MessageOutputStream implements MessageStream { private final OutputStream out; private final FastEncoder encoder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-24 14:23:57
|
Revision: 128 http://openfast.svn.sourceforge.net/openfast/?rev=128&view=rev Author: jacob_northey Date: 2008-01-24 06:23:39 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Added e-mails to pom Modified Paths: -------------- branches/ext-refactor/pom.xml Modified: branches/ext-refactor/pom.xml =================================================================== --- branches/ext-refactor/pom.xml 2008-01-24 13:19:56 UTC (rev 127) +++ branches/ext-refactor/pom.xml 2008-01-24 14:23:39 UTC (rev 128) @@ -22,7 +22,9 @@ <developers> <developer> + <id>jacob_northey</id> <name>Jacob Northey</name> + <email>jac...@us...</email> <organization>Lasalletech</organization> <organizationUrl>http://www.lasalletech.com/</organizationUrl> <roles> @@ -32,7 +34,9 @@ <timezone>-5</timezone> </developer> <developer> + <id>littleodie914</id> <name>Craig Otis</name> + <email>lit...@us...</email> <organization>Lasalletech</organization> <organizationUrl>http://www.lasalletech.com/</organizationUrl> <roles> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-24 13:19:54
|
Revision: 127 http://openfast.svn.sourceforge.net/openfast/?rev=127&view=rev Author: jacob_northey Date: 2008-01-24 05:19:56 -0800 (Thu, 24 Jan 2008) Log Message: ----------- Added ciManagement information to pom Modified Paths: -------------- branches/ext-refactor/core/pom.xml branches/ext-refactor/core/src/main/java/org/openfast/GroupValue.java branches/ext-refactor/ext/pom.xml branches/ext-refactor/pom.xml Modified: branches/ext-refactor/core/pom.xml =================================================================== --- branches/ext-refactor/core/pom.xml 2008-01-23 22:37:13 UTC (rev 126) +++ branches/ext-refactor/core/pom.xml 2008-01-24 13:19:56 UTC (rev 127) @@ -1,26 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.openfast</groupId> - <artifactId>openfast</artifactId> - <version>0.9.7-SNAPSHOT</version> - </parent> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <version>0.9.7-SNAPSHOT</version> + </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.openfast</groupId> <artifactId>openfast-core</artifactId> <packaging>jar</packaging> - - <name>OpenFAST Core</name> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/test/resources</directory> - </resource> - </resources> + + <name>OpenFAST Core</name> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> @@ -28,8 +30,8 @@ <version>1.0-beta-2</version> </extension> </extensions> - - <plugins> + + <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> @@ -38,41 +40,43 @@ </configuration> </plugin> <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> - </configuration> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase> + https://openfast.svn.sourceforge.net/svnroot/openfast/tags + </tagBase> + </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>javadoc</id> - <phase>process-classes</phase> - <goals> - <goal>javadoc</goal> - </goals> - </execution> - </executions> - </plugin> <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/source.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>attached</goal> - </goals> - </execution> - </executions> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> </plugin> - </plugins> - </build> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: branches/ext-refactor/core/src/main/java/org/openfast/GroupValue.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/GroupValue.java 2008-01-23 22:37:13 UTC (rev 126) +++ branches/ext-refactor/core/src/main/java/org/openfast/GroupValue.java 2008-01-24 13:19:56 UTC (rev 127) @@ -17,9 +17,8 @@ Contributor(s): Jacob Northey <ja...@la...> Craig Otis <co...@la...> -*/ + */ - package org.openfast; import org.openfast.template.Field; @@ -33,10 +32,11 @@ import java.math.BigDecimal; import java.util.Iterator; - public class GroupValue implements FieldValue { private static final long serialVersionUID = 1L; - protected final FieldValue[] values; + + protected final FieldValue[] values; + private final Group group; public GroupValue(Group group, FieldValue[] values) { @@ -59,135 +59,139 @@ public int getInt(int fieldIndex) { return getScalar(fieldIndex).toInt(); } - + public int getInt(String fieldName) { - // BAD ABSTRACTION - if (!group.hasField(fieldName)) { - if (group.hasIntrospectiveField(fieldName)) { - Scalar scalar = group.getIntrospectiveField(fieldName); - if (scalar.getType().equals(Type.UNICODE) || - scalar.getType().equals(Type.STRING) || - scalar.getType().equals(Type.ASCII)) - return getString(scalar.getName()).length(); - if (scalar.getType().equals(Type.BYTE_VECTOR)) - return getBytes(scalar.getName()).length; - } - - } - return getScalar(fieldName).toInt(); - } + // BAD ABSTRACTION + if (!group.hasField(fieldName)) { + if (group.hasIntrospectiveField(fieldName)) { + Scalar scalar = group.getIntrospectiveField(fieldName); + if (scalar.getType().equals(Type.UNICODE) || scalar.getType().equals(Type.STRING) + || scalar.getType().equals(Type.ASCII)) + return getString(scalar.getName()).length(); + if (scalar.getType().equals(Type.BYTE_VECTOR)) + return getBytes(scalar.getName()).length; + } - public boolean getBool(String fieldName) { - if (!isDefined(fieldName)) return false; - return getScalar(fieldName).toInt() != 0; - } + } + return getScalar(fieldName).toInt(); + } + public boolean getBool(String fieldName) { + if (!isDefined(fieldName)) + return false; + return getScalar(fieldName).toInt() != 0; + } + public long getLong(int fieldIndex) { return getScalar(fieldIndex).toLong(); } - + public long getLong(String fieldName) { - return getScalar(fieldName).toLong(); - } + return getScalar(fieldName).toLong(); + } - public byte getByte(int fieldIndex) { - return getScalar(fieldIndex).toByte(); + public byte getByte(int fieldIndex) { + return getScalar(fieldIndex).toByte(); } - public byte getByte(String fieldName) { - return getScalar(fieldName).toByte(); + public byte getByte(String fieldName) { + return getScalar(fieldName).toByte(); } - public short getShort(int fieldIndex) { - return getScalar(fieldIndex).toShort(); + public short getShort(int fieldIndex) { + return getScalar(fieldIndex).toShort(); } - public short getShort(String fieldName) { - return getScalar(fieldName).toShort(); + public short getShort(String fieldName) { + return getScalar(fieldName).toShort(); } public String getString(int index) { - return getValue(index).toString(); - } + return getValue(index).toString(); + } - public String getString(String fieldName) { - return getValue(fieldName).toString(); + public String getString(String fieldName) { + FieldValue value = getValue(fieldName); + if (value == null) + return null; + return value.toString(); } public double getDouble(int fieldIndex) { - return getScalar(fieldIndex).toDouble(); - } + return getScalar(fieldIndex).toDouble(); + } public double getDouble(String fieldName) { - return getScalar(fieldName).toDouble(); - } + return getScalar(fieldName).toDouble(); + } public BigDecimal getBigDecimal(int fieldIndex) { - return getScalar(fieldIndex).toBigDecimal(); - } + return getScalar(fieldIndex).toBigDecimal(); + } public BigDecimal getBigDecimal(String fieldName) { - return getScalar(fieldName).toBigDecimal(); - } + return getScalar(fieldName).toBigDecimal(); + } - public byte[] getBytes(int fieldIndex) { - return getScalar(fieldIndex).getBytes(); - } - - public byte[] getBytes(String fieldName) { - return getScalar(fieldName).getBytes(); - } + public byte[] getBytes(int fieldIndex) { + return getScalar(fieldIndex).getBytes(); + } - public SequenceValue getSequence(int fieldIndex) { - return (SequenceValue) getValue(fieldIndex); - } + public byte[] getBytes(String fieldName) { + return getScalar(fieldName).getBytes(); + } - public SequenceValue getSequence(String fieldName) { - return (SequenceValue) getValue(fieldName); - } - - public ScalarValue getScalar(int fieldIndex) { - return (ScalarValue) getValue(fieldIndex); - } + public SequenceValue getSequence(int fieldIndex) { + return (SequenceValue) getValue(fieldIndex); + } - public ScalarValue getScalar(String fieldName) { - return (ScalarValue) getValue(fieldName); - } + public SequenceValue getSequence(String fieldName) { + return (SequenceValue) getValue(fieldName); + } - public GroupValue getGroup(int fieldIndex) { - return (GroupValue) getValue(fieldIndex); - } + public ScalarValue getScalar(int fieldIndex) { + return (ScalarValue) getValue(fieldIndex); + } - public GroupValue getGroup(String fieldName) { - return (GroupValue) getValue(fieldName); - } + public ScalarValue getScalar(String fieldName) { + return (ScalarValue) getValue(fieldName); + } - public FieldValue getValue(int fieldIndex) { - return values[fieldIndex]; - } + public GroupValue getGroup(int fieldIndex) { + return (GroupValue) getValue(fieldIndex); + } - public FieldValue getValue(String fieldName) { - if (!group.hasField(fieldName)) { - throw new IllegalArgumentException("The field \"" + fieldName + "\" does not exist in group " + group); - } - - return values[group.getFieldIndex(fieldName)]; - } + public GroupValue getGroup(String fieldName) { + return (GroupValue) getValue(fieldName); + } - public Group getGroup() { - return group; - } + public FieldValue getValue(int fieldIndex) { + return values[fieldIndex]; + } - public void setString(Field field, String value) { - if (field == null) throw new IllegalArgumentException("Field must not be null [value=" + value + "]"); - setFieldValue(field, field.createValue(value)); - } + public FieldValue getValue(String fieldName) { + if (!group.hasField(fieldName)) { + throw new IllegalArgumentException("The field \"" + fieldName + "\" does not exist in group " + group); + } - public void setFieldValue(Field field, FieldValue value) { - setFieldValue(group.getFieldIndex(field), value); - } - - public void setFieldValue(int fieldIndex, FieldValue value) { + return values[group.getFieldIndex(fieldName)]; + } + + public Group getGroup() { + return group; + } + + public void setString(Field field, String value) { + if (field == null) + throw new IllegalArgumentException("Field must not be null [value=" + value + "]"); + setFieldValue(field, field.createValue(value)); + } + + public void setFieldValue(Field field, FieldValue value) { + setFieldValue(group.getFieldIndex(field), value); + } + + public void setFieldValue(int fieldIndex, FieldValue value) { values[fieldIndex] = value; } @@ -199,37 +203,37 @@ values[fieldIndex] = new ByteVectorValue(bytes); } - public void setByteVector(String fieldName, byte[] bytes) { - setFieldValue(fieldName, new ByteVectorValue(bytes)); - } + public void setByteVector(String fieldName, byte[] bytes) { + setFieldValue(fieldName, new ByteVectorValue(bytes)); + } public void setDecimal(int fieldIndex, double value) { values[fieldIndex] = new DecimalValue(value); } - public void setDecimal(String fieldName, double value) { - setFieldValue(fieldName, new DecimalValue(value)); - } + public void setDecimal(String fieldName, double value) { + setFieldValue(fieldName, new DecimalValue(value)); + } public void setInteger(String fieldName, int value) { setFieldValue(fieldName, new IntegerValue(value)); } - + public void setInteger(int fieldIndex, int value) { - values[fieldIndex] = new IntegerValue(value); + values[fieldIndex] = new IntegerValue(value); } - public void setBool(String fieldName, boolean value) { + public void setBool(String fieldName, boolean value) { setFieldValue(fieldName, new IntegerValue(value ? 1 : 0)); - } + } - public void setLong(String fieldName, long value) { - setFieldValue(fieldName, new LongValue(value)); - } + public void setLong(String fieldName, long value) { + setFieldValue(fieldName, new LongValue(value)); + } - public void setLong(int fieldIndex, long value) { - values[fieldIndex] = new LongValue(value); - } + public void setLong(int fieldIndex, long value) { + values[fieldIndex] = new LongValue(value); + } public void setString(int fieldIndex, String value) { values[fieldIndex] = new StringValue(value); @@ -237,7 +241,7 @@ public void setString(String fieldName, String value) { setFieldValue(fieldName, group.getField(fieldName).createValue(value)); - } + } public boolean equals(Object other) { if (other == this) { @@ -257,20 +261,19 @@ } for (int i = 0; i < values.length; i++) { - if (values[i] == null) { - if (other.values[i] != null) - return false; - } - else if (!values[i].equals(other.values[i])) { + if (values[i] == null) { + if (other.values[i] != null) + return false; + } else if (!values[i].equals(other.values[i])) { return false; } } return true; } - + public int hashCode() { - return values.hashCode(); + return values.hashCode(); } public String toString() { @@ -290,8 +293,8 @@ } public void setFieldValue(String fieldName, FieldValue value) { - if (!group.hasField(fieldName)) - throw new IllegalArgumentException("The field " + fieldName + " does not exist in group " + group); + if (!group.hasField(fieldName)) + throw new IllegalArgumentException("The field " + fieldName + " does not exist in group " + group); int index = group.getFieldIndex(fieldName); setFieldValue(index, value); } @@ -311,12 +314,12 @@ public boolean isDefined(String fieldName) { return getValue(fieldName) != null; } - + public FieldValue copy() { - FieldValue[] copies = new FieldValue[values.length]; - for (int i=0; i<copies.length; i++) { - copies[i] = values[i].copy(); - } - return new GroupValue(group, this.values); - } + FieldValue[] copies = new FieldValue[values.length]; + for (int i = 0; i < copies.length; i++) { + copies[i] = values[i].copy(); + } + return new GroupValue(group, this.values); + } } Modified: branches/ext-refactor/ext/pom.xml =================================================================== --- branches/ext-refactor/ext/pom.xml 2008-01-23 22:37:13 UTC (rev 126) +++ branches/ext-refactor/ext/pom.xml 2008-01-24 13:19:56 UTC (rev 127) @@ -1,27 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.openfast</groupId> - <artifactId>openfast</artifactId> - <version>0.9.7-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - <groupId>org.openfast</groupId> - <artifactId>openfast-ext</artifactId> - - <name>OpenFAST Extensions</name> - - <dependencies> - <dependency> - <groupId>org.openfast</groupId> - <artifactId>openfast-core</artifactId> - <version>${version}</version> - </dependency> - <dependency> - <groupId>org.apache.mina</groupId> - <artifactId>mina-core</artifactId> - <version>1.1.5</version> - </dependency> - </dependencies> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <version>0.9.7-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <groupId>org.openfast</groupId> + <artifactId>openfast-ext</artifactId> + + <name>OpenFAST Extensions</name> + + <dependencies> + <dependency> + <groupId>org.openfast</groupId> + <artifactId>openfast-core</artifactId> + <version>${version}</version> + </dependency> + <dependency> + <groupId>org.apache.mina</groupId> + <artifactId>mina-core</artifactId> + <version>1.1.5</version> + </dependency> + </dependencies> </project> \ No newline at end of file Modified: branches/ext-refactor/pom.xml =================================================================== --- branches/ext-refactor/pom.xml 2008-01-23 22:37:13 UTC (rev 126) +++ branches/ext-refactor/pom.xml 2008-01-24 13:19:56 UTC (rev 127) @@ -69,11 +69,24 @@ <system>sourceforge</system> <url>http://sourceforge.net/tracker/?group_id=198357</url> </issueManagement> + + <ciManagement> + <system>continuum</system> + <url>http://continuum.lasalletech.net/continuum</url> + <notifiers> + <notifier> + <sendOnError>true</sendOnError> + <sendOnFailure>true</sendOnFailure> + <sendOnWarning>true</sendOnWarning> + <sendOnSuccess>true</sendOnSuccess> + </notifier> + </notifiers> + </ciManagement> <scm> <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/branches/ext-refactor</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/ext-refactor</developerConnection> - <url>scm:svn:https://openfast.svn.sourceforge.net/viewvc/openfast/tags/ext-refactor</url> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/branches/ext-refactor</developerConnection> + <url>https://openfast.svn.sourceforge.net/viewvc/openfast/branches/ext-refactor</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-23 22:37:25
|
Revision: 126 http://openfast.svn.sourceforge.net/openfast/?rev=126&view=rev Author: jacob_northey Date: 2008-01-23 14:37:13 -0800 (Wed, 23 Jan 2008) Log Message: ----------- Added branches info to SCM properties Modified Paths: -------------- branches/ext-refactor/pom.xml Modified: branches/ext-refactor/pom.xml =================================================================== --- branches/ext-refactor/pom.xml 2008-01-23 22:29:53 UTC (rev 125) +++ branches/ext-refactor/pom.xml 2008-01-23 22:37:13 UTC (rev 126) @@ -71,9 +71,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/branches/ext-refactor</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/ext-refactor</developerConnection> + <url>scm:svn:https://openfast.svn.sourceforge.net/viewvc/openfast/tags/ext-refactor</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-23 22:29:52
|
Revision: 125 http://openfast.svn.sourceforge.net/openfast/?rev=125&view=rev Author: jacob_northey Date: 2008-01-23 14:29:53 -0800 (Wed, 23 Jan 2008) Log Message: ----------- Added ability to set writer for traces. Modified Paths: -------------- branches/ext-refactor/core/src/main/java/org/openfast/Context.java branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicDecodeTrace.java branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicEncodeTrace.java branches/ext-refactor/core/src/main/java/org/openfast/debug/Trace.java branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/EpochTimestampTest.java branches/ext-refactor/ext/pom.xml Property Changed: ---------------- branches/ext-refactor/core/ branches/ext-refactor/ext/ Property changes on: branches/ext-refactor/core ___________________________________________________________________ Name: svn:ignore - target + target .classpath .project .settings Modified: branches/ext-refactor/core/src/main/java/org/openfast/Context.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/Context.java 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/core/src/main/java/org/openfast/Context.java 2008-01-23 22:29:53 UTC (rev 125) @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; -import org.openfast.debug.BasicDecodeTrace; import org.openfast.debug.BasicEncodeTrace; import org.openfast.debug.Trace; import org.openfast.error.ErrorHandler; @@ -141,8 +140,8 @@ } public void startTrace() { - setEncodeTrace(new BasicEncodeTrace()); - setDecodeTrace(new BasicDecodeTrace()); +// setEncodeTrace(new BasicEncodeTrace()); +// setDecodeTrace(new BasicDecodeTrace()); } public void setTraceEnabled(boolean enabled) { Modified: branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicDecodeTrace.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicDecodeTrace.java 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicDecodeTrace.java 2008-01-23 22:29:53 UTC (rev 125) @@ -1,5 +1,7 @@ package org.openfast.debug; +import java.io.PrintWriter; + import org.openfast.ByteUtil; import org.openfast.FieldValue; import org.openfast.template.Field; @@ -7,6 +9,7 @@ public class BasicDecodeTrace implements Trace { private String indent = ""; + private PrintWriter out;// = new PrintWriter(System.out); public void groupStart(Group group) { print(group); @@ -22,8 +25,8 @@ } private void print(Object object) { - System.out.print(indent); - System.out.println(object); + out.print(indent); + out.println(object); } public void groupEnd() { @@ -41,4 +44,8 @@ public void pmap(byte[] bytes) { print("PMAP: " + ByteUtil.convertByteArrayToBitString(bytes)); } + + public void setWriter(PrintWriter writer) { + this.out = writer; + } } Modified: branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicEncodeTrace.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicEncodeTrace.java 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/core/src/main/java/org/openfast/debug/BasicEncodeTrace.java 2008-01-23 22:29:53 UTC (rev 125) @@ -1,5 +1,6 @@ package org.openfast.debug; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Stack; @@ -12,6 +13,7 @@ public class BasicEncodeTrace implements Trace { private Stack stack = new Stack(); + private PrintWriter out = new PrintWriter(System.out); public void groupStart(Group group) { TraceGroup traceGroup = new TraceGroup(group); @@ -27,7 +29,7 @@ public void groupEnd() { TraceGroup group = (TraceGroup) stack.pop(); if (stack.isEmpty()) { - System.out.println(group); + out.println(group); } } @@ -112,4 +114,8 @@ tab += " "; return tab; } + + public void setWriter(PrintWriter writer) { + this.out = writer; + } } Modified: branches/ext-refactor/core/src/main/java/org/openfast/debug/Trace.java =================================================================== --- branches/ext-refactor/core/src/main/java/org/openfast/debug/Trace.java 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/core/src/main/java/org/openfast/debug/Trace.java 2008-01-23 22:29:53 UTC (rev 125) @@ -1,5 +1,7 @@ package org.openfast.debug; +import java.io.PrintWriter; + import org.openfast.FieldValue; import org.openfast.template.Field; import org.openfast.template.Group; @@ -9,4 +11,5 @@ void groupEnd(); void field(Field field, FieldValue value, FieldValue encoded, byte[] encoding, int pmapIndex); void pmap(byte[] pmap); + void setWriter(PrintWriter writer); } Modified: branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/EpochTimestampTest.java =================================================================== --- branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/EpochTimestampTest.java 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/core/src/test/java/org/openfast/template/type/codec/EpochTimestampTest.java 2008-01-23 22:29:53 UTC (rev 125) @@ -1,6 +1,6 @@ package org.openfast.template.type.codec; -import java.util.Calendar; +import java.util.Date; import org.openfast.DateValue; import org.openfast.test.OpenFastTestCase; @@ -8,9 +8,7 @@ public class EpochTimestampTest extends OpenFastTestCase { public void testEncodeDecode() { - Calendar cal = Calendar.getInstance(); - cal.set(2007, 7, 7, 12, 0, 0); - cal.set(Calendar.MILLISECOND, 0); - assertEncodeDecode(new DateValue(cal.getTime()), "00100010 01000100 00001000 00110111 00110000 10000000", TypeCodec.EPOCH_TIMESTAMP); + Date date = new Date(1201025733046L); + assertEncodeDecode(new DateValue(date), "00100010 01111010 00010101 01011001 00100011 10110110", TypeCodec.EPOCH_TIMESTAMP); } } Property changes on: branches/ext-refactor/ext ___________________________________________________________________ Name: svn:ignore - target + target .classpath .project Modified: branches/ext-refactor/ext/pom.xml =================================================================== --- branches/ext-refactor/ext/pom.xml 2008-01-18 18:42:03 UTC (rev 124) +++ branches/ext-refactor/ext/pom.xml 2008-01-23 22:29:53 UTC (rev 125) @@ -14,6 +14,11 @@ <dependencies> <dependency> + <groupId>org.openfast</groupId> + <artifactId>openfast-core</artifactId> + <version>${version}</version> + </dependency> + <dependency> <groupId>org.apache.mina</groupId> <artifactId>mina-core</artifactId> <version>1.1.5</version> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 18:42:13
|
Revision: 124 http://openfast.svn.sourceforge.net/openfast/?rev=124&view=rev Author: jacob_northey Date: 2008-01-18 10:42:03 -0800 (Fri, 18 Jan 2008) Log Message: ----------- Refactored structure Modified Paths: -------------- branches/ext-refactor/pom.xml Added Paths: ----------- branches/ext-refactor/core/ branches/ext-refactor/core/pom.xml branches/ext-refactor/core/src/ branches/ext-refactor/core/src/assembly/ branches/ext-refactor/core/src/main/ branches/ext-refactor/core/src/test/ branches/ext-refactor/ext/ branches/ext-refactor/ext/pom.xml branches/ext-refactor/ext/src/ branches/ext-refactor/ext/src/main/ branches/ext-refactor/ext/src/main/java/ branches/ext-refactor/ext/src/main/resources/ branches/ext-refactor/ext/src/test/ branches/ext-refactor/ext/src/test/java/ branches/ext-refactor/ext/src/test/resources/ Removed Paths: ------------- branches/ext-refactor/etc/ branches/ext-refactor/src/assembly/ branches/ext-refactor/src/main/ branches/ext-refactor/src/test/ Property changes on: branches/ext-refactor/core ___________________________________________________________________ Name: svn:ignore + target Copied: branches/ext-refactor/core/pom.xml (from rev 123, branches/ext-refactor/pom.xml) =================================================================== --- branches/ext-refactor/core/pom.xml (rev 0) +++ branches/ext-refactor/core/pom.xml 2008-01-18 18:42:03 UTC (rev 124) @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <version>0.9.7-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openfast</groupId> + <artifactId>openfast-core</artifactId> + <packaging>jar</packaging> + + <name>OpenFAST Core</name> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh</artifactId> + <version>1.0-beta-2</version> + </extension> + </extensions> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Copied: branches/ext-refactor/core/src/assembly (from rev 123, branches/ext-refactor/src/assembly) Copied: branches/ext-refactor/core/src/main (from rev 123, branches/ext-refactor/src/main) Copied: branches/ext-refactor/core/src/test (from rev 123, branches/ext-refactor/src/test) Property changes on: branches/ext-refactor/ext ___________________________________________________________________ Name: svn:ignore + target Added: branches/ext-refactor/ext/pom.xml =================================================================== --- branches/ext-refactor/ext/pom.xml (rev 0) +++ branches/ext-refactor/ext/pom.xml 2008-01-18 18:42:03 UTC (rev 124) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <version>0.9.7-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <groupId>org.openfast</groupId> + <artifactId>openfast-ext</artifactId> + + <name>OpenFAST Extensions</name> + + <dependencies> + <dependency> + <groupId>org.apache.mina</groupId> + <artifactId>mina-core</artifactId> + <version>1.1.5</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Modified: branches/ext-refactor/pom.xml =================================================================== --- branches/ext-refactor/pom.xml 2008-01-18 18:29:00 UTC (rev 123) +++ branches/ext-refactor/pom.xml 2008-01-18 18:42:03 UTC (rev 124) @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> - <packaging>jar</packaging> + <packaging>pom</packaging> <version>0.9.7-SNAPSHOT</version> <organization> @@ -15,6 +15,11 @@ <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + <modules> + <module>core</module> + <module>ext</module> + </modules> + <developers> <developer> <name>Jacob Northey</name> @@ -95,70 +100,6 @@ </mailingList> </mailingLists> - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/test/resources</directory> - </resource> - </resources> - <extensions> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh</artifactId> - <version>1.0-beta-2</version> - </extension> - </extensions> - - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> - </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>javadoc</id> - <phase>process-classes</phase> - <goals> - <goal>javadoc</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/source.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>attached</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>junit</groupId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 18:28:59
|
Revision: 123 http://openfast.svn.sourceforge.net/openfast/?rev=123&view=rev Author: jacob_northey Date: 2008-01-18 10:29:00 -0800 (Fri, 18 Jan 2008) Log Message: ----------- Modifying OpenFAST to be a multi-module project (core, ext) Added Paths: ----------- branches/ext-refactor/ Copied: branches/ext-refactor (from rev 122, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 18:25:10
|
Revision: 122 http://openfast.svn.sourceforge.net/openfast/?rev=122&view=rev Author: jacob_northey Date: 2008-01-18 10:25:16 -0800 (Fri, 18 Jan 2008) Log Message: ----------- Added branches Added Paths: ----------- branches/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 18:02:01
|
Revision: 121 http://openfast.svn.sourceforge.net/openfast/?rev=121&view=rev Author: jacob_northey Date: 2008-01-18 10:02:03 -0800 (Fri, 18 Jan 2008) Log Message: ----------- Added javadoc links to site Modified Paths: -------------- trunk/src/site/site.xml trunk/src/site/xdoc/index.xml.vm Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-01-18 17:31:54 UTC (rev 120) +++ trunk/src/site/site.xml 2008-01-18 18:02:03 UTC (rev 121) @@ -28,6 +28,7 @@ </menu> <menu name="Documentation"> + <item name="Javadocs" href="apidocs/"/> <item name="15-minute Guide" href="http://openfast.wiki.sourceforge.net/FifteenMinute"/> <item name="Wiki" href="http://openfast.wiki.sourceforge.net/"/> </menu> Modified: trunk/src/site/xdoc/index.xml.vm =================================================================== --- trunk/src/site/xdoc/index.xml.vm 2008-01-18 17:31:54 UTC (rev 120) +++ trunk/src/site/xdoc/index.xml.vm 2008-01-18 18:02:03 UTC (rev 121) @@ -11,15 +11,17 @@ <p> <img valign="top" src="images/icon_arrowfolderopen2_sml.gif" border="0" alt="" title="download"/> <a href="http://sourceforge.net/project/showfiles.php?group_id=198357&package_id=240515"> - Download + Download ${project.version} </a> - OpenFAST ${project.version} </p> <ul> <li> <a href="http://openfast.wiki.sourceforge.net/FifteenMinute">Getting Started</a> </li> <li> + <a href="apidocs/">Javadocs</a> + </li> + <li> <a href="license.html">License</a> </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 17:31:49
|
Revision: 120 http://openfast.svn.sourceforge.net/openfast/?rev=120&view=rev Author: jacob_northey Date: 2008-01-18 09:31:54 -0800 (Fri, 18 Jan 2008) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-18 17:31:47 UTC (rev 119) +++ trunk/pom.xml 2008-01-18 17:31:54 UTC (rev 120) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.6</version> + <version>0.9.7-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.6</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 17:31:43
|
Revision: 119 http://openfast.svn.sourceforge.net/openfast/?rev=119&view=rev Author: jacob_northey Date: 2008-01-18 09:31:47 -0800 (Fri, 18 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openfast-0.9.6 Added Paths: ----------- tags/openfast-0.9.6/ tags/openfast-0.9.6/etc/ tags/openfast-0.9.6/license.txt tags/openfast-0.9.6/pom.xml tags/openfast-0.9.6/src/ tags/openfast-0.9.6/src/main/java/org/openfast/MessageBlockReader.java tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.6/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.6/src/site/ tags/openfast-0.9.6/src/site/resources/css/site.css tags/openfast-0.9.6/src/site/xdoc/index.xml.vm tags/openfast-0.9.6/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.6/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/IncrementOperatorTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/OpraFeedTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/StringNullTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.6/src/test/java/org/openfast/test/OpenFastTestCase.java tags/openfast-0.9.6/src/test/resources/CME/ tags/openfast-0.9.6/src/test/resources/FPL/ tags/openfast-0.9.6/src/test/resources/FPL/FASTTestTemplate.xml tags/openfast-0.9.6/src/test/resources/FPL/data.xml tags/openfast-0.9.6/src/test/resources/FPL/messages.fast tags/openfast-0.9.6/src/test/resources/OPRA/ tags/openfast-0.9.6/src/test/resources/components.xml tags/openfast-0.9.6/src/test/resources/preTrade.xml tags/openfast-0.9.6/src/test/resources/session.xml tags/openfast-0.9.6/src/test/resources/template.xml Removed Paths: ------------- tags/openfast-0.9.6/etc/ tags/openfast-0.9.6/etc/tagVersion.bat tags/openfast-0.9.6/etc/tagVersion.sh tags/openfast-0.9.6/license.txt tags/openfast-0.9.6/pom.xml tags/openfast-0.9.6/src/ tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.6/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.6/src/site/resources/css/site.css tags/openfast-0.9.6/src/site/xdoc/index.xml tags/openfast-0.9.6/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.6/src/test/java/org/openfast/components.xml tags/openfast-0.9.6/src/test/java/org/openfast/preTrade.xml tags/openfast-0.9.6/src/test/java/org/openfast/scenario/1.fast tags/openfast-0.9.6/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.6/src/test/java/org/openfast/scenario/templates.xml tags/openfast-0.9.6/src/test/java/org/openfast/session.xml tags/openfast-0.9.6/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/FASTTestTemplate.xml tags/openfast-0.9.6/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.6/src/test/java/org/openfast/submitted/messages.fast tags/openfast-0.9.6/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml tags/openfast-0.9.6/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.6/src/test/java/org/openfast/template.xml tags/openfast-0.9.6/src/test/java/org/openfast/test/OpenFastTestCase.java Copied: tags/openfast-0.9.6 (from rev 101, trunk) Copied: tags/openfast-0.9.6/etc (from rev 99, trunk/etc) Deleted: tags/openfast-0.9.6/etc/tagVersion.bat =================================================================== --- trunk/etc/tagVersion.bat 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/etc/tagVersion.bat 2008-01-18 17:31:47 UTC (rev 119) @@ -1,4 +0,0 @@ -@echo off -svn propset major.version %1 . -svn propset minor.version %2 . -echo "Set version to %1.%2" \ No newline at end of file Deleted: tags/openfast-0.9.6/etc/tagVersion.sh =================================================================== --- trunk/etc/tagVersion.sh 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/etc/tagVersion.sh 2008-01-18 17:31:47 UTC (rev 119) @@ -1,4 +0,0 @@ -#!/bin/sh -svn propset major.version $1 . -svn propset minor.version $2 . -echo Set version to $1.$2 \ No newline at end of file Deleted: tags/openfast-0.9.6/license.txt =================================================================== --- trunk/license.txt 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.6/license.txt 2008-01-18 17:31:47 UTC (rev 119) @@ -1,18 +0,0 @@ -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> \ No newline at end of file Copied: tags/openfast-0.9.6/license.txt (from rev 99, trunk/license.txt) =================================================================== --- tags/openfast-0.9.6/license.txt (rev 0) +++ tags/openfast-0.9.6/license.txt 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,18 @@ +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> \ No newline at end of file Deleted: tags/openfast-0.9.6/pom.xml =================================================================== --- trunk/pom.xml 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.6/pom.xml 2008-01-18 17:31:47 UTC (rev 119) @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.openfast</groupId> - <artifactId>openfast</artifactId> - <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> - - <organization> - <name>The LaSalle Technology Group, LLC</name> - <url>http://www.lasalletech.com</url> - </organization> - - <name>OpenFAST</name> - - <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> - - <licenses> - <license> - <name>Mozilla Public License Version 1.1</name> - <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> - <distribution>repo</distribution> - </license> - </licenses> - - <url>http://www.openfast.org</url> - <inceptionYear>2006</inceptionYear> - - <issueManagement> - <system>sourceforge</system> - <url>http://sourceforge.net/tracker/?group_id=198357</url> - </issueManagement> - - <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> - </scm> - - <mailingLists> - <mailingList> - <name>OpenFAST Users Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Commits Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Announcements Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> - <post>ope...@li...</post> - </mailingList> - </mailingLists> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/test/resources</directory> - </resource> - </resources> - <extensions> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh</artifactId> - <version>1.0-beta-2</version> - </extension> - </extensions> - - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> - </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>javadoc</id> - <phase>process-classes</phase> - <goals> - <goal>javadoc</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/source.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>attached</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - </dependency> - </dependencies> - - <distributionManagement> - <repository> - <id>sourceforge.net</id> - <name>Sourceforge.net Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/release</url> - </repository> - <snapshotRepository> - <id>sourceforge.net</id> - <name>Sourceforge.net Snapshot Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/snapshot</url> - </snapshotRepository> - </distributionManagement> -</project> \ No newline at end of file Copied: tags/openfast-0.9.6/pom.xml (from rev 118, trunk/pom.xml) =================================================================== --- tags/openfast-0.9.6/pom.xml (rev 0) +++ tags/openfast-0.9.6/pom.xml 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <packaging>jar</packaging> + <version>0.9.6</version> + + <organization> + <name>The LaSalle Technology Group, LLC</name> + <url>http://www.lasalletech.com</url> + </organization> + + <name>OpenFAST</name> + + <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + + <developers> + <developer> + <name>Jacob Northey</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>architect</role> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + <developer> + <name>Craig Otis</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + </developers> + + <contributors> + <contributor> + <name>Stefan Schwendiman</name> + <organization>Swiss Exchange</organization> + <organizationUrl>http://www.swx.com</organizationUrl> + <roles> + <role>tester</role> + </roles> + <timezone>+1</timezone> + </contributor> + </contributors> + + <licenses> + <license> + <name>Mozilla Public License Version 1.1</name> + <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <url>http://www.openfast.org</url> + <inceptionYear>2006</inceptionYear> + + <issueManagement> + <system>sourceforge</system> + <url>http://sourceforge.net/tracker/?group_id=198357</url> + </issueManagement> + + <scm> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.6</url> + </scm> + + <mailingLists> + <mailingList> + <name>OpenFAST Users Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Commits Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Announcements Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> + <post>ope...@li...</post> + </mailingList> + </mailingLists> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh</artifactId> + <version>1.0-beta-2</version> + </extension> + </extensions> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <distributionManagement> + <repository> + <id>sourceforge.net</id> + <name>Sourceforge.net Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/release</url> + </repository> + <snapshotRepository> + <id>sourceforge.net</id> + <name>Sourceforge.net Snapshot Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/snapshot</url> + </snapshotRepository> + <site> + <id>sourceforge.net</id> + <name>Sourceforge.net OpenFAST Web Site</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/</url> + </site> + </distributionManagement> +</project> \ No newline at end of file Copied: tags/openfast-0.9.6/src (from rev 99, trunk/src) Copied: tags/openfast-0.9.6/src/main/java/org/openfast/MessageBlockReader.java (from rev 101, trunk/src/main/java/org/openfast/MessageBlockReader.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/MessageBlockReader.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/MessageBlockReader.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,18 @@ +package org.openfast; + +import java.io.InputStream; + +public interface MessageBlockReader { + + MessageBlockReader NULL = new MessageBlockReader(){ + public boolean readBlock(InputStream in) { + return true; + } + + public void messageRead(InputStream in, Message message) { + }}; + + boolean readBlock(InputStream in); + void messageRead(InputStream in, Message message); + +} Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/MessageInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,133 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openfast.codec.FastDecoder; -import org.openfast.template.MessageTemplate; -import org.openfast.template.TemplateRegisteredListener; -import org.openfast.template.TemplateRegistry; - - -public class MessageInputStream implements MessageStream { - private InputStream in; - private FastDecoder decoder; - private Context context; - private Map templateHandlers = Collections.EMPTY_MAP; - private List handlers = Collections.EMPTY_LIST; - - public MessageInputStream(InputStream inputStream) { - this(inputStream, new Context()); - } - - public MessageInputStream(InputStream inputStream, Context context) { - this.in = inputStream; - this.context = context; - this.decoder = new FastDecoder(context, in); - } - - /** - * @throws java.io.EOFException - * @return the next message in the stream - */ - public Message readMessage() { - if (context.isTraceEnabled()) - context.startTrace(); - - Message message = decoder.readMessage(); - - if (message == null) { - return null; - } - if (!handlers.isEmpty()) { - for (int i=0; i<handlers.size(); i++) { - ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); - } - } - if (templateHandlers.containsKey(message.getTemplate())) { - MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); - handler.handleMessage(message, context, decoder); - - return readMessage(); - } - - return message; - } - - public void registerTemplate(int templateId, MessageTemplate template) { - context.registerTemplate(templateId, template); - } - - public void close() { - try { - in.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getUnderlyingStream() { - return in; - } - - public void addMessageHandler(MessageTemplate template, MessageHandler handler) { - if (templateHandlers == Collections.EMPTY_MAP) { - templateHandlers = new HashMap(); - } - - templateHandlers.put(template, handler); - } - - public void addMessageHandler(MessageHandler handler) { - if (handlers == Collections.EMPTY_LIST) { - handlers = new ArrayList(4); - } - handlers.add(handler); - } - - public void setTemplateRegistry(TemplateRegistry registry) { - context.setTemplateRegistry(registry); - } - - public TemplateRegistry getTemplateRegistry() { - return context.getTemplateRegistry(); - } - - public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { - } - - public void reset() { - decoder.reset(); - } - - public Context getContext() { - return context; - } -} Copied: tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java (from rev 101, trunk/src/main/java/org/openfast/MessageInputStream.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/MessageInputStream.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,145 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openfast.codec.FastDecoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.TemplateRegisteredListener; +import org.openfast.template.TemplateRegistry; + + +public class MessageInputStream implements MessageStream { + private InputStream in; + private FastDecoder decoder; + private Context context; + private Map templateHandlers = Collections.EMPTY_MAP; + private List handlers = Collections.EMPTY_LIST; + private MessageBlockReader blockReader = MessageBlockReader.NULL; + + public MessageInputStream(InputStream inputStream) { + this(inputStream, new Context()); + } + + public MessageInputStream(InputStream inputStream, Context context) { + this.in = inputStream; + this.context = context; + this.decoder = new FastDecoder(context, in); + } + + /** + * @throws java.io.EOFException + * @return the next message in the stream + */ + public Message readMessage() { + if (context.isTraceEnabled()) + context.startTrace(); + + boolean keepReading = blockReader.readBlock(in); + + if (!keepReading) return null; + + Message message = decoder.readMessage(); + + if (message == null) { + return null; + } + + blockReader.messageRead(in, message); + + if (!handlers.isEmpty()) { + for (int i=0; i<handlers.size(); i++) { + ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); + } + } + if (templateHandlers.containsKey(message.getTemplate())) { + MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); + handler.handleMessage(message, context, decoder); + + return readMessage(); + } + + return message; + } + + public void registerTemplate(int templateId, MessageTemplate template) { + context.registerTemplate(templateId, template); + } + + public void close() { + try { + in.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public InputStream getUnderlyingStream() { + return in; + } + + public void addMessageHandler(MessageTemplate template, MessageHandler handler) { + if (templateHandlers == Collections.EMPTY_MAP) { + templateHandlers = new HashMap(); + } + + templateHandlers.put(template, handler); + } + + public void addMessageHandler(MessageHandler handler) { + if (handlers == Collections.EMPTY_LIST) { + handlers = new ArrayList(4); + } + handlers.add(handler); + } + + public void setTemplateRegistry(TemplateRegistry registry) { + context.setTemplateRegistry(registry); + } + + public TemplateRegistry getTemplateRegistry() { + return context.getTemplateRegistry(); + } + + public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { + } + + public void reset() { + decoder.reset(); + } + + public Context getContext() { + return context; + } + + public void setBlockReader(MessageBlockReader messageBlockReader) { + this.blockReader = messageBlockReader; + } +} Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,74 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.NumericValue; -import org.openfast.ScalarValue; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class IncrementIntegerOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - IncrementIntegerOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (priorValue == null) { - return value; - } - - if (value == null) { - if (field.isOptional()) { - if (priorValue == ScalarValue.UNDEFINED) { - return null; - } - - return ScalarValue.NULL; - } else { - throw new IllegalArgumentException(); - } - } - - if (priorValue.isUndefined()) { - if (value.equals(field.getDefaultValue())) { - return null; - } else { - return value; - } - } - - if (!value.equals(((NumericValue) priorValue).increment())) { - return value; - } - - return null; - } - - public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { - return newValue; - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (previousValue == null) return null; - if (previousValue.isUndefined()) { - if (field.getDefaultValue().isUndefined()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); - } - } else { - return field.getDefaultValue(); - } - } - - return ((NumericValue) previousValue).increment(); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (from rev 103, trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,73 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.NumericValue; +import org.openfast.ScalarValue; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class IncrementIntegerOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + IncrementIntegerOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (priorValue == null) { + return value; + } + + if (value == null) { + if (field.isOptional()) { + if (priorValue == ScalarValue.UNDEFINED && field.getDefaultValue().isUndefined()) { + return null; + } + return ScalarValue.NULL; + } else { + throw new IllegalArgumentException(); + } + } + + if (priorValue.isUndefined()) { + if (value.equals(field.getDefaultValue())) { + return null; + } else { + return value; + } + } + + if (!value.equals(((NumericValue) priorValue).increment())) { + return value; + } + + return null; + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + return newValue; + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (previousValue == null) return null; + if (previousValue.isUndefined()) { + if (field.getDefaultValue().isUndefined()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); + } + } else { + return field.getDefaultValue(); + } + } + + return ((NumericValue) previousValue).increment(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,91 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class TailOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - TailOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (value == null) { - return ScalarValue.NULL; - } - - if (priorValue == null) { - return value; - } - - if (priorValue.isUndefined()) { - priorValue = field.getBaseValue(); - } - - int index = 0; - - byte[] val = value.getBytes(); - byte[] prior = priorValue.getBytes(); - - if (val.length > prior.length) - return value; - - while (index < val.length && val[index] == prior[index]) - index++; - if (val.length == index) - return null; - return (ScalarValue) field.createValue(new String(val, index, val.length-index)); - } - - public ScalarValue decodeValue(ScalarValue newValue, - ScalarValue previousValue, Scalar field) { - StringValue base; - - if ((previousValue == null) && !field.isOptional()) { - Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, - ""); - - return null; - } else if ((previousValue == null) || - previousValue.isUndefined()) { - base = (StringValue) field.getBaseValue(); - } else { - base = (StringValue) previousValue; - } - - if ((newValue == null) || newValue.isNull()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalArgumentException(""); - } - } - - String delta = ((StringValue) newValue).value; - int length = Math.max(base.value.length() - delta.length(), 0); - String root = base.value.substring(0, length); - - return new StringValue(root + delta); - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, - Scalar field) { - if (previousValue.isUndefined()) { - return field.getBaseValue(); - } - - return previousValue; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (from rev 110, trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,93 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class TailOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + TailOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (value == null) { + if (priorValue == null) + return null; + if (priorValue.isUndefined() && field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; + } + + if (priorValue == null) { + return value; + } + + if (priorValue.isUndefined()) { + priorValue = field.getBaseValue(); + } + + int index = 0; + + byte[] val = value.getBytes(); + byte[] prior = priorValue.getBytes(); + + if (val.length > prior.length) + return value; + if (val.length < prior.length) + Global.handleError(FastConstants.D3_CANT_ENCODE_VALUE, "The value " + val + " cannot be encoded by a tail operator with previous value " + priorValue); + + while (index < val.length && val[index] == prior[index]) + index++; + if (val.length == index) + return null; + return (ScalarValue) field.createValue(new String(val, index, val.length-index)); + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + StringValue base; + + if ((previousValue == null) && !field.isOptional()) { + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, ""); + return null; + } else if ((previousValue == null) || previousValue.isUndefined()) { + base = (StringValue) field.getBaseValue(); + } else { + base = (StringValue) previousValue; + } + + if ((newValue == null) || newValue.isNull()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalArgumentException(""); + } + } + + String delta = ((StringValue) newValue).value; + int length = Math.max(base.value.length() - delta.length(), 0); + String root = base.value.substring(0, length); + + return new StringValue(root + delta); + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + ScalarValue value = previousValue; + if (value != null && value.isUndefined()) + value = (field.getDefaultValue().isUndefined()) ? null : field.getDefaultValue(); + if (value == null && !field.isOptional()) + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, "The field " + field + " was not present."); + return value; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,103 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class AsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - - AsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if ((value == null) || value.isNull()) { - throw new IllegalStateException("Only nullable strings can represent null values."); - } - - String string = value.toString(); - - if ((string != null) && (string.length() == 0)) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - return new StringValue(""); - } - - return new StringValue(new String(bytes)); - } - - /** - * @return Returns a new StringValue object with the passed value - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/AsciiString.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,109 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class AsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final String ZERO_TERMINATOR = "\u0000"; + private static final byte[] ZERO_PREAMBLE = new byte[] { 0, 0 }; + + AsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if ((value == null) || value.isNull()) { + throw new IllegalStateException("Only nullable strings can represent null values."); + } + + String string = value.toString(); + + if ((string != null) && (string.length() == 0)) { + return TypeCodec.NULL_VALUE_ENCODING; + } + if (string.startsWith(ZERO_TERMINATOR)) { + return ZERO_PREAMBLE; + } + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if (bytes.length > 1 && bytes[1] == 0) + return new StringValue("\u0000"); + return new StringValue(""); + } + + return new StringValue(new String(bytes)); + } + + /** + * @return Returns a new StringValue object with the passed value + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,126 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class NullableAsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; - - NullableAsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if (value.isNull()) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - String string = ((StringValue) value).value; - - if ((string != null) && (string.length() == 0)) { - return NULLABLE_EMPTY_STRING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - if ((bytes.length == 1)) { - return null; - } else { - return new StringValue(""); - } - } - - return new StringValue(new String(bytes)); - } - - /** - * Creates a new StringValue object - * @param value The string to be value of the new object - * @return Returns a new StringValue object with the passed string as its - * parameter - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - /** - * - * @return Returns an empty StringValue object - */ - public ScalarValue getDefaultValue() { - return new StringValue(""); - } - - /** - * @return Returns true - */ - public boolean isNullable() { - return true; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java) =================================================================== --- tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (rev 0) +++ tags/openfast-0.9.6/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2008-01-18 17:31:47 UTC (rev 119) @@ -0,0 +1,131 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class NullableAsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; + private static final byte[] ZERO_ENCODING = new byte[] { 0x00, 0x00, 0x00 }; + + NullableAsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if (value.isNull()) { + return TypeCodec.NULL_VALUE_ENCODING; + } + + String string = ((StringValue) value).value; + + if ((string != null) && (string.length() == 0)) { + return NULLABLE_EMPTY_STRING; + } + + if (string.startsWith("\u0000")) + return ZERO_ENCODING; + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if ((bytes.length == 1)) { + return null; + } else if (bytes.length == 2 && bytes[1] == 0){ + return new StringValue(""); + } else if (bytes.length == 3 && bytes[2] == 0) { + return new StringValue("\u0000"); + } + } + + return new StringValue(new String(bytes)); + } + + /** + * Creates a new StringValue object + * @param value The string to be value of the new object + * @return Returns a new StringValue object with the passed string as its + * parameter + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + /** + * + * @return Returns an empty StringValue object + */ + public ScalarValue getDefaultValue() { + return new StringValue(""); + } + + /** + * @return Returns true + */ + public boolean isNullable() { + return true; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.6/src/main/java/org/openfast/util/RecordingInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.6/src/main/java/org/openfast/util/RecordingInputStream.java 2008-01-18 17:31:47 UTC (rev 119) @@ -1,62 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast.util; - -import org.openfast.ByteUtil; - -import java.io.IOException; -import java.io.InputStream; - - -public class RecordingInputStream extends InputStream { - private byte[] buffer = new byte[1024]; - private int index = 0; - private InputStream in; - - public RecordingInputStream(InputStream inputStream) { - this.in = inputStream; - } - - - public int read() throws IOException { - int read = in.read(); - buffer[index++] = (byte) read; - - return read; - } - - public String toString() { - return ByteUtil.convertByteArrayToBitString(buffer, index); - } - - public byte[] getBuffer() { - byte[] b = new byte[index]; - System.arraycopy(buffer, 0, b, 0, index); - - return b; - } - - public void clear() { - index = 0; - } -} Copied: tags/openfast-0.9.6/src/main/java/org/openfast/util/RecordingInputStream.java (from rev 104, trunk/src/main/java/org/openfast/util/RecordingInputStream.java) ===========================================... [truncated message content] |
From: <ope...@li...> - 2008-01-18 17:30:43
|
Revision: 118 http://openfast.svn.sourceforge.net/openfast/?rev=118&view=rev Author: jacob_northey Date: 2008-01-18 09:30:49 -0800 (Fri, 18 Jan 2008) Log Message: ----------- [maven-release-plugin] prepare release openfast-0.9.6 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-18 17:26:31 UTC (rev 117) +++ trunk/pom.xml 2008-01-18 17:30:49 UTC (rev 118) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.6-SNAPSHOT</version> + <version>0.9.6</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.6</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.6</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-18 17:26:28
|
Revision: 117 http://openfast.svn.sourceforge.net/openfast/?rev=117&view=rev Author: jacob_northey Date: 2008-01-18 09:26:31 -0800 (Fri, 18 Jan 2008) Log Message: ----------- Added filtering to main web page. Added Paths: ----------- trunk/src/site/xdoc/index.xml.vm Removed Paths: ------------- trunk/src/site/xdoc/index.xml Deleted: trunk/src/site/xdoc/index.xml =================================================================== --- trunk/src/site/xdoc/index.xml 2008-01-11 16:07:42 UTC (rev 116) +++ trunk/src/site/xdoc/index.xml 2008-01-18 17:26:31 UTC (rev 117) @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<document> - <properties> - <title>About</title> - <author>Jacob Northey</author> - </properties> - - <body> - <div id="downloadbox"> - <h5>Download OpenFAST 0.9.4</h5> - <p> - <img valign="top" src="images/icon_arrowfolderopen2_sml.gif" border="0" alt="" title="download"/> - <a href="http://sourceforge.net/project/showfiles.php?group_id=198357&package_id=240515"> - Download - </a> - OpenFAST 0.9.4 - </p> - <ul> - <li> - <a href="http://openfast.wiki.sourceforge.net/FifteenMinute">Getting Started</a> - </li> - <li> - <a href="license.html">License</a> - </li> - </ul> - </div> - <section name="OpenFAST"> - <subsection name="What is OpenFAST?"> - OpenFAST is a 100% Java implementation of the FAST Protocol (FIX Adapted for STreaming). - The FAST protocol is used to optimize communications in the electronic exchange of financial data. - OpenFAST is flexible and extensible through high volume - low latency transmissions. - The FAST protocol uses a data compression algorithm to decrease the size of data by two processes. - <ul> - <li><em>First Process: Field Encoding</em> - Data that is simliar or redundant is removed.</li> - <li><em>Second Process: Transfer Encoding</em> - Serialize remaining data through binary encoding.</li> - </ul> - The FAST protocol also uses templates to enhance data compression and decompression. The only specification - among the templates is that the creator and end-user must agree upon a template before data can be streamed. - Any template guide may be used, such as XML or a basic text file. - To learn more about OpenFAST and the FAST protocol, visit the FAQ. - </subsection> - <subsection name="Goals"> - <ul> - <li>Provide a complete implementation of the current FAST Specification</li> - <li>Create an implementation that follows Object Oriented Design principles</li> - <li>Extensible so that new types, codecs, and operators can be created easily</li> - </ul> - </subsection> - <subsection name="Features"> - <ul> - <li>100% Java Implementation of the FAST protocol - using the <a href="http://www.fixprotocol.org/fastspec">current 1.x.1 specification</a>.</li> - <li>Using a protocol that is market proven by: Archipelago Exchange, London Stock Exchange, CME, and others.</li> - <li>Easily creatable data template using existing specifications such as XML or develop your own.</li> - <li>SCP 1.0 implementation</li> - <li>SCP 1.1 implementation</li> - <li>Licensed under the <a href="http://www.mozilla.org/MPL/MPL-1.1.html">Mozilla Public License</a></li> - </ul> - </subsection> - </section> - </body> -</document> \ No newline at end of file Copied: trunk/src/site/xdoc/index.xml.vm (from rev 104, trunk/src/site/xdoc/index.xml) =================================================================== --- trunk/src/site/xdoc/index.xml.vm (rev 0) +++ trunk/src/site/xdoc/index.xml.vm 2008-01-18 17:26:31 UTC (rev 117) @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<document> + <properties> + <title>About</title> + <author>Jacob Northey</author> + </properties> + + <body> + <div id="downloadbox"> + <h5>Download OpenFAST ${project.version}</h5> + <p> + <img valign="top" src="images/icon_arrowfolderopen2_sml.gif" border="0" alt="" title="download"/> + <a href="http://sourceforge.net/project/showfiles.php?group_id=198357&package_id=240515"> + Download + </a> + OpenFAST ${project.version} + </p> + <ul> + <li> + <a href="http://openfast.wiki.sourceforge.net/FifteenMinute">Getting Started</a> + </li> + <li> + <a href="license.html">License</a> + </li> + </ul> + </div> + <section name="OpenFAST"> + <subsection name="What is OpenFAST?"> + OpenFAST is a 100% Java implementation of the FAST Protocol (FIX Adapted for STreaming). + The FAST protocol is used to optimize communications in the electronic exchange of financial data. + OpenFAST is flexible and extensible through high volume - low latency transmissions. + The FAST protocol uses a data compression algorithm to decrease the size of data by two processes. + <ul> + <li><em>First Process: Field Encoding</em> - Data that is simliar or redundant is removed.</li> + <li><em>Second Process: Transfer Encoding</em> - Serialize remaining data through binary encoding.</li> + </ul> + The FAST protocol also uses templates to enhance data compression and decompression. The only specification + among the templates is that the creator and end-user must agree upon a template before data can be streamed. + Any template guide may be used, such as XML or a basic text file. + To learn more about OpenFAST and the FAST protocol, visit the FAQ. + </subsection> + <subsection name="Goals"> + <ul> + <li>Provide a complete implementation of the current FAST Specification</li> + <li>Create an implementation that follows Object Oriented Design principles</li> + <li>Extensible so that new types, codecs, and operators can be created easily</li> + </ul> + </subsection> + <subsection name="Features"> + <ul> + <li>100% Java Implementation of the FAST protocol - using the <a href="http://www.fixprotocol.org/fastspec">current 1.x.1 specification</a>.</li> + <li>Using a protocol that is market proven by: Archipelago Exchange, London Stock Exchange, CME, and others.</li> + <li>Easily creatable data template using existing specifications such as XML or develop your own.</li> + <li>SCP 1.0 implementation</li> + <li>SCP 1.1 implementation</li> + <li>Licensed under the <a href="http://www.mozilla.org/MPL/MPL-1.1.html">Mozilla Public License</a></li> + </ul> + </subsection> + </section> + </body> +</document> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 16:07:38
|
Revision: 116 http://openfast.svn.sourceforge.net/openfast/?rev=116&view=rev Author: jacob_northey Date: 2008-01-11 08:07:42 -0800 (Fri, 11 Jan 2008) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-11 16:07:21 UTC (rev 115) +++ trunk/pom.xml 2008-01-11 16:07:42 UTC (rev 116) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5</version> + <version>0.9.6-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5b</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 16:07:30
|
Revision: 115 http://openfast.svn.sourceforge.net/openfast/?rev=115&view=rev Author: jacob_northey Date: 2008-01-11 08:07:21 -0800 (Fri, 11 Jan 2008) Log Message: ----------- [maven-release-plugin] copy for tag openfast-0.9.5b Added Paths: ----------- tags/openfast-0.9.5b/ tags/openfast-0.9.5b/etc/ tags/openfast-0.9.5b/license.txt tags/openfast-0.9.5b/pom.xml tags/openfast-0.9.5b/src/ tags/openfast-0.9.5b/src/main/java/org/openfast/MessageBlockReader.java tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.5b/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.5b/src/site/ tags/openfast-0.9.5b/src/site/resources/css/site.css tags/openfast-0.9.5b/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/IncrementOperatorTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/OpraFeedTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/StringNullTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/test/OpenFastTestCase.java tags/openfast-0.9.5b/src/test/resources/CME/ tags/openfast-0.9.5b/src/test/resources/FPL/ tags/openfast-0.9.5b/src/test/resources/FPL/FASTTestTemplate.xml tags/openfast-0.9.5b/src/test/resources/FPL/data.xml tags/openfast-0.9.5b/src/test/resources/FPL/messages.fast tags/openfast-0.9.5b/src/test/resources/OPRA/ tags/openfast-0.9.5b/src/test/resources/components.xml tags/openfast-0.9.5b/src/test/resources/preTrade.xml tags/openfast-0.9.5b/src/test/resources/session.xml tags/openfast-0.9.5b/src/test/resources/template.xml Removed Paths: ------------- tags/openfast-0.9.5b/etc/ tags/openfast-0.9.5b/etc/tagVersion.bat tags/openfast-0.9.5b/etc/tagVersion.sh tags/openfast-0.9.5b/license.txt tags/openfast-0.9.5b/pom.xml tags/openfast-0.9.5b/src/ tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.5b/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.5b/src/site/resources/css/site.css tags/openfast-0.9.5b/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/components.xml tags/openfast-0.9.5b/src/test/java/org/openfast/preTrade.xml tags/openfast-0.9.5b/src/test/java/org/openfast/scenario/1.fast tags/openfast-0.9.5b/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/scenario/templates.xml tags/openfast-0.9.5b/src/test/java/org/openfast/session.xml tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/FASTTestTemplate.xml tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/submitted/messages.fast tags/openfast-0.9.5b/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml tags/openfast-0.9.5b/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.5b/src/test/java/org/openfast/template.xml tags/openfast-0.9.5b/src/test/java/org/openfast/test/OpenFastTestCase.java Copied: tags/openfast-0.9.5b (from rev 101, trunk) Copied: tags/openfast-0.9.5b/etc (from rev 99, trunk/etc) Deleted: tags/openfast-0.9.5b/etc/tagVersion.bat =================================================================== --- trunk/etc/tagVersion.bat 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/etc/tagVersion.bat 2008-01-11 16:07:21 UTC (rev 115) @@ -1,4 +0,0 @@ -@echo off -svn propset major.version %1 . -svn propset minor.version %2 . -echo "Set version to %1.%2" \ No newline at end of file Deleted: tags/openfast-0.9.5b/etc/tagVersion.sh =================================================================== --- trunk/etc/tagVersion.sh 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/etc/tagVersion.sh 2008-01-11 16:07:21 UTC (rev 115) @@ -1,4 +0,0 @@ -#!/bin/sh -svn propset major.version $1 . -svn propset minor.version $2 . -echo Set version to $1.$2 \ No newline at end of file Deleted: tags/openfast-0.9.5b/license.txt =================================================================== --- trunk/license.txt 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.5b/license.txt 2008-01-11 16:07:21 UTC (rev 115) @@ -1,18 +0,0 @@ -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> \ No newline at end of file Copied: tags/openfast-0.9.5b/license.txt (from rev 99, trunk/license.txt) =================================================================== --- tags/openfast-0.9.5b/license.txt (rev 0) +++ tags/openfast-0.9.5b/license.txt 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,18 @@ +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> \ No newline at end of file Deleted: tags/openfast-0.9.5b/pom.xml =================================================================== --- trunk/pom.xml 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.5b/pom.xml 2008-01-11 16:07:21 UTC (rev 115) @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.openfast</groupId> - <artifactId>openfast</artifactId> - <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> - - <organization> - <name>The LaSalle Technology Group, LLC</name> - <url>http://www.lasalletech.com</url> - </organization> - - <name>OpenFAST</name> - - <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> - - <licenses> - <license> - <name>Mozilla Public License Version 1.1</name> - <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> - <distribution>repo</distribution> - </license> - </licenses> - - <url>http://www.openfast.org</url> - <inceptionYear>2006</inceptionYear> - - <issueManagement> - <system>sourceforge</system> - <url>http://sourceforge.net/tracker/?group_id=198357</url> - </issueManagement> - - <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> - </scm> - - <mailingLists> - <mailingList> - <name>OpenFAST Users Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Commits Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Announcements Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> - <post>ope...@li...</post> - </mailingList> - </mailingLists> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/test/resources</directory> - </resource> - </resources> - <extensions> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh</artifactId> - <version>1.0-beta-2</version> - </extension> - </extensions> - - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> - </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>javadoc</id> - <phase>process-classes</phase> - <goals> - <goal>javadoc</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/source.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>attached</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - </dependency> - </dependencies> - - <distributionManagement> - <repository> - <id>sourceforge.net</id> - <name>Sourceforge.net Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/release</url> - </repository> - <snapshotRepository> - <id>sourceforge.net</id> - <name>Sourceforge.net Snapshot Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/snapshot</url> - </snapshotRepository> - </distributionManagement> -</project> \ No newline at end of file Copied: tags/openfast-0.9.5b/pom.xml (from rev 114, trunk/pom.xml) =================================================================== --- tags/openfast-0.9.5b/pom.xml (rev 0) +++ tags/openfast-0.9.5b/pom.xml 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <packaging>jar</packaging> + <version>0.9.5</version> + + <organization> + <name>The LaSalle Technology Group, LLC</name> + <url>http://www.lasalletech.com</url> + </organization> + + <name>OpenFAST</name> + + <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + + <developers> + <developer> + <name>Jacob Northey</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>architect</role> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + <developer> + <name>Craig Otis</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + </developers> + + <contributors> + <contributor> + <name>Stefan Schwendiman</name> + <organization>Swiss Exchange</organization> + <organizationUrl>http://www.swx.com</organizationUrl> + <roles> + <role>tester</role> + </roles> + <timezone>+1</timezone> + </contributor> + </contributors> + + <licenses> + <license> + <name>Mozilla Public License Version 1.1</name> + <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <url>http://www.openfast.org</url> + <inceptionYear>2006</inceptionYear> + + <issueManagement> + <system>sourceforge</system> + <url>http://sourceforge.net/tracker/?group_id=198357</url> + </issueManagement> + + <scm> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5b</url> + </scm> + + <mailingLists> + <mailingList> + <name>OpenFAST Users Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Commits Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Announcements Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> + <post>ope...@li...</post> + </mailingList> + </mailingLists> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh</artifactId> + <version>1.0-beta-2</version> + </extension> + </extensions> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <distributionManagement> + <repository> + <id>sourceforge.net</id> + <name>Sourceforge.net Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/release</url> + </repository> + <snapshotRepository> + <id>sourceforge.net</id> + <name>Sourceforge.net Snapshot Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/snapshot</url> + </snapshotRepository> + <site> + <id>sourceforge.net</id> + <name>Sourceforge.net OpenFAST Web Site</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/</url> + </site> + </distributionManagement> +</project> \ No newline at end of file Copied: tags/openfast-0.9.5b/src (from rev 99, trunk/src) Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/MessageBlockReader.java (from rev 101, trunk/src/main/java/org/openfast/MessageBlockReader.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/MessageBlockReader.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/MessageBlockReader.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,18 @@ +package org.openfast; + +import java.io.InputStream; + +public interface MessageBlockReader { + + MessageBlockReader NULL = new MessageBlockReader(){ + public boolean readBlock(InputStream in) { + return true; + } + + public void messageRead(InputStream in, Message message) { + }}; + + boolean readBlock(InputStream in); + void messageRead(InputStream in, Message message); + +} Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/MessageInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,133 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openfast.codec.FastDecoder; -import org.openfast.template.MessageTemplate; -import org.openfast.template.TemplateRegisteredListener; -import org.openfast.template.TemplateRegistry; - - -public class MessageInputStream implements MessageStream { - private InputStream in; - private FastDecoder decoder; - private Context context; - private Map templateHandlers = Collections.EMPTY_MAP; - private List handlers = Collections.EMPTY_LIST; - - public MessageInputStream(InputStream inputStream) { - this(inputStream, new Context()); - } - - public MessageInputStream(InputStream inputStream, Context context) { - this.in = inputStream; - this.context = context; - this.decoder = new FastDecoder(context, in); - } - - /** - * @throws java.io.EOFException - * @return the next message in the stream - */ - public Message readMessage() { - if (context.isTraceEnabled()) - context.startTrace(); - - Message message = decoder.readMessage(); - - if (message == null) { - return null; - } - if (!handlers.isEmpty()) { - for (int i=0; i<handlers.size(); i++) { - ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); - } - } - if (templateHandlers.containsKey(message.getTemplate())) { - MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); - handler.handleMessage(message, context, decoder); - - return readMessage(); - } - - return message; - } - - public void registerTemplate(int templateId, MessageTemplate template) { - context.registerTemplate(templateId, template); - } - - public void close() { - try { - in.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getUnderlyingStream() { - return in; - } - - public void addMessageHandler(MessageTemplate template, MessageHandler handler) { - if (templateHandlers == Collections.EMPTY_MAP) { - templateHandlers = new HashMap(); - } - - templateHandlers.put(template, handler); - } - - public void addMessageHandler(MessageHandler handler) { - if (handlers == Collections.EMPTY_LIST) { - handlers = new ArrayList(4); - } - handlers.add(handler); - } - - public void setTemplateRegistry(TemplateRegistry registry) { - context.setTemplateRegistry(registry); - } - - public TemplateRegistry getTemplateRegistry() { - return context.getTemplateRegistry(); - } - - public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { - } - - public void reset() { - decoder.reset(); - } - - public Context getContext() { - return context; - } -} Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java (from rev 101, trunk/src/main/java/org/openfast/MessageInputStream.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/MessageInputStream.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,145 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openfast.codec.FastDecoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.TemplateRegisteredListener; +import org.openfast.template.TemplateRegistry; + + +public class MessageInputStream implements MessageStream { + private InputStream in; + private FastDecoder decoder; + private Context context; + private Map templateHandlers = Collections.EMPTY_MAP; + private List handlers = Collections.EMPTY_LIST; + private MessageBlockReader blockReader = MessageBlockReader.NULL; + + public MessageInputStream(InputStream inputStream) { + this(inputStream, new Context()); + } + + public MessageInputStream(InputStream inputStream, Context context) { + this.in = inputStream; + this.context = context; + this.decoder = new FastDecoder(context, in); + } + + /** + * @throws java.io.EOFException + * @return the next message in the stream + */ + public Message readMessage() { + if (context.isTraceEnabled()) + context.startTrace(); + + boolean keepReading = blockReader.readBlock(in); + + if (!keepReading) return null; + + Message message = decoder.readMessage(); + + if (message == null) { + return null; + } + + blockReader.messageRead(in, message); + + if (!handlers.isEmpty()) { + for (int i=0; i<handlers.size(); i++) { + ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); + } + } + if (templateHandlers.containsKey(message.getTemplate())) { + MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); + handler.handleMessage(message, context, decoder); + + return readMessage(); + } + + return message; + } + + public void registerTemplate(int templateId, MessageTemplate template) { + context.registerTemplate(templateId, template); + } + + public void close() { + try { + in.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public InputStream getUnderlyingStream() { + return in; + } + + public void addMessageHandler(MessageTemplate template, MessageHandler handler) { + if (templateHandlers == Collections.EMPTY_MAP) { + templateHandlers = new HashMap(); + } + + templateHandlers.put(template, handler); + } + + public void addMessageHandler(MessageHandler handler) { + if (handlers == Collections.EMPTY_LIST) { + handlers = new ArrayList(4); + } + handlers.add(handler); + } + + public void setTemplateRegistry(TemplateRegistry registry) { + context.setTemplateRegistry(registry); + } + + public TemplateRegistry getTemplateRegistry() { + return context.getTemplateRegistry(); + } + + public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { + } + + public void reset() { + decoder.reset(); + } + + public Context getContext() { + return context; + } + + public void setBlockReader(MessageBlockReader messageBlockReader) { + this.blockReader = messageBlockReader; + } +} Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,74 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.NumericValue; -import org.openfast.ScalarValue; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class IncrementIntegerOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - IncrementIntegerOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (priorValue == null) { - return value; - } - - if (value == null) { - if (field.isOptional()) { - if (priorValue == ScalarValue.UNDEFINED) { - return null; - } - - return ScalarValue.NULL; - } else { - throw new IllegalArgumentException(); - } - } - - if (priorValue.isUndefined()) { - if (value.equals(field.getDefaultValue())) { - return null; - } else { - return value; - } - } - - if (!value.equals(((NumericValue) priorValue).increment())) { - return value; - } - - return null; - } - - public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { - return newValue; - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (previousValue == null) return null; - if (previousValue.isUndefined()) { - if (field.getDefaultValue().isUndefined()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); - } - } else { - return field.getDefaultValue(); - } - } - - return ((NumericValue) previousValue).increment(); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (from rev 103, trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,73 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.NumericValue; +import org.openfast.ScalarValue; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class IncrementIntegerOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + IncrementIntegerOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (priorValue == null) { + return value; + } + + if (value == null) { + if (field.isOptional()) { + if (priorValue == ScalarValue.UNDEFINED && field.getDefaultValue().isUndefined()) { + return null; + } + return ScalarValue.NULL; + } else { + throw new IllegalArgumentException(); + } + } + + if (priorValue.isUndefined()) { + if (value.equals(field.getDefaultValue())) { + return null; + } else { + return value; + } + } + + if (!value.equals(((NumericValue) priorValue).increment())) { + return value; + } + + return null; + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + return newValue; + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (previousValue == null) return null; + if (previousValue.isUndefined()) { + if (field.getDefaultValue().isUndefined()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); + } + } else { + return field.getDefaultValue(); + } + } + + return ((NumericValue) previousValue).increment(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,91 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class TailOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - TailOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (value == null) { - return ScalarValue.NULL; - } - - if (priorValue == null) { - return value; - } - - if (priorValue.isUndefined()) { - priorValue = field.getBaseValue(); - } - - int index = 0; - - byte[] val = value.getBytes(); - byte[] prior = priorValue.getBytes(); - - if (val.length > prior.length) - return value; - - while (index < val.length && val[index] == prior[index]) - index++; - if (val.length == index) - return null; - return (ScalarValue) field.createValue(new String(val, index, val.length-index)); - } - - public ScalarValue decodeValue(ScalarValue newValue, - ScalarValue previousValue, Scalar field) { - StringValue base; - - if ((previousValue == null) && !field.isOptional()) { - Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, - ""); - - return null; - } else if ((previousValue == null) || - previousValue.isUndefined()) { - base = (StringValue) field.getBaseValue(); - } else { - base = (StringValue) previousValue; - } - - if ((newValue == null) || newValue.isNull()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalArgumentException(""); - } - } - - String delta = ((StringValue) newValue).value; - int length = Math.max(base.value.length() - delta.length(), 0); - String root = base.value.substring(0, length); - - return new StringValue(root + delta); - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, - Scalar field) { - if (previousValue.isUndefined()) { - return field.getBaseValue(); - } - - return previousValue; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (from rev 110, trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,93 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class TailOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + TailOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (value == null) { + if (priorValue == null) + return null; + if (priorValue.isUndefined() && field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; + } + + if (priorValue == null) { + return value; + } + + if (priorValue.isUndefined()) { + priorValue = field.getBaseValue(); + } + + int index = 0; + + byte[] val = value.getBytes(); + byte[] prior = priorValue.getBytes(); + + if (val.length > prior.length) + return value; + if (val.length < prior.length) + Global.handleError(FastConstants.D3_CANT_ENCODE_VALUE, "The value " + val + " cannot be encoded by a tail operator with previous value " + priorValue); + + while (index < val.length && val[index] == prior[index]) + index++; + if (val.length == index) + return null; + return (ScalarValue) field.createValue(new String(val, index, val.length-index)); + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + StringValue base; + + if ((previousValue == null) && !field.isOptional()) { + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, ""); + return null; + } else if ((previousValue == null) || previousValue.isUndefined()) { + base = (StringValue) field.getBaseValue(); + } else { + base = (StringValue) previousValue; + } + + if ((newValue == null) || newValue.isNull()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalArgumentException(""); + } + } + + String delta = ((StringValue) newValue).value; + int length = Math.max(base.value.length() - delta.length(), 0); + String root = base.value.substring(0, length); + + return new StringValue(root + delta); + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + ScalarValue value = previousValue; + if (value != null && value.isUndefined()) + value = (field.getDefaultValue().isUndefined()) ? null : field.getDefaultValue(); + if (value == null && !field.isOptional()) + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, "The field " + field + " was not present."); + return value; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,103 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class AsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - - AsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if ((value == null) || value.isNull()) { - throw new IllegalStateException("Only nullable strings can represent null values."); - } - - String string = value.toString(); - - if ((string != null) && (string.length() == 0)) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - return new StringValue(""); - } - - return new StringValue(new String(bytes)); - } - - /** - * @return Returns a new StringValue object with the passed value - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/AsciiString.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,109 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class AsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final String ZERO_TERMINATOR = "\u0000"; + private static final byte[] ZERO_PREAMBLE = new byte[] { 0, 0 }; + + AsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if ((value == null) || value.isNull()) { + throw new IllegalStateException("Only nullable strings can represent null values."); + } + + String string = value.toString(); + + if ((string != null) && (string.length() == 0)) { + return TypeCodec.NULL_VALUE_ENCODING; + } + if (string.startsWith(ZERO_TERMINATOR)) { + return ZERO_PREAMBLE; + } + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if (bytes.length > 1 && bytes[1] == 0) + return new StringValue("\u0000"); + return new StringValue(""); + } + + return new StringValue(new String(bytes)); + } + + /** + * @return Returns a new StringValue object with the passed value + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,126 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class NullableAsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; - - NullableAsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if (value.isNull()) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - String string = ((StringValue) value).value; - - if ((string != null) && (string.length() == 0)) { - return NULLABLE_EMPTY_STRING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - if ((bytes.length == 1)) { - return null; - } else { - return new StringValue(""); - } - } - - return new StringValue(new String(bytes)); - } - - /** - * Creates a new StringValue object - * @param value The string to be value of the new object - * @return Returns a new StringValue object with the passed string as its - * parameter - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - /** - * - * @return Returns an empty StringValue object - */ - public ScalarValue getDefaultValue() { - return new StringValue(""); - } - - /** - * @return Returns true - */ - public boolean isNullable() { - return true; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java) =================================================================== --- tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (rev 0) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2008-01-11 16:07:21 UTC (rev 115) @@ -0,0 +1,131 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class NullableAsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; + private static final byte[] ZERO_ENCODING = new byte[] { 0x00, 0x00, 0x00 }; + + NullableAsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if (value.isNull()) { + return TypeCodec.NULL_VALUE_ENCODING; + } + + String string = ((StringValue) value).value; + + if ((string != null) && (string.length() == 0)) { + return NULLABLE_EMPTY_STRING; + } + + if (string.startsWith("\u0000")) + return ZERO_ENCODING; + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if ((bytes.length == 1)) { + return null; + } else if (bytes.length == 2 && bytes[1] == 0){ + return new StringValue(""); + } else if (bytes.length == 3 && bytes[2] == 0) { + return new StringValue("\u0000"); + } + } + + return new StringValue(new String(bytes)); + } + + /** + * Creates a new StringValue object + * @param value The string to be value of the new object + * @return Returns a new StringValue object with the passed string as its + * parameter + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + /** + * + * @return Returns an empty StringValue object + */ + public ScalarValue getDefaultValue() { + return new StringValue(""); + } + + /** + * @return Returns true + */ + public boolean isNullable() { + return true; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.5b/src/main/java/org/openfast/util/RecordingInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5b/src/main/java/org/openfast/util/RecordingInputStream.java 2008-01-11 16:07:21 UTC (rev 115) @@ -1,62 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast.util; - -import org.openfast.ByteUtil; - -import java.io.IOException; -import java.io.InputStream; - - -public class RecordingInputStream extends InputStream { - private byte[] buffer = new byte[1024]; - private int index = 0; - private InputStream in; - - public RecordingInputStream(InputStream inputStream) { - this.in = inputStream; - } - - - public int read() throws IOException { - int read = in.read(); - buffer[index++] = (byte) read; - - return read; - } - - public String toString() { - return ByteUtil.convertByteArrayToBitString(buffer, index); - } - - public byte[] getBuffer() { - byte[] b = new byte[index]; - System.arraycopy(buffer, 0, b, 0, index); - - return b; - } - - public void clear() { - index = 0; - } -} Copied: tags/openfast-0.9.5b/src/main/java/org/openfast/util/RecordingInputStream.java (from rev 104, trunk/src/main/java/org/openfast/util/RecordingInputStream.java) =========================... [truncated message content] |
From: <ope...@li...> - 2008-01-11 16:06:41
|
Revision: 114 http://openfast.svn.sourceforge.net/openfast/?rev=114&view=rev Author: jacob_northey Date: 2008-01-11 08:06:03 -0800 (Fri, 11 Jan 2008) Log Message: ----------- [maven-release-plugin] prepare release openfast-0.9.5b Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-11 16:04:26 UTC (rev 113) +++ trunk/pom.xml 2008-01-11 16:06:03 UTC (rev 114) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> + <version>0.9.5</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5b</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5b</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 16:04:31
|
Revision: 113 http://openfast.svn.sourceforge.net/openfast/?rev=113&view=rev Author: jacob_northey Date: 2008-01-11 08:04:26 -0800 (Fri, 11 Jan 2008) Log Message: ----------- Trying the release one more time Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-11 16:02:39 UTC (rev 112) +++ trunk/pom.xml 2008-01-11 16:04:26 UTC (rev 113) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5</version> + <version>0.9.5-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 16:02:35
|
Revision: 112 http://openfast.svn.sourceforge.net/openfast/?rev=112&view=rev Author: jacob_northey Date: 2008-01-11 08:02:39 -0800 (Fri, 11 Jan 2008) Log Message: ----------- [maven-release-plugin] prepare release openfast-0.9.5 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-11 16:01:04 UTC (rev 111) +++ trunk/pom.xml 2008-01-11 16:02:39 UTC (rev 112) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> + <version>0.9.5</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 16:01:03
|
Revision: 111 http://openfast.svn.sourceforge.net/openfast/?rev=111&view=rev Author: jacob_northey Date: 2008-01-11 08:01:04 -0800 (Fri, 11 Jan 2008) Log Message: ----------- Reverted back to 0.9.5 due to missed release Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-01-11 14:58:51 UTC (rev 110) +++ trunk/pom.xml 2008-01-11 16:01:04 UTC (rev 111) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.6-SNAPSHOT</version> + <version>0.9.5-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2008-01-11 14:58:48
|
Revision: 110 http://openfast.svn.sourceforge.net/openfast/?rev=110&view=rev Author: jacob_northey Date: 2008-01-11 06:58:51 -0800 (Fri, 11 Jan 2008) Log Message: ----------- Fixed bugs in tail operator Modified Paths: -------------- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java Modified: trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-12 17:26:42 UTC (rev 109) +++ trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2008-01-11 14:58:51 UTC (rev 110) @@ -79,12 +79,12 @@ } public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (previousValue.isUndefined()) { - if (field.getDefaultValue().isUndefined()) return null; - return field.getBaseValue(); - } - - return previousValue; + ScalarValue value = previousValue; + if (value != null && value.isUndefined()) + value = (field.getDefaultValue().isUndefined()) ? null : field.getDefaultValue(); + if (value == null && !field.isOptional()) + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, "The field " + field + " was not present."); + return value; } public boolean equals(Object obj) { Modified: trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java 2007-12-12 17:26:42 UTC (rev 109) +++ trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java 2008-01-11 14:58:51 UTC (rev 110) @@ -59,6 +59,48 @@ assertEquals(string("z"), TAIL_CODEC.getValueToEncode(string("z"), null, MAND_DEFAULT)); } + public void testDecodeEmptyForOptionalNoDefault() { + assertEquals(null, TAIL_CODEC.decodeEmptyValue(UNDEF, OPT_NO_DEFAULT)); + assertEquals(null, TAIL_CODEC.decodeEmptyValue(null, OPT_NO_DEFAULT)); + assertEquals(string("abcd"), TAIL_CODEC.decodeEmptyValue(string("abcd"), OPT_NO_DEFAULT)); + } + + public void testDecodeEmptyForMandatoryNoDefaultThrowsException() { + try { + TAIL_CODEC.decodeEmptyValue(UNDEF, MAND_NO_DEFAULT); + fail(); + } catch (FastException e) { + assertEquals(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, e.getCode()); + } + try { + TAIL_CODEC.decodeEmptyValue(null, MAND_NO_DEFAULT); + fail(); + } catch (FastException e) { + assertEquals(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, e.getCode()); + } + } + + public void testDecodeEmptyForMandatoryNoDefault() { + assertEquals(string("a"), TAIL_CODEC.decodeEmptyValue(string("a"), MAND_NO_DEFAULT)); + } + + public void testDecodeEmptyForOptionalDefaultABC() { + assertEquals(string("abc"), TAIL_CODEC.decodeEmptyValue(UNDEF, OPT_DEFAULT)); + assertEquals(null, TAIL_CODEC.decodeEmptyValue(null, OPT_DEFAULT)); + assertEquals(string("abcd"), TAIL_CODEC.decodeEmptyValue(string("abcd"), OPT_DEFAULT)); + } + + public void testDecodeEmptyForMandatoryDefaultABC() { + assertEquals(string("abc"), TAIL_CODEC.decodeEmptyValue(UNDEF, MAND_DEFAULT)); + } + + public void testDecodeForOptionalNoDefault() { + assertEquals(string("abc"), TAIL_CODEC.decodeValue(string("abc"), UNDEF, OPT_NO_DEFAULT)); + assertEquals(string("abd"), TAIL_CODEC.decodeValue(string("d"), string("abc"), OPT_NO_DEFAULT)); + assertEquals(string("abcd"), TAIL_CODEC.decodeValue(string("abcd"), string("abc"), OPT_NO_DEFAULT)); + assertEquals(null, TAIL_CODEC.decodeValue(null, string("abc"), OPT_NO_DEFAULT)); + } + public void testUnencodableValue() { try { TAIL_CODEC.getValueToEncode(new StringValue("a"), new StringValue("abce"), OPT_NO_DEFAULT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-12 17:26:56
|
Revision: 109 http://openfast.svn.sourceforge.net/openfast/?rev=109&view=rev Author: jacob_northey Date: 2007-12-12 09:26:42 -0800 (Wed, 12 Dec 2007) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-12 17:26:35 UTC (rev 108) +++ trunk/pom.xml 2007-12-12 17:26:42 UTC (rev 109) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5</version> + <version>0.9.6-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-12 17:26:38
|
Revision: 108 http://openfast.svn.sourceforge.net/openfast/?rev=108&view=rev Author: jacob_northey Date: 2007-12-12 09:26:35 -0800 (Wed, 12 Dec 2007) Log Message: ----------- [maven-release-plugin] copy for tag openfast-0.9.5 Added Paths: ----------- tags/openfast-0.9.5/ tags/openfast-0.9.5/etc/ tags/openfast-0.9.5/license.txt tags/openfast-0.9.5/pom.xml tags/openfast-0.9.5/src/ tags/openfast-0.9.5/src/main/java/org/openfast/MessageBlockReader.java tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.5/src/site/ tags/openfast-0.9.5/src/site/resources/css/site.css tags/openfast-0.9.5/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.5/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/IncrementOperatorTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/OpraFeedTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/StringNullTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.5/src/test/java/org/openfast/test/OpenFastTestCase.java tags/openfast-0.9.5/src/test/resources/CME/ tags/openfast-0.9.5/src/test/resources/FPL/ tags/openfast-0.9.5/src/test/resources/FPL/FASTTestTemplate.xml tags/openfast-0.9.5/src/test/resources/FPL/data.xml tags/openfast-0.9.5/src/test/resources/FPL/messages.fast tags/openfast-0.9.5/src/test/resources/OPRA/ tags/openfast-0.9.5/src/test/resources/components.xml tags/openfast-0.9.5/src/test/resources/preTrade.xml tags/openfast-0.9.5/src/test/resources/session.xml tags/openfast-0.9.5/src/test/resources/template.xml Removed Paths: ------------- tags/openfast-0.9.5/etc/ tags/openfast-0.9.5/etc/tagVersion.bat tags/openfast-0.9.5/etc/tagVersion.sh tags/openfast-0.9.5/license.txt tags/openfast-0.9.5/pom.xml tags/openfast-0.9.5/src/ tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java tags/openfast-0.9.5/src/site/resources/css/site.css tags/openfast-0.9.5/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.5/src/test/java/org/openfast/components.xml tags/openfast-0.9.5/src/test/java/org/openfast/preTrade.xml tags/openfast-0.9.5/src/test/java/org/openfast/scenario/1.fast tags/openfast-0.9.5/src/test/java/org/openfast/scenario/CmeTemplateTest.java tags/openfast-0.9.5/src/test/java/org/openfast/scenario/templates.xml tags/openfast-0.9.5/src/test/java/org/openfast/session.xml tags/openfast-0.9.5/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/FASTTestTemplate.xml tags/openfast-0.9.5/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java tags/openfast-0.9.5/src/test/java/org/openfast/submitted/messages.fast tags/openfast-0.9.5/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml tags/openfast-0.9.5/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java tags/openfast-0.9.5/src/test/java/org/openfast/template.xml tags/openfast-0.9.5/src/test/java/org/openfast/test/OpenFastTestCase.java Copied: tags/openfast-0.9.5 (from rev 101, trunk) Copied: tags/openfast-0.9.5/etc (from rev 99, trunk/etc) Deleted: tags/openfast-0.9.5/etc/tagVersion.bat =================================================================== --- trunk/etc/tagVersion.bat 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/etc/tagVersion.bat 2007-12-12 17:26:35 UTC (rev 108) @@ -1,4 +0,0 @@ -@echo off -svn propset major.version %1 . -svn propset minor.version %2 . -echo "Set version to %1.%2" \ No newline at end of file Deleted: tags/openfast-0.9.5/etc/tagVersion.sh =================================================================== --- trunk/etc/tagVersion.sh 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/etc/tagVersion.sh 2007-12-12 17:26:35 UTC (rev 108) @@ -1,4 +0,0 @@ -#!/bin/sh -svn propset major.version $1 . -svn propset minor.version $2 . -echo Set version to $1.$2 \ No newline at end of file Deleted: tags/openfast-0.9.5/license.txt =================================================================== --- trunk/license.txt 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.5/license.txt 2007-12-12 17:26:35 UTC (rev 108) @@ -1,18 +0,0 @@ -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> \ No newline at end of file Copied: tags/openfast-0.9.5/license.txt (from rev 99, trunk/license.txt) =================================================================== --- tags/openfast-0.9.5/license.txt (rev 0) +++ tags/openfast-0.9.5/license.txt 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,18 @@ +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> \ No newline at end of file Deleted: tags/openfast-0.9.5/pom.xml =================================================================== --- trunk/pom.xml 2007-12-06 19:43:37 UTC (rev 101) +++ tags/openfast-0.9.5/pom.xml 2007-12-12 17:26:35 UTC (rev 108) @@ -1,148 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.openfast</groupId> - <artifactId>openfast</artifactId> - <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> - - <organization> - <name>The LaSalle Technology Group, LLC</name> - <url>http://www.lasalletech.com</url> - </organization> - - <name>OpenFAST</name> - - <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> - - <licenses> - <license> - <name>Mozilla Public License Version 1.1</name> - <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> - <distribution>repo</distribution> - </license> - </licenses> - - <url>http://www.openfast.org</url> - <inceptionYear>2006</inceptionYear> - - <issueManagement> - <system>sourceforge</system> - <url>http://sourceforge.net/tracker/?group_id=198357</url> - </issueManagement> - - <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> - </scm> - - <mailingLists> - <mailingList> - <name>OpenFAST Users Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Commits Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> - <post>ope...@li...</post> - </mailingList> - <mailingList> - <name>OpenFAST Announcements Mailing List</name> - <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> - <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> - <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> - <post>ope...@li...</post> - </mailingList> - </mailingLists> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/test/resources</directory> - </resource> - </resources> - <extensions> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh</artifactId> - <version>1.0-beta-2</version> - </extension> - </extensions> - - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.4</source> - <target>1.4</target> - </configuration> - </plugin> - <plugin> - <artifactId>maven-release-plugin</artifactId> - <configuration> - <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>javadoc</id> - <phase>process-classes</phase> - <goals> - <goal>javadoc</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/assembly/source.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>attached</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - </dependency> - </dependencies> - - <distributionManagement> - <repository> - <id>sourceforge.net</id> - <name>Sourceforge.net Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/release</url> - </repository> - <snapshotRepository> - <id>sourceforge.net</id> - <name>Sourceforge.net Snapshot Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/snapshot</url> - </snapshotRepository> - </distributionManagement> -</project> \ No newline at end of file Copied: tags/openfast-0.9.5/pom.xml (from rev 107, trunk/pom.xml) =================================================================== --- tags/openfast-0.9.5/pom.xml (rev 0) +++ tags/openfast-0.9.5/pom.xml 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <packaging>jar</packaging> + <version>0.9.5</version> + + <organization> + <name>The LaSalle Technology Group, LLC</name> + <url>http://www.lasalletech.com</url> + </organization> + + <name>OpenFAST</name> + + <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + + <developers> + <developer> + <name>Jacob Northey</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>architect</role> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + <developer> + <name>Craig Otis</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + </developers> + + <contributors> + <contributor> + <name>Stefan Schwendiman</name> + <organization>Swiss Exchange</organization> + <organizationUrl>http://www.swx.com</organizationUrl> + <roles> + <role>tester</role> + </roles> + <timezone>+1</timezone> + </contributor> + </contributors> + + <licenses> + <license> + <name>Mozilla Public License Version 1.1</name> + <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <url>http://www.openfast.org</url> + <inceptionYear>2006</inceptionYear> + + <issueManagement> + <system>sourceforge</system> + <url>http://sourceforge.net/tracker/?group_id=198357</url> + </issueManagement> + + <scm> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> + </scm> + + <mailingLists> + <mailingList> + <name>OpenFAST Users Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Commits Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Announcements Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> + <post>ope...@li...</post> + </mailingList> + </mailingLists> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh</artifactId> + <version>1.0-beta-2</version> + </extension> + </extensions> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <distributionManagement> + <repository> + <id>sourceforge.net</id> + <name>Sourceforge.net Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/release</url> + </repository> + <snapshotRepository> + <id>sourceforge.net</id> + <name>Sourceforge.net Snapshot Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/snapshot</url> + </snapshotRepository> + <site> + <id>sourceforge.net</id> + <name>Sourceforge.net OpenFAST Web Site</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/</url> + </site> + </distributionManagement> +</project> \ No newline at end of file Copied: tags/openfast-0.9.5/src (from rev 99, trunk/src) Copied: tags/openfast-0.9.5/src/main/java/org/openfast/MessageBlockReader.java (from rev 101, trunk/src/main/java/org/openfast/MessageBlockReader.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/MessageBlockReader.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/MessageBlockReader.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,18 @@ +package org.openfast; + +import java.io.InputStream; + +public interface MessageBlockReader { + + MessageBlockReader NULL = new MessageBlockReader(){ + public boolean readBlock(InputStream in) { + return true; + } + + public void messageRead(InputStream in, Message message) { + }}; + + boolean readBlock(InputStream in); + void messageRead(InputStream in, Message message); + +} Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/MessageInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,133 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openfast.codec.FastDecoder; -import org.openfast.template.MessageTemplate; -import org.openfast.template.TemplateRegisteredListener; -import org.openfast.template.TemplateRegistry; - - -public class MessageInputStream implements MessageStream { - private InputStream in; - private FastDecoder decoder; - private Context context; - private Map templateHandlers = Collections.EMPTY_MAP; - private List handlers = Collections.EMPTY_LIST; - - public MessageInputStream(InputStream inputStream) { - this(inputStream, new Context()); - } - - public MessageInputStream(InputStream inputStream, Context context) { - this.in = inputStream; - this.context = context; - this.decoder = new FastDecoder(context, in); - } - - /** - * @throws java.io.EOFException - * @return the next message in the stream - */ - public Message readMessage() { - if (context.isTraceEnabled()) - context.startTrace(); - - Message message = decoder.readMessage(); - - if (message == null) { - return null; - } - if (!handlers.isEmpty()) { - for (int i=0; i<handlers.size(); i++) { - ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); - } - } - if (templateHandlers.containsKey(message.getTemplate())) { - MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); - handler.handleMessage(message, context, decoder); - - return readMessage(); - } - - return message; - } - - public void registerTemplate(int templateId, MessageTemplate template) { - context.registerTemplate(templateId, template); - } - - public void close() { - try { - in.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getUnderlyingStream() { - return in; - } - - public void addMessageHandler(MessageTemplate template, MessageHandler handler) { - if (templateHandlers == Collections.EMPTY_MAP) { - templateHandlers = new HashMap(); - } - - templateHandlers.put(template, handler); - } - - public void addMessageHandler(MessageHandler handler) { - if (handlers == Collections.EMPTY_LIST) { - handlers = new ArrayList(4); - } - handlers.add(handler); - } - - public void setTemplateRegistry(TemplateRegistry registry) { - context.setTemplateRegistry(registry); - } - - public TemplateRegistry getTemplateRegistry() { - return context.getTemplateRegistry(); - } - - public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { - } - - public void reset() { - decoder.reset(); - } - - public Context getContext() { - return context; - } -} Copied: tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java (from rev 101, trunk/src/main/java/org/openfast/MessageInputStream.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/MessageInputStream.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,145 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openfast.codec.FastDecoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.TemplateRegisteredListener; +import org.openfast.template.TemplateRegistry; + + +public class MessageInputStream implements MessageStream { + private InputStream in; + private FastDecoder decoder; + private Context context; + private Map templateHandlers = Collections.EMPTY_MAP; + private List handlers = Collections.EMPTY_LIST; + private MessageBlockReader blockReader = MessageBlockReader.NULL; + + public MessageInputStream(InputStream inputStream) { + this(inputStream, new Context()); + } + + public MessageInputStream(InputStream inputStream, Context context) { + this.in = inputStream; + this.context = context; + this.decoder = new FastDecoder(context, in); + } + + /** + * @throws java.io.EOFException + * @return the next message in the stream + */ + public Message readMessage() { + if (context.isTraceEnabled()) + context.startTrace(); + + boolean keepReading = blockReader.readBlock(in); + + if (!keepReading) return null; + + Message message = decoder.readMessage(); + + if (message == null) { + return null; + } + + blockReader.messageRead(in, message); + + if (!handlers.isEmpty()) { + for (int i=0; i<handlers.size(); i++) { + ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); + } + } + if (templateHandlers.containsKey(message.getTemplate())) { + MessageHandler handler = (MessageHandler) templateHandlers.get(message.getTemplate()); + handler.handleMessage(message, context, decoder); + + return readMessage(); + } + + return message; + } + + public void registerTemplate(int templateId, MessageTemplate template) { + context.registerTemplate(templateId, template); + } + + public void close() { + try { + in.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public InputStream getUnderlyingStream() { + return in; + } + + public void addMessageHandler(MessageTemplate template, MessageHandler handler) { + if (templateHandlers == Collections.EMPTY_MAP) { + templateHandlers = new HashMap(); + } + + templateHandlers.put(template, handler); + } + + public void addMessageHandler(MessageHandler handler) { + if (handlers == Collections.EMPTY_LIST) { + handlers = new ArrayList(4); + } + handlers.add(handler); + } + + public void setTemplateRegistry(TemplateRegistry registry) { + context.setTemplateRegistry(registry); + } + + public TemplateRegistry getTemplateRegistry() { + return context.getTemplateRegistry(); + } + + public void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener) { + } + + public void reset() { + decoder.reset(); + } + + public Context getContext() { + return context; + } + + public void setBlockReader(MessageBlockReader messageBlockReader) { + this.blockReader = messageBlockReader; + } +} Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,74 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.NumericValue; -import org.openfast.ScalarValue; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class IncrementIntegerOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - IncrementIntegerOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (priorValue == null) { - return value; - } - - if (value == null) { - if (field.isOptional()) { - if (priorValue == ScalarValue.UNDEFINED) { - return null; - } - - return ScalarValue.NULL; - } else { - throw new IllegalArgumentException(); - } - } - - if (priorValue.isUndefined()) { - if (value.equals(field.getDefaultValue())) { - return null; - } else { - return value; - } - } - - if (!value.equals(((NumericValue) priorValue).increment())) { - return value; - } - - return null; - } - - public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { - return newValue; - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { - if (previousValue == null) return null; - if (previousValue.isUndefined()) { - if (field.getDefaultValue().isUndefined()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); - } - } else { - return field.getDefaultValue(); - } - } - - return ((NumericValue) previousValue).increment(); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (from rev 103, trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,73 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.NumericValue; +import org.openfast.ScalarValue; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class IncrementIntegerOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + IncrementIntegerOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (priorValue == null) { + return value; + } + + if (value == null) { + if (field.isOptional()) { + if (priorValue == ScalarValue.UNDEFINED && field.getDefaultValue().isUndefined()) { + return null; + } + return ScalarValue.NULL; + } else { + throw new IllegalArgumentException(); + } + } + + if (priorValue.isUndefined()) { + if (value.equals(field.getDefaultValue())) { + return null; + } else { + return value; + } + } + + if (!value.equals(((NumericValue) priorValue).increment())) { + return value; + } + + return null; + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + return newValue; + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (previousValue == null) return null; + if (previousValue.isUndefined()) { + if (field.getDefaultValue().isUndefined()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalStateException("Field with operator increment must send a value if no previous value existed."); + } + } else { + return field.getDefaultValue(); + } + } + + return ((NumericValue) previousValue).increment(); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,91 +0,0 @@ -/** - * - */ -package org.openfast.template.operator; - -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; -import org.openfast.template.Scalar; -import org.openfast.template.type.Type; - -final class TailOperatorCodec extends OperatorCodec { - private static final long serialVersionUID = 1L; - - TailOperatorCodec(Operator operator, Type[] types) { - super(operator, types); - } - - public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { - if (value == null) { - return ScalarValue.NULL; - } - - if (priorValue == null) { - return value; - } - - if (priorValue.isUndefined()) { - priorValue = field.getBaseValue(); - } - - int index = 0; - - byte[] val = value.getBytes(); - byte[] prior = priorValue.getBytes(); - - if (val.length > prior.length) - return value; - - while (index < val.length && val[index] == prior[index]) - index++; - if (val.length == index) - return null; - return (ScalarValue) field.createValue(new String(val, index, val.length-index)); - } - - public ScalarValue decodeValue(ScalarValue newValue, - ScalarValue previousValue, Scalar field) { - StringValue base; - - if ((previousValue == null) && !field.isOptional()) { - Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, - ""); - - return null; - } else if ((previousValue == null) || - previousValue.isUndefined()) { - base = (StringValue) field.getBaseValue(); - } else { - base = (StringValue) previousValue; - } - - if ((newValue == null) || newValue.isNull()) { - if (field.isOptional()) { - return null; - } else { - throw new IllegalArgumentException(""); - } - } - - String delta = ((StringValue) newValue).value; - int length = Math.max(base.value.length() - delta.length(), 0); - String root = base.value.substring(0, length); - - return new StringValue(root + delta); - } - - public ScalarValue decodeEmptyValue(ScalarValue previousValue, - Scalar field) { - if (previousValue.isUndefined()) { - return field.getBaseValue(); - } - - return previousValue; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} \ No newline at end of file Copied: tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (from rev 106, trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,93 @@ +/** + * + */ +package org.openfast.template.operator; + +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; +import org.openfast.template.Scalar; +import org.openfast.template.type.Type; + +final class TailOperatorCodec extends OperatorCodec { + private static final long serialVersionUID = 1L; + + TailOperatorCodec(Operator operator, Type[] types) { + super(operator, types); + } + + public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { + if (value == null) { + if (priorValue == null) + return null; + if (priorValue.isUndefined() && field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; + } + + if (priorValue == null) { + return value; + } + + if (priorValue.isUndefined()) { + priorValue = field.getBaseValue(); + } + + int index = 0; + + byte[] val = value.getBytes(); + byte[] prior = priorValue.getBytes(); + + if (val.length > prior.length) + return value; + if (val.length < prior.length) + Global.handleError(FastConstants.D3_CANT_ENCODE_VALUE, "The value " + val + " cannot be encoded by a tail operator with previous value " + priorValue); + + while (index < val.length && val[index] == prior[index]) + index++; + if (val.length == index) + return null; + return (ScalarValue) field.createValue(new String(val, index, val.length-index)); + } + + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { + StringValue base; + + if ((previousValue == null) && !field.isOptional()) { + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, ""); + return null; + } else if ((previousValue == null) || previousValue.isUndefined()) { + base = (StringValue) field.getBaseValue(); + } else { + base = (StringValue) previousValue; + } + + if ((newValue == null) || newValue.isNull()) { + if (field.isOptional()) { + return null; + } else { + throw new IllegalArgumentException(""); + } + } + + String delta = ((StringValue) newValue).value; + int length = Math.max(base.value.length() - delta.length(), 0); + String root = base.value.substring(0, length); + + return new StringValue(root + delta); + } + + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { + if (previousValue.isUndefined()) { + if (field.getDefaultValue().isUndefined()) return null; + return field.getBaseValue(); + } + + return previousValue; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} \ No newline at end of file Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,103 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class AsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - - AsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if ((value == null) || value.isNull()) { - throw new IllegalStateException("Only nullable strings can represent null values."); - } - - String string = value.toString(); - - if ((string != null) && (string.length() == 0)) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - return new StringValue(""); - } - - return new StringValue(new String(bytes)); - } - - /** - * @return Returns a new StringValue object with the passed value - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,109 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class AsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final String ZERO_TERMINATOR = "\u0000"; + private static final byte[] ZERO_PREAMBLE = new byte[] { 0, 0 }; + + AsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if ((value == null) || value.isNull()) { + throw new IllegalStateException("Only nullable strings can represent null values."); + } + + String string = value.toString(); + + if ((string != null) && (string.length() == 0)) { + return TypeCodec.NULL_VALUE_ENCODING; + } + if (string.startsWith(ZERO_TERMINATOR)) { + return ZERO_PREAMBLE; + } + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if (bytes.length > 1 && bytes[1] == 0) + return new StringValue("\u0000"); + return new StringValue(""); + } + + return new StringValue(new String(bytes)); + } + + /** + * @return Returns a new StringValue object with the passed value + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,126 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -/** - * - */ -package org.openfast.template.type.codec; - -import org.openfast.ByteUtil; -import org.openfast.Global; -import org.openfast.ScalarValue; -import org.openfast.StringValue; -import org.openfast.error.FastConstants; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -final class NullableAsciiString extends TypeCodec { - private static final long serialVersionUID = 1L; - private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; - - NullableAsciiString() { } - - /** - * Takes a ScalarValue object, and converts it to a byte array - * @param value The ScalarValue to be encoded - * @return Returns a byte array of the passed object - */ - public byte[] encodeValue(ScalarValue value) { - if (value.isNull()) { - return TypeCodec.NULL_VALUE_ENCODING; - } - - String string = ((StringValue) value).value; - - if ((string != null) && (string.length() == 0)) { - return NULLABLE_EMPTY_STRING; - } - - return string.getBytes(); - } - - /** - * Reads in a stream of data and stores it to a StringValue object - * @param in The InputStream to be decoded - * @return Returns a new StringValue object with the data stream as a String - */ - public ScalarValue decode(InputStream in) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int byt; - - try { - do { - byt = in.read(); - buffer.write(byt); - } while ((byt & 0x80) == 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - - byte[] bytes = buffer.toByteArray(); - bytes[bytes.length - 1] &= 0x7f; - - if (bytes[0] == 0) { - if (!ByteUtil.isEmpty(bytes)) - Global.handleError(FastConstants.R9_STRING_OVERLONG, null); - if ((bytes.length == 1)) { - return null; - } else { - return new StringValue(""); - } - } - - return new StringValue(new String(bytes)); - } - - /** - * Creates a new StringValue object - * @param value The string to be value of the new object - * @return Returns a new StringValue object with the passed string as its - * parameter - */ - public ScalarValue fromString(String value) { - return new StringValue(value); - } - - /** - * - * @return Returns an empty StringValue object - */ - public ScalarValue getDefaultValue() { - return new StringValue(""); - } - - /** - * @return Returns true - */ - public boolean isNullable() { - return true; - } - - public boolean equals(Object obj) { - return obj != null && obj.getClass() == getClass(); - } -} Copied: tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (from rev 105, trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,131 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +/** + * + */ +package org.openfast.template.type.codec; + +import org.openfast.ByteUtil; +import org.openfast.Global; +import org.openfast.ScalarValue; +import org.openfast.StringValue; +import org.openfast.error.FastConstants; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +final class NullableAsciiString extends TypeCodec { + private static final long serialVersionUID = 1L; + private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; + private static final byte[] ZERO_ENCODING = new byte[] { 0x00, 0x00, 0x00 }; + + NullableAsciiString() { } + + /** + * Takes a ScalarValue object, and converts it to a byte array + * @param value The ScalarValue to be encoded + * @return Returns a byte array of the passed object + */ + public byte[] encodeValue(ScalarValue value) { + if (value.isNull()) { + return TypeCodec.NULL_VALUE_ENCODING; + } + + String string = ((StringValue) value).value; + + if ((string != null) && (string.length() == 0)) { + return NULLABLE_EMPTY_STRING; + } + + if (string.startsWith("\u0000")) + return ZERO_ENCODING; + return string.getBytes(); + } + + /** + * Reads in a stream of data and stores it to a StringValue object + * @param in The InputStream to be decoded + * @return Returns a new StringValue object with the data stream as a String + */ + public ScalarValue decode(InputStream in) { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int byt; + + try { + do { + byt = in.read(); + buffer.write(byt); + } while ((byt & 0x80) == 0); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] bytes = buffer.toByteArray(); + bytes[bytes.length - 1] &= 0x7f; + + if (bytes[0] == 0) { + if (!ByteUtil.isEmpty(bytes)) + Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if ((bytes.length == 1)) { + return null; + } else if (bytes.length == 2 && bytes[1] == 0){ + return new StringValue(""); + } else if (bytes.length == 3 && bytes[2] == 0) { + return new StringValue("\u0000"); + } + } + + return new StringValue(new String(bytes)); + } + + /** + * Creates a new StringValue object + * @param value The string to be value of the new object + * @return Returns a new StringValue object with the passed string as its + * parameter + */ + public ScalarValue fromString(String value) { + return new StringValue(value); + } + + /** + * + * @return Returns an empty StringValue object + */ + public ScalarValue getDefaultValue() { + return new StringValue(""); + } + + /** + * @return Returns true + */ + public boolean isNullable() { + return true; + } + + public boolean equals(Object obj) { + return obj != null && obj.getClass() == getClass(); + } +} Deleted: tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-06 17:11:51 UTC (rev 99) +++ tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-12 17:26:35 UTC (rev 108) @@ -1,62 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast.util; - -import org.openfast.ByteUtil; - -import java.io.IOException; -import java.io.InputStream; - - -public class RecordingInputStream extends InputStream { - private byte[] buffer = new byte[1024]; - private int index = 0; - private InputStream in; - - public RecordingInputStream(InputStream inputStream) { - this.in = inputStream; - } - - - public int read() throws IOException { - int read = in.read(); - buffer[index++] = (byte) read; - - return read; - } - - public String toString() { - return ByteUtil.convertByteArrayToBitString(buffer, index); - } - - public byte[] getBuffer() { - byte[] b = new byte[index]; - System.arraycopy(buffer, 0, b, 0, index); - - return b; - } - - public void clear() { - index = 0; - } -} Copied: tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java (from rev 104, trunk/src/main/java/org/openfast/util/RecordingInputStream.java) =================================================================== --- tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java (rev 0) +++ tags/openfast-0.9.5/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-12 17:26:35 UTC (rev 108) @@ -0,0 +1,61 @@ +/... [truncated message content] |
From: <ope...@li...> - 2007-12-12 17:26:22
|
Revision: 107 http://openfast.svn.sourceforge.net/openfast/?rev=107&view=rev Author: jacob_northey Date: 2007-12-12 09:26:18 -0800 (Wed, 12 Dec 2007) Log Message: ----------- [maven-release-plugin] prepare release openfast-0.9.5 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-12 15:39:48 UTC (rev 106) +++ trunk/pom.xml 2007-12-12 17:26:18 UTC (rev 107) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.5-SNAPSHOT</version> + <version>0.9.5</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -66,9 +66,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.5</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.5</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |