Skip to content

Commit

Permalink
Mvn-ize build and upgrade to log4j 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Bravo27 committed Dec 11, 2020
1 parent ad2fc55 commit 4c00c93
Show file tree
Hide file tree
Showing 18 changed files with 3,890 additions and 3,816 deletions.
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,30 @@ You can easily expand your configurations using the generic template, see the [J
Please refer [here](https://lightstreamer.com/docs/ls-server/latest/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.
* 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](https://lightstreamer.com/download/), 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.
* [Optional] Customize logging settings in log4j configuration file `LeapDemo/classes/log4j2.xml`.
* 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

TTo build your own version of `example-LeapMotion-adapter-java-0.0.1-SNAPSHOT.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, you have two options:
either use [Maven](https://maven.apache.org/) (or other build tools) to take care of dependencies and building (recommended) or gather the necessary jars yourself and build it manually.
As a precondition for compiling you need to download [croftsoft](http://sourceforge.net/projects/croftsoft/files/) library and copy the sources of applet, io, jnlp, lang and math packages into `src\main\java\` folder of this project.
For the sake of simplicity only the Maven case is detailed here.

### Maven

You can easily build and run this application using Maven through the pom.xml file located in the root folder of this project. As an alternative, you can use an alternative build tool (e.g. Gradle, Ivy, etc.) by converting the provided pom.xml file.

Assuming Maven is installed and available in your path you can build the demo by running
```sh
mvn install dependency:copy-dependencies
```
* Copy the just compiled `LS_leapdemo_adapters.jar` in the `adapters/LeapDemo/lib` folder of your Lightstreamer Server installation.



## See Also
Expand All @@ -82,5 +86,7 @@ To build your own version of `LS_leapdemo_adapters.jar`, instead of using the on

## Lightstreamer Compatibility Notes

* Compatible with Lightstreamer SDK for Java In-Process Adapters since 6.0

- Compatible with Lightstreamer SDK for Java In-Process Adapters since 7.3.
- For a version of this example compatible with Lightstreamer SDK for Java Adapters version 6.0, please refer to [this tag](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java/tree/pre_mvn).
- For a version of this example compatible with Lightstreamer SDK for Java Adapters version 5.1, please refer to [this tag](https://github.com/Lightstreamer/Lightstreamer-example-LeapMotion-adapter-java/tree/for_Lightstreamer_5.1).
2 changes: 0 additions & 2 deletions deployment_LS/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions deployment_LS/leapdemo/adapters.xml

This file was deleted.

5 changes: 0 additions & 5 deletions lib/README.md

This file was deleted.

85 changes: 85 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.lightstreamer</groupId>
<artifactId>example-LeapMotion-adapter-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>example-LeapMotion-adapter-java</name>
<url>http://maven.apache.org</url>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.lightstreamer.adapters.LeapMotionDemo.LeapMotionMetaDataAdapter</mainClass>
</configuration>
</plugin>

</plugins>
</build>

<repositories>
<repository>
<id>Twitter</id>
<name>Twitter repository</name>
<url>https://maven.twttr.com/</url>
</repository>
<repository>
<id>Anahata</id>
<name>Anahata Repository</name>
<url>http://repo.anahata.uno/artifactory/anahata-public/</url>
</repository>

</repositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.lightstreamer</groupId>
<artifactId>ls-adapter-inprocess</artifactId>
<version>7.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.jnlp/jnlp -->
<dependency>
<groupId>javax.jnlp</groupId>
<artifactId>jnlp</artifactId>
<version>7.0</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
/*
Copyright (c) Lightstreamer Srl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.lightstreamer.adapters.LeapMotionDemo;

public class Constants {

public static String USER_SUBSCRIPTION = "user_";
public static String ROOMPOSITION_SUBSCRIPTION = "roompos_";
public static String ROOMCHATLIST_SUBSCRIPTION = "roomchatlist_";

public static String SPLIT_CHAR_REG = "\\|";
public static String SPLIT_CHAR = "|";

public static final String LOGGER_CAT = "LS_demos_Logger.LeapDemo.adapters";
public static final String CHAT_CAT = "LS_demos_Logger.LeapDemo.chat";
public static final String WORLD_CAT = "LS_demos_Logger.LeapDemo.world";

public static final String USER_ID = "USER_ID";

public static final String NICK_MESSAGE = "nick|";
public static final String STATUS_MESSAGE = "status|";
public static final String VOID_STATUS_ID = "0";
public static final String ENTER_ROOM = "enter|";
public static final String EXIT_ROOM = "leave|";

public static final String GRAB_MESSAGE = "grab|";
public static final String RELEASE_MESSAGE = "release|";
public static final String MOVE_MESSAGE = "move|";

public static final int BASE_RATE = 10;
public static final int FRAME_INTERVAL = 50;


public static String getVal(String original, String type) {
if(original.indexOf(type) == 0) {
return original.substring(type.length());
}
return null;
}
}
/*
Copyright (c) Lightstreamer Srl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.lightstreamer.adapters.LeapMotionDemo;

public class Constants {

public static String USER_SUBSCRIPTION = "user_";
public static String ROOMPOSITION_SUBSCRIPTION = "roompos_";
public static String ROOMCHATLIST_SUBSCRIPTION = "roomchatlist_";

public static String SPLIT_CHAR_REG = "\\|";
public static String SPLIT_CHAR = "|";

public static final String LOGGER_CAT = "LS_demos_Logger.LeapDemo.adapters";
public static final String CHAT_CAT = "LS_demos_Logger.LeapDemo.chat";
public static final String WORLD_CAT = "LS_demos_Logger.LeapDemo.world";

public static final String USER_ID = "USER_ID";

public static final String NICK_MESSAGE = "nick|";
public static final String STATUS_MESSAGE = "status|";
public static final String VOID_STATUS_ID = "0";
public static final String ENTER_ROOM = "enter|";
public static final String EXIT_ROOM = "leave|";

public static final String GRAB_MESSAGE = "grab|";
public static final String RELEASE_MESSAGE = "release|";
public static final String MOVE_MESSAGE = "move|";

public static final int BASE_RATE = 10;
public static final int FRAME_INTERVAL = 50;


public static String getVal(String original, String type) {
if(original.indexOf(type) == 0) {
return original.substring(type.length());
}
return null;
}
}
Loading

0 comments on commit 4c00c93

Please sign in to comment.