Git Product home page Git Product logo

faa-swim / fns-client Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 6.0 59.23 MB

The System Wide Information Service (SWIM) Federal NOTAM System (FNS) Java Messaging Service (JMS) Reference Implementation (FnsClient) provides an example implementation on how to establish and maintain a local instance of the FNS NOTAM Database through the use of the FNS Initial Load (FIL) and SWIM FNS JMS services. FIL provides all active NOTAMS, via SFTP, that is required to initialize a NOTAM database and the SWIM JMS service provides, via JMS, NOTAM updates to keep the NOTAM database current. FIL also provides for re-initialization of a NOTAM database in the case of JMS service interruption.

License: Apache License 2.0

HTML 13.96% JavaScript 7.12% Java 78.91%

fns-client's Introduction

SWIM FNS JMS Reference Implementation (FnsClient)

Overview

The System Wide Information Service (SWIM) Federal NOTAM System (FNS) Java Messaging Service (JMS) Reference Implementation (FnsClient) provides an example implementation on how to establish and maintain a local instance of the FNS NOTAM Database through the use of the FNS Initial Load (FIL) and SWIM FNS JMS services. FIL provides all active NOTAMS, via SFTP, that is required to initialize a NOTAM database and the SWIM JMS service provides, via JMS, NOTAM updates to keep the NOTAM database current. FIL also provides for re-initialization of a NOTAM database in the case of JMS service interruption.

FnsClient Diagram

Contents

This repository includes the java source code for the FnsClient which consists of the following classes:

  • FnsClient: Main entry for the application.
  • FilClient: Obtains the FIL file via SFTP.
  • NotamDb: Provides all methods to create, put, and query the NOTAM database; supports PostgreSQL and prototype H2 db. Recommend use of Postgresql DB.
  • FnsJmsMessageWorker: Implementation of a JMS Message Worker used to process FNS Messages received from the SWIM AIM FNS JMS service and load into the NOTAM Database.
  • FnsMessage: Provides methods to marshal and unmarshal AIXM NOTAMs into a workable java object.
  • FnsRestApi: Implementation of a basic REST API to query the NOTAM Database.

Prerequisites

A SWIM subscription to the AIM FNS JMS service and credentials to access the AIM FIL service are required to run the FnsClient. These can be obtained via the SWIM Cloud Distribution Service (SCDS) by visiting scds.faa.gov, creating an account, and requesting a subscription for the AIM FNS service. In order for the FnsClient to run properly it is necessary to set up an AIM FNS subscription that receives all messages - any filters limiting which messages are received will cause the FnsClient to falsely identify missed messages. Once the subscription has been approved you will receive an email with instructions on how to request FIL credentials.

  • Built using JDK 11 and Maven

Building and Running

  1. Clone this repository including submodules
  2. Install submodule dependencies to your local maven repo
    • mvn clean install -f ./aixm-5.1/pom.xml
    • mvn clean install -f ./jms-client/pom.xml
    • mvn clean install -f ./swim-utilities/pom.xml
  3. Run mvn clean package
  4. Change to the target directory; cd target/FnsClient
  5. Modify the fnsClient.conf file and add the SWIM AIM FNS JMS and FIL connection details - FIL Cert needs to be in RSA (aka pem) format; conversion can been done via: ssh-keygen -p -N "" -m pem -f /path/to/key’
  6. Run the FnsClient; java -jar FnsClient.jar

Rest API - Prototype

Once the FnsClient has started and initialized, NOTAMS can be queried directly from the NOTAM database, via calling the rest api, or by the web ui as localhost:8080

There is an initial REST API implementation - but it is not fully functional.

The target REST API includes the following web services - but again requires some javascript code modifications to run properly:

fns-client's People

Contributors

armfaactr avatar felixruble-faa-ctr avatar jvctrotis avatar nhasan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fns-client's Issues

Running the client creates database conflicts

Configuration

Ubuntu 22.04 (LTS) x64 with PostgreSQL 16

Description of the issue

When starting the client after an initial run, the following output is generated:

2024-03-29T09:07:27.924 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Loading FnsClient Config and Initalizing
2024-03-29T09:07:28.425 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Starting FnsClient
2024-03-29T09:07:29.967 [mainhread] INFO  [us.dot.faa.swim.fns.notamdb.NotamDb] - Creating new NOTAMS Table
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: relation "notams" already exists
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:166)
	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:155)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
	at us.dot.faa.swim.fns.notamdb.NotamDb.createNotamTable(NotamDb.java:174)
	at us.dot.faa.swim.fns.FnsClient.start(FnsClient.java:343)
	at us.dot.faa.swim.fns.FnsClient.main(FnsClient.java:455)

Deleting the associated notams table and restarting the client resolves the initial error but then results in the following:

2024-03-29T09:43:15.613 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Loading FnsClient Config and Initalizing
2024-03-29T09:43:16.074 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Starting FnsClient
2024-03-29T09:43:17.334 [mainhread] INFO  [us.dot.faa.swim.fns.notamdb.NotamDb] - Creating new NOTAMS Table
2024-03-29T09:43:17.359 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Starting JMS Consumer
2024-03-29T09:43:17.711 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connecting to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (host 1 of 1, smfclient 2, attempt 1 of 2147483647, this_host_attempt: 1 of 1)
2024-03-29T09:43:18.182 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connected to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (smfclient 2)
2024-03-29T09:43:18.513 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Channel Closed (smfclient 2)
2024-03-29T09:43:18.574 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connecting to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (host 1 of 1, smfclient 4, attempt 1 of 2147483647, this_host_attempt: 1 of 2147483648)
2024-03-29T09:43:18.955 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connected to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (smfclient 4)
2024-03-29T09:43:19.091 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connecting to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (host 1 of 1, smfclient 6, attempt 1 of 2147483647, this_host_attempt: 1 of 1)
2024-03-29T09:43:19.470 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Connected to host 'orig=tcps://ems2.swim.faa.gov:55443, scheme=tcps://, host=ems2.swim.faa.gov, port=55443' (smfclient 6)
2024-03-29T09:43:19.646 [mainhread] INFO  [com.solacesystems.jcsmp.protocol.impl.TcpClientChannel] - Channel Closed (smfclient 6)
2024-03-29T09:43:19.768 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - JMS Consumer Started
2024-03-29T09:43:19.769 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Recent Correlation Id not found in NotamDb, starting NotamDb initalization from FIL
2024-03-29T09:44:19.769 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Initalizing Database
2024-03-29T09:44:19.770 [mainhread] INFO  [us.dot.faa.swim.fns.fil.FilClient] - Connecting to FNS Initial Load SFTP server
2024-03-29T09:44:23.970 [mainhread] INFO  [us.dot.faa.swim.fns.notamdb.NotamDb] - Creating new NOTAMS Table
2024-03-29T09:44:23.980 [mainhread] ERROR [us.dot.faa.swim.fns.FnsClient] - NotamDb initalization failed due to:org.postgresql.util.PSQLException: ERROR: relation "notams" already exists

[Repetition omitted for brevity]

2024-03-29T09:44:27.704 [mainhread] INFO  [us.dot.faa.swim.fns.FnsClient] - Initalizing Database
2024-03-29T09:44:27.705 [mainhread] INFO  [us.dot.faa.swim.fns.fil.FilClient] - Connecting to FNS Initial Load SFTP server
2024-03-29T09:44:31.292 [mainhread] INFO  [us.dot.faa.swim.fns.notamdb.NotamDb] - Creating new NOTAMS Table
2024-03-29T09:44:31.295 [mainhread] ERROR [us.dot.faa.swim.fns.FnsClient] - NotamDb initalization failed due to:org.postgresql.util.PSQLException: ERROR: relation "notams" already exists

Deleting the notams table again while the client is running allows execution to continue normally and the database to be populated.

Effects

When running the client as a daemon, it is unable to restart on its own should the process get interrupted.

Possible solution?

My knowledge of Java is next to none, but reading through the source, I believe the issue has to do with the notTableExists() method not returning false when it should be returning true, generating a conflict when PostgreSQL attempts to create an already existing table.

Missing artifact issues

Hi

i am getting the following errors

[{
"resource": "/Users/xyz/fns-client/pom.xml",
"owner": "generated_diagnostic_collection_name#3",
"code": "0",
"severity": 8,
"message": "Missing artifact us.dot.faa.swim.jaxb.aixm:aixm-5.1:jar:1.0",
"source": "Java",
"startLineNumber": 68,
"startColumn": 4,
"endLineNumber": 68,
"endColumn": 15
}]
Missing artifact us.dot.faa.swim.jms:jms-client:jar:1.0
Missing artifact us.dot.faa.swim.utilities:swim-utilities:jar:1.0

with respect to the below code block

	<dependency>
		<groupId>us.dot.faa.swim.jaxb.aixm</groupId>
		<artifactId>aixm-5.1</artifactId>
		<version>1.0</version>
	</dependency>
	<dependency>
		<groupId>us.dot.faa.swim.jms</groupId>
		<artifactId>jms-client</artifactId>
		<version>1.0</version>
	</dependency>
	<dependency>
		<groupId>us.dot.faa.swim.utilities</groupId>
		<artifactId>swim-utilities</artifactId>
		<version>1.0</version>
	</dependency>

Also getting the error
The project was not built since its build path is incomplete. Cannot find the class file for javax.xml.bind.JAXBElement. Fix the build path then try building this project

Would appreciate if you can guide me to resolve these issues.

thank you

mvn clean install /aixm-5.1 Unknown lifecycle phase error

I try to install submodule dependencies but i get the following error:
`(venv)fns-client git:(v1.0) mvn clean install /aixm-5.1

[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< us.dot.faa.swim.fns:fns-client >-------------------
[INFO] Building fns-client 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.190 s
[INFO] Finished at: 2021-03-11T21:21:49+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "/aixm-5.1". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
`

I am on macos big sur 11.1 (20C69)

(venv) ‚ûú fns-client git:(v1.0) mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 15.0.1, vendor: N/A, runtime: /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "11.1", arch: "x86_64", family: "mac"

(venv) ‚ûú fns-client git:(v1.0) java --version
java 14.0.2 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

NotamDb initalization failed due to missed message identified during initalization process

We keep getting this error while running FnsClient in our servers. Any way to resolve it?
Here is complete stack trace -

java.lang.Exception NotamDb initalization failed due to missed message identified during initalization process. LogbackBugsnagAppender.java:71 bugsnag.soschat.LogbackBugsnagAppender.extractThrowable LogbackBugsnagAppender.java:42 bugsnag.soschat.LogbackBugsnagAppender.append LogbackBugsnagAppender.java:18 bugsnag.soschat.LogbackBugsnagAppender.append AppenderBase.java:82 ch.qos.logback.core.AppenderBase.doAppend AppenderAttachableImpl.java:51 ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders Logger.java:270 ch.qos.logback.classic.Logger.appendLoopOnAppenders Logger.java:257 ch.qos.logback.classic.Logger.callAppenders Logger.java:421 ch.qos.logback.classic.Logger.buildLoggingEventAndAppend Logger.java:383 ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus Logger.java:522 ch.qos.logback.classic.Logger.error FnsClient.java:198 com.soschat.notam.source.fns.FnsClient.initalizeNotamDbFromFil FnsClient.java:366 com.soschat.notam.source.fns.FnsClient.start NotamAppListener.java:27 com.soschat.notam.source.configuration.NotamAppListener.onApplicationEvent NotamAppListener.java:14 com.soschat.notam.source.configuration.NotamAppListener.onApplicationEvent SimpleApplicationEventMulticaster.java:172 org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener SimpleApplicationEventMulticaster.java:165 org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener SimpleApplicationEventMulticaster.java:139 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent AbstractApplicationContext.java:402 org.springframework.context.support.AbstractApplicationContext.publishEvent AbstractApplicationContext.java:408 org.springframework.context.support.AbstractApplicationContext.publishEvent AbstractApplicationContext.java:359 org.springframework.context.support.AbstractApplicationContext.publishEvent EventPublishingRunListener.java:105 org.springframework.boot.context.event.EventPublishingRunListener.running SpringApplicationRunListeners.java:78 org.springframework.boot.SpringApplicationRunListeners.running SpringApplication.java:332 org.springframework.boot.SpringApplication.run SpringApplicationBuilder.java:139 org.springframework.boot.builder.SpringApplicationBuilder.run DefaultBinderFactory.java:250 org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinderInstance DefaultBinderFactory.java:174 org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder DefaultBinderFactory.java:120 org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder BindingService.java:313 org.springframework.cloud.stream.binding.BindingService.getBinder BindingService.java:214 org.springframework.cloud.stream.binding.BindingService.bindProducer BindableProxyFactory.java:262 org.springframework.cloud.stream.binding.BindableProxyFactory.createAndBindOutputs OutputBindingLifecycle.java:55 org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable LinkedHashMap.java:608 java.util.LinkedHashMap$LinkedValues.forEach AbstractBindingLifecycle.java:47 org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start OutputBindingLifecycle.java:34 org.springframework.cloud.stream.binding.OutputBindingLifecycle.start DefaultLifecycleProcessor.java:182 org.springframework.context.support.DefaultLifecycleProcessor.doStart DefaultLifecycleProcessor.java:53 org.springframework.context.support.DefaultLifecycleProcessor.access$200 DefaultLifecycleProcessor.java:360 org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start DefaultLifecycleProcessor.java:158 org.springframework.context.support.DefaultLifecycleProcessor.startBeans DefaultLifecycleProcessor.java:122 org.springframework.context.support.DefaultLifecycleProcessor.onRefresh AbstractApplicationContext.java:893 org.springframework.context.support.AbstractApplicationContext.finishRefresh ServletWebServerApplicationContext.java:163 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh AbstractApplicationContext.java:552 org.springframework.context.support.AbstractApplicationContext.refresh ServletWebServerApplicationContext.java:142 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh SpringApplication.java:775 org.springframework.boot.SpringApplication.refresh SpringApplication.java:397 org.springframework.boot.SpringApplication.refreshContext SpringApplication.java:316 org.springframework.boot.SpringApplication.run SpringApplication.java:1260 org.springframework.boot.SpringApplication.run SpringApplication.java:1248 org.springframework.boot.SpringApplication.run SpringNotamSourceApp.java:14 com.soschat.notam.source.SpringNotamSourceApp.main NativeMethodAccessorImpl.java:-2 jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 NativeMethodAccessorImpl.java:62 jdk.internal.reflect.NativeMethodAccessorImpl.invoke DelegatingMethodAccessorImpl.java:43 jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Method.java:566 java.lang.reflect.Method.invoke MainMethodRunner.java:48 org.springframework.boot.loader.MainMethodRunner.run Launcher.java:87 org.springframework.boot.loader.Launcher.launch Launcher.java:50 org.springframework.boot.loader.Launcher.launch JarLauncher.java:51 org.springframework.boot.loader.JarLauncher.main

Error while parsing xml file from SFTP server

Looks like there is some issue while parsing xml file during Notam db initialization.

java.io.IOException error ChannelSftp.java:1448 com.jcraft.jsch.ChannelSftp$2.read InflaterInputStream.java:243 java.util.zip.InflaterInputStream.fill InflaterInputStream.java:159 java.util.zip.InflaterInputStream.read GZIPInputStream.java:118 java.util.zip.GZIPInputStream.read XMLEntityManager.java:3064 com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read UTF8Reader.java:303 com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read XMLEntityScanner.java:1904 com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load XMLEntityScanner.java:1560 com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar XMLDocumentFragmentScannerImpl.java:2746 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next XMLDocumentScannerImpl.java:605 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next XMLNSDocumentScannerImpl.java:112 com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next XMLDocumentFragmentScannerImpl.java:534 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument XML11Configuration.java:888 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse XML11Configuration.java:824 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse XMLParser.java:141 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse AbstractSAXParser.java:1216 com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse SAXParserImpl.java:635 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse FilParser.java:53 com.soschat.notam.source.fil.FilParser.parseFilFile FnsClient.java:259 com.soschat.notam.source.fns.FnsClient.loadNotams FnsClient.java:188 com.soschat.notam.source.fns.FnsClient.initalizeNotamDbFromFil FnsClient.java:105 com.soschat.notam.source.fns.FnsClient$2.onMissed MissedMessageTracker.java:161 us.dot.faa.swim.utilities.MissedMessageTracker.run

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.