<commit_before># Lightstreamer - Room-Ball Demo - Java Adapter

<!-- START DESCRIPTION lightstreamer-example-roomball-adapter-java -->

This project includes the resources needed to develop the Metadata and Data Adapters for the [Room-Ball Demo](https://github.com/Lightstreamer/Lightstreamer-example-RoomBall-client-javascript) that is pluggable into Lightstreamer Server.<br>

The *Room-Ball Demo* implements a simple pure Server-side Mode multiplayer soccer game:
* Physics runs on server side only
* User commands are streamed from clients to server
* Position updates are streamed from server to clients
* Clients are pure renderer (no feedback, no prediction, no interpolation)
 
For more information, see this slide deck from the HTML5 Developer Conference:<br>
http://www.slideshare.net/alinone/slides-html5-devconf-20131022

## Details

The project is comprised of source code and a deployment example.

### Dig the Code

#### Java Data Adapter and MetaData Adapter

A Java Adapter implementing both the [SmartDataProvider](http://www.lightstreamer.com/docs/adapter_java_inprocess_api/com/lightstreamer/interfaces/data/SmartDataProvider.html) interface and the [MetadataProviderAdapter](http://www.lightstreamer.com/docs/adapter_java_inprocess_api/com/lightstreamer/interfaces/metadata/MetadataProviderAdapter.html) interface, to inject data into Lightstreamer server with real-time information about the movement of every player in the room. The adapter accepts also message submission for the chat room.<br>
The adapter receives input commands from Lightstreamer server, which forwards messages arrived from clients to the adapter in relation to:
* Movement commands;
* Changing last message for the player.

The Metadata Adapter inherits from the reusable [LiteralBasedProvider](https://github.com/Lightstreamer/Lightstreamer-example-ReusableMetadata-adapter-java) and just adds a simple support for message submission. It should not be used as a reference, as no guaranteed delivery and no clustering support is shown.

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

### The Adapter Set Configuration

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

The `adapters.xml` file for the *Room-Ball Demo*, should look like:

```xml      
<?xml version="1.0"?>
<adapters_conf id="ROOMBALL">


    <!--
      Not all configuration options of an Adapter Set are exposed by this file. 
      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.
    -->
    
    <metadata_adapter_initialised_first>Y</metadata_adapter_initialised_first>

    <metadata_provider>
        <adapter_class>com.lightstreamer.adapters.RoomBall.RoomBallMetaAdapter</adapter_class>

        <!-- Optional configuration file for the Adapter's own logging.
             Logging is managed through log4j. -->
        <param name="log_config">adapters_log_conf.xml</param>
        <param name="log_config_refresh_seconds">10</param>
  
        <!--
          TCP port on which Sun/Oracle's JMXMP connector will be
          listening.
        -->
        <param name="jmxPort">9999</param>
        
        <messages_pool>
            <max_size>10</max_size>
            <max_free>10</max_free>
        </messages_pool>
        
        <!--
          Dimensions of the world. 
          Any changes to these parameters involves actions on the client
          side for the drawing of the room.
        -->
        <param name="world_size_x">1000</param>
        <param name="world_size_y">550</param>
        
    </metadata_provider>
    
    <data_provider>
        <adapter_class>com.lightstreamer.adapters.RoomBall.RoomBallAdapter</adapter_class>
        
        <!--
          Frame rate for physics calculations. In milliseconds.
        -->
        <param name="frameRate">10</param>

        <!--<commit_msg>Revise suggestions on dedicated pools<commit_after># Lightstreamer - Room-Ball Demo - Java Adapter

<!-- START DESCRIPTION lightstreamer-example-roomball-adapter-java -->

This project includes the resources needed to develop the Metadata and Data Adapters for the [Room-Ball Demo](https://github.com/Lightstreamer/Lightstreamer-example-RoomBall-client-javascript) that is pluggable into Lightstreamer Server.<br>

The *Room-Ball Demo* implements a simple pure Server-side Mode multiplayer soccer game:
* Physics runs on server side only
* User commands are streamed from clients to server
* Position updates are streamed from server to clients
* Clients are pure renderer (no feedback, no prediction, no interpolation)
 
For more information, see this slide deck from the HTML5 Developer Conference:<br>
http://www.slideshare.net/alinone/slides-html5-devconf-20131022

## Details

The project is comprised of source code and a deployment example.

### Dig the Code

#### Java Data Adapter and MetaData Adapter

A Java Adapter implementing both the [SmartDataProvider](http://www.lightstreamer.com/docs/adapter_java_inprocess_api/com/lightstreamer/interfaces/data/SmartDataProvider.html) interface and the [MetadataProviderAdapter](http://www.lightstreamer.com/docs/adapter_java_inprocess_api/com/lightstreamer/interfaces/metadata/MetadataProviderAdapter.html) interface, to inject data into Lightstreamer server with real-time information about the movement of every player in the room. The adapter accepts also message submission for the chat room.<br>
The adapter receives input commands from Lightstreamer server, which forwards messages arrived from clients to the adapter in relation to:
* Movement commands;
* Changing last message for the player.

The Metadata Adapter inherits from the reusable [LiteralBasedProvider](https://github.com/Lightstreamer/Lightstreamer-example-ReusableMetadata-adapter-java) and just adds a simple support for message submission. It should not be used as a reference, as no guaranteed delivery and no clustering support is shown.

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

### The Adapter Set Configuration

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

The `adapters.xml` file for the *Room-Ball Demo*, should look like:

```xml      
<?xml version="1.0"?>
<adapters_conf id="ROOMBALL">


    <!--
      Not all configuration options of an Adapter Set are exposed by this file. 
      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.
    -->
    
    <metadata_adapter_initialised_first>Y</metadata_adapter_initialised_first>

    <metadata_provider>
        <adapter_class>com.lightstreamer.adapters.RoomBall.RoomBallMetaAdapter</adapter_class>

        <!-- Optional configuration file for the Adapter's own logging.
             Logging is managed through log4j. -->
        <param name="log_config">adapters_log_conf.xml</param>
        <param name="log_config_refresh_seconds">10</param>
  
        <!--
          TCP port on which Sun/Oracle's JMXMP connector will be
          listening.
        -->
        <param name="jmxPort">9999</param>
        
        <messages_pool>
            <max_size>1000</max_size>
            <max_free>10</max_free>
        </messages_pool>
        
        <!--
          Dimensions of the world. 
          Any changes to these parameters involves actions on the client
          side for the drawing of the room.
        -->
        <param name="world_size_x">1000</param>
        <param name="world_size_y">550</param>
        
    </metadata_provider>
    
    <data_provider>
        <adapter_class>com.lightstreamer.adapters.RoomBall.RoomBallAdapter</adapter_class>
        
        <!--
          Frame rate for physics calculations. In milliseconds.
        -->
        <param name="frameRate">10</param>

        <!--
{'fraction_non_alphanumeric': 0.08318717113505388, 'fraction_numerical': 0.008268604359809572, 'mean_word_length': 3.477285473920359, 'pattern_counts': {'":': 0, '<': 83, '<?xml version=': 2, '>': 81, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3239710', 'n_tokens_mistral': 2217, 'n_tokens_neox': 2077, 'n_words': 702}