Skip to content

Commit

Permalink
Updates documentation to address Azure#89.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-buckley committed Jan 10, 2017
1 parent 1fc89fc commit bd41ae3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 44 deletions.
76 changes: 52 additions & 24 deletions samples/java_sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,38 @@ Creating a Java module is easy:

```json
{
"module name": "<<Friendly name for your module>>",
"module path": "<<path/to/java_module_host.[so|dll]>>",
"args": {
"class_path": "<<Complete java class path containing all .jar and .class files necessary>>",
"library_path": "<<path/to/dir/containing/java_module_host.[so|dll]>>",
"class_name": "<<Name of your module class>>",
"args": <<User-defined JSON configuration for your Java module>>,
"jvm_options": {
"version": <<Version number>>,
"debug": [true | false],
"debug_port": <<Remote debugging port>>,
"verbose": [true | false],
"additional_options": [
"<<Any additional options>>"
]
"loaders": [
{
"type": "java",
"name": "java",
"configuration":{
"jvm.options":{
"library.path": "<<path/to/dir/containing/java_module_host.[so|dll]>>",
"version": <<Version number>>,
"debug": [true | false],
"debug_port": <<Remote debugging port>>,
"verbose": [true | false],
"additional_options": [
"<<Any additional options>>"
]
}
}

}
}
}
],
"modules": [
{
"name": "<<Friendly name for your module>>",
"loader":{
"name": "java",
"entrypoint": {
"class.name": "<<Name of your module class>>",
"class.path": "<<Complete java class path containing all .jar and .class files necessary>>"
}
},
"args": <<User-defined JSON configuration for your Java module>>
}
}
```

According to [Java documentation](https://docs.oracle.com/javase/tutorial/essential/environment/paths.html) one may also set the CLASSPATH environment
Expand All @@ -92,16 +106,30 @@ Creating a Java module is easy:

```json
{
"jvm_options": {
"version": 4,
"debug": false,
"debug_port": 9876,
"verbose": false,
"additional_options": null
}
...
"jvm.options": {
"library.path": "<<Default search paths (see below)>>",
"version": 5,
"debug": false,
"debug_port": 9876,
"verbose": false,
"additional_options": null
}
...
}
```

**Note:** The default search locations are as follows:

On Windows:

%PROGRAMFILES%\azure_iot_gateway_sdk-{version}\lib\modules\java_module_host.dll
%PROGRAMFILES(x86)%\azure_iot_gateway_sdk-{version}\lib\modules\java_module_host.dll

On Linux:

/usr/local/lib/modules/java_module_host.so

**Note:** Since the JVM is only loaded once, the full classpath must be set and be the same across all module in a configuration. Similar to the
"jvm_options" section, if the classpath differs across configuration, creation will fail.

Expand Down
21 changes: 1 addition & 20 deletions samples/java_sample/java_devbox_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This document describes how to prepare your development environment to use the *
- [Maven 3](#installmaven)
- [Azure IoT Gateway SDK for Java](#installgw)
- [Build from source](#installgwsource)
- [Include using Maven](#installgwmaven)
- [Application Samples](#samplecode)

<a name="installjava"/>
Expand Down Expand Up @@ -112,29 +111,11 @@ Open a command prompt and use the following commands for the steps above:
The compiled JAR file with all dependencies bundled in can then be found at:
```
{IoT gateway SDK root}/bindings/java/gateway-java-binding/target/gateway-java-binding-{version}-with-deps.jar
{IoT gateway SDK root}/bindings/java/gateway-java-binding/target/gateway-java-binding-{version}.jar
```
When you're ready to build your own module in Java, include this JAR file in your project to get the interfaces and classes that you need.
<a name="installgwmaven">
### Get the Java binding for the Azure IoT Gateway SDK from Maven (as a dependency)
_This is the recommended method of including the Azure IoT Gateway SDK in your project, however this method will only work if your project is a Maven project_
_For a guide on creating a maven project, see here: https://maven.apache.org/guides/getting-started/ _
- Navigate to http://search.maven.org, search for **com.microsoft.azure.gateway** and take note of the latest version number (or the version number of whichever version of the sdk you desire to use).
In your main pom.xml file, add the Azure IoT Gateway SDK Java binding as a dependency using your desired version as follows:
```
<dependency>
<groupId>com.microsoft.azure.gateway</groupId>
<artifactId>gateway-java-binding</artifactId>
<version>1.0.0</version>
<!--This is the current version number as of the writing of this document. Yours may be different.-->
</dependency>
```
<a name="samplecode">
## Sample applications
Expand Down

0 comments on commit bd41ae3

Please sign in to comment.