├── .gitignore ├── .vscode ├── settings.json └── launch.json ├── images ├── Chain.png ├── main.png ├── connect.png ├── invalid.png ├── fieldList.png ├── connectRTOv1.png ├── connectRTOv2.png └── jarExtension.png ├── src └── main │ ├── assembly │ ├── SplashScreen.xcf │ └── distribution.xml │ ├── distribution │ ├── keystore.jks │ └── README.txt │ ├── resources │ ├── LSEG Icon.ico │ ├── SpeedGuide.bmp │ ├── SpeedGuide.png │ └── LSEG small logo.png │ └── java │ └── com │ └── lseg │ └── ema │ └── example │ └── gui │ ├── view │ ├── images │ │ ├── mbri-home.png │ │ ├── mbri-left.png │ │ └── mbri-right.png │ ├── application.css │ ├── SpeedGuideView.fxml │ ├── ConnectionDialog.fxml │ ├── SpeedGuideConnection.java │ └── SpeedGuideViewController.java │ ├── StatusLogHandler.java │ ├── SpeedGuide.java │ ├── ConsumerClient.java │ └── SpeedGuideConsumer.java ├── LICENSE.md ├── pom.xml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /src/main/resources/images 3 | /src/main/resources/view 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "interactive" 3 | } -------------------------------------------------------------------------------- /images/Chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/Chain.png -------------------------------------------------------------------------------- /images/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/main.png -------------------------------------------------------------------------------- /images/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/connect.png -------------------------------------------------------------------------------- /images/invalid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/invalid.png -------------------------------------------------------------------------------- /images/fieldList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/fieldList.png -------------------------------------------------------------------------------- /images/connectRTOv1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/connectRTOv1.png -------------------------------------------------------------------------------- /images/connectRTOv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/connectRTOv2.png -------------------------------------------------------------------------------- /images/jarExtension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/images/jarExtension.png -------------------------------------------------------------------------------- /src/main/assembly/SplashScreen.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/assembly/SplashScreen.xcf -------------------------------------------------------------------------------- /src/main/distribution/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/distribution/keystore.jks -------------------------------------------------------------------------------- /src/main/resources/LSEG Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/resources/LSEG Icon.ico -------------------------------------------------------------------------------- /src/main/resources/SpeedGuide.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/resources/SpeedGuide.bmp -------------------------------------------------------------------------------- /src/main/resources/SpeedGuide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/resources/SpeedGuide.png -------------------------------------------------------------------------------- /src/main/resources/LSEG small logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/resources/LSEG small logo.png -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/images/mbri-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/java/com/lseg/ema/example/gui/view/images/mbri-home.png -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/images/mbri-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/java/com/lseg/ema/example/gui/view/images/mbri-left.png -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/images/mbri-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide/HEAD/src/main/java/com/lseg/ema/example/gui/view/images/mbri-right.png -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/application.css: -------------------------------------------------------------------------------- 1 | /* SpeedGuide CSS */ 2 | 3 | /* 4 | * Service ComboBox 5 | */ 6 | .combo-box .list.cell{ 7 | -fx-font-size: 12px "System"; 8 | } 9 | 10 | .tab-pane *.tab-header-background { 11 | -fx-background-color: #0f000d12; 12 | } 13 | 14 | /* 15 | * Status Pane 16 | */ 17 | #status-time { 18 | -fx-fill: blue; 19 | -fx-font-weight:bold; 20 | } 21 | 22 | #status-request { 23 | -fx-fill: black; 24 | -fx-font-weight: normal; 25 | } 26 | 27 | #status-response-success { 28 | -fx-fill: darkgreen; 29 | -fx-font-weight: normal; 30 | } 31 | 32 | #status-response-error { 33 | -fx-fill: crimson; 34 | -fx-font-weight: normal; 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2017 THOMSON REUTERS 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /src/main/assembly/distribution.xml: -------------------------------------------------------------------------------- 1 | 4 | distribution 5 | 6 | zip 7 | 8 | 9 | 10 | ${project.build.directory} 11 | / 12 | 13 | ${project.artifactId}.jar 14 | ${project.artifactId}.exe 15 | 16 | 17 | 18 | ${project.basedir}/src/main/distribution 19 | / 20 | 21 | *.jks 22 | *.txt 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Debug (No args)", 10 | "request": "launch", 11 | "mainClass": "com.lseg.ema.example.gui.SpeedGuide", 12 | "vmArgs": "-splash:src/main/resources/SpeedGuide.png", 13 | "args": "--keyStore=src/main/distribution/keystore.jks" 14 | }, 15 | { 16 | "type": "java", 17 | "name": "Debug (ADS)", 18 | "request": "launch", 19 | "mainClass": "com.lseg.ema.example.gui.SpeedGuide", 20 | "vmArgs": "-splash:src/main/resources/SpeedGuide.png", 21 | "args": "--host=${env:RTDS_HOST}" 22 | }, 23 | { 24 | "type": "java", 25 | "name": "Debug (RTO V1)", 26 | "request": "launch", 27 | "mainClass": "com.lseg.ema.example.gui.SpeedGuide", 28 | "vmArgs": "-splash:src/main/resources/SpeedGuide.png", 29 | "args": ["--keyStore=src/main/distribution/keystore.jks", "--machineId=${env:MACHINE_ID}", 30 | "--password=${env:MACHINE_PASSWD}", "--appKey=${env:APPKEY}", "--region=eu-west-1"] 31 | }, 32 | { 33 | "type": "java", 34 | "name": "Debug (RTO V2)", 35 | "request": "launch", 36 | "mainClass": "com.lseg.ema.example.gui.SpeedGuide", 37 | "vmArgs": "-splash:src/main/resources/SpeedGuide.png", 38 | "args": ["--keyStore=src/main/distribution/keystore.jks", "--clientId=${env:CLIENT_ID}", 39 | "--clientSecret=${env:CLIENT_SECRET}", "--region=ap-northeast-1"] 40 | }, 41 | { 42 | "type": "java", 43 | "name": "Debug (debug logging)", 44 | "request": "launch", 45 | "mainClass": "com.lseg.ema.example.gui.SpeedGuide", 46 | "vmArgs": "-splash:src/main/resources/SpeedGuide.png", 47 | "args": ["--keyStore=src/main/distribution/keystore.jks", "--d"] 48 | }, 49 | ] 50 | } -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/StatusLogHandler.java: -------------------------------------------------------------------------------- 1 | package com.lseg.ema.example.gui; 2 | 3 | import java.util.logging.Level; 4 | import java.util.logging.LogRecord; 5 | import java.util.logging.StreamHandler; 6 | 7 | import com.lseg.ema.example.gui.SpeedGuide.StatusIndicator; 8 | import com.lseg.ema.example.gui.view.SpeedGuideViewController; 9 | 10 | public class StatusLogHandler extends StreamHandler { 11 | private SpeedGuideViewController m_viewController; 12 | 13 | public void setViewController(SpeedGuideViewController viewController) { 14 | m_viewController = viewController; 15 | } 16 | 17 | @Override 18 | public void publish(LogRecord record) 19 | { 20 | if ( m_viewController != null && (record.getLevel() == Level.WARNING || record.getLevel() == Level.SEVERE) ) 21 | { 22 | final String TOKEN_TEXT = "Text:"; 23 | final String TOKEN_DETAILS = "Error text"; 24 | final String TOKEN_STATE = "State:"; 25 | 26 | // Ignore the error reporting no EmaConfig.xml found 27 | if ( !record.getMessage().contains("EmaConfig.xml")) 28 | { 29 | String[] lines = record.getMessage().split("\n"); 30 | 31 | String text = ""; 32 | for (String line : lines) 33 | { 34 | if (line.contains(TOKEN_TEXT)) 35 | text += line.substring(line.indexOf(TOKEN_TEXT)+TOKEN_TEXT.length()).trim() + SpeedGuide.NEWLINE; 36 | else if (line.contains(TOKEN_DETAILS)) 37 | text += line.substring(line.indexOf(TOKEN_DETAILS)+TOKEN_DETAILS.length()).trim() + SpeedGuide.NEWLINE; 38 | else if (line.contains(TOKEN_STATE)) 39 | text += line.substring(line.indexOf(TOKEN_STATE)+TOKEN_STATE.length()).trim() + SpeedGuide.NEWLINE; 40 | } 41 | 42 | // Send errors to GUI status 43 | if (!text.isEmpty() ) { 44 | int pos = text.lastIndexOf(SpeedGuide.NEWLINE); 45 | if ( pos >= 0) 46 | text = text.substring(0, pos); 47 | 48 | m_viewController.updateStatus(text, StatusIndicator.RESPONSE_ERROR); 49 | } 50 | else 51 | m_viewController.updateStatus(record.getMessage(), StatusIndicator.RESPONSE_ERROR); 52 | } 53 | } 54 | super.publish(record); 55 | } 56 | 57 | 58 | @Override 59 | public void flush() { 60 | super.flush(); 61 | } 62 | 63 | @Override 64 | public void close() throws SecurityException { 65 | super.close(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/distribution/README.txt: -------------------------------------------------------------------------------- 1 | README 2 | 3 | The SpeedGuide tool is a simple, GUI-based, market data consumer written in Java, using the LSEG Real-Time Java SDK, 4 | that allows the ability to navigate through realtime data offered within LSEG. 5 | 6 | Refer to GitHub (https://github.com/LSEG-API-Samples/Example.EMA.Java.SpeedGuide) for full details of the operation of the utility. 7 | 8 | Note: While the utility will launch the "REFINITIV" RIC, which represents the root code of the Speed Guide pages, the utility 9 | is extremely useful for developers to visualize any other instrument available within real-time platform. 10 | 11 | The user is presented with a basic window allowing the selection of navigation items, as identified by values within <> brackets, 12 | or to input items manually. 13 | 14 | The package includes 2 components offering multiple ways to launch the tool. Packaged are: 15 | 16 | - SpeedGuide.jar: An executable JAR available for both Windows and Linux 17 | - SpeedGuide.exe: A windows wrapper 18 | 19 | Launching the tool by double clicking on the icon (Windows): 20 | ============================================================ 21 | 22 | Double-clicking either the .jar or .exe file will not pass any required parameters to the application. As such, the application 23 | will present a Connection Dialog requesting for these connection parameters. In either case, no console is involved thus no 24 | additional messages, such as log messages, can be viewed. 25 | 26 | Note: Launching the executable JAR requires the Javaw (https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html) 27 | program to open it. When not associated, you will be presented with a request to select a program. 28 | 29 | 30 | Launching the tool from the console: 31 | ==================================== 32 | 33 | At the console, you can pass command-line parameters to the utility: 34 | 35 | o Launching the executable JAR 36 | > java -jar SpeedGuide.jar [options] 37 | 38 | When launching the executable JAR, users optionally specify command-line options and have the opportunity to see 39 | the output on the console. 40 | 41 | o Launching the windows wrapper EXE 42 | > SpeedGuide.exe [options] 43 | 44 | The windows wrapper is strictly a GUI based facility that does not have an explicit console attached. Thus, no 45 | output can be viewed on the console. However, users can capture the output within a file. for example: 46 | 47 | > SpeedGuide.exe>output.txt [options] 48 | 49 | Console output will provide additional log messages, and if the user specifies the --d[ebug] option on the command-line, 50 | additional debug details. These messages can be useful to better understand connection details, messages returned, etc. 51 | 52 | Command-line Options 53 | -------------------- 54 | 55 | Options: 56 | 57 | --service=serviceName Optional. Service Name providing market data content. 58 | Eg: ELEKTRON_DD. Default: Determined from Directory response. 59 | 60 | ************* ADS Connection Parameters ************** 61 | --host=hostname:port Required. Elektron Server address/hostname and port of your Market Data server. 62 | Syntax: :. Eg: myserver:14002 or 192.168.1.1:14002 63 | --user=userName Optional. DACS User name required if authentication is enabled on server. 64 | Note: if no user name is provided, the utility will use your desktop login 65 | --appid=ApplicationId Optional. DACS Application ID if authentication is enabled on server. 66 | Application ID has no default. 67 | --position=Position Optional. DACS Position if authentication is enabled on server. 68 | Position has no default. 69 | 70 | ************* Real-Time -- Optimized Connection Parameters ************** 71 | --region=location Optional. Specify the location to connect within the cloud. 72 | Eg: ap-northeast-1 (Asia) eu-west-1 (EU) us-east-2 (US). Default: us-east-1 73 | 74 | **** Version 1 Authentication > 75 | --machineId=machine ID Required. Real-Time -- Optimized Machine ID/User required for OAuth Password Grant. 76 | Eg: GE-A-00000000-1-8888 77 | --password=password Required. Real-Time -- OPtimized password required for OAuth Password Grant. 78 | Eg: Sunshine_1_UserPass 79 | --appKey=App Key Required. Real-Time -- Optimized AppKey or Client ID required for server authentication. 80 | Eg: x888x8x88888888x88888x88x8888xx88x88888x 81 | 82 | **** Version 2 Authentication > 83 | --clientId=Client ID Required. Real-Time -- Optimized Client/Service Account ID required for OAuth Client Credentials. 84 | Eg: GE-XXXXXXXXXXXX 85 | --clientSecret=secret Required. Real-Time -- Optimized Client secret required for OAuth Client Credentials. 86 | Eg: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 87 | 88 | 89 | --keyStore=keystorefile Optional. A Java KeyStore (JKS) required for secure package exchange. 90 | Default: SpeedGuide provides a file for convenience. 91 | --keyStorePasswd=passwd Optional. Password associated with the specified keystore file. 92 | Default: SpeedGuide includes the password for the default keystore file. 93 | 94 | --d[ebug] Debug Mode. Display verbose messages to the console 95 | --h[elp] Prints this screen 96 | 97 | If neither the required parameters for the ADS or Real-Time -- Optmized are specified, the utility will prompt the user. 98 | 99 | Example: 100 | > SpeedGuide.exe --host=myserver:14002 --service=ELEKTRON_AD --user=testuser --appid=256 --position=127.0.0.1 101 | > SpeedGuide.exe --clientId=GE-XXXX1234XXXX --clientSecret=9x999999-9xxx-9999-9x99-9x9xx99x9x99 102 | > SpeedGuide.exe --clientId=GE-123X9ABCDE9Z --clientSecret=9z123456-9abc-5555-9a12-1a2bc34d5e67 --region=eu-west-1 103 | 104 | -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/SpeedGuideView.fxml: -------------------------------------------------------------------------------- 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 | 40 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 62 | 71 | 80 | 81 | 82 | 83 | 84 | 85 | 90 | 91 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 103 | 104 | 105 | 106 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.lseg.ema.example.gui 8 | SpeedGuide 9 | 4.1.0 10 | 11 | London Stock Exchange 12 | 13 | 2017 14 | Tool to navigate LSEG SpeedGuide market data 15 | 16 | 17 | 8 18 | 8 19 | UTF-8 20 | 21 | 22 | 23 | 24 | com.refinitiv.ema 25 | ema 26 | 3.7.2.0 27 | 28 | 29 | 30 | com.refinitiv.eta 31 | eta 32 | 3.7.2.0 33 | 34 | 35 | 36 | 37 | ${project.artifactId} 38 | 39 | 40 | maven-resources-plugin 41 | 3.3.1 42 | 43 | 44 | 45 | copy-view-resources 46 | generate-resources 47 | 48 | copy-resources 49 | 50 | 51 | ${project.basedir}/src/main/resources/view 52 | 53 | 54 | src/main/java/com/lseg/ema/example/gui/view 55 | 56 | **/*.fxml 57 | **/*.css 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | copy-image-resources 67 | generate-resources 68 | 69 | copy-resources 70 | 71 | 72 | ${project.basedir}/src/main/resources/view/images 73 | 74 | 75 | src/main/java/com/lseg/ema/example/gui/view/images 76 | 77 | **/*.png 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | org.apache.maven.plugins 88 | maven-jar-plugin 89 | 3.3.0 90 | 91 | 92 | 93 | true 94 | lib/ 95 | com.lseg.ema.example.gui.SpeedGuide 96 | true 97 | 98 | 99 | SpeedGuide.png 100 | 101 | 102 | 103 | 104 | 105 | org.apache.maven.plugins 106 | maven-shade-plugin 107 | 3.5.1 108 | 109 | false 110 | 111 | 112 | 113 | package 114 | 115 | shade 116 | 117 | 118 | 119 | 120 | 121 | com.lseg.ema.example.gui.SpeedGuide 122 | 1.0 123 | 124 | 125 | 126 | 127 | 128 | *:* 129 | 130 | module-info.class 131 | META-INF/versions/9/module-info.class 132 | META-INF/*.SF 133 | META-INF/*.DSA 134 | META-INF/*.RSA 135 | META-INF/LICENSE* 136 | META-INF/NOTICE* 137 | META-INF/DEPENDENCIES 138 | META-INF/MANIFEST.MF 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | com.akathist.maven.plugins.launch4j 148 | launch4j-maven-plugin 149 | 2.4.1 150 | 151 | 152 | l4j-clui 153 | package 154 | 155 | launch4j 156 | 157 | 158 | gui 159 | ${project.build.directory}/${project.artifactId}.jar 160 | ${project.build.directory}/${project.artifactId}.exe 161 | 162 | 163 | com.lseg.ema.example.gui.SpeedGuide 164 | 165 | 169 | 170 | C:\Program Files\Common Files\Oracle\javapath 171 | 1.8.0 172 | 173 | 174 | ${project.basedir}/src/main/resources/SpeedGuide.bmp 175 | true 176 | 10 177 | true 178 | 179 | src/main/resources/LSEG Icon.ico 180 | 181 | 182 | 183 | 184 | 185 | maven-assembly-plugin 186 | 3.6.0 187 | 188 | 189 | make-assembly 190 | package 191 | 192 | single 193 | 194 | 195 | false 196 | 197 | ${project.basedir}/src/main/assembly/distribution.xml 198 | 199 | ${project.artifactId} 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/SpeedGuide.java: -------------------------------------------------------------------------------- 1 | package com.lseg.ema.example.gui; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics2D; 6 | import java.awt.SplashScreen; 7 | import java.io.InputStream; 8 | import java.net.URL; 9 | 10 | import com.lseg.ema.example.gui.view.SpeedGuideConnection; 11 | import com.lseg.ema.example.gui.view.SpeedGuideViewController; 12 | 13 | import javafx.application.Application; 14 | import javafx.fxml.FXMLLoader; 15 | import javafx.scene.Scene; 16 | import javafx.scene.image.Image; 17 | import javafx.scene.layout.AnchorPane; 18 | import javafx.stage.Stage; 19 | 20 | 21 | // SpeedGuide 22 | // 23 | // Main class driving the application. The SpeedGuide class represents our entry point for our UI 24 | // and launching the EMA Consumer thread to manage all market data activity. The SpeedGuide utilizes 25 | // the FXML specification to drive the UI components. All FXML definitions are launched at startup within 26 | // this class. 27 | public class SpeedGuide extends Application 28 | { 29 | public enum StatusIndicator 30 | { 31 | REQUEST, 32 | RESPONSE_SUCCESS, 33 | RESPONSE_ERROR 34 | } 35 | 36 | public static final String NEWLINE = System.getProperty("line.separator"); 37 | public static final String VER_CODE = "4.1.0"; 38 | public SpeedGuideConsumer m_consumer = new SpeedGuideConsumer(); 39 | private boolean m_debug = false; 40 | 41 | @Override 42 | public void start(Stage primaryStage) throws Exception { 43 | try { 44 | final SplashScreen splash = SplashScreen.getSplashScreen(); 45 | if (splash != null) { 46 | Graphics2D g = splash.createGraphics(); 47 | if (g == null) { 48 | System.out.println("g is null"); 49 | return; 50 | } 51 | // render the splash screen 52 | renderSplashFrame(g, (int)splash.getSize().getHeight()); 53 | splash.update(); 54 | } 55 | 56 | // Determine if we passed anything on the cmd line 57 | parseCmdLine(); 58 | 59 | // Define our controllers 60 | SpeedGuideViewController viewController = loadFXMLController("/view/SpeedGuideView.fxml"); 61 | SpeedGuideConnection connectionController = loadFXMLController("/view/ConnectionDialog.fxml"); 62 | 63 | appInit(primaryStage, viewController, connectionController); 64 | 65 | if ( splash != null ) 66 | splash.close(); 67 | 68 | // Attempt to Connect into the configured server (ADS or Refinitiv Real-Time -- Optimized) 69 | connectionController.connect(); 70 | } catch (Exception e) { 71 | System.out.print("Exception in Application Start: "); 72 | e.printStackTrace(); 73 | stop(); 74 | } 75 | } 76 | 77 | private static void renderSplashFrame(Graphics2D g, int height) { 78 | g.setComposite(AlphaComposite.Clear); 79 | g.fillRect(120,140,200,40); 80 | g.setPaintMode(); 81 | g.setColor(Color.BLACK); 82 | 83 | // Set the position for the string. Adjust these values as needed. 84 | int xPosition = 10; // 10 pixels from the left edge of the window 85 | int yPosition = height - 10; // 10 pixels from the bottom edge of the window 86 | 87 | g.drawString("Loading...", xPosition, yPosition); 88 | } 89 | 90 | private void appInit(Stage primaryStage, SpeedGuideViewController viewController, SpeedGuideConnection connectionController) 91 | { 92 | // Wire up our Model/View/Controllers 93 | viewController.setConnectionViewController(connectionController); 94 | viewController.setDebug(m_debug); 95 | viewController.defineControlBindings(m_consumer); 96 | 97 | // Notify our consumer some setup information 98 | m_consumer.setDebug(m_debug); 99 | m_consumer.setViewController(viewController); 100 | 101 | // Define the main viewing scene, 102 | AnchorPane layout = viewController.getLayout(); 103 | Scene scene = new Scene(layout, layout.getPrefWidth(), layout.getPrefHeight()); 104 | 105 | // Prevent the user from resizing the window too small 106 | primaryStage.setMinHeight(layout.getMinHeight()); 107 | primaryStage.setMinWidth(layout.getMinWidth()); 108 | 109 | // Assign to our main stage and show the application to the end user 110 | primaryStage.setTitle("Speed Guide"); 111 | InputStream iconStream = getClass().getResourceAsStream("/LSEG small logo.png"); 112 | if (iconStream != null) 113 | primaryStage.getIcons().add(new Image(iconStream)); 114 | primaryStage.setScene(scene); 115 | primaryStage.show(); 116 | 117 | // Set up our EMA Consumer and launch a thread to run... 118 | Thread t = new Thread(m_consumer); 119 | t.start(); 120 | 121 | // Initialize Connection Parameters 122 | connectionController.initialize(getParameters(), m_consumer); 123 | } 124 | 125 | private T loadFXMLController(String resource) 126 | { 127 | try { 128 | // Load our view (from an fxml layout) 129 | FXMLLoader loader = new FXMLLoader(); 130 | URL fxmlResource = getClass().getResource(resource); 131 | loader.setLocation(fxmlResource); 132 | loader.load(); 133 | return(loader.getController()); 134 | } catch (Exception e) { 135 | System.out.print("Exception in loading FXML resource: " + resource + ": "); 136 | e.printStackTrace(); 137 | stop(); 138 | } 139 | return null; 140 | } 141 | 142 | private void parseCmdLine() throws Exception 143 | { 144 | Application.Parameters params = getParameters(); 145 | 146 | if ( params.getRaw().contains("--h") || params.getRaw().contains("--help") || 147 | params.getNamed().containsKey("h") || params.getNamed().containsKey("help")) 148 | { 149 | System.out.println(NEWLINE+"Syntax:"+NEWLINE); 150 | System.out.println(" > java -jar SpeedGuide.jar [options] or"+NEWLINE); 151 | System.out.println(" > SpeedGuide.exe [options] "+NEWLINE); 152 | System.out.println("Options:"+NEWLINE); 153 | System.out.println(" --service=serviceName Optional. Service Name providing market data content."); 154 | System.out.println(" Eg: ELEKTRON_DD. Default: Determined from Directory response."); 155 | System.out.println(NEWLINE); 156 | System.out.println("************* ADS Connection Parameters **************"); 157 | System.out.println(" --host=hostname:port Required. ADS Server address/hostname and port of your Real-Time Distribution Server."); 158 | System.out.println(" Syntax: :. Eg: myserver:14002 or 192.168.1.1:14002"); 159 | System.out.println(" --user=userName Optional. DACS User name required if authentication is enabled on server."); 160 | System.out.println(" Note: if no user name is provided, the utility will use your desktop login"); 161 | System.out.println(" --appid=ApplicationId Optional. DACS Application ID if authentication is enabled on server."); 162 | System.out.println(" Application ID has no default."); 163 | System.out.println(" --position=Position Optional. DACS Position if authentication is enabled on server."); 164 | System.out.println(" Position has no default."); 165 | System.out.println(NEWLINE); 166 | System.out.println("************* Refinitiv Real-Time -- Optimized Connection Parameters **************"); 167 | System.out.println(" --region=location Optional. Specify the location to connect within the cloud."); 168 | System.out.println(" Eg: ap-northeast-1 (Asia) eu-west-1 (EU) us-east-2 (US). Default: us-east-1"); 169 | System.out.println(NEWLINE); 170 | System.out.println("**** Version 1 Authentication >"); 171 | System.out.println(" --machineId=machine ID Required. Real-Time -- Optimized Machine ID/User required for OAuth Password Grant."); 172 | System.out.println(" Eg: GE-A-00000000-1-8888"); 173 | System.out.println(" --password=password Required. Real-Time -- OPtimized password required for OAuth Password Grant."); 174 | System.out.println(" Eg: Sunshine_1_UserPass"); 175 | System.out.println(" --appKey=App Key Required. Refinitiv Real-Time -- Optimized AppKey or Client ID required for server authentication."); 176 | System.out.println(" Eg: x888x8x88888888x88888x88x8888xx88x88888x"); 177 | System.out.println("**** Version 2 Authentication >"); 178 | System.out.println(" --clientId=Client ID Required. Real-Time -- Optimized Client/Service Account ID required for OAuth Client Credentials."); 179 | System.out.println(" Eg: GE-XXXXXXXXXXXX"); 180 | System.out.println(" --clientSecret=secret Required. Real-Time -- Optimized Client secret required for OAuth Client Credentials."); 181 | System.out.println(" Eg: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n"); 182 | System.out.println(" --keyStore=keystorefile Optional. A Java KeyStore (JKS) required for secure package exchange."); 183 | System.out.println(" Default: SpeedGuide provides a file for convenience."); 184 | System.out.println(" --keyStorePasswd=passwd Optional. Password associated with the specified keystore file."); 185 | System.out.println(" Default: SpeedGuide includes the password for the default keystore file."); 186 | System.out.println(NEWLINE); 187 | System.out.println(" --d[ebug] Debug Mode. Display verbose messages to the console"); 188 | System.out.println(" --h[elp] Prints this screen"+NEWLINE); 189 | System.out.println("If neither the required parameters for the ADS or Refinitiv Real-Time -- Optimized parameters are specified, the utility will prompt the user."); 190 | System.out.println(NEWLINE); 191 | System.out.println("Example:"); 192 | System.out.println(" > SpeedGuide.exe --host=myserver:14002 --service=ELEKTRON_DD --user=testuser --appid=256 --position=127.0.0.1"); 193 | System.out.println(" > SpeedGuide.exe --machineId=GE-A-00000000-1-8888 --password=Sunshine_1_UserPass --appKey=x888x8x88888888x88888x88x8888xx88x88888x"); 194 | System.out.println(" > SpeedGuide.exe --clientId=GE-123X9ABCDE9Z --clientSecret=9z123456-9abc-5555-9a12-1a2bc34d5e67 --region=eu-west-1"); 195 | stop(); 196 | } 197 | 198 | m_debug = params.getRaw().contains("--d") || params.getRaw().contains("--debug") || 199 | params.getNamed().containsKey("d") || params.getNamed().containsKey("debug"); 200 | } 201 | 202 | @Override 203 | public void stop() { 204 | System.exit(0); 205 | } 206 | 207 | public static void main(String[] args) throws Exception { 208 | System.out.println("Java Version: " + System.getProperty("java.runtime.version") + " (" + System.getProperty("sun.arch.data.model") + "-bit)"); 209 | System.out.println("javafx.runtime.version: " + System.getProperties().get("javafx.runtime.version")); 210 | 211 | launch(args); 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /src/main/java/com/lseg/ema/example/gui/view/ConnectionDialog.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 60 | 61 |