- Java client library source.
- Client library tutorial examples.
- Client library unit tests.
- Client library, examples, tests build scripts.
This commit is contained in:
David Russell 2014-11-27 09:38:29 +07:00
Родитель b842f1cecf
Коммит 7d1c178fb8
267 изменённых файлов: 30311 добавлений и 3 удалений

8
LICENSE.md Normal file
Просмотреть файл

@ -0,0 +1,8 @@
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.

107
README.md
Просмотреть файл

@ -1,4 +1,105 @@
java-client-library
===================
Java Client Library for DeployR
===============================
The [DeployR API](https://github.com/deployr/server) exposes a wide range of
R analytics services to client application developers. These services are
exposed using standards based JSON/XML and are delivered by the DeployR
server as Web services over HTTP(S).
The DeployR Java client library is provided to simplify the integration of
DeployR services within Java client applications.
Links
-----
* [Download](http://deployr.revolutionanalytics.com/docanddown/#clientlib)
* [Quick Start Tutorial](http://deployr.revolutionanalytics.com/documents/dev/clientlib)
* [Client Library API JavaDoc](http://deployr.revolutionanalytics.com/documents/dev/client-javadoc)
* [DeployR API Reference Guide](http://deployr.revolutionanalytics.com/documents/dev/api-doc/guide)
* [Library Dependencies](#dependencies)
* [Example Code](#examples)
* [License](#license)
Dependencies
============
Declaractive JAR Dependencies: Maven Central Repository Artifacts
-----------------------------------------------------------------
Artifacts for each official release (since 7.3.0) of the DeployR Java client
library are published to the Maven Central repository.
[ArtifactId](http://search.maven.org/#search|ga|1|a%3A%22jDeployR%22): `jDeployR`
Using build frameworks such as Maven and Gradle your Java client
application can simply declare a dependency on the appropriate version
of the `jDeployR` artifact to ensure all required JAR dependencies are resolved
and available at runtime.
Bundled JAR Dependencies
------------------------
If you are not defining your DeployR client library JAR dependencies using
declarative tools then you must ensure the required JAR files are placed
directly on your application CLASSPATH.
Besides the DeployR Java client library JAR itself, `jDeployR-<version>.jar`,
there are a number of 3rd party JAR file dependencies. These additional JAR
file dependencies are provided for your convenience in the `lib` directory
within this repository.
Building the Java Client Library
--------------------------------
A Gradle build script is provided to build the DeployR Java client
library:
```
build.gradle
```
By default, the build will generate a version of the `jDeployR-<version>.jar`
file in the `build/libs` directory.
You do not need to install Gradle before running these commands. To
build the DeployR Java client library a Unix based OS, run the following shell
script:
```
gradlew build
```
To build the DeployR Java client library on a Windows based OS, run the following
batch file:
```
gradlew.bat build
```
Examples
========
The DeployR Java client library 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/clientlib)
for the Java client library. See
[here](examples/tutorial) for details.
The DeployR Java client library also ships with a set of unit tests. See
[here](test) 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.

49
build.gradle Normal file
Просмотреть файл

@ -0,0 +1,49 @@
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile "commons-codec:commons-codec:1.9"
compile "commons-lang:commons-lang:2.6"
compile "commons-logging:commons-logging:1.2"
compile "org.apache.httpcomponents:httpcore:4.3.2"
compile "org.apache.httpcomponents:httpmime:4.3.5"
compile "org.apache.httpcomponents:httpclient:4.3.5"
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
compile 'log4j:log4j:1.2.17'
}
jar {
baseName = 'jDeployR'
version = '7.3.0'
}
javadoc {
title = "DeployR 7.3.0 Java Client Library"
options.overview = "src/main/java/overview.html"
exclude "com/revo/deployr/client/core/**/*.java"
exclude "com/revo/deployr/client/call/**/*.java"
exclude "com/revo/deployr/client/data/impl/**/*.java"
exclude "com/revo/deployr/client/managers/impl/**/*.java"
exclude "com/revo/deployr/client/auth/impl/**/*.java"
exclude "com/revo/deployr/client/response/impl/**/*.java"
exclude "com/revo/deployr/client/util/**/*.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
}

7
examples/awt/README.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
To run the SimpleConsole example application use:
gradlew run
or
gradlew.bat run

35
examples/awt/build.gradle Normal file
Просмотреть файл

@ -0,0 +1,35 @@
apply plugin: 'java'
apply plugin: 'application'
mainClassName = 'com.revo.deployr.example.SimpleConsole'
applicationDefaultJvmArgs = ["-Dendpoint=http://localhost:7300/deployr",
"-Dusername=testuser",
"-Dpassword=changeme"]
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: '../../build/libs', include: ['*.jar'])
compile "commons-codec:commons-codec:1.9"
compile "commons-lang:commons-lang:2.6"
compile "commons-logging:commons-logging:1.2"
compile "org.apache.httpcomponents:httpcore:4.3.2"
compile "org.apache.httpcomponents:httpmime:4.3.5"
compile "org.apache.httpcomponents:httpclient:4.3.5"
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
compile 'log4j:log4j:1.2.17'
}
jar {
baseName = 'deployr-example'
version = '7.3.0'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}

Двоичные данные
examples/awt/gradle/wrapper/gradle-wrapper.jar поставляемый Normal file

Двоичный файл не отображается.

6
examples/awt/gradle/wrapper/gradle-wrapper.properties поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
#Thu Sep 11 21:49:57 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

164
examples/awt/gradlew поставляемый Executable file
Просмотреть файл

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
examples/awt/gradlew.bat поставляемый Normal file
Просмотреть файл

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Просмотреть файл

@ -0,0 +1,267 @@
/*
* SimpleConsole.java
*
* 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.
*
*/
package com.revo.deployr.example;
import com.revo.deployr.client.*;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.URL;
import java.util.ArrayList;
public class SimpleConsole extends JFrame {
JTextField id = new JTextField(System.getProperty("username"), 6);
JPasswordField pw = new JPasswordField(System.getProperty("password"), 6);
JTextField server = new JTextField(System.getProperty("endpoint"), 12);
JTextArea inputText = new JTextArea("demo(graphics)");
JTextArea outputText = new JTextArea();
JButton exeButton = new JButton("Execute Code");
JButton exeSelButton = new JButton("Execute Selected Code");
JButton cc = new JButton("Connect/Authenticate");
JButton rc = new JButton("Sign Off & Release Client");
RUser rUser = null;
RClient rClient = null;
RProject rProject = null;
public SimpleConsole() {
initComponents();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new SimpleConsole().setVisible(true);
}
});
}
private void initComponents() {
this.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
if (rClient != null) {
try {
if (rProject != null) {
rProject.close();
rProject = null;
}
rClient.logout(rUser);
} catch (RClientException ex) {
ex.printStackTrace();
} catch (RSecurityException ex) {
ex.printStackTrace();
}
rClient.release();
}
}
});
setTitle("DeployR Java Client Library Simple Console");
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel subPanel = new JPanel(new BorderLayout());
JPanel textPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel idLabel = new JLabel("Username: ");
textPanel.add(idLabel);
textPanel.add(id);
JLabel pwLabel = new JLabel("Password: ");
textPanel.add(pwLabel);
textPanel.add(pw);
JLabel sLabel = new JLabel("Server: ");
textPanel.add(sLabel);
textPanel.add(server);
cc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
createClient();
}
});
textPanel.add(cc);
rc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
releaseClient();
}
});
rc.setEnabled(false);
textPanel.add(rc);
subPanel.add(textPanel, BorderLayout.NORTH);
JPanel executePanel = new JPanel(new BorderLayout());
JPanel bp = new JPanel(new FlowLayout(FlowLayout.LEFT));
exeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String code = inputText.getText();
executeCode(code);
}
});
bp.add(exeButton);
exeButton.setEnabled(false);
exeSelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String code = inputText.getSelectedText();
if (code != null) {
executeCode(code);
}
}
});
bp.add(exeSelButton);
exeSelButton.setEnabled(false);
executePanel.add(bp, BorderLayout.NORTH);
JPanel textAreaExecutePanel = new JPanel(new GridLayout(1, 2));
JScrollPane isp = new JScrollPane(inputText);
isp.setBorder(BorderFactory.createTitledBorder("Input Code"));
textAreaExecutePanel.add(isp);
JScrollPane osp = new JScrollPane(outputText);
osp.setBorder(BorderFactory.createTitledBorder("Execute Results"));
textAreaExecutePanel.add(osp);
executePanel.add(textAreaExecutePanel, BorderLayout.CENTER);
subPanel.add(executePanel, BorderLayout.CENTER);
mainPanel.add(subPanel);
this.getContentPane().add(mainPanel);
pack();
this.setSize(800, 400);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
this.setLocation(screenSize.width / 2 - (frameSize.width / 2),
screenSize.height / 2 - (frameSize.height / 2));
}
private void createClient() {
try {
String url = server.getText();
rClient = RClientFactory.createClient(url);
RBasicAuthentication pAuthentication = new RBasicAuthentication(id.getText(), new String(pw.getPassword()));
rUser = rClient.login(pAuthentication);
if (rUser != null) {
exeButton.setEnabled(true);
exeSelButton.setEnabled(true);
cc.setEnabled(false);
rc.setEnabled(true);
}
} catch (RClientException ex) {
ex.printStackTrace();
} catch (RSecurityException ex) {
ex.printStackTrace();
}
}
private void releaseClient() {
if (rClient != null) {
try {
if (rProject != null) {
rProject.close();
rProject = null;
}
rClient.logout(rUser);
rUser = null;
} catch (RClientException ex) {
ex.printStackTrace();
} catch (RSecurityException ex) {
ex.printStackTrace();
}
rClient.release();
rClient = null;
cc.setEnabled(true);
rc.setEnabled(false);
exeButton.setEnabled(false);
exeSelButton.setEnabled(false);
}
}
private void executeCode(String code) {
if (rUser != null) {
try {
if (rProject == null) {
rProject = rUser.createProject();
}
RProjectExecution codeResult = rProject.executeCode(code);
outputText.append(codeResult.about().console + "\n");
// check for plot file
ArrayList results = (ArrayList) codeResult.about().results;
for (int i = 0; i < results.size(); i++) {
RProjectResult pr = (RProjectResult) results.get(i);
URL url = pr.about().url;
if (url != null) {
createPlotWindow(url, (i + 1) * 20, (i + 1) * 20);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
outputText.append("Please create client before executing code\n");
}
}
private void createPlotWindow(URL url, int x, int y) {
ImagePanel panel = new ImagePanel(new ImageIcon(url).getImage());
JFrame frame = new JFrame();
frame.setTitle("DeployR Graph");
frame.getContentPane().add(panel);
frame.pack();
frame.setLocation(x, y);
frame.setVisible(true);
}
class ImagePanel extends JPanel {
private Image img;
public ImagePanel(String img) {
this(new ImageIcon(img).getImage());
}
public ImagePanel(Image img) {
this.img = img;
Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
setPreferredSize(size);
setMinimumSize(size);
setMaximumSize(size);
setSize(size);
setLayout(null);
}
public void paintComponent(Graphics g) {
g.drawImage(img, 0, 0, null);
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
# Root logger option
log4j.rootLogger=INFO, stdout
# DeployR Client Library
log4j.category.com.revo.deployr.client=INFO
# Simple Console example application
log4j.category.com.revo.deployr.example=INFO
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Просмотреть файл

@ -0,0 +1,77 @@
DeployR Java Client Library Tutorial Examples
=============================================
The DeployR Java client library 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/clientlib)
for the Java client library.
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 `endpoint` property in the
configuration file as appropriate.
You do not need to install Gradle before running these commands. To run
the `Connect` example application on a Unix based OS, run the following shell
script:
```
gradlew.bat run -DtestClass=com.revo.deployr.tutorial.connection.Connect
```
To run the `Connnect` example application on a Windows based OS, run the
following batch file:
```
gradlew.bat run -DtestClass=com.revo.deployr.tutorial.connection.Connect
```
The complete list of Client Library Tutorial example applications are as
follows:
```
//
// Getting Connected
//
gradlew run -DtestClass=com.revo.deployr.tutorial.connection.Connect
//
// Authentication
//
gradlew run -DtestClass=com.revo.deployr.tutorial.authentication.Authenticate
//
// Authenticated Services - Project Services
//
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectCreate
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectDirectory
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectExecuteCode
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectExecuteScript
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectPackages
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectPoolCreate
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AuthProjectWorkspace
//
// Authenticated Services - Background Job Services
//
gradlew run -DtestClass=com.revo.deployr.tutorial.services.background.AuthJobExecuteCode
gradlew run -DtestClass=com.revo.deployr.tutorial.services.background.AuthJobExecuteScript
gradlew run -DtestClass=com.revo.deployr.tutorial.services.background.AuthJobStoreResultToRepository
//
// Authenticated Services - Repository Services
//
gradlew run -DtestClass=com.revo.deployr.tutorial.services.repository.AuthRepositoryManagement
//
// Anonymous Services
//
gradlew run -DtestClass=com.revo.deployr.tutorial.services.project.AnonProjectExecuteScript
```

Просмотреть файл

@ -0,0 +1,38 @@
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 "commons-codec:commons-codec:1.9"
compile "commons-lang:commons-lang:2.6"
compile "commons-logging:commons-logging:1.2"
compile "org.apache.httpcomponents:httpcore:4.3.2"
compile "org.apache.httpcomponents:httpmime:4.3.5"
compile "org.apache.httpcomponents:httpclient:4.3.5"
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
compile 'log4j:log4j:1.2.17'
}
jar {
baseName = 'client-tutorial'
version = '7.3.0'
}
task execute(type: JavaExec) {
mainClassName = System.getProperty("testClass")
classpath = sourceSets.main.runtimeClasspath
}
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}

Двоичные данные
examples/tutorial/gradle/wrapper/gradle-wrapper.jar поставляемый Normal file

Двоичный файл не отображается.

6
examples/tutorial/gradle/wrapper/gradle-wrapper.properties поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
#Thu Sep 11 21:50:22 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

164
examples/tutorial/gradlew поставляемый Executable file
Просмотреть файл

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
examples/tutorial/gradlew.bat поставляемый Normal file
Просмотреть файл

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Просмотреть файл

@ -0,0 +1,80 @@
/*
* Authenticate.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.authentication;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
public class Authenticate {
private static Logger log = Logger.getLogger(Authenticate.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
/*
* Connect.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.connection;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
public class Connect {
private static Logger log = Logger.getLogger(Connect.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,149 @@
/*
* AuthJobExecuteCode.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.background;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RJob;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.about.RJobDetails;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.JobExecutionOptions;
import org.apache.log4j.Logger;
public class AuthJobExecuteCode {
private static Logger log = Logger.getLogger(AuthJobExecuteCode.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
RJob rJob = null;
RProject rProject = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Submit a background job to execute an arbitrary block
* of R code.
*/
String rCode = "demo(graphics)";
JobExecutionOptions options = new JobExecutionOptions();
options.priority = JobExecutionOptions.MEDIUM_PRIORITY;
rJob = rUser.submitJobCode("Background Code Execution",
"Background code execution.",
rCode, options);
log.info("Submitted background job " +
"for execution, rJob=" + rJob);
try {
boolean jobPending = true;
while (jobPending) {
RJobDetails details = rJob.query();
if (details.status.equals(RJob.COMPLETED)) {
jobPending = false;
/*
* Retrieve the results of the background job
* execution. Based on the JobExecutionOptions
* for this example the results are found
* within an RProject generated on the
* successful completion of the job.
*/
rProject = rUser.getProject(details.project);
log.info("Retrieved background " +
"job result on project, rProject=" + rProject);
} else {
Thread.currentThread().sleep(500);
}
}
} catch (Exception wex) {
log.warn("Waiting for background job " +
"execution to complete, ex=" + wex);
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
rJob.delete();
} catch (Exception pex) {
}
try {
rProject.delete();
} catch (Exception pex) {
}
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,147 @@
/*
* AuthJobExecuteScript.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.background;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RJob;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.about.RJobDetails;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.JobExecutionOptions;
import org.apache.log4j.Logger;
public class AuthJobExecuteScript {
private static Logger log = Logger.getLogger(AuthJobExecuteScript.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
RJob rJob = null;
RProject rProject = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Submit a background job to execute a repository-managed
* script: /testuser/root/Histogram of Auto Sales.R.
*/
JobExecutionOptions options = new JobExecutionOptions();
options.priority = JobExecutionOptions.HIGH_PRIORITY;
rJob = rUser.submitJobScript("Background Script Execution",
"Background script execution.",
"Histogram of Auto Sales",
"root", "testuser", null,
options);
log.info("Submitted background job " +
"for execution, rJob=" + rJob);
try {
boolean jobPending = true;
while (jobPending) {
RJobDetails details = rJob.query();
if (details.status.equals(RJob.COMPLETED)) {
jobPending = false;
/*
* Retrieve the results of the background job
* execution. Based on the JobExecutionOptions
* for this example the results are found
* within an RProject generated on the
* successful completion of the job.
*/
rProject = rUser.getProject(details.project);
log.info("Retrieved background " +
"job result on project, rProject=" + rProject);
} else {
Thread.currentThread().sleep(500);
}
}
} catch (Exception wex) {
log.warn("Waiting for background job " +
"execution to complete, ex=" + wex);
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
rJob.delete();
} catch (Exception pex) {
}
try {
rProject.delete();
} catch (Exception pex) {
}
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,180 @@
/*
* AuthJobStoreResultToRepository.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.background;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RJob;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.about.RJobDetails;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.JobExecutionOptions;
import com.revo.deployr.client.params.ProjectStorageOptions;
import org.apache.log4j.Logger;
public class AuthJobStoreResultToRepository {
private static Logger log = Logger.getLogger(AuthJobStoreResultToRepository.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
RJob rJob = null;
RRepositoryFile rRepositoryFile = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Submit a background job to execute a block of R code
* that will generate a vector object. We will then use
* JobExecutionOtpions to request the following behavior:
*
* 1. Execute the job at low (default) priority.
* 2. Skip the persistence of results to a project.
* 3. Request the persistence of a named vector object
* as a binary R object file to the repository.
*/
String rCode = "tutorialVector <- rnorm(100)";
JobExecutionOptions options = new JobExecutionOptions();
options.priority = JobExecutionOptions.LOW_PRIORITY;
options.noproject = true;
/*
* Use ProjectStorageOptions to identify the name of one
* or more workspace objects for storage to the repository.
*
* In this case, the named object matches the name of the
* object created the rCode being executed on the job. We
* request that the binary R object file be stored into
* the root directory in the repository.
*/
options.storageOptions = new ProjectStorageOptions();
options.storageOptions.objects = "tutorialVector";
options.storageOptions.directory = "root";
rJob = rUser.submitJobCode("Background Code Execution",
"Demonstrate storing job results to repository.",
rCode, options);
log.info("Submitted background job " +
"for execution, rJob=" + rJob);
try {
boolean jobPending = true;
while (jobPending) {
RJobDetails details = rJob.query();
if (details.status.equals(RJob.COMPLETED)) {
jobPending = false;
/*
* Retrieve the results of the background job
* execution. Given the custom JobExecutionOptions
* specified for this job (noproject=true) there will
* be no RProject to hold the results.
*
* However, the custom JobExecutionOptions specified
* for this job requested the storage of the
* "tutorialVector" vectory object as a binary R
* object file (.rData) in the repository.
*
* The following code demonstrates how we can
* retrieve that result from the repository:
*/
rRepositoryFile =
rUser.fetchFile("tutorialVector.rData",
"root",
System.getProperty("username"),
null);
log.info("Retrieved background " +
"job result from repository, rRepositoryFile=" + rRepositoryFile);
} else {
Thread.currentThread().sleep(500);
}
}
} catch (Exception wex) {
log.warn("Waiting for background job " +
"execution to complete, ex=" + wex);
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
rJob.delete();
} catch (Exception pex) {
}
try {
rRepositoryFile.delete();
} catch (Exception pex) {
}
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,98 @@
/*
* AnonProjectExecuteScript.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProjectFile;
import com.revo.deployr.client.RProjectResult;
import com.revo.deployr.client.RScriptExecution;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
import java.util.List;
public class AnonProjectExecuteScript {
private static Logger log = Logger.getLogger(AnonProjectExecuteScript.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Execute a public analytics Web service as an anonymous
* user based on a repository-managed R script:
* /testuser/root/Histogram of Auto Sales.R.
*
* Optionally:
* AnonymousProjectExecutionOptions options =
* new AnonymousProjectExecutionOptions();
*
* Populate options as needed, then:
*
* RScriptExecution exec =
* rClient.executeScript(filename, directory, author options);
*/
RScriptExecution exec =
rClient.executeScript("Histogram of Auto Sales",
"root", "testuser", null,
null);
log.info("Public repository-managed " +
"script execution completed, rScriptExecution=" + exec);
/*
* Retrieve script execution results.
*/
String console = exec.about().console;
List<RProjectResult> plots = exec.about().results;
List<RProjectFile> files = exec.about().artifacts;
List<RData> objects = exec.about().workspaceObjects;
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,111 @@
/*
* AnonProjectExecuteScriptInOut.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProjectFile;
import com.revo.deployr.client.RProjectResult;
import com.revo.deployr.client.RScriptExecution;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.data.RNumericVector;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.factory.RDataFactory;
import com.revo.deployr.client.params.AnonymousProjectExecutionOptions;
import org.apache.log4j.Logger;
import java.util.Arrays;
import java.util.List;
public class AnonProjectExecuteScriptInOut {
private static Logger log = Logger.getLogger(AnonProjectExecuteScriptInOut.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Execute a public analytics Web service as an anonymous
* user based on a repository-managed R script:
* /testuser/root/DeployR - Hello World.R
*
* Create the AnonymousProjectExecutionOptions object·
* to specify inputs and output to the script.
* The R object that is an input to the script is:
* 'input_randomNum'.
* The R object that we want to retrieve after script execution is:
* 'x'.
*/
AnonymousProjectExecutionOptions options =
new AnonymousProjectExecutionOptions();
RData randNum = RDataFactory.createNumeric("input_randomNum", 100);
options.rinputs = Arrays.asList(randNum);
options.routputs = Arrays.asList("x");
RScriptExecution exec =
rClient.executeScript("DeployR - Hello World.R",
"root", "testuser", null, options);
log.info("Public " +
"repository-managed script execution completed, " +
"rScriptExecution=" + exec);
/*
* Retrieve script execution results.
*/
String console = exec.about().console;
List<RProjectResult> plots = exec.about().results;
List<RProjectFile> files = exec.about().artifacts;
List<RData> objects = exec.about().workspaceObjects;
RNumericVector xVec = (RNumericVector) objects.get(0);
log.info("Public " +
"repository-managed script execution completed, " +
"retrieved encoded R object=" + xVec);
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,97 @@
/*
* AuthProjectCreate.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
public class AuthProjectCreate {
private static Logger log = Logger.getLogger(AuthProjectCreate.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("Created temporary " +
"R session, rProject=" + rProject);
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,143 @@
/*
* AuthProjectDirectory.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RProjectFile;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.DirectoryUploadOptions;
import org.apache.log4j.Logger;
import java.net.URL;
import java.util.List;
public class AuthProjectDirectory {
private static Logger log = Logger.getLogger(AuthProjectDirectory.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("Created temporary " +
"R session, rProject=" + rProject);
/*
* Create a file in the R session's working directory
* by writing text to a named file.
*/
DirectoryUploadOptions options = new DirectoryUploadOptions();
options.filename = "hello.txt";
String fileContent = "Hello World!";
RProjectFile rProjectFile =
rProject.writeFile(fileContent, options);
/*
* Download working directory file content using
* standard Java URL.
*/
URL fileURL = rProjectFile.download();
/*
* Retrieve a list of files in the R session's
* working directory.
*/
List<RProjectFile> files = rProject.listFiles();
for (RProjectFile file : files) {
log.info("Working directory, " +
"found file name=" +
file.about().filename + ", type=" +
file.about().type + ", size=" +
file.about().size);
try {
file.delete();
log.info("Working directory, " +
"deleted file name=" +
file.about().filename + ", type=" +
file.about().type + ", size=" +
file.about().size);
} catch (Exception dex) {
log.warn("File=" + file +
", deletion ex=" + dex);
}
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,125 @@
/*
* AuthProjectExecuteCode.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.*;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
import java.util.List;
public class AuthProjectExecuteCode {
private static Logger log = Logger.getLogger(AuthProjectExecuteCode.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("AuthProjectExecuteCode: using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("AuthProjectExecuteCode: established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("AuthProjectExecuteCode: established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("AuthProjectExecuteCode: created temporary " +
"R session, rProject=" + rProject);
/*
* Execute an analytics Web service based on an arbitrary
* block of R code.
*
* Optionally:
* ProjectExecutionOptions options =
* new ProjectExecutionOptions();
*
* Populate options as needed, then:
*
* exec =
* rProject.executeCode(rCode, options);
*/
String rCode = "demo(graphics)";
RProjectExecution exec = rProject.executeCode(rCode);
log.info("AuthProjectExecuteCode: R code " +
"execution completed, rProjectExecution=" + exec);
/*
* Retrieve script execution results.
*/
String console = exec.about().console;
List<RProjectResult> plots = exec.about().results;
List<RProjectFile> files = exec.about().artifacts;
List<RData> objects = exec.about().workspaceObjects;
} catch (Exception ex) {
log.warn("AuthProjectExecuteCode: ex=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,127 @@
/*
* AuthProjectExecuteScript.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.*;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.ProjectExecutionOptions;
import org.apache.log4j.Logger;
import java.util.List;
public class AuthProjectExecuteScript {
private static Logger log = Logger.getLogger(AuthProjectExecuteScript.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("Created temporary " +
"R session, rProject=" + rProject);
/*
* Execute an analytics Web service based on a repository-managed
* R script: /testuser/root/Histogram of Auto Sales.R.
*
* Optionally:
* ProjectExecutionOptions options =
* new ProjectExecutionOptions();
*
* Populate options as needed, then:
*
* exec =
* rProject.executeScript(filename, directory, author options);
*/
RProjectExecution exec =
rProject.executeScript("Histogram of Auto Sales",
"root", "testuser", null, (ProjectExecutionOptions) null);
log.info("Repository-managed script " +
"execution completed, rProjectExecution=" + exec);
/*
* Retrieve script execution results.
*/
String console = exec.about().console;
List<RProjectResult> plots = exec.about().results;
List<RProjectFile> files = exec.about().artifacts;
List<RData> objects = exec.about().workspaceObjects;
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,113 @@
/*
* AuthProjectPackages.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RProjectPackage;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import org.apache.log4j.Logger;
import java.util.List;
public class AuthProjectPackages {
private static Logger log = Logger.getLogger(AuthProjectPackages.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("Created temporary " +
"R session, rProject=" + rProject);
/*
* Retrieve a list of R packages that are current
* attached on the R session.
*/
List<RProjectPackage> pkgs = rProject.listPackages(false);
for (RProjectPackage pkg : pkgs) {
log.info("R session, " +
"found attached R package name=" +
pkg.about().name + ", repo=" +
pkg.about().repo + ", version=" +
pkg.about().version);
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,98 @@
/*
* AuthProjectPoolCreate.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.ProjectCreationOptions;
import org.apache.log4j.Logger;
import java.util.List;
public class AuthProjectPoolCreate {
private static Logger log = Logger.getLogger(AuthProjectPoolCreate.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a pool of temporary projects (R sessions).
*
* Population options as needed.
*/
int requestedPoolSize = 4;
ProjectCreationOptions options =
new ProjectCreationOptions();
List<RProject> pool =
rUser.createProjectPool(requestedPoolSize, options);
log.info("Created pool of " +
pool.size() + " temporary R sessions, pool=" + pool);
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,167 @@
/*
* AuthProjectWorkspace.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.project;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RProject;
import com.revo.deployr.client.RProjectExecution;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.data.RBoolean;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.data.RNumericVector;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.factory.RDataFactory;
import org.apache.log4j.Logger;
import java.util.Arrays;
import java.util.List;
public class AuthProjectWorkspace {
private static Logger log = Logger.getLogger(AuthProjectWorkspace.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a temporary project (R session).
*
* Optionally:
* ProjectCreationOptions options =
* new ProjectCreationOptions();
*
* Populate options as needed, then:
*
* rProject = rUser.createProject(options);
*/
RProject rProject = rUser.createProject();
log.info("Created temporary " +
"R session, rProject=" + rProject);
/*
* Execute a block of R code to create an object
* in the R session's workspace.
*/
String rCode = "x <- T";
RProjectExecution exec = rProject.executeCode(rCode);
/*
* Retrieve the object "x" from the R session's workspace.
*/
RData encodedX = rProject.getObject("x");
log.info("Retrieved object x " +
"from workspace, encodedX=" + encodedX);
if (encodedX instanceof RBoolean) {
RBoolean xBool = (RBoolean) encodedX;
Boolean xValue = xBool.getValue();
}
/*
* Create R object data in the R sesssion's workspace
* by pushing DeployR-encoded data from the client application.
*
* - Prepare sample R object vector data.
* - Use RDataFactory to encode the sample R object vector data.
* - Push encoded R object into the workspace.
*/
List<Double> vectorValues =
Arrays.asList(10.0, 11.1, 12.2, 13.3, 14.4);
RData encodedY =
RDataFactory.createNumericVector("y", vectorValues);
rProject.pushObject(encodedY);
/*
* Retrieve the DeployR-encoding of the R object
* from the R session's workspace.
*/
encodedY = rProject.getObject("y");
log.info("Retrieved object y " +
"from workspace, encodedY=" + encodedY);
if (encodedY instanceof RNumericVector) {
RNumericVector numVector = (RNumericVector) encodedY;
List<Double> numVectorValues = numVector.getValue();
}
/*
* Retrieve a list of R objects in the R session's workspace.
*
* Optionally:
* ProjectWorkspaceOptions options =
* new ProjectWorkspaceOptions();
*
* Populate options as needed, then:
*
* objs = rProject.listObjects(options);
*
*/
List<RData> objs = rProject.listObjects();
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,124 @@
/*
* AuthRepositoryManagement.java
*
* 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.
*
*/
package com.revo.deployr.tutorial.services.repository;
import com.revo.deployr.client.RClient;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RUser;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.auth.basic.RBasicAuthentication;
import com.revo.deployr.client.factory.RClientFactory;
import com.revo.deployr.client.params.RepoUploadOptions;
import org.apache.log4j.Logger;
import java.net.URL;
import java.util.List;
public class AuthRepositoryManagement {
private static Logger log = Logger.getLogger(AuthRepositoryManagement.class);
public static void main(String args[]) throws Exception {
RClient rClient = null;
RRepositoryFile rRepositoryFile = null;
try {
/*
* Determine DeployR server endpoint.
*/
String endpoint = System.getProperty("endpoint");
log.info("Using endpoint=" + endpoint);
/*
* Establish RClient connection to DeployR server.
*
* An RClient connection is the mandatory starting
* point for any application using the client library.
*/
rClient = RClientFactory.createClient(endpoint);
log.info("Established anonymous " +
"connection, rClient=" + rClient);
/*
* Build a basic authentication token.
*/
RAuthentication rAuth =
new RBasicAuthentication(System.getProperty("username"),
System.getProperty("password"));
/*
* Establish an authenticated handle with the DeployR
* server, rUser.
*/
RUser rUser = rClient.login(rAuth);
log.info("Established authenticated " +
"connection, rUser=" + rUser);
/*
* Create a file in the authenticated user's private
* repository and set shared access on the file so
* other authenticated users can access the file.
*/
RepoUploadOptions options = new RepoUploadOptions();
options.filename = "hello.txt";
options.shared = true;
String fileContent = "Hello World!";
rRepositoryFile = rUser.writeFile(fileContent, options);
/*
* Download working directory file content using
* standard Java URL.
*/
URL fileURL = rRepositoryFile.download();
/*
* Retrieve a list of files in the authenticated user's
* private repository.
*/
List<RRepositoryFile> files = rUser.listFiles();
for (RRepositoryFile file : files) {
log.info("Private repository, " +
"found file name=" +
file.about().filename + ", directory=" +
file.about().directory + ", access=" +
file.about().access);
}
} catch (Exception ex) {
log.warn("Runtime exception=" + ex);
} finally {
try {
rRepositoryFile.delete();
} catch (Exception rex) {
}
try {
if (rClient != null) {
/*
* Release rClient connection before application exits.
*/
rClient.release();
}
} catch (Exception fex) {
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
# Root logger option
log4j.rootLogger=INFO, stdout
# DeployR Client Library Tutorial Examples
log4j.category.com.revo.deployr.tutorial=INFO
# DeployR Client Library
log4j.category.com.revo.deployr.client=INFO
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p %c{1}: - %m%n

Двоичные данные
gradle/wrapper/gradle-wrapper.jar поставляемый Normal file

Двоичный файл не отображается.

6
gradle/wrapper/gradle-wrapper.properties поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
#Thu Sep 11 11:11:40 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

164
gradlew поставляемый Executable file
Просмотреть файл

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat поставляемый Normal file
Просмотреть файл

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Двоичные данные
lib/apache-mime4j-0.6.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/commons-codec-1.6.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/commons-lang-2.1.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/commons-logging-1.1.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/httpclient-4.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/httpcore-4.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/httpmime-4.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/jackson-annotations-2.2.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/jackson-core-2.2.3.jar Normal file

Двоичный файл не отображается.

Двоичные данные
lib/jackson-databind-2.2.3.jar Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,216 @@
/*
* RClient.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.auth.RAuthentication;
import com.revo.deployr.client.params.AnonymousProjectExecutionOptions;
import java.net.URL;
/**
* Represents a DeployR client connection.
* Supports top level DeployR API calls and provides access
* to the DeployR Service Management objects.
*/
public interface RClient {
/**
* Authenticate with the DeployR server.
*
* @param pAuthentication - an authentication token.
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RUser
*/
public RUser login(RAuthentication pAuthentication)
throws RClientException, RSecurityException;
/**
* Authenticate with the DeployR server.
*
* @param pAuthentication - an authentication token.
* @param disableautosave - when true, disables persistent project auto-save semantics for duration of user session.
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RUser login(RAuthentication pAuthentication, boolean disableautosave)
throws RClientException, RSecurityException;
/**
* Logout from the DeployR server.
*
* @param user a managed user reference
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void logout(RUser user) throws RClientException, RSecurityException;
/**
* Execute a single repository-managed script or a chain of
* repository-managed scripts on an anonymous project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
* @deprecated As of release 7.1, use executeScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
@Deprecated
public RScriptExecution executeScript(String scriptName,
String scriptAuthor,
String scriptVersion)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of
* repository-managed scripts on an anonymous project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
* @deprecated As of release 7.1, use executeScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
@Deprecated
public RScriptExecution executeScript(String scriptName,
String scriptAuthor,
String scriptVersion,
AnonymousProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of repository-managed scripts
* on an anonymous project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
*/
public RScriptExecution executeScript(String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of repository-managed scripts
* on an anonymous project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
*/
public RScriptExecution executeScript(String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
AnonymousProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single script found on a URL/path or a chain of scripts found on a set of URLs/paths
* on an anonymous project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the externalSource parameter.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
* <p/>
* POWER_USER privileges are required for this call.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
*/
public RScriptExecution executeExternal(String externalSource,
AnonymousProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of repository-managed scripts
* on an anonymous project and render the outputs to a HTML page.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
*/
public URL renderScript(String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
AnonymousProjectExecutionOptions options)
throws RClientException,
RDataException;
/**
* Interrupts the current execution on the HTTP blackbox project associated
* with the current HTTP session.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RScriptExecution
*/
public void interruptScript() throws RClientException, RSecurityException;
/**
* Shutdown the client connection releasing any resources
* associated with the connection. If needed, the user will
* be automatically logged out as a result of this call.
*/
public void release();
}

Просмотреть файл

@ -0,0 +1,39 @@
/*
* RClientException.java
*
* 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.
*
*/
package com.revo.deployr.client;
/**
* Exception thrown when RClient fails to complete call.
*/
public class RClientException extends Exception {
public int errorCode = 400;
public RClientException(String message) {
super(message);
}
public RClientException(String message, int errorCode) {
super(message);
this.errorCode = errorCode;
}
public RClientException(String message, Throwable cause) {
super(message, cause);
}
public RClientException(String message, Throwable cause, int errorCode) {
super(message, cause);
this.errorCode = errorCode;
}
}

Просмотреть файл

@ -0,0 +1,24 @@
/*
* RDataException.java
*
* 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.
*
*/
package com.revo.deployr.client;
/**
* Exception thrown when parsing or invalid constraint errors
* arise processing RData inputs on DeployR API calls.
*/
public class RDataException extends Exception {
public RDataException(String message) {
super(message);
}
}

Просмотреть файл

@ -0,0 +1,29 @@
/*
* RGridException.java
*
* 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.
*
*/
package com.revo.deployr.client;
/**
* Exception thrown when the DeployR grid determines an operation
* exceeds runtime limits set by Server Policies or when the grid
* is simply at resource exhaustion and incapable of accepting
* additional operations at this time.
*/
public class RGridException extends Exception {
public int errorCode;
public RGridException(String message, int errorCode) {
super(message);
this.errorCode = errorCode;
}
}

Просмотреть файл

@ -0,0 +1,67 @@
/*
* RJob.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RJobDetails;
/**
* Represents a DeployR managed job.
*/
public interface RJob {
/**
* About job.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RJobDetails
*/
public RJobDetails about() throws RClientException, RSecurityException;
/**
* Query job.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RJobDetails
*/
public RJobDetails query() throws RClientException, RSecurityException;
/**
* Cancel job.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RJobDetails
*/
public RJobDetails cancel() throws RClientException, RSecurityException;
/**
* Delete job.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void delete() throws RClientException, RSecurityException;
public static final String SCHEDULED = "Scheduled";
public static final String QUEUED = "Queued";
public static final String RUNNING = "Running";
public static final String COMPLETED = "Completed";
public static final String CANCELLED = "Cancelled";
public static final String INTERRUPTED = "Interrupted";
public static final String FAILED = "Failed";
public static final String ABORTED = "Aborted";
}

Просмотреть файл

@ -0,0 +1,188 @@
/*
* RProject.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectDetails;
import com.revo.deployr.client.api.RProjectDirectoryCalls;
import com.revo.deployr.client.api.RProjectExecuteCalls;
import com.revo.deployr.client.api.RProjectPackageCalls;
import com.revo.deployr.client.api.RProjectWorkspaceCalls;
import com.revo.deployr.client.params.ProjectCloseOptions;
import com.revo.deployr.client.params.ProjectDropOptions;
import java.net.URL;
/**
* Represents a DeployR managed project.
*/
public interface RProject extends
RProjectExecuteCalls, RProjectWorkspaceCalls, RProjectDirectoryCalls, RProjectPackageCalls {
/**
* About project.
*
* @see RProjectDetails
*/
public RProjectDetails about();
/**
* Ping project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public boolean ping() throws RClientException, RSecurityException;
/**
* Update project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails update(RProjectDetails about) throws RClientException, RSecurityException;
/**
* Grant project authorship to another user.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails grant(String username) throws RClientException, RSecurityException;
/**
* Save project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails save() throws RClientException, RSecurityException;
/**
* Save project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails save(RProjectDetails details) throws RClientException, RSecurityException;
/**
* Save project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails save(RProjectDetails details, ProjectDropOptions dropOptions) throws RClientException, RSecurityException;
/**
* Save-as project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProject
*/
public RProject saveAs(RProjectDetails details) throws RClientException, RSecurityException;
/**
* Save-as project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProject
*/
public RProject saveAs(RProjectDetails details, ProjectDropOptions dropOptions) throws RClientException, RSecurityException;
/**
* Recycle R session on project.
* <p/>
* Recycles the R session associated with the project by deleting all
* R objects from the workspace and all files from the working directory.
* <p/>
* Recommended for temporary and blackbox projects. Recycle persistent projects
* with caution as this operation can not be reversed.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails recycle()
throws RClientException, RSecurityException;
/**
* Recycle R session on project.
* <p/>
* Recycles the R session associated with the project by deleting all
* R objects from the workspace and all files from the working directory.
* <p/>
* Workspace objects and/or directory files can be preserved on a recycle
* by enabling the respective parameter.
* <p/>
* Recycling a project is a convenient and efficient alternative to
* starting over by closing an existing project and then creating a new project.
* <p/>
* Recommended for temporary and blackbox projects. Recycle persistent projects
* with caution as this operation can not be reversed.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectDetails
*/
public RProjectDetails recycle(boolean preserveWorkspace,
boolean preserveDirectory)
throws RClientException, RSecurityException;
/**
* Close project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void close() throws RClientException, RSecurityException;
/**
* Close project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see ProjectCloseOptions
*/
public void close(ProjectCloseOptions options) throws RClientException, RSecurityException;
/**
* Delete project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void delete() throws RClientException, RSecurityException;
/**
* Export project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL export() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,65 @@
/*
* RProjectExecution.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectExecutionDetails;
import java.net.URL;
import java.util.List;
/**
* Represents a DeployR project execution.
*/
public interface RProjectExecution {
/**
* About project execution.
*
* @see RProjectExecutionDetails
*/
public RProjectExecutionDetails about();
/**
* Flush execution.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void flush() throws RClientException, RSecurityException;
/**
* List execution results.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectResult> listResults() throws RClientException, RSecurityException;
/**
* Download execution results.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL downloadResults() throws RClientException, RSecurityException;
/**
* Delete execution results.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void deleteResults() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,70 @@
/*
* RProjectFile.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectFileDetails;
import com.revo.deployr.client.params.RepoUploadOptions;
import java.net.URL;
/**
* Represents a DeployR project directory file.
*/
public interface RProjectFile {
/**
* About project directory file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectFileDetails
*/
public RProjectFileDetails about() throws RClientException, RSecurityException;
/**
* Update project directory file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectFileDetails
*/
public RProjectFile update(String name, String descr, boolean overwrite) throws RClientException, RSecurityException;
/**
* Store project directory file in repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectFileDetails
*/
public RRepositoryFile store(RepoUploadOptions options) throws RClientException, RSecurityException;
/**
* Delete project directory file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectFileDetails
*/
public void delete() throws RClientException, RSecurityException;
/**
* Download project directory file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectFileDetails
*/
public URL download() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,31 @@
/*
* RProjectPackage.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectPackageDetails;
/**
* Represents a DeployR project package dependency.
*/
public interface RProjectPackage {
/**
* About managed project R package.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RProjectPackageDetails
*/
public RProjectPackageDetails about() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,38 @@
/*
* RProjectResult.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectResultDetails;
/**
* Represents a DeployR project execution result.
*/
public interface RProjectResult {
/**
* About project execution.
*
* @see RProjectResultDetails
*/
public RProjectResultDetails about();
/**
* Delete execution result.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void delete() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,100 @@
/*
* RRepositoryDirectory.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RRepositoryDirectoryDetails;
import com.revo.deployr.client.params.RepoAccessControlOptions;
import com.revo.deployr.client.params.RepoUploadOptions;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
/**
* Represents a DeployR repository-managed directory.
*/
public interface RRepositoryDirectory {
public static final String ROOT = "root";
/**
* About managed repository directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryDirectoryDetails
*/
public RRepositoryDirectoryDetails about() throws RClientException, RSecurityException;
/**
* Update access-controls on files found in repository-managed user directory.
* <p/>
* If the files parameter is null, all files in the directory are updated.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void update(RepoAccessControlOptions options,
List<RRepositoryFile> files)
throws RClientException, RSecurityException;
/**
* Upload files in a zip archive to repository-managed user directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void upload(InputStream fileStream, RepoUploadOptions options)
throws RClientException, RSecurityException;
/**
* Archive files found in repository-managed user directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RUser
*/
public RRepositoryDirectory archive(String archiveDirectoryName,
List<RRepositoryFile> files)
throws RClientException, RSecurityException;
/**
* Rename repository-managed user directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryDirectory rename(String newDirectoryName)
throws RClientException, RSecurityException;
/**
* Download zip archive of files found in repository-managed user directory.
* <p/>
* If the files parameter is null, all files in the directory are downloaded.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL download(List<RRepositoryFile> files) throws RClientException, RSecurityException;
/**
* Delete repository-managed user directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryDirectoryDetails
*/
public void delete() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,110 @@
/*
* RRepositoryFile.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RRepositoryFileDetails;
import java.net.URL;
import java.util.List;
/**
* Represents a DeployR managed repository file.
*/
public interface RRepositoryFile {
/**
* About managed repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public RRepositoryFileDetails about() throws RClientException, RSecurityException;
/**
* Retrieve versions of this managed repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public List<RRepositoryFile> versions() throws RClientException, RSecurityException;
/**
* Grant or revoke repository file to/from another user.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public RRepositoryFile grant(String newauthor, String revokeauthor) throws RClientException, RSecurityException;
/**
* Revert repository file to an earlier version.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public RRepositoryFile revert(RRepositoryFile fileVersion, String descr, String restricted, boolean shared, boolean published) throws RClientException, RSecurityException;
/**
* Update repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public RRepositoryFile update(String restricted, boolean shared, boolean published, String descr) throws RClientException, RSecurityException;
/**
* Update repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public RRepositoryFile update(String restricted, boolean shared, boolean published, String descr, String inputs, String outputs) throws RClientException, RSecurityException;
/**
* Diff managed repository file version against the latest version.
* Available only for text based files in the repository. Generates
* a HTML encoded response diff.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public URL diff() throws RClientException, RSecurityException;
/**
* Download managed repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public URL download() throws RClientException, RSecurityException;
/**
* Delete managed repository file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @see RRepositoryFileDetails
*/
public void delete() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,28 @@
/*
* RScriptExecution.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RProjectExecutionDetails;
/**
* Represents a DeployR script execution.
*/
public interface RScriptExecution {
/**
* About script execution.
*
* @see RProjectExecutionDetails
*/
public RProjectExecutionDetails about();
}

Просмотреть файл

@ -0,0 +1,39 @@
/*
* RSecurityException.java
*
* 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.
*
*/
package com.revo.deployr.client;
/**
* Exception thrown when DeployR security conditions not met.
*/
public class RSecurityException extends Exception {
/**
* Denotes unauthenciated call.
*/
public static int AUTHENTICATION = 401;
/**
* Denotes unauthorized call.
*/
public static int AUTHORIZATION = 403;
/**
* Denotes concurrency conflict on call.
*/
public static int CONFLICT = 409;
public int errorCode;
public RSecurityException(String message, int errorCode) {
super(message);
this.errorCode = errorCode;
}
}

Просмотреть файл

@ -0,0 +1,34 @@
/*
* RUser.java
*
* 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.
*
*/
package com.revo.deployr.client;
import com.revo.deployr.client.about.RUserDetails;
import com.revo.deployr.client.api.*;
/**
* Represents a DeployR managed user.
*/
public interface RUser extends RUserProjectCalls,
RUserRepositoryDirectoryCalls,
RUserRepositoryFileCalls,
RUserRepositoryScriptCalls,
RUserJobCalls {
/**
* Retrieve details about user.
*
* @return RUserDetails
*/
public RUserDetails about();
}

Просмотреть файл

@ -0,0 +1,20 @@
/*
* RDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
/**
* Details marker interface.
*/
public interface RDetails {
}

Просмотреть файл

@ -0,0 +1,118 @@
/*
* RJobDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
/**
* Managed job details.
*/
public class RJobDetails {
public RJobDetails(String id, String name, String descr, String status, String statusMsg, long schedstart, int schedrepeat, long schedinterval, int onrepeat, String project, long timeStart, long timeCode, long timeTotal, String tag) {
this.id = id;
this.name = name;
this.descr = descr;
this.status = status;
this.statusMsg = statusMsg;
this.schedstart = schedstart;
this.schedrepeat = schedrepeat;
this.schedinterval = schedinterval;
this.onrepeat = onrepeat;
this.project = project;
this.timeStart = timeStart;
this.timeCode = timeCode;
this.timeTotal = timeTotal;
this.tag = tag;
}
/**
* Job id.
*/
public final String id;
/**
* Job name.
*/
public final String name;
/**
* Job description.
*/
public final String descr;
/**
* Job status.
*/
public final String status;
/**
* Job statusMsg.
*/
public final String statusMsg;
/**
* Job scheduled start time (UTC).
*/
public final long schedstart;
/**
* Job scheduled repeat count.
*/
public final int schedrepeat;
/**
* Job scheduled repeat interval.
*/
public final long schedinterval;
/**
* Job on repeat.
*/
public final int onrepeat;
/**
* Job generated project identifier.
*/
public final String project;
/**
* Start time (millis) for job. Can be used in conjunction with timeCode
* and timeTotal to profile job runtime characteristics.
*/
public final long timeStart;
/**
* Code execution time (millis) for job. Measures the time taken to
* execute the R code for the job.
* <p/>
* Can be used in conjunction with timeStart and timeTotal to profile
* job runtime characteristics.
*/
public final long timeCode;
/**
* Total time (millis) for job. Measures the time taken to prepare
* R workspace and directory for job, execute code for the job and then
* persist job artifacts as a persistent project.
* <p/>
* Can be used in conjunction with timeStart and timeCode to profile
* job runtime characteristics.
*/
public final long timeTotal;
/**
* Job execution tag.
*/
public final String tag;
}

Просмотреть файл

@ -0,0 +1,82 @@
/*
* RProjectDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import java.util.Date;
import java.util.List;
/**
* Managed project details.
*/
public class RProjectDetails {
public RProjectDetails(String id, String origin, boolean islive, Date modified, List<String> authors) {
this.id = id;
this.origin = origin;
this.islive = islive;
this.modified = modified;
this.authors = authors;
}
/**
* Project id.
*/
public final String id;
/**
* Project name.
*/
public String name;
/**
* Project description.
*/
public String descr;
/**
* Project long description.
*/
public String longdescr;
/**
* Project origin.
*/
public final String origin;
/**
* Project shared.
*/
public boolean shared;
/**
* Project islive.
*/
public final boolean islive;
/**
* Project cookie.
*/
public String cookie;
/**
* Project last modified date.
*/
public final Date modified;
/**
* Project authors.
*/
public final List<String> authors;
}

Просмотреть файл

@ -0,0 +1,131 @@
/*
* RProjectExecutionDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import com.revo.deployr.client.RProjectFile;
import com.revo.deployr.client.RProjectResult;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.data.RData;
import java.util.List;
/**
* Project execution details.
*/
public class RProjectExecutionDetails {
public RProjectExecutionDetails(String id, String code, long timeStart, long timeCode, long timeTotal, String tag, String console, String error, int errorCode, List<String> warnings, boolean interrupted, List<RProjectResult> results, List<RProjectFile> artifacts, List<RData> workspaceObjects, List<RRepositoryFile> repositoryFiles) {
this.id = id;
this.code = code;
this.timeStart = timeStart;
this.timeCode = timeCode;
this.timeTotal = timeTotal;
this.tag = tag;
this.console = console;
this.error = error;
this.errorCode = errorCode;
this.warnings = warnings;
this.interrupted = interrupted;
this.results = results;
this.artifacts = artifacts;
this.workspaceObjects = workspaceObjects;
this.repositoryFiles = repositoryFiles;
}
/**
* Project execution id.
*/
public final String id;
/**
* Code on R execution.
*/
public final String code;
/**
* Start time (millis) for execution. Can be used in conjunction with
* timeCode and timeTotal to profile execution runtime characteristics.
*/
public final long timeStart;
/**
* Code execution time (millis) for execution. Measures the time taken to
* execute the R code for execution.
* <p/>
* Can be used in conjunction with timeStart and timeTotal to profile
* execution runtime characteristics.
*/
public final long timeCode;
/**
* Total time (millis) for execution. Measures the time taken to prepare
* R workspace and directory for execution, execute R code and then
* persist execution artifacts to on project.
* <p/>
* Can be used in conjunction with timeStart and timeCode to profile
* execution runtime characteristics.
*/
public final long timeTotal;
/**
* Tag associated with R execution.
*/
public final String tag;
/**
* Console output resulting from R execution.
*/
public final String console;
/**
* Error message resulting from failed R execution.
*/
public String error;
/**
* Error code resulting from failed R execution.
*/
public int errorCode;
/**
* Warning messages resulting from R execution.
*/
public List<String> warnings;
/**
* Interrupted status on R execution.
*/
public boolean interrupted;
/**
* Generated artifacts on R execution.
*/
public List<RProjectFile> artifacts;
/**
* Generated results on R execution.
*/
public List<RProjectResult> results;
/**
* RData encoded workspace objects on R execution.
*/
public final List<RData> workspaceObjects;
/**
* RRepositoryFile references on R execution.
*/
public final List<RRepositoryFile> repositoryFiles;
}

Просмотреть файл

@ -0,0 +1,49 @@
/*
* RProjectFileDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import java.net.URL;
/**
* Managed project directory file details.
*/
public class RProjectFileDetails {
public RProjectFileDetails(String filename, String descr, String type, int size, URL url) {
this.filename = filename;
this.descr = descr;
this.type = type;
this.size = size;
}
/**
* Project directory file name.
*/
public final String filename;
/**
* Project directory file description.
*/
public final String descr;
/**
* Project directory file mime type.
*/
public final String type;
/**
* Project directory file size.
*/
public final int size;
}

Просмотреть файл

@ -0,0 +1,60 @@
/*
* RProjectPackageDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
/**
* Managed project package dependency details.
*/
public class RProjectPackageDetails {
public RProjectPackageDetails(String name, String descr, String repo, String version, String status, boolean attached) {
this.name = name;
this.descr = descr;
this.repo = repo;
this.version = version;
this.status = status;
this.attached = attached;
}
/**
* Package name.
*/
public final String name;
/**
* Package description.
*/
public final String descr;
/**
* Package repo.
*/
public final String repo;
/**
* Package version.
*/
public final String version;
/**
* Package status.
*/
public final String status;
/**
* Package attached on current project.
*/
public final boolean attached;
}

Просмотреть файл

@ -0,0 +1,55 @@
/*
* RProjectResultDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import java.net.URL;
/**
* Managed project execution result details.
*/
public class RProjectResultDetails {
public RProjectResultDetails(String execution, String filename, String type, int size, URL url) {
this.execution = execution;
this.filename = filename;
this.type = type;
this.size = size;
this.url = url;
}
/**
* Project execution result file name.
*/
public final String filename;
/**
* Project execution result file mime type.
*/
public final String type;
/**
* Project execution result file size.
*/
public final int size;
/**
* Project execution result file url.
*/
public final URL url;
/**
* Project execution identifier.
*/
public final String execution;
}

Просмотреть файл

@ -0,0 +1,51 @@
/*
* RRepositoryDirectoryDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import com.revo.deployr.client.RRepositoryFile;
import java.util.List;
/**
* Managed repository directory details.
*/
public class RRepositoryDirectoryDetails {
public final static String SYSTEM_RESTRICTED = "Restricted";
public final static String SYSTEM_SHARED = "Shared";
public final static String SYSTEM_PUBLIC = "Public";
public RRepositoryDirectoryDetails(String name,
boolean systemDirectory,
List<RRepositoryFile> files) {
this.name = name;
this.systemDirectory = systemDirectory;
this.files = files;
}
/**
* Repository directory name.
*/
public final String name;
/**
* Repository directory type: system or user.
*/
public final boolean systemDirectory;
/**
* Repository directory files.
*/
public final List<RRepositoryFile> files;
}

Просмотреть файл

@ -0,0 +1,152 @@
/*
* RRepositoryFileDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
import java.net.URL;
import java.util.Date;
import java.util.List;
/**
* Managed repository file details.
*/
public class RRepositoryFileDetails {
public RRepositoryFileDetails(String filename, String directory,
String author, String version,
String latestby, String descr, String type,
int size, URL url, String access,
String restricted, boolean shared, boolean published,
List<String> authors, String inputs, String outputs,
String tags, String category,
String md5, Date lastModified) {
this.filename = filename;
this.directory = directory;
this.author = author;
this.version = version;
this.latestby = latestby;
this.descr = descr;
this.type = type;
this.size = size;
this.access = access;
this.restricted = restricted;
this.shared = shared;
this.published = published;
this.authors = authors;
this.inputs = inputs;
this.outputs = outputs;
this.tags = tags;
this.category = category;
this.md5 = md5;
this.lastModified = lastModified;
}
/**
* Repository file name.
*/
public final String filename;
/**
* Repository file directory.
*/
public final String directory;
/**
* Repository file author.
*/
public final String author;
/**
* Repository file version.
*/
public final String version;
/**
* Repository file latest version author.
*/
public final String latestby;
/**
* Repository file description.
*/
public final String descr;
/**
* Repository file mime type.
*/
public final String type;
/**
* Repository file size.
*/
public final int size;
/**
* Repository file access level display-friendly description:
* Private, Restricted, Shared, Public.
*/
public final String access;
/**
* Repository file access is restricted to authenticated
* user with the ROLE(s) indicated.
*/
public final String restricted;
/**
* Repository file access is shared to all authenticated
* users.
*/
public final boolean shared;
/**
* Repository file access is public, visible to all
* authenticated and anonymous users.
*/
public final boolean published;
/**
* Repository file authors.
*/
public final List<String> authors;
/**
* Repository file (script) inputs.
*/
public final String inputs;
/**
* Repository file (script) outputs.
*/
public final String outputs;
/**
* Repository file tags.
*/
public final String tags;
/**
* Repository file category.
*/
public final String category;
/**
* Repository file md5 checksum.
*/
public final String md5;
/**
* Repository file last modified date.
*/
public final Date lastModified;
}

Просмотреть файл

@ -0,0 +1,48 @@
/*
* RUserDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
/**
* Managed user details.
*/
public class RUserDetails {
public RUserDetails(String username, String displayname, String cookie, RUserLimitDetails limits) {
this.username = username;
this.displayname = displayname;
this.cookie = cookie;
this.limits = limits;
}
/**
* Username for currently authenticated user.
*/
public final String username;
/**
* Displayname for currently authenticated user.
*/
public final String displayname;
/**
* Custom cookie for currently authenticated user.
*/
public final String cookie;
/**
* About limits for currently authenticated user.
*/
public final RUserLimitDetails limits;
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* RUserLimitDetails.java
*
* 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.
*
*/
package com.revo.deployr.client.about;
/**
* Managed user limit details.
*/
public class RUserLimitDetails {
public RUserLimitDetails(int maxConcurrentLiveProjectCount,
int maxIdleLiveProjectTimeout,
int maxFileUploadSize) {
this.maxConcurrentLiveProjectCount = maxConcurrentLiveProjectCount;
this.maxIdleLiveProjectTimeout = maxIdleLiveProjectTimeout;
this.maxFileUploadSize = maxFileUploadSize;
}
/**
* Max concurrent live project limit.
*/
public final int maxConcurrentLiveProjectCount;
/**
* Max idle live project timeout limit.
*/
public final int maxIdleLiveProjectTimeout;
/**
* Max file upload size limit.
*/
public final int maxFileUploadSize;
}

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Defines classes describing the core entities managed by the DeployR Java client library.
<!-- Put @see and @since tags down here. -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,86 @@
/*
* RProjectDirectoryCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RProjectFile;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RSecurityException;
import com.revo.deployr.client.params.DirectoryUploadOptions;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
/**
* Defines directory related interfaces for DeployR-managed project.
*/
public interface RProjectDirectoryCalls {
/**
* List files in project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectFile> listFiles() throws RClientException, RSecurityException;
/**
* Upload file to project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectFile uploadFile(InputStream fileStream, DirectoryUploadOptions options) throws RClientException, RSecurityException;
/**
* Transfer file to project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectFile transferFile(URL url, DirectoryUploadOptions options) throws RClientException, RSecurityException;
/**
* Write file to project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectFile writeFile(String text, DirectoryUploadOptions options) throws RClientException, RSecurityException;
/**
* Load file in user repository into project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectFile loadFile(RRepositoryFile file) throws RClientException, RSecurityException;
/**
* Download all files from project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL downloadFiles() throws RClientException, RSecurityException;
/**
* Download files from project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL downloadFiles(List<String> files) throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,220 @@
/*
* RProjectExecuteCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.*;
import com.revo.deployr.client.params.ProjectExecutionOptions;
import java.net.URL;
import java.util.List;
/**
* Defines execution related interfaces for DeployR-managed project.
*/
public interface RProjectExecuteCalls {
/**
* Execute code on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectExecution executeCode(String code)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute code on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectExecution executeCode(String code,
ProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of
* repository-managed scripts on the current project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @deprecated As of release 7.1, use executeScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
public RProjectExecution executeScript(String scriptName,
String scriptAuthor,
String scriptVersion)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of
* repository-managed scripts on the current project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @deprecated As of release 7.1, use executeScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
public RProjectExecution executeScript(String scriptName,
String scriptAuthor,
String scriptVersion,
ProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of repository-managed scripts
* on the current project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectExecution executeScript(String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single repository-managed script or a chain of repository-managed scripts
* on the current project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectExecution executeScript(String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
ProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Execute a single script found on a URL/path or a chain of scripts found on a set of URLs/paths
* on the current project.
* <p/>
* To execute a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the externalSource parameter.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
* <p/>
* POWER_USER privileges are required for this call.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectExecution executeExternal(String externalSource,
ProjectExecutionOptions options)
throws RClientException,
RSecurityException,
RDataException,
RGridException;
/**
* Retrieve console output on latest execution on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public String getConsole() throws RClientException, RSecurityException;
/**
* Interrupt execution on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void interruptExecution() throws RClientException, RSecurityException;
/**
* Retrieve execution history on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectExecution> getHistory() throws RClientException, RSecurityException;
/**
* Flush execution history on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void flushHistory() throws RClientException, RSecurityException;
/**
* Retreive execution result list on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectResult> listResults() throws RClientException, RSecurityException;
/**
* Delete execution results on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void deleteResults() throws RClientException, RSecurityException;
/**
* Download execution results on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public URL downloadResults() throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,66 @@
/*
* RProjectPackageCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RProjectPackage;
import com.revo.deployr.client.RSecurityException;
import java.util.List;
/**
* Defines package related interfaces for DeployR-managed project.
*/
public interface RProjectPackageCalls {
/**
* List R packages on project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectPackage> listPackages(boolean installed) throws RClientException, RSecurityException;
/**
* Attach R packages to project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectPackage> attachPackage(String packageName, String repo) throws RClientException, RSecurityException;
/**
* Attach R packages to project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectPackage> attachPackage(List<String> packageNames, String repo) throws RClientException, RSecurityException;
/**
* Detach R packages from project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectPackage> detachPackage(String packageName) throws RClientException, RSecurityException;
/**
* Detach R packages from project.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProjectPackage> detachPackage(List<String> packageNames) throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,148 @@
/*
* RProjectWorkspaceCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.*;
import com.revo.deployr.client.data.RData;
import com.revo.deployr.client.params.ProjectWorkspaceOptions;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
/**
* Defines workspace related interfaces for DeployR managed project.
*/
public interface RProjectWorkspaceCalls {
/**
* List objects in project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RData> listObjects() throws RClientException, RSecurityException;
/**
* List objects in project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RData> listObjects(ProjectWorkspaceOptions options) throws RClientException, RSecurityException;
/**
* Retrieve encoded objects from project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RData getObject(String objectName) throws RClientException, RSecurityException;
/**
* Retrieve encoded objects from project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RData getObject(String objectName, boolean encodeDataFramePrimitiveAsVector) throws RClientException, RSecurityException;
/**
* Retrieve encoded objects from project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RData> getObjects(List<String> objectNames) throws RClientException, RSecurityException;
/**
* Retrieve encoded objects from project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RData> getObjects(List<String> objectNames, boolean encodeDataFramePrimitiveAsVector) throws RClientException, RSecurityException;
/**
* Upload object to project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void uploadObject(String name, InputStream fileStream) throws RClientException, RSecurityException;
/**
* Transfer object to project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void transferObject(String name, URL url) throws RClientException, RSecurityException;
/**
* Push object to project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void pushObject(RData object) throws RClientException, RSecurityException, RDataException;
/**
* Push objects to project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void pushObject(List<RData> objects) throws RClientException, RSecurityException, RDataException;
/**
* Save object from project workspace to project directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProjectFile saveObject(String name, String descr, boolean versioning) throws RClientException, RSecurityException;
/**
* Store object from project workspace to user repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryFile storeObject(String name, String descr, boolean versioning, String restricted, boolean shared, boolean published) throws RClientException, RSecurityException;
/**
* Load user repository object into project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void loadObject(RRepositoryFile file) throws RClientException, RSecurityException;
/**
* Delete objects in project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void deleteObject(String objectName) throws RClientException, RSecurityException;
/**
* Delete objects in project workspace.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void deleteObject(List<String> objectNames) throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,180 @@
/*
* RUserJobCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RDataException;
import com.revo.deployr.client.RJob;
import com.revo.deployr.client.RSecurityException;
import com.revo.deployr.client.params.JobExecutionOptions;
import java.util.List;
/**
* Defines job related interfaces for DeployR-managed user.
*/
public interface RUserJobCalls {
/**
* List jobs.
*
* @return List<RJob>
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RJob> listJobs()
throws RClientException, RSecurityException;
/**
* Query an existing job by job identifier.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob queryJob(String job)
throws RClientException, RSecurityException;
/**
* Submit job based on block of R code.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob submitJobCode(String jobName, String jobDescr, String code)
throws RClientException, RSecurityException, RDataException;
/**
* Submit job based on block of R code.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob submitJobCode(String jobName,
String jobDescr,
String code,
JobExecutionOptions options)
throws RClientException, RSecurityException, RDataException;
/**
* Submit a single repository-managed script or a chain of
* repository-managed scripts (found in the root directory)
* to execute as a job.
* <p/>
* To submit a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @deprecated As of release 7.1, use submitJobScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
@Deprecated
public RJob submitJobScript(String jobName,
String jobDescr,
String scriptName,
String scriptAuthor,
String scriptVersion)
throws RClientException, RSecurityException, RDataException;
/**
* Submit a single repository-managed script or a chain of
* repository-managed scripts to execute as a job.
* <p/>
* To submit a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
* @deprecated As of release 7.1, use submitJobScript method that
* supports scriptDirectory parameter. This deprecated call assumes
* each script is found in the root directory.
*/
@Deprecated
public RJob submitJobScript(String jobName,
String jobDescr,
String scriptName,
String scriptAuthor,
String scriptVersion,
JobExecutionOptions options)
throws RClientException, RSecurityException, RDataException;
/**
* Submit a single repository-managed script or a chain of repository-managed scripts
* to execute as a job.
* <p/>
* To submit a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob submitJobScript(String jobName,
String jobDescr,
String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion)
throws RClientException, RSecurityException, RDataException;
/**
* Submit a single repository-managed script or a chain of repository-managed scripts
* to execute as a job.
* <p/>
* To submit a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the scriptName, scriptAuthor and optionally scriptVersion parameters.
* Chained execution executes each of the scripts identified on the call in a sequential
* fashion on the R session, with execution occuring in the order specified on the parameter list.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob submitJobScript(String jobName,
String jobDescr,
String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
JobExecutionOptions options)
throws RClientException, RSecurityException, RDataException;
/**
* Submit a single script found on a URL/path or a chain of scripts found on a set of URLs/paths
* on the current project.
* <p/>
* To submit a chain of repository-managed scripts on this call provide a comma-separated
* list of values on the externalSource parameter.
* <p/>
* POWER_USER privileges are required for this call.
*
* @return RJob
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RJob submitJobExternal(String jobName, String jobDescr, String externalSource, JobExecutionOptions options)
throws RClientException, RSecurityException, RDataException;
}

Просмотреть файл

@ -0,0 +1,136 @@
/*
* RUserProjectCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.*;
import com.revo.deployr.client.params.ProjectCreationOptions;
import java.io.InputStream;
import java.util.List;
/**
* Defines project related interfaces for DeployR-managed user.
*/
public interface RUserProjectCalls {
/**
* Enabled/disable project auto-save semantics for duration of user session.
*
* @param save true to enable auto-save of projects on close or logout.
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void autosaveProjects(boolean save) throws RClientException, RSecurityException;
/**
* Releases all server-wide live project grid resources associated with
* this user.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void releaseProjects() throws RClientException, RSecurityException;
/**
* Create a temporary project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject createProject()
throws RClientException, RSecurityException, RDataException, RGridException;
/**
* Create a temporary project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject createProject(ProjectCreationOptions options)
throws RClientException, RSecurityException, RDataException, RGridException;
/**
* Create a pool of temporary projects.
*
* @return List<RProject>
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProject> createProjectPool(int poolSize, ProjectCreationOptions options)
throws RClientException, RSecurityException, RDataException, RGridException;
/**
* Create a named persistent project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject createProject(String name, String descr)
throws RClientException, RSecurityException, RDataException, RGridException;
/**
* Create a named persistent project based on adoptions from existing projects.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject createProject(String name, String descr, ProjectCreationOptions adoptions)
throws RClientException, RSecurityException, RDataException, RGridException;
/**
* Retrieve project reference.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject getProject(String pid)
throws RClientException, RSecurityException;
/**
* List projects.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProject> listProjects()
throws RClientException, RSecurityException;
/**
* List projects.
*
* @param sortByLastModified true is projects to be sorted by last modified date.
* @param showPublicProjects true is projects list to include public projects.
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RProject> listProjects(boolean sortByLastModified, boolean showPublicProjects)
throws RClientException, RSecurityException;
/**
* Import project.
*
* @return RProject
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RProject importProject(InputStream fileStream, String descr)
throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,114 @@
/*
* RUserRepositoryDirectoryCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RRepositoryDirectory;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RSecurityException;
import com.revo.deployr.client.params.RepoUploadOptions;
import java.io.InputStream;
import java.util.List;
/**
* tori
* Defines repository-managed directory related interfaces for
* DeployR-managed user.
*/
public interface RUserRepositoryDirectoryCalls {
/**
* List repository-managed directories.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions
* not met on call.
*/
public List<RRepositoryDirectory> listDirectories()
throws RClientException, RSecurityException;
/**
* List repository-managed directories.
* If the archived parameter is enabled, then files in the user archive
* directories are included in the response.
* If the shared parameter is enabled, then files in the system shared
* directory is included in the response.
* If the published parameter is enabled, then files in the system
* published directory is included in the response.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions
* not met on call.
*/
public List<RRepositoryDirectory> listDirectories(boolean userfiles,
boolean archived,
boolean shared,
boolean published)
throws RClientException, RSecurityException;
/**
* Creates a new repository-managed custom user directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryDirectory createDirectory(String directory)
throws RClientException, RSecurityException;
/**
* Copies one or more repository-managed files from a source
* user directory to a destination user directory.
* <p/>
* If the files parameter is null, all files in the source
* directory will be copied to the destination directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void copyDirectory(String sourceDirectory,
String destinationDirectory,
List<RRepositoryFile> files)
throws RClientException, RSecurityException;
/**
* Moves one or more repository-managed files from a source
* user directory to a destination user directory.
* <p/>
* If the files parameter is null, all files in the source
* directory will be moved to the destination directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void moveDirectory(String sourceDirectory,
String destinationDirectory,
List<RRepositoryFile> files)
throws RClientException, RSecurityException;
/**
* Uploads a set of files in a single zip archive into an existing
* repository-managed user directory. The files are extracted from
* the zip archive and placed file-by-file into the directory.
* <p/>
* The options.filename property is ignored on this call and
* can be left blank.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void uploadDirectory(InputStream zipStream,
RepoUploadOptions options)
throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,121 @@
/*
* RUserRepositoryFileCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RSecurityException;
import com.revo.deployr.client.params.RepoUploadOptions;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
/**
* Defines repository-managed file related interfaces for
* a DeployR-managed user.
*/
public interface RUserRepositoryFileCalls {
/**
* List files in user repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listFiles() throws RClientException, RSecurityException;
/**
* List files including those archived by the caller or those shared or published
* by other users in the repository. The list of shared files will include any
* restricted files that the caller can access.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listFiles(boolean archived,
boolean shared,
boolean published)
throws RClientException, RSecurityException;
/**
* List versions of named file in user repository-managed directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listFiles(String filename, String directory)
throws RClientException, RSecurityException;
/**
* Fetch latest meta-data on repository-managed file.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryFile fetchFile(String filename,
String directory,
String author,
String version)
throws RClientException, RSecurityException;
/**
* Upload file to user repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryFile uploadFile(InputStream fileStream, RepoUploadOptions options)
throws RClientException, RSecurityException;
/**
* Write file to user repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryFile writeFile(String text, RepoUploadOptions options)
throws RClientException, RSecurityException;
/**
* Transfer file to user repository.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public RRepositoryFile transferFile(URL url, RepoUploadOptions options)
throws RClientException, RSecurityException;
/**
* Copy one or more files to a repository-managed directory.
* The fileRenames parameter is optional. If specified, it
* can be used to rename each file as it is copied.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void copyFiles(String destinationDirectory,
List<RRepositoryFile> files,
List<String> fileRenames)
throws RClientException, RSecurityException;
/**
* Move one or more files to a repository-managed directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public void moveFiles(String destinationDirectory,
List<RRepositoryFile> files)
throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,59 @@
/*
* RUserRepositoryScriptCalls.java
*
* 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.
*
*/
package com.revo.deployr.client.api;
import com.revo.deployr.client.RClientException;
import com.revo.deployr.client.RRepositoryFile;
import com.revo.deployr.client.RSecurityException;
import java.util.List;
/**
* Defines the managed script interfaces for DeployR-managed user.
*/
public interface RUserRepositoryScriptCalls {
/**
* List scripts in user repository.
*
* @return List<RRepositoryFile>
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listScripts()
throws RClientException, RSecurityException;
/**
* List scripts including those archived by the caller or those shared or published
* by other users in the repository. The list of shared scripts will include any
* restricted scripts that the caller can access.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listScripts(boolean archived,
boolean shared,
boolean published)
throws RClientException, RSecurityException;
/**
* List versions of named script in user repository-managed directory.
*
* @throws RClientException if RClient fails to complete call.
* @throws RSecurityException if DeployR server security conditions not met on call.
*/
public List<RRepositoryFile> listScripts(String filename,
String directory)
throws RClientException, RSecurityException;
}

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Defines API interfaces on the core entities managed by DeployR Java client library.
<!-- Put @see and @since tags down here. -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,19 @@
/*
* RAuthentication.java
*
* 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.
*
*/
package com.revo.deployr.client.auth;
/**
* DeployR Authentication marker interface.
*/
public interface RAuthentication {
}

Просмотреть файл

@ -0,0 +1,37 @@
/*
* RBasicAuthentication.java
*
* 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.
*
*/
package com.revo.deployr.client.auth.basic;
import com.revo.deployr.client.auth.RAuthentication;
/**
* DeployR Basic Authentication, expects username and plain-text password.
*/
public class RBasicAuthentication implements RAuthentication {
private String username;
private String password;
public RBasicAuthentication(String username, String password) {
this.username = username;
this.password = password;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Defines basic authentication token for DeployR-enabled client applications.
<!-- Put @see and @since tags down here. -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
Defines base authentication interface for DeployR-enabled client applications.
<!-- Put @see and @since tags down here. -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,196 @@
/*
* AbstractCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call;
import com.revo.deployr.client.core.RCoreResponse;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.RExecutionException;
import com.revo.deployr.client.core.RInterruptedException;
import com.revo.deployr.client.core.impl.RCoreResultImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
/**
* Provides abstract base class for PCall implementations.
*/
public abstract class AbstractCall implements RCall, RCoreResponse {
private Log log = LogFactory.getLog(AbstractCall.class);
protected HttpClient httpClient;
protected String serverUrl;
protected Future future;
protected HttpUriRequest httpUriRequest;
protected Map<String, String> httpParams = new HashMap();
/**
* Method, internal use only.
*/
public void setClient(HttpClient httpClient, String serverUrl) {
this.httpClient = httpClient;
this.serverUrl = serverUrl;
}
/**
* Method, internal use only.
*/
public void setFuture(Future future) {
this.future = future;
}
/*
* RCall Implementation - Interface Marker Only, No Implementation.
*/
/*
* RCoreResponse Implementation
*/
public RCoreResult get() throws RInterruptedException,
RExecutionException {
RCoreResult pResult = null;
try {
pResult = (RCoreResult) future.get();
} catch (InterruptedException iex) {
log.warn("Interrupted exception on call, httpUriRequest=" + httpUriRequest);
try {
httpUriRequest.abort();
log.warn("Interrupted exception, call aborted.");
} catch (UnsupportedOperationException uoe) {
log.warn("Interrupted, unsupported operation exception.", uoe);
}
if (httpUriRequest.isAborted())
throw new RInterruptedException("InterruptedException, call aborted.");
else
throw new RInterruptedException("InterruptedException, call not aborted.");
} catch (ExecutionException eex) {
throw new RExecutionException("ExecutionException, call aborted.", eex);
}
return pResult;
}
public boolean cancel() {
return future.cancel(true);
}
public boolean isCancelled() {
return future.isCancelled();
}
public boolean isCompleted() {
return future.isDone();
}
/*
* Protected implementation making HTTP Request.
*/
protected RCoreResult makePostRequest(String API) {
try {
HttpPost httpPost = new HttpPost(serverUrl + API);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : httpParams.entrySet()) {
postParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postParams, "UTF-8");
httpPost.setEntity(entity);
return makeRequest(httpPost, API);
} catch (UnsupportedEncodingException uex) {
log.warn("AbstractCall: makePostRequest unsupported encoding exception.", uex);
return null;
}
}
protected RCoreResult makeGetRequest(String API) {
List<NameValuePair> getParams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : httpParams.entrySet()) {
getParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
String encodedParams = URLEncodedUtils.format(getParams, "UTF-8");
HttpGet httpGet = new HttpGet(serverUrl + API + "?" + encodedParams);
return makeRequest(httpGet, API);
}
protected RCoreResult makeRequest(HttpUriRequest httpUriRequest, String API) {
this.httpUriRequest = httpUriRequest;
RCoreResultImpl pResult = null;
try {
HttpResponse response = httpClient.execute(this.httpUriRequest);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
pResult = new RCoreResultImpl();
try {
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (Throwable tex) {
log.warn("AbstractCall: makeRequest pResult.parseMarkup throwable=" + tex);
throw tex;
}
} catch (UnsupportedEncodingException ueex) {
log.warn("AbstractCall: makeRequest unsupported encoding exception=" + ueex);
} catch (IOException ioex) {
log.warn("AbstractCall: makeRequest io exception=" + ioex);
} catch (Exception ex) {
log.warn("AbstractCall: makeRequest exception=" + ex);
} finally {
log.debug("AbstractCall: makeRequest pResult=" + pResult);
}
return pResult;
}
}

Просмотреть файл

@ -0,0 +1,16 @@
/*
* RCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call;
public interface RCall {
}

Просмотреть файл

@ -0,0 +1,94 @@
/*
* StandardExecutionModelCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call;
import com.revo.deployr.client.RDataException;
import com.revo.deployr.client.params.ProjectExecutionOptions;
import com.revo.deployr.client.util.RDataUtil;
/**
* Provides support for the standard execution model parameters on
* all DeployR Execution APIs.
*/
public abstract class StandardExecutionModelCall extends AbstractCall {
public StandardExecutionModelCall(ProjectExecutionOptions options) throws RDataException {
if (options != null) {
if (options.rinputs != null) {
String markup = RDataUtil.toJSON(options.rinputs);
httpParams.put("inputs", markup);
}
httpParams.put("csvinputs", options.csvrinputs);
String objectNames = null;
if (options.routputs != null) {
for (String object : options.routputs) {
if (objectNames != null) {
objectNames = objectNames + "," + object;
} else {
objectNames = object;
}
}
}
httpParams.put("robjects", objectNames);
httpParams.put("tag", options.tag);
httpParams.put("enableConsoleEvents", Boolean.toString(options.enableConsoleEvents));
httpParams.put("echooff", Boolean.toString(options.echooff));
httpParams.put("consoleoff", Boolean.toString(options.consoleoff));
httpParams.put("encodeDataFramePrimitiveAsVector", Boolean.toString(options.encodeDataFramePrimitiveAsVector));
if (options.preloadWorkspace != null) {
httpParams.put("preloadobjectname", options.preloadWorkspace.filename);
httpParams.put("preloadobjectdirectory", options.preloadWorkspace.directory);
httpParams.put("preloadobjectauthor", options.preloadWorkspace.author);
httpParams.put("preloadobjectversion", options.preloadWorkspace.version);
}
if (options.preloadDirectory != null) {
httpParams.put("preloadfilename", options.preloadDirectory.filename);
httpParams.put("preloadfiledirectory", options.preloadDirectory.directory);
httpParams.put("preloadfileauthor", options.preloadDirectory.author);
httpParams.put("preloadfileversion", options.preloadDirectory.version);
}
httpParams.put("preloadbydirectory", options.preloadByDirectory);
if (options.adoptionOptions != null) {
httpParams.put("adoptworkspace", options.adoptionOptions.adoptWorkspace);
httpParams.put("adoptdirectory", options.adoptionOptions.adoptDirectory);
httpParams.put("adoptpackages", options.adoptionOptions.adoptPackages);
}
if (options.storageOptions != null) {
httpParams.put("storefile", options.storageOptions.files);
httpParams.put("storeobject", options.storageOptions.objects);
httpParams.put("storeworkspace", options.storageOptions.workspace);
httpParams.put("storedirectory", options.storageOptions.directory);
httpParams.put("storenewversion", Boolean.toString(options.storageOptions.newversion));
httpParams.put("storepublic", Boolean.toString(options.storageOptions.published));
}
httpParams.put("nan", options.nan);
httpParams.put("infinity", options.infinity);
httpParams.put("graphics", options.graphicsDevice);
httpParams.put("graphicswidth", Integer.toString(options.graphicsWidth));
httpParams.put("graphicsheight", Integer.toString(options.graphicsHeight));
}
httpParams.put("format", "json");
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* JobCancelCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/cancel.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobCancelCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBCANCEL;
public JobCancelCall(String job) {
httpParams.put("job", job);
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* JobDeleteCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/delete.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobDeleteCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBDELETE;
public JobDeleteCall(String job) {
httpParams.put("job", job);
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* JobListCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/list.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobListCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBLIST;
public JobListCall(boolean openonly) {
httpParams.put("openonly", Boolean.toString(openonly));
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makeGetRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* JobQueryCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/query.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobQueryCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBQUERY;
public JobQueryCall(String job) {
httpParams.put("job", job);
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makeGetRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/*
* JobScheduleCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.RDataException;
import com.revo.deployr.client.call.StandardExecutionModelCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import com.revo.deployr.client.params.JobExecutionOptions;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/schedule.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobScheduleCall extends StandardExecutionModelCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBSCHEDULE;
public JobScheduleCall(String name, String descr,
String code,
String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
String externalSource,
JobExecutionOptions options) throws RDataException {
super(options);
httpParams.put("name", name);
httpParams.put("descr", descr);
httpParams.put("code", code);
httpParams.put("rscriptname", scriptName);
httpParams.put("rscriptdirectory", scriptDirectory);
httpParams.put("rscriptauthor", scriptAuthor);
httpParams.put("rscriptversion", scriptVersion);
httpParams.put("externalsource", externalSource);
if (options != null) {
httpParams.put("priority", options.priority);
httpParams.put("storenoproject", Boolean.toString(options.noproject));
}
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/*
* JobSubmitCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.job;
import com.revo.deployr.client.RDataException;
import com.revo.deployr.client.call.StandardExecutionModelCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import com.revo.deployr.client.params.JobExecutionOptions;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/job/submit.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class JobSubmitCall extends StandardExecutionModelCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RJOBSUBMIT;
public JobSubmitCall(String name, String descr,
String code,
String scriptName,
String scriptDirectory,
String scriptAuthor,
String scriptVersion,
String externalSource,
JobExecutionOptions options) throws RDataException {
super(options);
httpParams.put("name", name);
httpParams.put("descr", descr);
httpParams.put("code", code);
httpParams.put("rscriptname", scriptName);
httpParams.put("rscriptdirectory", scriptDirectory);
httpParams.put("rscriptauthor", scriptAuthor);
httpParams.put("rscriptversion", scriptVersion);
httpParams.put("externalsource", externalSource);
if (options != null) {
httpParams.put("priority", options.priority);
httpParams.put("storenoproject", Boolean.toString(options.noproject));
}
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* ProjectAboutCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.project;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/project/about.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class ProjectAboutCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RPROJECTABOUT;
public ProjectAboutCall(String id) {
httpParams.put("project", id);
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makeGetRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,51 @@
/*
* ProjectAboutUpdateCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.project;
import com.revo.deployr.client.about.RProjectDetails;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/project/about/update.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class ProjectAboutUpdateCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RPROJECTABOUTUPDATE;
public ProjectAboutUpdateCall(RProjectDetails details) {
httpParams.put("project", details.id);
httpParams.put("name", details.name);
httpParams.put("descr", details.descr);
httpParams.put("longdescr", details.longdescr);
httpParams.put("projectcookie", details.cookie);
httpParams.put("shared", Boolean.toString(details.shared));
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Просмотреть файл

@ -0,0 +1,57 @@
/*
* ProjectCloseCall.java
*
* 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.
*
*/
package com.revo.deployr.client.call.project;
import com.revo.deployr.client.about.RProjectDetails;
import com.revo.deployr.client.call.AbstractCall;
import com.revo.deployr.client.core.RCoreResult;
import com.revo.deployr.client.core.REndpoints;
import com.revo.deployr.client.params.ProjectCloseOptions;
import java.util.concurrent.Callable;
/**
* Provides support for DeployR API call: /r/project/close.
* <p/>
* Simply construct an instance of this call and pass it on the
* execute() method of your {@link com.revo.deployr.client.RClient}.
*/
public class ProjectCloseCall extends AbstractCall
implements Callable<RCoreResult> {
private final String API = REndpoints.RPROJECTCLOSE;
public ProjectCloseCall(RProjectDetails details, ProjectCloseOptions options) {
httpParams.put("project", details.id);
if (options != null) {
httpParams.put("flushhistory", Boolean.toString(options.flushHistory));
httpParams.put("disableautosave", Boolean.toString(options.disableAutosave));
httpParams.put("projectcookie", options.cookie);
if (options.dropOptions != null) {
httpParams.put("dropworkspace", Boolean.toString(options.dropOptions.dropWorkspace));
httpParams.put("dropdirectory", Boolean.toString(options.dropOptions.dropDirectory));
httpParams.put("drophistory", Boolean.toString(options.dropOptions.dropHistory));
}
}
httpParams.put("format", "json");
}
/**
* Internal use only, to execute call use RClient.execute().
*/
public RCoreResult call() {
return makePostRequest(API);
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше