RDAVIDWebService setup

An R Package for retrieving data from DAVID into R objects using Web Services API.
Last updated on

Java >= 1.8 and OpenSSL >= 1.0.2.d are required.

openssl version
java -version

Upgrade Java

Here’s how to upgrade to the latest version of Java with Homebrew:

brew cask install java

The latest JDK will be installed at /Library/Java/JavaVirtualMachines.

Upgrade OpenSSL

Here’s how to compile the latest version:

cd ~/Downloads
curl -O https://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar -xvzf openssl-*
cd openssl-*
./Configure darwin64-x86_64-cc
make test
sudo make install

# Relaunch the terminal and check version:
which openssl
openssl version

Update cacerts

cd ~/
echo -n | openssl s_client -connect david.ncifcrf.gov:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ncifcrf.cert

Check that the download was successful:

openssl x509 -in ncifcrf.cert -text

Find your cacerts file:

sudo find /Library/Java/JavaVirtualMachines -name cacerts

You should see something that matches /Library/Java/JavaVirtualMachines/jdk{VERSION}.jdk. Now with that virtual machine, we’re going to copy the cacerts file to the home directory, add the DAVID certificate, and copy back:

sudo cp /Library/Java/JavaVirtualMachines/jdk$VERSION.jdk/Contents/Home/jre/lib/security/cacerts .
sudo keytool -import -trustcacerts -keystore cacerts -storepass changeit -noprompt -alias david -file ncifcrf.cert
# The certificate should be added to the keystore.
# If successful, copy the modified `cacerts` file to the virtual machine.
sudo cp cacerts /Library/Java/JavaVirtualMachines/jdk$VERSION.jdk/Contents/Home/jre/lib/security/cacerts

Now update the Java configuration in R:

R CMD javareconf

Install RDAVIDWebService:

.jcall("java/lang/System", "S", "getProperty", "java.runtime.version")

Note that the Java version here should match the JDK above. If this looks good, RDAVIDWebService should install correctly:

## try http:// if https:// URLs are not supported