-
Notifications
You must be signed in to change notification settings - Fork 155
Added Java Implementation for FDC3 appDirectory #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fdc3 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Have you considered maintaining this as a separate project from the TS implementation? Like how fdc3-dotnet is separate from the TS |
|
Hi @psmulovics , This is a reference implementation of the FDC Open API specifications using Java and springboot . This was one of the use case of the citi-hackathon. As part of this PR I have created a separate directory to house the Java implementation. It was suggested by @kriswest in the below comment to add the implementation to toolbox directory . Do let me know in case we need to place somewhere else. |
|
Hi @kriswest let me know if we could discuss on merging the PR for the Java Implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a full Java-based implementation of the FDC3 Application Directory API, including data loading, security, schema, and generated model classes.
- Adds a
V2ApplicationReaderinterface with a JSON-backed implementation and factory. - Introduces JWT‐based authentication via an interceptor and a simple user management service.
- Supplies resource files (
local.v2.json,user_db.json), application properties, OpenAPI schema, and generated model classes.
Reviewed Changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/application.properties | Sets application name, JSON path, security credentials, reader type |
| src/main/resources/user_db.json | Sample user database |
| src/main/resources/local.v2.json | Sample application directory data |
| src/main/resources/app-directory-schema-2.0.yml | OpenAPI spec for the App Directory API |
| src/main/java/com/fdc/appd/service/V2ApplicationReader.java | Defines the service interface for v2 readers |
| src/main/java/com/fdc/appd/service/V2ApplicationJsonReaderImpl.java | Implements JSON-based reader with lazy loading |
| src/main/java/com/fdc/appd/service/ApplicationReaderFactory.java | Factory selects reader implementation based on configuration |
| src/main/java/com/fdc/appd/security/UserManagementServiceImpl.java | Loads and validates users from JSON |
| src/main/java/com/fdc/appd/security/JwtUtil.java | Utility for signing and validating JWTs |
| src/main/java/com/fdc/appd/security/JwtAuthInterceptor.java | Intercepts HTTP requests to enforce JWT authentication |
| src/main/java/com/fdc/appd/model/**.java | Generated model classes from the OpenAPI schema |
Comments suppressed due to low confidence (2)
toolbox/fdc3-appd-java/fdc3-app-directory-java/src/main/resources/application.properties:5
- The property key is malformed: it should use '=' instead of '-'. Change to
spring.security.user.password=sa.
spring.security.user.password-sa
toolbox/fdc3-appd-java/fdc3-app-directory-java/src/main/java/com/fdc/appd/service/V2ApplicationJsonReaderImpl.java:38
- Potential race condition: multiple threads could initialize
allApplicationsconcurrently. Consider synchronizing the initialization or using a thread-safe lazy holder.
if(Objects.isNull(allApplications))
| /** | ||
| * | ||
| * @param appId | ||
| * @return com.fdc.appd.model.Applciation |
Copilot
AI
Jul 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the return Javadoc: 'Applciation' should be corrected to 'Application'.
| * @return com.fdc.appd.model.Applciation | |
| * @return com.fdc.appd.model.Application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @kriswest ,
I have resolved the copilot comment for this file
...ava/fdc3-app-directory-java/src/main/java/com/fdc/appd/service/ApplicationReaderFactory.java
Outdated
Show resolved
Hide resolved
| try { | ||
| userDb= objectMapper.readValue(resource.getInputStream(), new TypeReference<HashMap<String,String>>() {}); | ||
| } catch (IOException e) { | ||
| System.out.println("Error in loading Users DB"); |
Copilot
AI
Jul 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Avoid using System.out.println for error handling. Consider using a logger at ERROR level and rethrow or handle the exception properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kriswest
I have done the required changes for this comment.
|
|
||
| return Optional.of(claims); | ||
| } catch (Exception e) { | ||
| System.out.println(e); |
Copilot
AI
Jul 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Printing the exception to stdout is not ideal. Use a logger to record the stack trace and avoid exposing internal errors to standard output.
| System.out.println(e); | |
| LOGGER.log(Level.SEVERE, "Exception occurred while validating token", e); |
|
HI @kriswest I have mage the required changes as per the copilot comments . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this looks pretty solid, but just needs some tests.
I think rather than add this code here, though, we should add to https://github.com/finos-labs/fdc3-java-api and complete the Java support there.
| import org.springframework.boot.test.context.SpringBootTest; | ||
|
|
||
| @SpringBootTest | ||
| class Fdc3AppDirectoryJavaSpringApplicationTests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to see some tests here for all the endpoints that have been created, perhaps this can be done with an example AppD file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @robmoffat ,
I have added the test cases in this PR and also are part of the below PR on the suggested repository .
Kindly let me know in case any further edits are required .
Describe your change
#563
This PR provides a java implementation for FDC3 API .
Related Issue
Contributor License Agreement
Review Checklist
DesktopAgent,Channel,PrivateChannel,Listener,Bridging)?JSDoc comments on interfaces and types should be matched to the main documentation in /docs
Conformance test definitions should cover all required aspects of an FDC3 Desktop Agent implementation, which are usually marked with a MUST keyword, and optional features (SHOULD or MAY) where the format of those features is defined
The Web Connection protocol and Desktop Agent Communication Protocol schemas must be able to support all necessary aspects of the Desktop Agent API, while Bridging must support those aspects necessary for Desktop Agents to communicate with each other
npm run build) run and the results checked in?Generated code will be found at
/src/api/BrowserTypes.tsand/or/src/bridging/BridgingTypes.tsBaseContextschema applied viaallOf(as it is in existing types)?titleanddescriptionprovided for all properties defined in the schema?npm run build) run and the results checked in?Generated code will be found at
/src/context/ContextTypes.ts