<commit_before># Lightstreamer - Leap Motion Demo - Java Adapter #
<!-- START DESCRIPTION lightstreamer-example-leapmotion-adapter-java -->

The *Leap Motion Demo* is a simple application showing the integration between a [Leap Motion Controller](https://www.leapmotion.com/) and the [Lightstreamer Web Client library](https://lightstreamer.com/api/ls-web-client/latest/index.html).

This project shows the Data Adapter and Metadata Adapters for the *Leap Motion Demo* and how they can be plugged into Lightstreamer Server.

As an example of a client using this adapter, you may refer to the [Lightstreamer - Leap Motion Demo - HTML (LeapJS, Three.js) Client](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-client-javascript) and view the corresponding [Live Demo](http://demos.lightstreamer.com/LeapDemo/).

## Details

This demo displays a game field containing some small blocks. Each block is controlled by a different user connected to the same application through a Leap Motion Controller device. 

This adapter maintains a representation of the world containing all of the users' blocks and updates it accordingly with the clients commands.
Each block in the world can be in either one of the following statuses:

* Grabbed: in this case, all the positions are sent to the Lightstreamer server by the client. The server updates the world without any 
modification on the received position, and broadcasts the positions back to all the connected clients. 
* Released: the client only sends to the Lightstreamer server the forces to apply to its object in the world. The server broadcasts such forces to 
the clients, that are then able to update the world representation themselves, while also keeping its own world updated by 
applying such forces. Every few seconds, the server will also broadcast the current positions to re-synchronize the clients with the 
server positions. 

<!-- END DESCRIPTION lightstreamer-example-leapmotion-adapter-java -->

### The Adapter Set Configuration

This Adapter Set is configured and will be referenced by the clients as `LEAPDEMO`. 

The `adapters.xml` file for the *Leap Motion Demo*, should look like:

```xml      
<?xml version="1.0"?>

<adapters_conf id="LEAPDEMO">
    <metadata_provider>
        <adapter_class>com.lightstreamer.adapters.LeapMotionDemo.LeapMotionMetaDataAdapter</adapter_class>
    </metadata_provider>
    
    <data_provider>
        <adapter_class>com.lightstreamer.adapters.LeapMotionDemo.LeapMotionDataAdapter</adapter_class>
    </data_provider>
</adapters_conf>
```

<i>NOTE: not all configuration options of an Adapter Set are exposed by the file suggested above. 
You can easily expand your configurations using the generic template, `DOCS-SDKs/sdk_adapter_java_inprocess/doc/adapter_conf_template/adapters.xml`, as a reference.</i><br>
<br>
Please refer [here](http://www.lightstreamer.com/docs/base/Lightstreamer/DOCS-SDKs/General%20Concepts.pdf) for more details about Lightstreamer Adapters.

## Install
If you want to install a version of this demo in your local Lightstreamer Server, follow these steps:
* Download *Lightstreamer Server Vivace* (make sure you use Vivace edition, otherwise, you will see a limit on the event rate; Lightstreamer Server comes with a free non-expiring demo license for 20 connected users) from [Lightstreamer Download page](http://www.lightstreamer.com/download.htm), and install it, as explained in the `GETTING_STARTED.TXT` file in the installation home directory.
* Get the `deploy.zip` file of the [latest release](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java/releases), unzip it, and copy the just unzipped `LeapDemo` folder into the `adapters` folder of your Lightstreamer Server installation.
* Download [croftsoft](http://sourceforge.net/projects/croftsoft/files/) library and compile a `croftsoft-math.jar` version. Please make sure to include: applet, io, inlp, lang, and math packages. Copy the just compiled `croftsoft-math.jar` file in the `adapters/LeapDemo/lib` folder.
* Launch Lightstreamer Server.
* Test the Adapter, launching one of the clients listed in [Clients Using This Adapter](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java#clients-using-this-adapter).

## Build
To build your own version of `LS_leapdemo_adapters.jar`, instead of using the one provided in the `deploy.zip` file from the [Install](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java#install) section above, follow these steps:
* Clone this project
* Get the `ls-adapter-interface.jar` file from the [Lightstreamer distribution](http://www.lightstreamer.com/download) and copy it into the `lib` folder.
* Get the `log4j-1.2.17.jar` file from [Apache log4j](https://logging.apache.org/log4j/1.2/) and copy it into the `lib` folder.
* Download [croftsoft](http://sourceforge.net/projects/croftsoft/files/) library and compile a `croftsoft-math.jar` version. Please make sure to include: applet, io, inlp, lang and math packages. Put the just compiled `croftsoft-math.jar` file in the `lib` folder.
* Build the java source files in the `src` folder into a `LS_leapdemo_adapters.jar` file. Here is an example for that:
```sh
 > mkdir classes
 > javac -classpath ./lib/croftsoft-math.jar;./lib/ls-adapter-interface.jar;./lib/log4j-1.2.17.jar -d ./classes ./src/com/lightstreamer/adapters/\LeapMotionDemo/*.java ./src/com/lightstreamer/adapters/\LeapMotionDemo/engine3D/*.java ./src/com/lightstreamer/adapters/\LeapMotionDemo/room/*.java
 > jar cvf LS_leapdemo_adapters.jar -C classes com
```
* Copy the just compiled `LS_leapdemo_adapters.jar` in the `adapters/LeapDemo/lib` folder of your Lightstreamer Server installation.


## See Also <commit_msg>Revise obsolete notes<commit_after># Lightstreamer - Leap Motion Demo - Java Adapter #
<!-- START DESCRIPTION lightstreamer-example-leapmotion-adapter-java -->

The *Leap Motion Demo* is a simple application showing the integration between a [Leap Motion Controller](https://www.leapmotion.com/) and the [Lightstreamer Web Client library](https://lightstreamer.com/api/ls-web-client/latest/index.html).

This project shows the Data Adapter and Metadata Adapters for the *Leap Motion Demo* and how they can be plugged into Lightstreamer Server.

As an example of a client using this adapter, you may refer to the [Lightstreamer - Leap Motion Demo - HTML (LeapJS, Three.js) Client](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-client-javascript) and view the corresponding [Live Demo](http://demos.lightstreamer.com/LeapDemo/).

## Details

This demo displays a game field containing some small blocks. Each block is controlled by a different user connected to the same application through a Leap Motion Controller device. 

This adapter maintains a representation of the world containing all of the users' blocks and updates it accordingly with the clients commands.
Each block in the world can be in either one of the following statuses:

* Grabbed: in this case, all the positions are sent to the Lightstreamer server by the client. The server updates the world without any 
modification on the received position, and broadcasts the positions back to all the connected clients. 
* Released: the client only sends to the Lightstreamer server the forces to apply to its object in the world. The server broadcasts such forces to 
the clients, that are then able to update the world representation themselves, while also keeping its own world updated by 
applying such forces. Every few seconds, the server will also broadcast the current positions to re-synchronize the clients with the 
server positions. 

<!-- END DESCRIPTION lightstreamer-example-leapmotion-adapter-java -->

### The Adapter Set Configuration

This Adapter Set is configured and will be referenced by the clients as `LEAPDEMO`. 

The `adapters.xml` file for the *Leap Motion Demo*, should look like:

```xml      
<?xml version="1.0"?>

<adapters_conf id="LEAPDEMO">
    <metadata_provider>
        <adapter_class>com.lightstreamer.adapters.LeapMotionDemo.LeapMotionMetaDataAdapter</adapter_class>
    </metadata_provider>
    
    <data_provider>
        <adapter_class>com.lightstreamer.adapters.LeapMotionDemo.LeapMotionDataAdapter</adapter_class>
    </data_provider>
</adapters_conf>
```

<i>NOTE: not all configuration options of an Adapter Set are exposed by the file suggested above. 
You can easily expand your configurations using the generic template, `DOCS-SDKs/sdk_adapter_java_inprocess/doc/adapter_conf_template/adapters.xml`, as a reference.</i><br>
<br>
Please refer [here](http://www.lightstreamer.com/docs/base/Lightstreamer/DOCS-SDKs/General%20Concepts.pdf) for more details about Lightstreamer Adapters.

## Install
If you want to install a version of this demo in your local Lightstreamer Server, follow these steps:
* Download *Lightstreamer Server* (Lightstreamer Server comes with a free non-expiring demo license for 20 connected users; this should be preferred to using COMMUNITY edition, otherwise you would see a limit on the event rate) from [Lightstreamer Download page](http://www.lightstreamer.com/download.htm), and install it, as explained in the `GETTING_STARTED.TXT` file in the installation home directory.
* Get the `deploy.zip` file of the [latest release](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java/releases), unzip it, and copy the just unzipped `LeapDemo` folder into the `adapters` folder of your Lightstreamer Server installation.
* Download [croftsoft](http://sourceforge.net/projects/croftsoft/files/) library and compile a `croftsoft-math.jar` version. Please make sure to include: applet, io, inlp, lang, and math packages. Copy the just compiled `croftsoft-math.jar` file in the `adapters/LeapDemo/lib` folder.
* Launch Lightstreamer Server.
* Test the Adapter, launching one of the clients listed in [Clients Using This Adapter](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java#clients-using-this-adapter).

## Build
To build your own version of `LS_leapdemo_adapters.jar`, instead of using the one provided in the `deploy.zip` file from the [Install](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java#install) section above, follow these steps:
* Clone this project
* Get the `ls-adapter-interface.jar` file from the [Lightstreamer distribution](http://www.lightstreamer.com/download) and copy it into the `lib` folder.
* Get the `log4j-1.2.17.jar` file from [Apache log4j](https://logging.apache.org/log4j/1.2/) and copy it into the `lib` folder.
* Download [croftsoft](http://sourceforge.net/projects/croftsoft/files/) library and compile a `croftsoft-math.jar` version. Please make sure to include: applet, io, inlp, lang and math packages. Put the just compiled `croftsoft-math.jar` file in the `lib` folder.
* Build the java source files in the `src` folder into a `LS_leapdemo_adapters.jar` file. Here is an example for that:
```sh
 > mkdir classes
 > javac -classpath ./lib/croftsoft-math.jar;./lib/ls-adapter-interface.jar;./lib/log4j-1.2.17.jar -d ./classes ./src/com/lightstreamer/adapters/\LeapMotionDemo/*.java ./src/com/lightstreamer/adapters/\LeapMotionDemo/engine3D/*.java ./src/com/lightstreamer/adapters/\LeapMotionDemo/room/*.java
 > jar cvf LS_leapdemo_adapters.jar -C classes com
```
* Copy the just compiled `LS_leapdemo_adapters.jar` in the `adapters/LeapDemo/lib` folder of your Lightstreamer Server installation.


## See Also 
{'fraction_non_alphanumeric': 0.08904465212876428, 'fraction_numerical': 0.0036344755970924196, 'mean_word_length': 4.866497461928934, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 2, '>': 43, 'https://': 14, 'lorem ipsum': 0, 'www.': 8, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3448651', 'n_tokens_mistral': 3395, 'n_tokens_neox': 3204, 'n_words': 1245}