Skip to content

Conversation

@amanjmd
Copy link

@amanjmd amanjmd commented Jun 23, 2025

Describe your change

#563

This PR provides a java implementation for FDC3 API .

Related Issue

Contributor License Agreement

  • I acknowledge that a contributor license agreement is required and that I have one in place or will seek to put one in place ASAP.

Review Checklist

  • Issue: If a change was made to the FDC3 Standard, was an issue linked above?
  • CHANGELOG: Is a CHANGELOG.md entry included?
  • API changes: Does this PR include changes to any of the FDC3 APIs (DesktopAgent, Channel, PrivateChannel, Listener, Bridging)?
    • Docs & Sources: If yes, were both documentation (/docs) and sources updated?

      JSDoc comments on interfaces and types should be matched to the main documentation in /docs
    • Conformance tests: If yes, are conformance test definitions (/toolbox/fdc3-conformance) still correct and complete?

      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
    • Schemas: If yes, were changes applied to the Bridging and FDC3 for Web protocol schemas?

      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
      • If yes, was code generation (npm run build) run and the results checked in?

        Generated code will be found at /src/api/BrowserTypes.ts and/or /src/bridging/BridgingTypes.ts
  • Context types: Were new Context type schemas created or modified in this PR?
    • Were the field type conventions adhered to?
    • Was the BaseContext schema applied via allOf (as it is in existing types)?
    • Was a title and description provided for all properties defined in the schema?
    • Was at least one example provided?
    • Was code generation (npm run build) run and the results checked in?

      Generated code will be found at /src/context/ContextTypes.ts
  • Intents: Were new Intents created in this PR?

@amanjmd amanjmd requested a review from a team as a code owner June 23, 2025 17:30
@netlify
Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for fdc3 ready!

Name Link
🔨 Latest commit d3137d6
🔍 Latest deploy log https://app.netlify.com/projects/fdc3/deploys/68d1a44763f75a000888e321
😎 Deploy Preview https://deploy-preview-1620.preview-fdc3.finos.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 23, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@psmulovics
Copy link
Contributor

Have you considered maintaining this as a separate project from the TS implementation? Like how fdc3-dotnet is separate from the TS

@amanjmd
Copy link
Author

amanjmd commented Jun 23, 2025

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 .
comment

Do let me know in case we need to place somewhere else.

@amanjmd
Copy link
Author

amanjmd commented Jul 8, 2025

Hi @kriswest let me know if we could discuss on merging the PR for the Java Implementation.

@bingenito bingenito requested a review from Copilot July 9, 2025 13:13
Copy link
Contributor

Copilot AI left a 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 V2ApplicationReader interface 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 allApplications concurrently. Consider synchronizing the initialization or using a thread-safe lazy holder.
        if(Objects.isNull(allApplications))

/**
*
* @param appId
* @return com.fdc.appd.model.Applciation
Copy link

Copilot AI Jul 9, 2025

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'.

Suggested change
* @return com.fdc.appd.model.Applciation
* @return com.fdc.appd.model.Application

Copilot uses AI. Check for mistakes.
Copy link
Author

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

try {
userDb= objectMapper.readValue(resource.getInputStream(), new TypeReference<HashMap<String,String>>() {});
} catch (IOException e) {
System.out.println("Error in loading Users DB");
Copy link

Copilot AI Jul 9, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Author

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);
Copy link

Copilot AI Jul 9, 2025

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.

Suggested change
System.out.println(e);
LOGGER.log(Level.SEVERE, "Exception occurred while validating token", e);

Copilot uses AI. Check for mistakes.
@kriswest kriswest changed the title Added Java Implementation for FDC3 API Added Java Implementation for FDC3 appDirectory Jul 18, 2025
@amanjmd
Copy link
Author

amanjmd commented Aug 13, 2025

HI @kriswest I have mage the required changes as per the copilot comments .
Let me know if any further changes are required.

robmoffat
robmoffat previously approved these changes Sep 10, 2025
Copy link
Member

@robmoffat robmoffat left a 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 {
Copy link
Member

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?

Copy link
Author

@amanjmd amanjmd Sep 22, 2025

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 .

finos-labs/fdc3-java-api#6

Kindly let me know in case any further edits are required .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants