├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.gradle └── src ├── main ├── java │ ├── org │ │ └── fix4j │ │ │ ├── engine │ │ │ ├── exception │ │ │ │ ├── Fix4jException.java │ │ │ │ ├── InvalidValueException.java │ │ │ │ └── NoSuchTagException.java │ │ │ ├── msg │ │ │ │ ├── CharSequenceTagStream.java │ │ │ │ ├── CustomMsgType.java │ │ │ │ ├── FixMsgType.java │ │ │ │ ├── FixVersion.java │ │ │ │ ├── Message.java │ │ │ │ ├── MsgType.java │ │ │ │ ├── TagBag.java │ │ │ │ └── impl │ │ │ │ │ └── SimpleTagBag.java │ │ │ ├── stream │ │ │ │ ├── TagStream.java │ │ │ │ └── TagValueConsumer.java │ │ │ ├── tag │ │ │ │ ├── BooleanTag.java │ │ │ │ ├── CharTag.java │ │ │ │ ├── DecimalTag.java │ │ │ │ ├── DoubleTag.java │ │ │ │ ├── FixTag.java │ │ │ │ ├── GroupTag.java │ │ │ │ ├── IntTag.java │ │ │ │ ├── LongTag.java │ │ │ │ ├── ObjectTag.java │ │ │ │ ├── StringTag.java │ │ │ │ ├── TagLib.java │ │ │ │ ├── impl │ │ │ │ │ ├── AbstractEnumTag.java │ │ │ │ │ ├── AbstractFixTag.java │ │ │ │ │ ├── BasicBooleanTag.java │ │ │ │ │ ├── BasicCharTag.java │ │ │ │ │ ├── BasicDecimalTag.java │ │ │ │ │ ├── BasicDoubleTag.java │ │ │ │ │ ├── BasicGroupTag.java │ │ │ │ │ ├── BasicIntTag.java │ │ │ │ │ ├── BasicLongTag.java │ │ │ │ │ ├── BasicStringTag.java │ │ │ │ │ └── CharEncodedEnumTag.java │ │ │ │ └── type │ │ │ │ │ └── LengthTag.java │ │ │ ├── util │ │ │ │ └── ParseUtil.java │ │ │ └── validate │ │ │ │ ├── ValidatingConsumer.java │ │ │ │ └── Validity.java │ │ │ └── sketch │ │ │ ├── Dictionary.java │ │ │ ├── Field.java │ │ │ ├── FieldDefinition.java │ │ │ ├── Fix42MessageType.java │ │ │ ├── Fix42Tags.java │ │ │ ├── IntTag.java │ │ │ ├── Message.java │ │ │ ├── MessageDefinition.java │ │ │ ├── MessageType.java │ │ │ ├── SimpleDictionary.java │ │ │ ├── SimpleFieldDefinition.java │ │ │ ├── SimpleMessage.java │ │ │ ├── SimpleMessageDefinition.java │ │ │ ├── StringTag.java │ │ │ └── Tag.java │ └── overview.html └── resources │ ├── LICENSE.template │ ├── codegen │ ├── config │ │ ├── config.fmpp │ │ └── type-mappings.properties │ └── templates │ │ └── FixTag.ftl │ └── fix_repository_2010_edition_20140507 │ ├── .DS_Store │ ├── FIX.4.0 │ └── Base │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ └── MsgContents.xml │ ├── FIX.4.1 │ └── Base │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ └── MsgContents.xml │ ├── FIX.4.2 │ └── Base │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ └── MsgContents.xml │ ├── FIX.4.3 │ └── Base │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ └── MsgContents.xml │ ├── FIX.4.4 │ └── Base │ │ ├── Abbreviations.xml │ │ ├── Categories.xml │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ ├── MsgContents.xml │ │ └── Sections.xml │ ├── FIX.5.0 │ ├── .DS_Store │ └── Base │ │ ├── Abbreviations.xml │ │ ├── Categories.xml │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ ├── MsgContents.xml │ │ └── Sections.xml │ ├── FIX.5.0SP1 │ └── Base │ │ ├── Abbreviations.xml │ │ ├── Categories.xml │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ ├── MsgContents.xml │ │ └── Sections.xml │ ├── FIX.5.0SP2 │ └── Base │ │ ├── Abbreviations.xml │ │ ├── Categories.xml │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ ├── MsgContents.xml │ │ └── Sections.xml │ ├── FIXT.1.1 │ └── Base │ │ ├── Abbreviations.xml │ │ ├── Categories.xml │ │ ├── Components.xml │ │ ├── Datatypes.xml │ │ ├── Enums.xml │ │ ├── Fields.xml │ │ ├── Messages.xml │ │ ├── MsgContents.xml │ │ └── Sections.xml │ ├── Unified │ ├── .DS_Store │ ├── FIX.4.0_en_phrases.xml │ ├── FIX.4.1_en_phrases.xml │ ├── FIX.4.2_en_phrases.xml │ ├── FIX.4.3_en_phrases.xml │ ├── FIX.4.4_en_phrases.xml │ ├── FIX.5.0SP1_en_phrases.xml │ ├── FIX.5.0SP2_en_phrases.xml │ ├── FIX.5.0_en_phrases.xml │ ├── FIXRepositoryMetadata.xml │ ├── FIXT.1.1_en_phrases.xml │ ├── FixRepository.xml │ └── FixRepositoryMeta.xsd │ ├── schema │ ├── Abbreviations.xsd │ ├── Categories.xsd │ ├── Components.xsd │ ├── Datatypes.xsd │ ├── Enums.xsd │ ├── Fields.xsd │ ├── Messages.xsd │ ├── MsgContents.xsd │ ├── Sections.xsd │ ├── extensionpack.xsd │ ├── repositorystructures.xsd │ ├── repositorytypes.xsd │ └── versions.xsd │ └── xsl │ ├── Translate_Abbreviations_2010_to_2009.xsl │ ├── Translate_Categories_2010_to_2009.xsl │ ├── Translate_Components_2010_to_2009.xsl │ ├── Translate_Datatypes_2010_to_2009.xsl │ ├── Translate_Enums_2010_to_2009.xsl │ ├── Translate_Fields_2010_to_2009.xsl │ ├── Translate_Messages_2010_to_2009.xsl │ ├── Translate_MsgContents_2010_to_2009.xsl │ ├── Translate_Sections_2010_to_2009.xsl │ └── Translate_support.xsl └── test └── java └── org └── fix4j ├── engine └── msg │ ├── FixVersionTest.java │ └── MsgTypeTest.java └── sketch └── Example.java /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .classpath 3 | .project 4 | .settings/ 5 | build/ 6 | bin/ 7 | *.iml 8 | .idea 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | branches: 5 | only: 6 | - master 7 | - feature/engine 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017 fix4j.org (tools4j.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Join the chat at https://gitter.im/tools4j/fix4j](https://badges.gitter.im/tools4j/fix4j.svg)](https://gitter.im/tools4j/fix4j?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 2 |   branch:master: [![Build Status (branch: master)](https://travis-ci.org/tools4j/fix4j.svg?branch=master)](https://travis-ci.org/tools4j/fix4j) 3 |   branch:feature/engine: [![Build Status (branch: feature/engine)](https://travis-ci.org/tools4j/fix4j.svg?branch=feature/engine)](https://travis-ci.org/tools4j/fix4j/branches) 4 | 5 | # fix4j 6 | Attempt to build a fast zero garbage FIX engine with Java. 7 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'jacoco' 3 | apply plugin: 'license' 4 | 5 | //temporary jacoco fix for java8 6 | jacoco { 7 | toolVersion = "0.7.1.201405082137" 8 | } 9 | 10 | sourceCompatibility = 1.8 11 | group = "org.fix4j" 12 | version = '1.0.1-SNAPSHOT' 13 | archivesBaseName = "fix4j-engine" 14 | 15 | jar { 16 | manifest { 17 | attributes 'Implementation-Title': 'fix4j', 'Implementation-Version': version 18 | } 19 | } 20 | 21 | repositories { 22 | mavenCentral() 23 | maven { 24 | url "https://oss.sonatype.org/content/repositories/snapshots/" 25 | } 26 | } 27 | 28 | buildscript { 29 | repositories { 30 | mavenCentral() 31 | jcenter() 32 | } 33 | 34 | dependencies { 35 | classpath 'net.sourceforge.fmpp:fmpp:0.9.15' 36 | classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0' 37 | classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3" 38 | } 39 | 40 | ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask', classpath: buildscript.configurations.classpath.asPath) 41 | } 42 | 43 | configurations.all { 44 | // check for updates every build 45 | //resolutionStrategy.cacheChangingModulesFor 0, 'seconds' 46 | } 47 | 48 | dependencies { 49 | compile group: "org.decimal4j", name: "decimal4j", version: "1.0.1", changing: true 50 | testCompile 'junit:junit:4.11' 51 | } 52 | 53 | uploadArchives { 54 | repositories { 55 | flatDir { 56 | dirs 'build/repositories' 57 | } 58 | } 59 | } 60 | 61 | def generatedSources = "${buildDir}/generated-src" 62 | 63 | task generateSources() << { 64 | println "Generating sources...." 65 | ant.fmpp( 66 | configuration: "src/main/resources/codegen/config/config.fmpp", 67 | sourceRoot: "src/main/resources/codegen/templates", 68 | outputRoot: generatedSources 69 | ) 70 | } 71 | 72 | sourceSets.main.java { 73 | srcDirs generatedSources, 'src/main/java' 74 | } 75 | 76 | license { 77 | header rootProject.file('src/main/resources/LICENSE.template') 78 | strictCheck true 79 | include "**/*.java" 80 | ext.year = Calendar.getInstance().get(Calendar.YEAR) 81 | } 82 | 83 | compileJava.dependsOn generateSources,licenseFormat 84 | 85 | javadoc { 86 | options.showFromPackage() 87 | options.linkSource() 88 | options.links("http://docs.oracle.com/javase/8/docs/api/"); 89 | options.windowTitle = "fix4j API ${version}" 90 | options.overview = "src/main/java/overview.html"; 91 | } 92 | 93 | task javadocJar(type: Jar) { 94 | classifier = 'javadoc' 95 | from javadoc 96 | } 97 | 98 | task sourcesJar(type: Jar) { 99 | classifier = 'sources' 100 | from sourceSets.main.allSource 101 | } 102 | 103 | artifacts { 104 | archives javadocJar, sourcesJar 105 | } 106 | 107 | gradle.taskGraph.whenReady { graph -> if (graph.hasTask(uploadArchives)) { 108 | 109 | allprojects { 110 | apply plugin: 'signing' 111 | apply plugin: 'maven' 112 | apply plugin: 'io.codearte.nexus-staging' 113 | 114 | // Signature of artifacts 115 | signing { 116 | sign configurations.archives 117 | } 118 | 119 | // OSSRH publication 120 | uploadArchives { 121 | repositories { 122 | mavenDeployer { 123 | beforeDeployment { 124 | MavenDeployment deployment -> signing.signPom(deployment) 125 | } 126 | repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { 127 | authentication(userName: ossrhUsername, password: ossrhPassword) 128 | } 129 | snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { 130 | authentication(userName: ossrhUsername, password: ossrhPassword) 131 | } 132 | 133 | pom.project { 134 | name 'fix4j' 135 | packaging 'jar' 136 | // optionally artifactId can be defined here 137 | description 'Java low latency zero garbage FIX engine' 138 | url 'http://fix4j.org' 139 | 140 | scm { 141 | connection 'scm:git:git@github.com:tools4j/fix4j.git' 142 | developerConnection 'scm:git:git@github.com:tools4j/fix4j.git' 143 | url 'git@github.com:tools4j/fix4j.git' 144 | } 145 | licenses { 146 | license { 147 | name 'MIT License' 148 | url 'http://opensource.org/licenses/MIT' 149 | } 150 | } 151 | 152 | developers { 153 | developer { 154 | id 'terzerm' 155 | name 'Marco Terzer' 156 | } 157 | developer { 158 | id 'harukizaemon' 159 | name 'Simon Harris' 160 | } 161 | } 162 | } 163 | } 164 | } 165 | } 166 | 167 | nexusStaging { 168 | username = ossrhUsername 169 | password = ossrhPassword 170 | } 171 | } 172 | }} 173 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/exception/Fix4jException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.exception; 25 | 26 | public class Fix4jException extends Exception { 27 | private static final long serialVersionUID = 1L; 28 | 29 | public Fix4jException(String message) { 30 | super(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/exception/InvalidValueException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.exception; 25 | 26 | import java.util.Objects; 27 | 28 | import org.fix4j.engine.tag.FixTag; 29 | 30 | public class InvalidValueException extends Fix4jException { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | private final FixTag fixTag; 35 | private final String value; 36 | 37 | public InvalidValueException(final FixTag fixTag, final CharSequence seq, int start, int end) { 38 | super(new StringBuilder(40) 39 | .append("Invalid value for tag ") 40 | .append(fixTag) 41 | .append(": ") 42 | .append(seq, start, end).toString()); 43 | this.fixTag = Objects.requireNonNull(fixTag, "fixTag is null"); 44 | this.value = seq.subSequence(start, end).toString(); 45 | } 46 | public InvalidValueException(final FixTag fixTag, final CharSequence seq, int start, int end, Throwable cause) { 47 | this(fixTag, seq, start, end); 48 | initCause(cause); 49 | } 50 | public InvalidValueException(final FixTag fixTag, final String value) { 51 | this(fixTag, value, 0, value.length()); 52 | } 53 | public InvalidValueException(final FixTag fixTag, final String value, Throwable cause) { 54 | this(fixTag, value, 0, value.length(), cause); 55 | } 56 | 57 | public FixTag getFixTag() { 58 | return fixTag; 59 | } 60 | public String getValue() { 61 | return value; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/exception/NoSuchTagException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.exception; 25 | 26 | import org.fix4j.engine.tag.FixTag; 27 | 28 | public class NoSuchTagException extends Fix4jException { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | public NoSuchTagException(final FixTag tag) { 33 | super("Tag is illegal in message or group: " + tag); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/msg/CharSequenceTagStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import java.util.Objects; 27 | import java.util.function.IntPredicate; 28 | 29 | import org.decimal4j.api.DecimalArithmetic; 30 | import org.decimal4j.scale.Scale0f; 31 | import org.fix4j.engine.exception.InvalidValueException; 32 | import org.fix4j.engine.stream.TagStream; 33 | import org.fix4j.engine.stream.TagValueConsumer; 34 | import org.fix4j.engine.tag.FixTag; 35 | import org.fix4j.engine.tag.TagLib; 36 | 37 | public class CharSequenceTagStream implements TagStream { 38 | 39 | private static final DecimalArithmetic INT_ARITH = Scale0f.INSTANCE.getRoundingUnnecessaryArithmetic(); 40 | private static final TagLib TAGLIB = new TagLib(); 41 | 42 | private final CharSequence seq; 43 | private final Token token = new Token(); 44 | 45 | public CharSequenceTagStream(final CharSequence seq) { 46 | this.seq = Objects.requireNonNull(seq, "seq is null"); 47 | } 48 | 49 | @Override 50 | public boolean tryNextMatchingTag(IntPredicate condition, TagValueConsumer consumer) throws InvalidValueException { 51 | final int tag = readNextTag(); 52 | if (tag > 0) { 53 | readNextValue(); 54 | if (condition.test(tag)) { 55 | final FixTag fixTag = TAGLIB.get(tag); 56 | try { 57 | fixTag.dispatch(token, consumer); 58 | } catch (InvalidValueException e) { 59 | consumer.invalidValue(fixTag, e); 60 | } 61 | } 62 | //skip '\0' 63 | token.end++; 64 | return true; 65 | } 66 | return false; 67 | } 68 | 69 | private final int readNextTag() { 70 | token.start = token.end; 71 | if (token.hasNextChar()) { 72 | char ch = token.readNextChar(); 73 | while (ch != '=' && isDigit(ch) && token.hasNextChar()) { 74 | ch = token.readNextChar(); 75 | } 76 | if (ch != '=') { 77 | throw new IllegalStateException("Expected '=' but found " + (isDigit(ch) ? "eof" : ("'" + ch + "'"))); 78 | } 79 | return (int)INT_ARITH.parse(seq, token.start, token.end); 80 | } 81 | return 0; 82 | } 83 | 84 | private final void readNextValue() { 85 | token.start = token.end; 86 | if (token.hasNextChar()) { 87 | char ch = token.readNextChar(); 88 | while (ch != '\0' && token.hasNextChar()) { 89 | ch = token.readNextChar(); 90 | } 91 | if (ch == '\0') { 92 | token.end--; 93 | } 94 | } 95 | } 96 | 97 | private final boolean isDigit(char ch) { 98 | return '0' <= ch & ch <= '9'; 99 | } 100 | 101 | private class Token implements CharSequence { 102 | private int start = 0; 103 | private int end = 0; 104 | @Override 105 | public final CharSequence subSequence(int start, int end) { 106 | return toStringBuilder().subSequence(start, end); 107 | } 108 | 109 | @Override 110 | public final int length() { 111 | return end - start; 112 | } 113 | 114 | @Override 115 | public final char charAt(int index) { 116 | if (index < 0 | index >= length()) { 117 | throw new IndexOutOfBoundsException(index + " is not in [0," + length() + "]"); 118 | } 119 | return seq.charAt(start + index); 120 | } 121 | public final String toString() { 122 | return toStringBuilder().toString(); 123 | } 124 | public final StringBuilder toStringBuilder() { 125 | return new StringBuilder(this); 126 | } 127 | private final boolean hasNextChar() { 128 | return end < seq.length(); 129 | } 130 | private char readNextChar() { 131 | final char ch = charAt(end); 132 | end++; 133 | return ch; 134 | } 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/msg/CustomMsgType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import java.util.Objects; 27 | import java.util.Queue; 28 | import java.util.concurrent.ConcurrentLinkedQueue; 29 | import java.util.function.Predicate; 30 | 31 | /** 32 | * User-defined custom message types. 33 | */ 34 | public final class CustomMsgType implements MsgType { 35 | 36 | private static final Queue REGISTRY = new ConcurrentLinkedQueue<>(); 37 | 38 | private final String name; 39 | private final String tagValue; 40 | private final int ordinal; 41 | 42 | private CustomMsgType(final String name, final String tagValue, final int ordinal) { 43 | this.name = Objects.requireNonNull(name, "name is null"); 44 | this.tagValue = Objects.requireNonNull(tagValue, "tagValue is null"); 45 | this.ordinal = ordinal; 46 | } 47 | 48 | public static final synchronized MsgType register(final String name, final String tagValue) { 49 | checkNonStandard(name, tagValue); 50 | final Predicate matchNameOrType = (m) -> m.name.equals(name) || m.tagValue.equals(tagValue); 51 | final CustomMsgType msgType; 52 | final CustomMsgType existing; 53 | synchronized(REGISTRY) { 54 | msgType = new CustomMsgType(name, tagValue, FixMsgType.VALUES.size() + REGISTRY.size()); 55 | if (REGISTRY.stream().noneMatch(matchNameOrType)) { 56 | REGISTRY.add(msgType); 57 | return msgType; 58 | } 59 | existing = REGISTRY.stream().filter(matchNameOrType).findAny().get(); 60 | } 61 | throw new IllegalArgumentException("Conflicting custom message type definitions: " + existing + ", " + msgType); 62 | } 63 | 64 | private static void checkNonStandard(final String name, final String tagValue) { 65 | MsgType standard = FixMsgType.parse(tagValue); 66 | if (standard != null) { 67 | throw new IllegalArgumentException("Tag value '" + tagValue 68 | + "' of custom message type definition conflicts with standard FIX message type: " + standard); 69 | } 70 | try { 71 | standard = FixMsgType.valueOf(name); 72 | } catch (IllegalArgumentException e) { 73 | // as expected 74 | return; 75 | } 76 | throw new IllegalArgumentException("Name '" + name 77 | + "' of custom message type definition conflicts with standard FIX message type: " + standard); 78 | } 79 | 80 | public static final void unregisterAll() { 81 | REGISTRY.clear(); 82 | } 83 | 84 | public static MsgType parse(final CharSequence tagValue) { 85 | for (final MsgType type : REGISTRY) { 86 | if (type.get().contentEquals(tagValue)) { 87 | return type; 88 | } 89 | } 90 | return null; 91 | } 92 | 93 | @Override 94 | public boolean isCustom() { 95 | return true; 96 | } 97 | 98 | @Override 99 | public String name() { 100 | return name; 101 | } 102 | 103 | @Override 104 | public int tag() { 105 | return MsgType; 106 | } 107 | 108 | @Override 109 | public String get() { 110 | return tagValue; 111 | } 112 | 113 | @Override 114 | public int ordinal() { 115 | return ordinal; 116 | } 117 | 118 | @Override 119 | public String toString() { 120 | return "CustomMsgType{name=" + name + ",tagValue=" + tagValue + "}"; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/msg/FixVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import java.util.Objects; 27 | 28 | /** 29 | * Constants for the FIX version. 30 | */ 31 | public enum FixVersion { 32 | FIX_4_0("FIX.4.0"), // 33 | FIX_4_1("FIX.4.1"), // 34 | FIX_4_2("FIX.4.2"), // 35 | FIX_4_3("FIX.4.3"), // 36 | FIX_4_4("FIX.4.4"), // 37 | FIX_5_0("FIXT.1.1");//FIXME 5.0 has no begin-string 38 | 39 | private final String beginString; 40 | 41 | private static final FixVersion[] VALUES = values(); 42 | 43 | private FixVersion(final String beginString) { 44 | this.beginString = Objects.requireNonNull(beginString, "beginString is null"); 45 | } 46 | 47 | /** 48 | * Returns the begin string for this fix version, such as "FIX.4.4". 49 | * 50 | * @return the begin string tag content for this fix version 51 | */ 52 | public String getBeginString() { 53 | return beginString; 54 | } 55 | 56 | /** 57 | * Returns true if the given argument matches the begin-string of this {@code FixVersion}. 58 | * 59 | * @param beginString 60 | * the begin-string to compare, for instance "FIX.4.4" 61 | * @return true if it matches the begin-string of this {@code FixVersion} constant 62 | */ 63 | public final boolean matchesBeginString(final CharSequence beginString) { 64 | final String toMatch = this.beginString; 65 | final int len = toMatch.length(); 66 | if (beginString.length() != len) { 67 | return false; 68 | } 69 | // compare from back for increased performance of non-match 70 | for (int i = len - 1; i >= 0; i--) { 71 | if (beginString.charAt(i) != toMatch.charAt(i)) { 72 | return false; 73 | } 74 | } 75 | return true; 76 | } 77 | 78 | public static FixVersion parse(final String beginString) { 79 | for (final FixVersion value : VALUES) { 80 | if (value.matchesBeginString(beginString)) { 81 | return value; 82 | } 83 | } 84 | throw new IllegalArgumentException("Not a valid begin-string: " + beginString); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/msg/Message.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | public interface Message extends TagBag { 27 | MsgType msgType(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/msg/MsgType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import java.util.function.Supplier; 27 | 28 | import org.fix4j.engine.stream.TagValueConsumer; 29 | import org.fix4j.engine.tag.FixTag; 30 | 31 | public interface MsgType extends FixTag, Supplier { 32 | 33 | String name(); 34 | boolean isCustom(); 35 | int ordinal(); 36 | 37 | @Override 38 | default void dispatch(final CharSequence value, final TagValueConsumer consumer) { 39 | consumer.acceptOther(this, get()); 40 | } 41 | 42 | static MsgType parse(CharSequence tagValue) { 43 | final MsgType msgType = FixMsgType.parse(tagValue); 44 | if (msgType != null) { 45 | return msgType; 46 | } 47 | final MsgType customMsgType = CustomMsgType.parse(tagValue); 48 | if (customMsgType != null) { 49 | return customMsgType; 50 | } 51 | throw new IllegalArgumentException("Not a valid message type: " + tagValue); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/stream/TagValueConsumer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.stream; 25 | 26 | import org.fix4j.engine.exception.InvalidValueException; 27 | import org.fix4j.engine.tag.BooleanTag; 28 | import org.fix4j.engine.tag.CharTag; 29 | import org.fix4j.engine.tag.DecimalTag; 30 | import org.fix4j.engine.tag.DoubleTag; 31 | import org.fix4j.engine.tag.FixTag; 32 | import org.fix4j.engine.tag.GroupTag; 33 | import org.fix4j.engine.tag.IntTag; 34 | import org.fix4j.engine.tag.LongTag; 35 | import org.fix4j.engine.tag.ObjectTag; 36 | import org.fix4j.engine.tag.StringTag; 37 | 38 | public interface TagValueConsumer { 39 | void acceptBoolean(BooleanTag tag, boolean value); 40 | void acceptChar(CharTag tag, char value); 41 | void acceptInt(IntTag tag, int value); 42 | void acceptLong(LongTag tag, long value); 43 | void acceptDouble(DoubleTag tag, double value); 44 | void acceptDecimal(DecimalTag tag, long value); 45 | void acceptString(StringTag tag, CharSequence value); 46 | void acceptGroup(GroupTag tag, int groupSize); 47 | void acceptObject(ObjectTag tag, T value); 48 | void acceptOther(FixTag tag, CharSequence value); 49 | 50 | default void invalidValue(FixTag tag, InvalidValueException exception) throws InvalidValueException { 51 | throw exception; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/BooleanTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | import org.fix4j.engine.util.ParseUtil; 31 | 32 | public interface BooleanTag extends FixTag { 33 | @Override 34 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 35 | consumer.acceptBoolean(this, convertFrom(value, 0, value.length())); 36 | } 37 | default boolean convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 38 | return ParseUtil.parseBoolean(this, value, start, end); 39 | } 40 | default void convertTo(boolean value, Appendable destination) throws IOException { 41 | destination.append(value ? 'Y' : 'N'); 42 | } 43 | default String convertToString(boolean value) { 44 | return value ? "Y" : "N"; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/CharTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | import org.fix4j.engine.util.ParseUtil; 31 | 32 | public interface CharTag extends FixTag { 33 | @Override 34 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 35 | consumer.acceptChar(this, convertFrom(value, 0, value.length())); 36 | } 37 | default char convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 38 | return ParseUtil.parseChar(this, value, start, end); 39 | } 40 | default void convertTo(char value, Appendable destination) throws IOException { 41 | destination.append(value); 42 | } 43 | default String convertToString(char value) { 44 | return String.valueOf(value); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/DecimalTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.decimal4j.api.DecimalArithmetic; 29 | import org.fix4j.engine.exception.InvalidValueException; 30 | import org.fix4j.engine.stream.TagValueConsumer; 31 | import org.fix4j.engine.util.ParseUtil; 32 | 33 | public interface DecimalTag extends FixTag { 34 | 35 | /** 36 | * Returns the arithmetic defining the scale (aka precision) of the decimal value. 37 | * @return the arithmetic with scale, rounding and overflow mode for the parsing 38 | */ 39 | DecimalArithmetic getArithmetic(); 40 | 41 | /** 42 | * Returns the precision for tag values, for instance 2 for 2 decimal places. 43 | * @return the precision after the decimal point 44 | */ 45 | default int getPrecision() { 46 | return getArithmetic().getScale(); 47 | } 48 | 49 | @Override 50 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 51 | consumer.acceptDecimal(this, convertFrom(value, 0, value.length())); 52 | } 53 | default long convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 54 | return ParseUtil.parseDecimal(this, value, start, end); 55 | } 56 | default void convertTo(long value, Appendable destination) throws IOException { 57 | getArithmetic().toString(value, destination); 58 | } 59 | default String convertToString(long value) { 60 | return getArithmetic().toString(value); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/DoubleTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | import org.fix4j.engine.util.ParseUtil; 31 | 32 | public interface DoubleTag extends FixTag { 33 | 34 | @Override 35 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 36 | consumer.acceptDouble(this, convertFrom(value, 0, value.length())); 37 | } 38 | default double convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 39 | return ParseUtil.parseDouble(this, value, start, end); 40 | } 41 | default void convertTo(double value, Appendable destination) throws IOException { 42 | destination.append(String.valueOf(value));//FIXME make this garbage free 43 | } 44 | default String convertToString(double value) { 45 | return String.valueOf(value); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/GroupTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | import java.util.List; 28 | 29 | import org.fix4j.engine.exception.InvalidValueException; 30 | import org.fix4j.engine.stream.TagValueConsumer; 31 | import org.fix4j.engine.util.ParseUtil; 32 | 33 | public interface GroupTag extends FixTag { 34 | List getGroupTags(); 35 | @Override 36 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 37 | consumer.acceptGroup(this, convertFrom(value, 0, value.length())); 38 | } 39 | default int convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 40 | return ParseUtil.parseNonNegativeInt(this, value, start, end); 41 | } 42 | default void convertTo(int value, Appendable destination) throws IOException { 43 | ParseUtil.LONG_ARITHMETIC.toString(value, destination); 44 | } 45 | default String convertToString(int value) { 46 | return ParseUtil.LONG_ARITHMETIC.toString(value); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/IntTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | import org.fix4j.engine.util.ParseUtil; 31 | 32 | public interface IntTag extends FixTag { 33 | @Override 34 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 35 | consumer.acceptInt(this, convertFrom(value, 0, value.length())); 36 | } 37 | default int convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 38 | return ParseUtil.parseInt(this, value, start, end); 39 | } 40 | default void convertTo(int value, Appendable destination) throws IOException { 41 | ParseUtil.LONG_ARITHMETIC.toString(value, destination); 42 | } 43 | default String convertToString(int value) { 44 | return ParseUtil.LONG_ARITHMETIC.toString(value); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/LongTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | import org.fix4j.engine.util.ParseUtil; 31 | 32 | public interface LongTag extends FixTag { 33 | @Override 34 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 35 | consumer.acceptLong(this, convertFrom(value, 0, value.length())); 36 | } 37 | default long convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 38 | return ParseUtil.parseLong(this, value, start, end); 39 | } 40 | default void convertTo(long value, Appendable destination) throws IOException { 41 | ParseUtil.LONG_ARITHMETIC.toString(value, destination); 42 | } 43 | default String convertToString(long value) { 44 | return ParseUtil.LONG_ARITHMETIC.toString(value); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/ObjectTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import java.io.IOException; 27 | 28 | import org.fix4j.engine.exception.InvalidValueException; 29 | import org.fix4j.engine.stream.TagValueConsumer; 30 | 31 | public interface ObjectTag extends FixTag { 32 | @Override 33 | default void dispatch(CharSequence value, TagValueConsumer consumer) throws InvalidValueException { 34 | consumer.acceptObject(this, convertFrom(value, 0, value.length())); 35 | } 36 | Class valueType(); 37 | T convertFrom(CharSequence value, int start, int end) throws InvalidValueException; 38 | void convertTo(T value, Appendable destination) throws IOException; 39 | String convertToString(T value); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/StringTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | import org.fix4j.engine.stream.TagValueConsumer; 27 | 28 | public interface StringTag extends FixTag { 29 | @Override 30 | default void dispatch(CharSequence value, TagValueConsumer consumer) { 31 | consumer.acceptString(this, value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/TagLib.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag; 25 | 26 | public class TagLib { 27 | private final FixTag[] tags; 28 | public TagLib() { 29 | this(FixTag.RiskEncodedSecurityDesc); 30 | } 31 | public TagLib(int maxTag) { 32 | this.tags = new FixTag[maxTag + 1]; 33 | for (int i = 1; i <= maxTag; i++) { 34 | final int tag = i; 35 | final StringTag stag = () -> tag; 36 | tags[i] = stag; 37 | } 38 | } 39 | 40 | public final void registerTag(FixTag fixTag) { 41 | if (fixTag.tag() < 1 || fixTag.tag() > tags.length) { 42 | throw new IllegalArgumentException("Illegal tag: " + fixTag.tag()); 43 | } 44 | tags[fixTag.tag()] = fixTag; 45 | } 46 | 47 | public final FixTag get(int tag) { 48 | if (tag < 1 || tag > tags.length) { 49 | throw new IllegalArgumentException("Illegal tag: " + tag); 50 | } 51 | return tags[tag]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/AbstractEnumTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import java.util.Objects; 27 | 28 | import org.fix4j.engine.tag.ObjectTag; 29 | 30 | abstract public class AbstractEnumTag> extends AbstractFixTag implements ObjectTag { 31 | 32 | private final Class enumType; 33 | 34 | public AbstractEnumTag(final int tag, final String type, final String name, final Class enumType) { 35 | super(tag, type, name); 36 | this.enumType = Objects.requireNonNull(enumType, "enumType is null"); 37 | } 38 | 39 | @Override 40 | public final Class valueType() { 41 | return enumType; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/AbstractFixTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import java.util.Objects; 27 | 28 | import org.fix4j.engine.tag.FixTag; 29 | 30 | abstract public class AbstractFixTag implements FixTag { 31 | 32 | private final int tag; 33 | private final String type; 34 | private final String name; 35 | 36 | public AbstractFixTag(final int tag, final String type, final String name) { 37 | this.tag = validateTag(tag); 38 | this.type = Objects.requireNonNull(type, "type is null"); 39 | this.name = Objects.requireNonNull(name, "name is null"); 40 | } 41 | 42 | private static int validateTag(int tag) { 43 | if (tag > 0) { 44 | return tag; 45 | } 46 | throw new IllegalArgumentException("invalid tag: " + tag); 47 | } 48 | 49 | @Override 50 | public final int tag() { 51 | return tag; 52 | } 53 | 54 | @Override 55 | public String name() { 56 | return name; 57 | } 58 | 59 | public String type() { 60 | return type; 61 | } 62 | 63 | @Override 64 | public int hashCode() { 65 | return tag; 66 | } 67 | 68 | @Override 69 | public boolean equals(Object obj) { 70 | if (obj == this) return true; 71 | if (obj instanceof FixTag) { 72 | return tag == ((FixTag)obj).tag(); 73 | } 74 | return false; 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | return name; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicBooleanTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.BooleanTag; 27 | 28 | public class BasicBooleanTag extends AbstractFixTag implements BooleanTag { 29 | 30 | public BasicBooleanTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicCharTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.CharTag; 27 | 28 | public class BasicCharTag extends AbstractFixTag implements CharTag { 29 | 30 | public BasicCharTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicDecimalTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import java.math.RoundingMode; 27 | import java.util.Objects; 28 | 29 | import org.decimal4j.api.DecimalArithmetic; 30 | import org.decimal4j.scale.Scales; 31 | import org.fix4j.engine.tag.DecimalTag; 32 | 33 | public class BasicDecimalTag extends AbstractFixTag implements DecimalTag { 34 | 35 | private final DecimalArithmetic arithmetic; 36 | 37 | public BasicDecimalTag(final int tag, final String type, final String name, final DecimalArithmetic arithmetic) { 38 | super(tag, type, name); 39 | this.arithmetic = Objects.requireNonNull(arithmetic, "arithmetic is null"); 40 | } 41 | 42 | public BasicDecimalTag(final int tag, final String type, final String name, final int precision, final RoundingMode roundingMode) { 43 | this(tag, type, name, Scales.getScaleMetrics(precision).getCheckedArithmetic(roundingMode)); 44 | } 45 | 46 | @Override 47 | public final DecimalArithmetic getArithmetic() { 48 | return arithmetic; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicDoubleTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.DoubleTag; 27 | 28 | public class BasicDoubleTag extends AbstractFixTag implements DoubleTag { 29 | 30 | public BasicDoubleTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicGroupTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import java.util.ArrayList; 27 | import java.util.Collections; 28 | import java.util.List; 29 | 30 | import org.fix4j.engine.tag.FixTag; 31 | import org.fix4j.engine.tag.GroupTag; 32 | 33 | public class BasicGroupTag extends AbstractFixTag implements GroupTag { 34 | 35 | private final List groupTags; 36 | 37 | public BasicGroupTag(final int tag, final String type, final String name, final List groupTags) { 38 | super(tag, type, name); 39 | this.groupTags = Collections.unmodifiableList(new ArrayList(groupTags)); 40 | } 41 | 42 | @Override 43 | public List getGroupTags() { 44 | return groupTags; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicIntTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.IntTag; 27 | 28 | public class BasicIntTag extends AbstractFixTag implements IntTag { 29 | 30 | public BasicIntTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicLongTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.LongTag; 27 | 28 | public class BasicLongTag extends AbstractFixTag implements LongTag { 29 | 30 | public BasicLongTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/BasicStringTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import org.fix4j.engine.tag.StringTag; 27 | 28 | public class BasicStringTag extends AbstractFixTag implements StringTag { 29 | 30 | public BasicStringTag(final int tag, final String type, final String name) { 31 | super(tag, type, name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/impl/CharEncodedEnumTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.impl; 25 | 26 | import java.io.IOException; 27 | import java.lang.reflect.Array; 28 | import java.util.Objects; 29 | 30 | import org.fix4j.engine.exception.InvalidValueException; 31 | 32 | public class CharEncodedEnumTag> extends AbstractEnumTag { 33 | 34 | private final CharEncoder enumToCharEncoder; 35 | private final T[] universe; 36 | 37 | public static interface CharEncoder { 38 | char apply(T value); 39 | } 40 | 41 | public CharEncodedEnumTag(final int tag, final String type, final String name, final Class enumType, final CharEncoder enumToCharEncoder) { 42 | super(tag, type, name, enumType); 43 | this.enumToCharEncoder = Objects.requireNonNull(enumToCharEncoder, "enumToCharEncoder is null"); 44 | this.universe = initUniverse(enumType, enumToCharEncoder); 45 | } 46 | 47 | private static > T[] initUniverse(final Class enumType, final CharEncoder enumToCharEncoder) { 48 | final T[] universe = enumType.getEnumConstants();// TODO avoid this garbage? how? 49 | // find max first 50 | int max = 0; 51 | for (final T value : universe) { 52 | final char code = enumToCharEncoder.apply(value); 53 | if (code > 127) { 54 | throw new IllegalArgumentException("invalid char encoding, must be ASCII in [0, 127] but was: " + code); 55 | } 56 | max = Math.max(max, code); 57 | } 58 | // create universe array now 59 | @SuppressWarnings("unchecked") // safe cast 60 | final T[] mappedUniverse = (T[]) Array.newInstance(enumType, max); 61 | for (final T value : universe) { 62 | final char code = enumToCharEncoder.apply(value); 63 | if (mappedUniverse[code] != null) { 64 | throw new IllegalArgumentException("enumCharEncoder returns same code '" + code 65 | + "' for different constants: " + mappedUniverse[code] + ", " + value); 66 | } 67 | mappedUniverse[code] = value; 68 | } 69 | return mappedUniverse; 70 | } 71 | 72 | @Override 73 | public T convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 74 | if (end - start == 1) { 75 | final char code = value.charAt(start); 76 | if (code < universe.length) { 77 | final T enumValue = universe[code]; 78 | if (enumValue != null) { 79 | return enumValue; 80 | } 81 | } 82 | } 83 | throw new InvalidValueException(this, value, start, end); 84 | } 85 | 86 | @Override 87 | public void convertTo(T value, Appendable destination) throws IOException { 88 | final char code = enumToCharEncoder.apply(value); 89 | destination.append(code); 90 | } 91 | 92 | @Override 93 | public String convertToString(T value) { 94 | return String.valueOf(enumToCharEncoder.apply(value)); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/tag/type/LengthTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.tag.type; 25 | 26 | import org.fix4j.engine.exception.InvalidValueException; 27 | import org.fix4j.engine.tag.impl.BasicIntTag; 28 | import org.fix4j.engine.util.ParseUtil; 29 | 30 | public class LengthTag extends BasicIntTag { 31 | 32 | public LengthTag(final int tag, final String name) { 33 | super(tag, "Length", name); 34 | } 35 | 36 | public int convertFrom(CharSequence value, int start, int end) throws InvalidValueException { 37 | return ParseUtil.parseNonNegativeInt(this, value, start, end); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/validate/ValidatingConsumer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.validate; 25 | 26 | import java.util.Map; 27 | import java.util.concurrent.ConcurrentHashMap; 28 | 29 | import org.fix4j.engine.exception.InvalidValueException; 30 | import org.fix4j.engine.stream.TagValueConsumer; 31 | import org.fix4j.engine.tag.BooleanTag; 32 | import org.fix4j.engine.tag.CharTag; 33 | import org.fix4j.engine.tag.DecimalTag; 34 | import org.fix4j.engine.tag.DoubleTag; 35 | import org.fix4j.engine.tag.FixTag; 36 | import org.fix4j.engine.tag.GroupTag; 37 | import org.fix4j.engine.tag.IntTag; 38 | import org.fix4j.engine.tag.LongTag; 39 | import org.fix4j.engine.tag.ObjectTag; 40 | import org.fix4j.engine.tag.StringTag; 41 | 42 | public class ValidatingConsumer implements TagValueConsumer { 43 | 44 | private final Map validities = new ConcurrentHashMap<>(); 45 | 46 | public Validity isValid(final FixTag tag) { 47 | return validities.get(tag); 48 | } 49 | 50 | @Override 51 | public void acceptBoolean(final BooleanTag tag, boolean value) { 52 | validities.putIfAbsent(tag, Validity.VALID); 53 | } 54 | 55 | @Override 56 | public void acceptChar(final CharTag tag, final char value) { 57 | validities.putIfAbsent(tag, Validity.VALID); 58 | } 59 | 60 | @Override 61 | public void acceptInt(IntTag tag, int value) { 62 | validities.putIfAbsent(tag, Validity.VALID); 63 | } 64 | 65 | @Override 66 | public void acceptLong(LongTag tag, long value) { 67 | validities.putIfAbsent(tag, Validity.VALID); 68 | } 69 | 70 | @Override 71 | public void acceptDouble(DoubleTag tag, double value) { 72 | validities.putIfAbsent(tag, Validity.VALID); 73 | } 74 | 75 | @Override 76 | public void acceptDecimal(DecimalTag tag, long value) { 77 | validities.putIfAbsent(tag, Validity.VALID); 78 | } 79 | 80 | @Override 81 | public void acceptString(StringTag tag, CharSequence value) { 82 | validities.putIfAbsent(tag, Validity.VALID); 83 | } 84 | 85 | @Override 86 | public void acceptGroup(GroupTag tag, int groupSize) { 87 | validities.putIfAbsent(tag, Validity.VALID); 88 | } 89 | 90 | @Override 91 | public void acceptObject(ObjectTag tag, T value) { 92 | validities.putIfAbsent(tag, Validity.VALID); 93 | } 94 | 95 | @Override 96 | public void acceptOther(FixTag tag, CharSequence value) { 97 | validities.putIfAbsent(tag, Validity.VALID); 98 | } 99 | 100 | @Override 101 | public void invalidValue(FixTag tag, InvalidValueException exception) throws InvalidValueException { 102 | validities.putIfAbsent(tag, Validity.INVALID_WITH_MESSAGE.apply(exception.getMessage())); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/engine/validate/Validity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.validate; 25 | 26 | import java.util.function.Function; 27 | 28 | public interface Validity { 29 | boolean isValid(); 30 | String getValidationMessage(); 31 | 32 | public Validity VALID = new Validity() { 33 | @Override 34 | public boolean isValid() { 35 | return true; 36 | } 37 | @Override 38 | public String getValidationMessage() { 39 | return "valid"; 40 | } 41 | public String toString() { 42 | return "Valid"; 43 | } 44 | }; 45 | public Validity INVALID = new Validity() { 46 | @Override 47 | public boolean isValid() { 48 | return false; 49 | } 50 | @Override 51 | public String getValidationMessage() { 52 | return "invalid"; 53 | } 54 | public String toString() { 55 | return "Invalid"; 56 | } 57 | }; 58 | public Function INVALID_WITH_MESSAGE = (m) -> new Validity() { 59 | @Override 60 | public boolean isValid() { 61 | return false; 62 | } 63 | 64 | @Override 65 | public String getValidationMessage() { 66 | return m; 67 | } 68 | public String toString() { 69 | return "Invalid(" + m + ")"; 70 | } 71 | }; 72 | public Validity NO_SUCH_TAG = INVALID_WITH_MESSAGE.apply("No such tag"); 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/Dictionary.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.function.Consumer; 27 | 28 | public interface Dictionary { 29 | MessageDefinition defineMessage(T messageType); 30 | 31 | MessageDefinition defineMessage(T messageType, Consumer> consumer); 32 | 33 | Message createMessage(T messageType); 34 | 35 | Message createMessage(T messageType, Consumer> consumer); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/Field.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public interface Field { 27 | Tag tag(); 28 | 29 | boolean isSet(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/FieldDefinition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public interface FieldDefinition { 27 | boolean isRequired(); 28 | 29 | FieldDefinition setRequired(); 30 | 31 | Field createField(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/Fix42Tags.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public final class Fix42Tags { 27 | public static final IntTag MsgSeqNum = new IntTag(34); 28 | public static final StringTag TestRequestID = new StringTag(112); 29 | 30 | private Fix42Tags() { 31 | throw new IllegalStateException("No org.fix4j.sketch.Fix42Tags for you!"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/IntTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public final class IntTag implements Tag { 27 | public IntTag(final int number) { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/Message.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.function.Consumer; 27 | import java.util.function.IntConsumer; 28 | import java.util.function.IntSupplier; 29 | import java.util.function.Supplier; 30 | 31 | public interface Message { 32 | T messageType(); 33 | 34 | boolean isSet(Tag tag); 35 | 36 | void unset(Tag tag); 37 | 38 | void set(StringTag tag, String value); 39 | 40 | void set(StringTag tag, Supplier supplier); 41 | 42 | String get(StringTag tag); 43 | 44 | void get(StringTag tag, Consumer consumer); 45 | 46 | void set(IntTag tag, int value); 47 | 48 | void set(IntTag tag, IntSupplier supplier); 49 | 50 | int get(IntTag tag); 51 | 52 | void get(IntTag tag, IntConsumer consumer); 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/MessageDefinition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.function.Consumer; 27 | 28 | public interface MessageDefinition { 29 | FieldDefinition defineField(Tag tag); 30 | 31 | FieldDefinition defineField(Tag tag, Consumer consumer); 32 | 33 | Message createMessage(); 34 | 35 | Message createMessage(Consumer> consumer); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/MessageType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public interface MessageType { 27 | // TODO: StringField ? 28 | String fieldValue(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/SimpleDictionary.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.HashMap; 27 | import java.util.Map; 28 | import java.util.Objects; 29 | import java.util.function.Consumer; 30 | 31 | public final class SimpleDictionary implements Dictionary { 32 | private final Map> messageDefinitions = new HashMap<>(); 33 | 34 | public static SimpleDictionary define() { 35 | return new SimpleDictionary<>(); 36 | } 37 | 38 | public static SimpleDictionary define(final Consumer> consumer) { 39 | final SimpleDictionary dictionary = new SimpleDictionary<>(); 40 | consumer.accept(dictionary); 41 | return dictionary; 42 | } 43 | 44 | private SimpleDictionary() { 45 | } 46 | 47 | @Override 48 | public SimpleMessageDefinition defineMessage(final T messageType) { 49 | Objects.requireNonNull(messageType); 50 | return messageDefinitions.computeIfAbsent(messageType, SimpleMessageDefinition::new); 51 | } 52 | 53 | @Override 54 | public SimpleMessageDefinition defineMessage(final T messageType, final Consumer> consumer) { 55 | final SimpleMessageDefinition messageDefinition = defineMessage(messageType); 56 | consumer.accept(messageDefinition); 57 | return messageDefinition; 58 | } 59 | 60 | @Override 61 | public SimpleMessage createMessage(final T messageType) { 62 | return messageDefinition(messageType).createMessage(); 63 | } 64 | 65 | @Override 66 | public SimpleMessage createMessage(final T messageType, final Consumer> consumer) { 67 | return messageDefinition(messageType).createMessage(consumer); 68 | } 69 | 70 | private SimpleMessageDefinition messageDefinition(final T messageType) { 71 | return messageDefinitions.get(messageType); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/SimpleFieldDefinition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.Objects; 27 | 28 | public final class SimpleFieldDefinition implements FieldDefinition { 29 | private final Tag tag; 30 | 31 | public SimpleFieldDefinition(final Tag tag) { 32 | this.tag = Objects.requireNonNull(tag); 33 | } 34 | 35 | @Override 36 | public boolean isRequired() { 37 | return false; 38 | } 39 | 40 | @Override 41 | public FieldDefinition setRequired() { 42 | return null; 43 | } 44 | 45 | @Override 46 | public Field createField() { 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/SimpleMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.Objects; 27 | import java.util.function.Consumer; 28 | import java.util.function.IntConsumer; 29 | import java.util.function.IntSupplier; 30 | import java.util.function.Supplier; 31 | 32 | public final class SimpleMessage implements Message { 33 | private final T messageType; 34 | private final Field[] fields; 35 | 36 | public SimpleMessage(final T messageType, final Field[] fields) { 37 | this.messageType = Objects.requireNonNull(messageType); 38 | this.fields = Objects.requireNonNull(fields); 39 | } 40 | 41 | @Override 42 | public T messageType() { 43 | return messageType; 44 | } 45 | 46 | @Override 47 | public boolean isSet(final Tag tag) { 48 | return false; 49 | } 50 | 51 | @Override 52 | public void unset(final Tag tag) { 53 | 54 | } 55 | 56 | @Override 57 | public void set(final StringTag tag, final String value) { 58 | 59 | } 60 | 61 | @Override 62 | public void set(final StringTag tag, final Supplier supplier) { 63 | 64 | } 65 | 66 | @Override 67 | public String get(final StringTag tag) { 68 | return null; 69 | } 70 | 71 | @Override 72 | public void get(final StringTag tag, final Consumer consumer) { 73 | 74 | } 75 | 76 | @Override 77 | public void set(final IntTag tag, final int value) { 78 | 79 | } 80 | 81 | @Override 82 | public void set(final IntTag tag, final IntSupplier supplier) { 83 | 84 | } 85 | 86 | @Override 87 | public int get(final IntTag tag) { 88 | return 0; 89 | } 90 | 91 | @Override 92 | public void get(final IntTag tag, final IntConsumer consumer) { 93 | 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/SimpleMessageDefinition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | import java.util.HashMap; 27 | import java.util.Map; 28 | import java.util.Objects; 29 | import java.util.function.Consumer; 30 | 31 | public final class SimpleMessageDefinition implements MessageDefinition { 32 | private final Map fieldDefinitions = new HashMap<>(); 33 | private final T messageType; 34 | 35 | public SimpleMessageDefinition(final T messageType) { 36 | this.messageType = Objects.requireNonNull(messageType); 37 | } 38 | 39 | @Override 40 | public SimpleFieldDefinition defineField(final Tag tag) { 41 | Objects.requireNonNull(tag); 42 | return fieldDefinitions.computeIfAbsent(tag, SimpleFieldDefinition::new); 43 | } 44 | 45 | @Override 46 | public SimpleFieldDefinition defineField(final Tag tag, final Consumer consumer) { 47 | final SimpleFieldDefinition fieldDefinition = defineField(tag); 48 | consumer.accept(fieldDefinition); 49 | return fieldDefinition; 50 | } 51 | 52 | @Override 53 | public SimpleMessage createMessage() { 54 | final Field[] fields = fieldDefinitions 55 | .values() 56 | .stream() 57 | .map(FieldDefinition::createField) 58 | .toArray(Field[]::new); 59 | return new SimpleMessage<>(messageType, fields); 60 | } 61 | 62 | @Override 63 | public SimpleMessage createMessage(final Consumer> consumer) { 64 | final SimpleMessage message = createMessage(); 65 | consumer.accept(message); 66 | return message; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/StringTag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public final class StringTag implements Tag { 27 | public StringTag(final int number) { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/fix4j/sketch/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public interface Tag { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/overview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Java low latency zero garbage FIX engine. 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/LICENSE.template: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-${year} fix4j.org (tools4j.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/resources/codegen/config/config.fmpp: -------------------------------------------------------------------------------- 1 | data: { 2 | mappings: properties('../config/type-mappings.properties') 3 | components: { 4 | } 5 | datatypes: { 6 | } 7 | enums: { 8 | } 9 | fields: { 10 | fix40: xml('../../fix_repository_2010_edition_20140507/FIX.4.0/Base/Fields.xml') 11 | fix41: xml('../../fix_repository_2010_edition_20140507/FIX.4.1/Base/Fields.xml') 12 | fix42: xml('../../fix_repository_2010_edition_20140507/FIX.4.2/Base/Fields.xml') 13 | fix43: xml('../../fix_repository_2010_edition_20140507/FIX.4.3/Base/Fields.xml') 14 | fix44: xml('../../fix_repository_2010_edition_20140507/FIX.4.4/Base/Fields.xml') 15 | } 16 | messages: { 17 | } 18 | msg-contents: { 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/resources/codegen/config/type-mappings.properties: -------------------------------------------------------------------------------- 1 | int: IntTag 2 | float: DoubleTag 3 | char: CharTag 4 | #data: 5 | String: StringTag 6 | Boolean: BooleanTag 7 | Qty: DecimalTag:2:UNNECESSARY 8 | Amt: DecimalTag:2:UNNECESSARY 9 | Price: DecimalTag:8:UNNECESSARY 10 | PriceOffset: DecimalTag:8:UNNECESSARY 11 | Percentage: DoubleTag 12 | Length: LengthTag 13 | NumInGroup: IntTag 14 | SeqNum: LongTag 15 | TagNum: IntTag 16 | #MultipleStringValue: 17 | #MultipleCharValue: 18 | #Tenor: PatternTag:[DMWY](\d)+ 19 | #XMLData: 20 | #Country: EnumTag 21 | #Currency: EnumTag 22 | #Exchange: EnumTag 23 | #Language: EnumTag 24 | #YYYYMMDD-HH:MM:SS or YYYYMMDD-HH:MM:SS.sss 25 | #UTCTimestamp: UTCTimestampTag 26 | #HH:MM:SS or HH:MM:SS.sss 27 | #UTCTimeOnly: UTCTimeOnlyTag 28 | #YYYYMMDD 29 | #UTCDate: UTCDateTag 30 | #UTCDateOnly: UTCDateTag 31 | #YYYYMMDD 32 | #LocalMktDate LocalDateTag 33 | #HH:MM[:SS][Z | [ + | - hh[:mm]]] 34 | #TZTimeOnly 35 | #YYYYMMDD-HH:MM:SS[Z | [ + | - hh[:mm]]] 36 | #TZTimestamp 37 | #YYYYMM or YYYYMMDD or YYYYMMWW 38 | #MonthYear MonthYearTag 39 | #DayOfMonth DayOfMonthTag -------------------------------------------------------------------------------- /src/main/resources/codegen/templates/FixTag.ftl: -------------------------------------------------------------------------------- 1 | <@pp.dropOutputFile /> 2 | <#list fields?keys as versionString> 3 | <#assign version=versionString?substring(3)> 4 | <#assign doc=fields[versionString]> 5 | 6 | <#macro decimalTag field> 7 | <#assign matcher=mappings[field.Type]?matches("DecimalTag:(\\d\\d?):(\\w+)")> 8 | <#if matcher> 9 | <#assign precision=matcher?groups[1]> 10 | <#assign roundingMode=matcher?groups[2]> 11 | public static final DecimalTag ${field.Name} = new BasicDecimalTag(${field.Tag}, "${field.Type}", "${field.Name}", ${precision}, RoundingMode.${roundingMode}); 12 | <#else> 13 | <#stop "Illegal type specification for DecimalTag field: expected format 'DecimalTag::' but found: " + mappings[field.Type]> 14 | 15 | 16 | <#macro basicTag field> 17 | <#assign tagType=mappings[field.Type]> 18 | public static final ${tagType} ${field.Name} = new Basic${tagType}(${field.Tag}, "${field.Type}", "${field.Name}"); 19 | 20 | <#macro typeTag field> 21 | <#assign tagType=mappings[field.Type]> 22 | public static final ${tagType} ${field.Name} = new ${tagType}(${field.Tag}, "${field.Name}"); 23 | 24 | <#macro unknownType field> 25 | public static final FixTag ${field.Name} = null;//No type-mapping for FIX type: ${field.Type} 26 | 27 | 28 | <@pp.changeOutputFile name=pp.home + "org/fix4j/engine/fix/" + versionString + "/FixTag" + version + ".java" /> 29 | package org.fix4j.engine.fix.${versionString}; 30 | <#list doc.Fields.Field as field> 31 | <#if mappings[field.Type]?? && mappings[field.Type]?starts_with("DecimalTag")> 32 | 33 | import java.math.RoundingMode; 34 | <#break> 35 | 36 | 37 | 38 | import org.fix4j.engine.tag.*; 39 | import org.fix4j.engine.tag.impl.*; 40 | import org.fix4j.engine.tag.type.*; 41 | 42 | public final class FixTag${version} { 43 | <#list doc.Fields.Field as field> 44 | /** ${field.Description?xhtml?replace("\r\n", "
")?replace("\n", "
")} */ 45 | <#if mappings[field.Type]??> 46 | <#assign tagType=mappings[field.Type]> 47 | <#if tagType?starts_with("DecimalTag")> 48 | <@decimalTag field/> 49 | <#elseif tagType="LengthTag"> 50 | <@typeTag field/> 51 | <#else> 52 | <@basicTag field/> 53 | 54 | <#else> 55 | <@unknownType field/> 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tools4j/fix4j/2cf12950555bc8955ae658f6f4df010a79ac2a16/src/main/resources/fix_repository_2010_edition_20140507/.DS_Store -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.4.0/Base/Components.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 1001 21 | Block 22 | Session 23 | StandardHeader 24 | 1 25 | The standard FIX message header 26 | 27 | 28 | 1002 29 | Block 30 | Session 31 | StandardTrailer 32 | 1 33 | The standard FIX message trailer 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.4.0/Base/Datatypes.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | int 21 | Sequence of digits without commas or decimals and optional sign character (ASCII characters "-" and "0" - "9" ). The sign character utilizes one byte (i.e. positive int is "99999" while negative int is "-99999"). Note that int values may contain leading zeros (e.g. "00023" = "23"). 22 | Examples: 23 | 723 in field 21 would be mapped int as |21=723|. 24 | -723 in field 12 would be mapped int as |12=-723| 25 | The following data types are based on int. 26 | 27 | 28 | float 29 | Sequence of digits with optional decimal point and sign character (ASCII characters "-", "0" - "9" and "."); the absence of the decimal point within the string will be interpreted as the float representation of an integer value. All float fields must accommodate up to fifteen significant digits. 30 | 31 | 32 | char 33 | Alpha-numeric free format strings, can include any character or punctuation except the delimiter. All char fields are case sensitive. 34 | 35 | 36 | time 37 | Time/date combination in YYYYMMDD-HH:MM:SS format, colons and dash required. Valid values: YYYY = 0000-9999, MM = 01-12, DD = 01-31, HH = 00-23, MM = 00-59, SS = 00-59. 38 | 39 | 40 | date 41 | Date in YYYYMMDD format. Valid values: YYYY = 0000-9999, MM = 01-12, DD = 01-31. 42 | 43 | 44 | data 45 | Raw data with no format or content restrictions. Data fields are always immediately preceded by a length field. Caution: may contain the delimiter (SOH) character. 46 | 47 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.4.1/Base/Components.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 1001 21 | Block 22 | Session 23 | StandardHeader 24 | 1 25 | The standard FIX message header 26 | 27 | 28 | 1002 29 | Block 30 | Session 31 | StandardTrailer 32 | 1 33 | The standard FIX message trailer 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.4.2/Base/Components.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 1001 21 | Block 22 | Session 23 | StandardHeader 24 | 1 25 | The standard FIX message header 26 | 27 | 28 | 1002 29 | Block 30 | Session 31 | StandardTrailer 32 | 1 33 | The standard FIX message trailer 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.4.4/Base/Sections.xml: -------------------------------------------------------------------------------- 1 | 19 |
20 | Session 21 | Session 22 | 0 23 | FIXT.1.1 24 | 1 25 | session 26 | Session level messages to establish and control a FIX session 27 |
28 |
29 | PreTrade 30 | PreTrade 31 | 1 32 | 3 33 | 0 34 | pretrade 35 | Pre trade messages including reference data, market data, quoting, news and email, indication of interest 36 |
37 |
38 | Trade 39 | Trade 40 | 2 41 | 4 42 | 0 43 | trade 44 | Order handling and execution messages 45 |
46 |
47 | PostTrade 48 | PostTrade 49 | 3 50 | 5 51 | 0 52 | posttrade 53 | Post trade messages including trade reporting, allocation, collateral, confirmation, position mantemenance, registration instruction, and settlement instructions 54 |
55 |
-------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.5.0/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tools4j/fix4j/2cf12950555bc8955ae658f6f4df010a79ac2a16/src/main/resources/fix_repository_2010_edition_20140507/FIX.5.0/.DS_Store -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.5.0/Base/Sections.xml: -------------------------------------------------------------------------------- 1 | 19 |
20 | Session 21 | Session 22 | 0 23 | FIXT.1.1 24 | 1 25 | session 26 | Session level messages to establish and control a FIX session 27 |
28 |
29 | PreTrade 30 | PreTrade 31 | 1 32 | 3 33 | 0 34 | pretrade 35 | Pre trade messages including reference data, market data, quoting, news and email, indication of interest 36 |
37 |
38 | Trade 39 | Trade 40 | 2 41 | 4 42 | 0 43 | trade 44 | Order handling and execution messages 45 |
46 |
47 | PostTrade 48 | PostTrade 49 | 3 50 | 5 51 | 0 52 | posttrade 53 | Post trade messages including trade reporting, allocation, collateral, confirmation, position mantemenance, registration instruction, and settlement instructions 54 |
55 |
-------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.5.0SP1/Base/Sections.xml: -------------------------------------------------------------------------------- 1 | 19 |
20 | Session 21 | Session 22 | 0 23 | FIXT.1.1 24 | 1 25 | session 26 | Session level messages to establish and control a FIX session 27 |
28 |
29 | PreTrade 30 | PreTrade 31 | 1 32 | 3 33 | 0 34 | pretrade 35 | Pre trade messages including reference data, market data, quoting, news and email, indication of interest 36 |
37 |
38 | Trade 39 | Trade 40 | 2 41 | 4 42 | 0 43 | trade 44 | Order handling and execution messages 45 |
46 |
47 | PostTrade 48 | PostTrade 49 | 3 50 | 5 51 | 0 52 | posttrade 53 | Post trade messages including trade reporting, allocation, collateral, confirmation, position mantemenance, registration instruction, and settlement instructions 54 |
55 |
56 | Infrastructure 57 | Infrastructure 58 | 4 59 | 1 60 | 0 61 | infrastructure 62 | Infrastructure messages for application sequencing, business reject, network and user management 63 |
64 |
-------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIX.5.0SP2/Base/Sections.xml: -------------------------------------------------------------------------------- 1 | 19 |
20 | Session 21 | Session 22 | 0 23 | FIXT.1.1 24 | 1 25 | session 26 | Session level messages to establish and control a FIX session 27 |
28 |
29 | PreTrade 30 | PreTrade 31 | 1 32 | 3 33 | 0 34 | pretrade 35 | Pre trade messages including reference data, market data, quoting, news and email, indication of interest 36 |
37 |
38 | Trade 39 | Trade 40 | 2 41 | 4 42 | 0 43 | trade 44 | Order handling and execution messages 45 |
46 |
47 | PostTrade 48 | PostTrade 49 | 3 50 | 5 51 | 0 52 | posttrade 53 | Post trade messages including trade reporting, allocation, collateral, confirmation, position mantemenance, registration instruction, and settlement instructions 54 |
55 |
56 | Infrastructure 57 | Infrastructure 58 | 4 59 | 1 60 | 0 61 | infrastructure 62 | Infrastructure messages for application sequencing, business reject, network and user management 63 |
64 |
-------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIXT.1.1/Base/Components.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 1024 21 | Block 22 | Session 23 | StandardHeader 24 | Hdr 25 | 1 26 | The standard FIX message header 27 | 28 | 29 | 1025 30 | Block 31 | Session 32 | StandardTrailer 33 | Trlr 34 | 1 35 | The standard FIX message trailer 36 | 37 | 38 | 2085 39 | ImplicitBlock 40 | Session 41 | HopGrp 42 | HopGrp 43 | 0 44 | 45 | 46 | 47 | 2098 48 | ImplicitBlockRepeating 49 | Common 50 | MsgTypeGrp 51 | MsgTypeGrp 52 | 0 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/FIXT.1.1/Base/Sections.xml: -------------------------------------------------------------------------------- 1 | 19 |
20 | Session 21 | Session 22 | 0 23 | FIXT.1.1 24 | 1 25 | session 26 | Session level messages to establish and control a FIX session 27 |
28 |
-------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/Unified/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tools4j/fix4j/2cf12950555bc8955ae658f6f4df010a79ac2a16/src/main/resources/fix_repository_2010_edition_20140507/Unified/.DS_Store -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/Unified/FIXRepositoryMetadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/Unified/FixRepositoryMeta.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Comment describing your root element 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Abbreviations.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Categories.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Components.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Datatypes.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Enums.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Fields.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Messages.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/MsgContents.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/Sections.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/schema/versions.xsd: -------------------------------------------------------------------------------- 1 | 2 | DISCLAIMER 3 | 4 | THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER. 5 | 6 | NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES. 7 | 8 | No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein). 9 | 10 | Copyright 2003-2009 FIX Protocol Limited, all rights reserved 11 | 12 | REPRODUCTION 13 | 14 | FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page. 15 | 16 | Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited". 17 | FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification. 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Abbreviations_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | EP 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Categories_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Pre TradePost Trade 41 |
42 |
43 | 44 | 45 | 46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | EP 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Components_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | EP 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Datatypes_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | EP 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Enums_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | EP 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Fields_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | EP 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Messages_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Message 42 | 43 | 44 |
45 | 46 | 47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 | 55 | EP 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_MsgContents_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | EP 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_Sections_2010_to_2009.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Pre TradePost Trade 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | EP 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 | -------------------------------------------------------------------------------- /src/main/resources/fix_repository_2010_edition_20140507/xsl/Translate_support.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | EP 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | EP 47 | 48 | 49 | 50 | 51 | 52 | EP 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/test/java/org/fix4j/engine/msg/FixVersionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import static org.junit.Assert.assertSame; 27 | 28 | import org.fix4j.engine.msg.FixVersion; 29 | import org.junit.Test; 30 | 31 | /** 32 | * Unit test for {@link FixVersion}. 33 | */ 34 | public class FixVersionTest { 35 | 36 | @Test 37 | public void shouldParse() { 38 | for (final FixVersion fixVersion : FixVersion.values()) { 39 | final FixVersion parsed = FixVersion.parse(fixVersion.getBeginString()); 40 | assertSame("should be same constant", fixVersion, parsed); 41 | } 42 | } 43 | @Test(expected = NullPointerException.class) 44 | public void parseShouldThrowExceptionForNullFixVersion() { 45 | FixVersion.parse(null); 46 | } 47 | @Test(expected = IllegalArgumentException.class) 48 | public void parseShouldThrowExceptionForEmptyFixVersion() { 49 | FixVersion.parse(""); 50 | } 51 | @Test(expected = IllegalArgumentException.class) 52 | public void parseShouldThrowExceptionForInvalidFixVersion() { 53 | FixVersion.parse("FIX 4.0"); 54 | } 55 | @Test(expected = IllegalArgumentException.class) 56 | public void parseShouldThrowExceptionForInvalidFixVersion5() { 57 | FixVersion.parse("FIX.5.0"); 58 | } 59 | @Test(expected = IllegalArgumentException.class) 60 | public void parseShouldThrowExceptionForFixVersionWithSP() { 61 | FixVersion.parse("FIXT.1.1.SP1"); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/test/java/org/fix4j/engine/msg/MsgTypeTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.engine.msg; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | import static org.junit.Assert.assertSame; 28 | 29 | import org.fix4j.engine.msg.CustomMsgType; 30 | import org.fix4j.engine.msg.FixMsgType; 31 | import org.fix4j.engine.msg.MsgType; 32 | import org.junit.After; 33 | import org.junit.Test; 34 | 35 | /** 36 | * Unit test for {@link MsgType}. 37 | */ 38 | public class MsgTypeTest { 39 | 40 | @After 41 | public void afterEach() { 42 | CustomMsgType.unregisterAll(); 43 | } 44 | 45 | @Test 46 | public void shouldParse() { 47 | for (final MsgType fixMsgType : FixMsgType.values()) { 48 | final MsgType parsed = MsgType.parse(fixMsgType.get()); 49 | assertSame("should be same constant", fixMsgType, parsed); 50 | } 51 | } 52 | @Test 53 | public void shouldParseCustomMsgType() { 54 | final MsgType customType1 = CustomMsgType.register("CustomMsgType1", "U1"); 55 | final MsgType customType2 = CustomMsgType.register("CustomMsgType2", "U2"); 56 | final MsgType parsed1 = MsgType.parse("U1"); 57 | final MsgType parsed2 = MsgType.parse("U2"); 58 | assertSame("should be same constant", customType1, parsed1); 59 | assertSame("should be same constant", customType2, parsed2); 60 | assertEquals("should have ordinal", FixMsgType.VALUES.size(), parsed1.ordinal()); 61 | assertEquals("should have ordinal", FixMsgType.VALUES.size() + 1, parsed2.ordinal()); 62 | } 63 | @Test(expected = IllegalArgumentException.class) 64 | public void shouldRejectCustomMsgTypeWithDuplicateName() { 65 | CustomMsgType.register("CustomMsgType", "U1"); 66 | CustomMsgType.register("CustomMsgType", "U2"); 67 | } 68 | @Test(expected = IllegalArgumentException.class) 69 | public void shouldRejectCustomMsgTypeWithDuplicateTagValue() { 70 | CustomMsgType.register("CustomMsgType1", "U1"); 71 | CustomMsgType.register("CustomMsgType2", "U1"); 72 | } 73 | @Test(expected = IllegalArgumentException.class) 74 | public void shouldRejectCustomMsgTypeWithStandardName() { 75 | CustomMsgType.register("NewOrderSingle", "U1"); 76 | } 77 | @Test(expected = IllegalArgumentException.class) 78 | public void shouldRejectCustomMsgTypeWithStandardTagValue() { 79 | CustomMsgType.register("CustomMsgType1", "A"); 80 | } 81 | @Test(expected = NullPointerException.class) 82 | public void parseShouldThrowExceptionForNullMsgType() { 83 | MsgType.parse(null); 84 | } 85 | @Test(expected = IllegalArgumentException.class) 86 | public void parseShouldThrowExceptionForEmptyMsgType() { 87 | MsgType.parse(""); 88 | } 89 | @Test(expected = IllegalArgumentException.class) 90 | public void parseShouldThrowExceptionForInvalidMsgType() { 91 | MsgType.parse("*"); 92 | } 93 | @Test(expected = IllegalArgumentException.class) 94 | public void parseShouldThrowExceptionForInvalidMsgTypeA() { 95 | MsgType.parse("A*"); 96 | } 97 | @Test(expected = IllegalArgumentException.class) 98 | public void parseShouldThrowExceptionForInvalidMsgTypeB() { 99 | MsgType.parse("B*"); 100 | } 101 | @Test(expected = IllegalArgumentException.class) 102 | public void parseShouldThrowExceptionForInvalidMsgTypeC() { 103 | MsgType.parse("CH"); 104 | } 105 | @Test(expected = IllegalArgumentException.class) 106 | public void parseShouldThrowExceptionForInvalidMsgTypeD() { 107 | MsgType.parse("DA"); 108 | } 109 | @Test(expected = IllegalArgumentException.class) 110 | public void parseShouldThrowExceptionForInvalidMsgTypeA3() { 111 | MsgType.parse("ABC"); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/test/java/org/fix4j/sketch/Example.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 fix4j.org (tools4j.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package org.fix4j.sketch; 25 | 26 | public class Example { 27 | public static void main(final String[] args) { 28 | final Dictionary fix42Dictionary = SimpleDictionary.define(dictionary -> { 29 | dictionary.defineMessage(Fix42MessageType.Heartbeat, heartbeat -> { 30 | heartbeat.defineField(Fix42Tags.TestRequestID); 31 | }); 32 | 33 | dictionary.defineMessage(Fix42MessageType.TestRequest, testRequest -> { 34 | testRequest.defineField(Fix42Tags.TestRequestID, FieldDefinition::setRequired); 35 | }); 36 | }); 37 | 38 | final Message testRequest = fix42Dictionary.createMessage(Fix42MessageType.TestRequest); 39 | testRequest.set(Fix42Tags.TestRequestID, "TEST"); 40 | 41 | switch (testRequest.messageType()) { 42 | case TestRequest: 43 | testRequest.get(Fix42Tags.TestRequestID, System.out::println); 44 | break; 45 | } 46 | } 47 | } 48 | --------------------------------------------------------------------------------