Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
david-russell committed Nov 28, 2014
1 parent f26c257 commit 362463e
Show file tree
Hide file tree
Showing 74 changed files with 6,859 additions and 3 deletions.
102 changes: 99 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,100 @@
java-rbroker-framework
======================

Java RBroker Framework for DeployR
==================================

The Java RBroker Framework provides a simple yet powerful API that supports the
rapid integration of R Analytics inside any Java application. Simply define an
RTask, submit your task to an instance of RBroker and be notified when
your RTaskResult is available.

The framework scales effortlessly to support simple integrations through
sophisticated solutions such as high throughput, realtime scoring engines.

Links
-----

* [Download](http://deployr.revolutionanalytics.com/docanddown/#rbroker)
* [Quick Start Tutorial](http://deployr.revolutionanalytics.com/documents/dev/rbroker)
* [Framework API JavaDoc](http://deployr.revolutionanalytics.com/documents/dev/rbroker-javadoc)
* [Framework Dependencies](#dependencies)
* [Example Code](#examples)
* [License](#license)

Dependencies
============


Declarative JAR Dependencies: Maven Central Repository Artifacts
----------------------------------------------------------------

Artifacts for each official release (since 7.3.0) of the DeployR Java
RBroker Framework are published to the Maven Central repository.

[ArtifactId](http://search.maven.org/#search|ga|1|a%3A%22jRBroker%22): `jRBroker`

Using build frameworks such as Maven and Gradle your Java client
application can simply declare a dependency on the appropriate version
of the `jRBroker` artifact to ensure all required JAR dependencies are resolved
and available at runtime.


Bundled JAR Dependencies
------------------------

If you are not defining your DeployR RBroker Framework JAR dependencies using
declarative tools then you must ensure the required JAR files are placed
directly on your application CLASSPATH.

Besides the DeployR Java RBroker Framework JAR itself, `jRBroker-<version>.jar`,
the framework depends on the
[DeployR Java Client Library](https://github.com/deployr/java-client-library)
and all of it's third party JAR dependencies.

Building the Java RBroker Framework
-----------------------------------

A Gradle build script is provided to build the DeployR Java RBroker
Framework:

```
build.gradle
```

By default, the build will generate a version of the `jRBroker-<version>.jar`
file in the `build/libs` directory.

You do not need to install Gradle before running these commands. To
build the DeployR Java RBroker Framework a Unix based OS, run the following shell
script:

```
gradlew build
```

To build the DeployR Java RBroker Framework on a Windows based OS, run the following
batch file:

```
gradlew.bat build
```


Examples
========

The DeployR Java RBroker Framework ships with a number of sample applications
provided to demonstrate some of the key featues introduced by the
[Quick Start Tutorial](http://deployr.revolutionanalytics.com/documents/dev/rbroker)
for the Java client library. See
[here](examples/tutorial) for details.

License
=======

Copyright (C) 2010-2014 by Revolution Analytics Inc.

This program is licensed to you under the terms of Version 2.0 of the
Apache License. This program is distributed WITHOUT
ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) for more
details.
39 changes: 39 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apply plugin: 'java'

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: '../build/libs', include: ['*.jar'])
compile "com.revolutionanalytics.deployr:jDeployR:7.3.0"
}

jar {
baseName = 'jRBroker'
version = '7.3.0'
}

javadoc {
title = "DeployR 7.3.0 Java RBroker Framework"
options.overview = "src/main/java/overview.html"
exclude "com/revo/deployr/client/factory/RClientFactory.java"
exclude "com/revo/deployr/client/broker/task/**/*.java"
exclude "com/revo/deployr/client/broker/worker/**/*.java"
exclude "com/revo/deployr/client/broker/engine/**/*.java"
exclude "com/revo/deployr/client/broker/impl/**/*.java"
}

task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
78 changes: 78 additions & 0 deletions examples/tutorial/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Java RBroker Tutorial Example Applications
==========================================

The DeployR Java RBroker Framework ships with a number of sample applications
provided to demonstrate some of the key featues introduced by the
[Quick Start Tutorial](http://deployr.revolutionanalytics.com/documents/dev/rbroker)
for the framework.

R Analytics File Dependencies
-----------------------------

The R scripts and data models used by these example applications are
bundled by default within the DeployR repository within the
`tutorial-rbroker` directory owned by `testuser`.

However, if for any reason your DeployR repository does not contain
these files you can add them using the DeployR Repository Manager as
follows:

1. Log in as `testuser` into the Repository Manager
2. Create a new directory called `tutorial-rbroker`
3. Upload each of the files found in the `./analytics` directory
4. Set the access control on 5SecondNoOp.R to `Public`.

Running the Example Applications
--------------------------------

A Gradle build script is provided to run the example applications:

```
build.gradle
```

By default, the build configuration assumes an instance of the DeployR server
is running on `localhost`. If your instance of DeployR is running at some
other IP address then please udpate the `deployr.endpoint` property in the
configuration file as appropriate.

You do not need to install Gradle before running these commands. For
example, to run the `DiscreteBlocking` example application on a Unix based OS,
run the following shell script:

```
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteBlocking
```

To run the `DiscreteBlocking` example application on a Windows based OS,
run the following batch file:

```
gradlew.bat run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteBlocking
```

The complete list of RBroker Framework Tutorial example applications are as
follows:


```
//
// Discrete Task Broker
//
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteBlocking
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscretePolling
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteAsynchronous
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteProfiling
gradlew run -DtestClass=com.revo.deployr.tutorial.discrete.DiscreteSimulation
//
// Pooled Task Broker
//
gradlew run -DtestClass=com.revo.deployr.tutorial.pooled.PooledSimulation
//
// Background Task Broker
//
gradlew run -DtestClass=com.revo.deployr.tutorial.background.BackgroundBasics
```
1 change: 1 addition & 0 deletions examples/tutorial/analytics/5SecondNoOp.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sys.sleep(5)
Binary file added examples/tutorial/analytics/insurModel.rData
Binary file not shown.
4 changes: 4 additions & 0 deletions examples/tutorial/analytics/rtScore.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x
customerid
Sys.sleep(1)
score <- customerid * 10
29 changes: 29 additions & 0 deletions examples/tutorial/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apply plugin: 'java'
apply plugin: 'application'

applicationDefaultJvmArgs = ["-Dendpoint=http://localhost:7300/deployr",
"-Dusername=testuser",
"-Dpassword=changeme"]

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: '../../build/libs', include: ['*.jar'])
compile "com.revolutionanalytics.deployr:jDeployR:7.3.0"
}

jar {
baseName = 'rbroker-tutorial'
version = '7.3.0'
}

task execute(type:JavaExec) {
mainClassName = System.getProperty("testClass")
classpath = sourceSets.main.runtimeClasspath
}

task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/tutorial/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Sep 11 21:48:56 ICT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
Loading

0 comments on commit 362463e

Please sign in to comment.