Skip to content

Commit

Permalink
Update Java example instructions to use new repository (#216)
Browse files Browse the repository at this point in the history
* Update instructions to use new repository

* Update instructions on second page as well
  • Loading branch information
bethaitman-da authored Apr 5, 2019
1 parent 3183973 commit 52ce976
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions docs/source/app-dev/bindings-java/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ Sometimes the default settings for gRPC connections/channels are not suitable fo
Example
=======

To try out the Java Binding library, use one of the two example projects.
To try out the Java Binding library, use the `examples on GitHub <https://github.com/digital-asset/ex-java-bindings>`__: ``PingPongReactive`` or ``PingPongComponents``.

There's one with and one without the Reactive Components.
The former example does not use the Reactive Components, and the latter example does.
Both examples implement the ``PingPong`` application, which consists of:

- a DAML model with two contract templates, ``Ping`` and ``Pong``
Expand All @@ -200,8 +200,8 @@ The logic of the application is the following:
Setting up the example projects
===============================

To set up the examples project, clone the public GitHub repository at: https://github.com/digital-asset/ex-java-bindings
and follow the setup instruction in the README file. This project contains three examples of the PingPong application, built
To set up the example projects, clone the public GitHub repository at `github.com/digital-asset/ex-java-bindings <https://github.com/digital-asset/ex-java-bindings>`__
and follow the setup instruction in the `README file <https://github.com/digital-asset/ex-java-bindings/blob/master/README.rst#setting-up-the-example-projects>`__. This project contains three examples of the PingPong application, built
with gRPC (non-Reactive), Reactive and Reactive Component bindings respectively.

Example project -- Ping Pong without reactive components
Expand Down
17 changes: 9 additions & 8 deletions docs/source/app-dev/ledger-api-introduction/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,21 @@ can be added to an existing SDK project by running
a wide range of programming languages, the DAML SDK provides
pre-compiled client bindings for the Ledger API for Java. If
you are using a different programming language, please see the
`Quickstart <https://grpc.io/docs/quickstart/>`__
and `Tutorials <https://grpc.io/docs/tutorials/>`__
`gRPC quickstart <https://grpc.io/docs/quickstart/>`__
and `gRPC tutorials <https://grpc.io/docs/tutorials/>`__
section in the official gRPC documentation.

Example project - Ping Pong
===========================

The SDK provides an example project demonstrating the use of the Ledger API.
The SDK provides an example project demonstrating the use of the Ledger API with gRPC.
Read :ref:`setup-maven-project` to configure your machine to use the examples.

1. Start a new project with ``da new example-ping-pong-grpc-java ping-pong-java``. This creates a new SDK project in the folder ``./ping-pong-java`` that is comprised of a DAML model in ``daml/PingPong.daml`` and Java source code.
2. Run ``mvn compile`` to build the Java code with `Maven <https://maven.apache.org/>`__.
3. Run ``da sandbox`` to start the sandbox.
4. Run ``mvn exec:java`` to run the application.
To get the example project, ``PingPongGrpc``:

1. Clone the `repository from GitHub <https://github.com/digital-asset/ex-java-bindings>`__.

2. Follow the `setup instructions in the README <https://github.com/digital-asset/ex-java-bindings/blob/master/README.rst#setting-up-the-example-projects>`__. Use ``examples.pingpong.grpc.PingPongGrpcMain`` as the main class.

The DAML model contains two contract templates ``Ping`` and ``Pong`` to showcase how two parties
can interact via the ledger. Party ``Alice`` creates a ``Ping`` contract
Expand All @@ -75,7 +76,7 @@ who can choose to exercise the ``RespondPing`` choice on that contract. This cre
effectively starting a new ping pong cycle, until this has happened a number of times, as defined within
the DAML model.

The entry point for the Java code is the main class ``src/main/java/examples/pingpong/PingPongMain.java``.
The entry point for the Java code is the main class ``src/main/java/examples/pingpong/grpc/PingPongGrpcMain.java``.
It shows how to connect to and interact with the DML Ledger via the gRPC API.
The code is augmented with comments that describe the various parts of the code.
Each party will connect to the ledger, subscribe to the transaction stream, and send initial ``Ping`` contracts.
Expand Down

0 comments on commit 52ce976

Please sign in to comment.