Giter Club home page Giter Club logo

java-example's People

Contributors

datamadic avatar johnman avatar mjosling avatar royhafin avatar weiteho avatar wenjunche avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-example's Issues

Enabling FDC3 API within a Java App

I'm following the example here (FDC3Example.java) in order to set up FDC3 communication for a proof of concept. I'm encountering an issue when trying to connect to the fdc3client using fdc3Client.connect (line 185 in the example). This never gets to either the onSuccess or the onError. I ran into the same issue when trying to run the example. I was later going through the docs here, and I found the following wrt JS:

Enabling FDC3 is as simple as adding it to your application manifest.

Therefore, I created a quick test JS app, and added "fdc3Api": true to my manifest.
Now my Java app works, since the FDC3 service has been launched and my Java app is able to connect to it.

As such, I am now looking for some way to enable the FDC3 service directly in the Java app. I have found references in the .NET API to enabling FDC3 (here and here), however have been unable to find anything of the sort for the Java API.

Any help would be appreciated, thanks in advance.


The below is an excerpt of my code. Entry point is launchOpenFin at the bottom.

    private void setUpFDC3IntentListener(String intent, JTextField textField) {
        fdc3Client.addIntentListener(intent, new IntentListener() {
            @Override
            public JSONObject onIntent(Context context) {
                textField.setText(String.format("Received Intent: %s", context.toString()));
                context.put("comment", "Java rules");
                return context;
            }
        }, new AckListener() {
            @Override
            public void onSuccess(Ack ack) {
                if (ack.isSuccessful()) {
                    System.out.println("Registered intent listener");
                } else {
                    System.out.println(String.format("Failed to register intent listener %s", ack.getReason()));
                }
            }

            @Override
            public void onError(Ack ack) {
                System.out.println(String.format("Failed to register intent listener %s", ack.getReason()));
            }
        });
    }
    
    void setUpFDC3() {
        OpenFinJavaDemo.this.fdc3Client = FDC3Client.getInstance(OpenFinJavaDemo.this.desktopConnection);

        OpenFinJavaDemo.this.fdc3Client.connect(new AckListener() {
            @Override
            public void onSuccess(Ack ack) {
                System.out.println(String.format("Connected to FDC3 service"));
                setUpFDC3IntentListener(TOPIC, fdc3ReceiptTextField);
            }

            @Override
            public void onError(Ack ack) {
                System.out.println(String.format("Failed to Connect to FDC3 service"));
            }
        });
    }

    void launchOpenFin() throws DesktopIOException, IOException, DesktopException {
        RuntimeConfiguration runtimeConfiguration = new RuntimeConfiguration();
        runtimeConfiguration.setRuntimeVersion("16.83.53.26");
        runtimeConfiguration.setAdditionalRuntimeArguments("--v=1");
        this.desktopConnection = new DesktopConnection("openfin-IAB-java-demo");
        this.desktopConnection.connect(runtimeConfiguration, new DesktopStateListener() {

            @Override
            public void onReady() {
                OpenFinJavaDemo.this.openFinSystem = new OpenFinRuntime(OpenFinJavaDemo.this.desktopConnection);
                try {
                    openFinSystem.addEventListener("application-platform-api-ready", e -> {
                        System.out.println("application-platform-api-ready: " + e.getEventObject());
                        String uuid = e.getEventObject().getString("uuid");
                        System.out.println(uuid);
                    }, null);

                    setUpFDC3();

                } catch (DesktopException e) {
                    e.printStackTrace();
                }
                SwingUtilities.invokeLater(() -> {
                    OpenFinJavaDemo.this.glassPane.setVisible(false);
                });
            }
            .
            .
            .
            .
            .
        });
    }

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.