updateSonia {rSoNIA}R Documentation

Retrieves and executes a java-based installer from sonia website

Description

Downloads and runs an java-based installer to deal with various third-partly libraries, licenses, etc. Also checks for java and QuickTime.

Usage

updateSonia(installerLoc =
"http://internap.dl.sourceforge.net/sourceforge/sonia/",
installerName = "install_sonia_1_1_5.jar", installDir
= rSoniaLoc(), javaDownloadUrl =
"http://www.java.com/getjava/index.jsp", rsoniaRepos =
"http://csde.washington.edu/~skyebend/rsonia/current/",
dynamicNetworkRepos =
"http://csde.washington.edu/~skyebend/dynamicnetwork/current/")

Arguments

installerLoc url to download the java installer from
installerName installer file name / verasin
installDir directory where java files should be installed, defaults to rSoNIA install directory
javaDownloadUrl url to download java installer from if needed
rsoniaRepos url to download rSoNIA files from
dynamicNetworkRepos url to download dynamicnetwork files from

Details

Java must be installed. If it is not installed, it will ask to open a the sun web page to download the installer. Input and interaction is handled in java windows. Then downloads the sonia installer. Runs the installer, pointing it to the rSoNIA library directory. Users is presented with the licenses and information about the various dependent packages, needed .jar files are extracted.

Value

Returns 1 if install is successful, prints status to the terminal.

Author(s)

Skye Bender-deMoll skyebend@skyeome.net CSDE statnet team

References

http://sonia.stanford.edu/

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function () 
{
    installerLoc <- "http://www.stanford.edu/group/sonia/"
    installerName <- "install_sonia.jar"
    installDir <- paste(gsub("\\", "/", R.home()), "/library/rSoNIA/java/", 
        sep = "")
    javaDownloadUrl <- "http://www.java.com/getjava/index.jsp"
    rsoniaRepos <- "http://csde.washington.edu/~skyebend/rsonia/current/"
    dynamicNetworkRepos <- "http://csde.washington.edu/~skyebend/dynamicnetwork/current/"
    print("Checking java version..")
    javaVer <- system("java -version", intern = TRUE)
    print(javaVer)
    verNum <- as.numeric(substr(javaVer[1], 15, 17))
    print(verNum)
    if (is.na(is.numeric(verNum))) {
        answer <- readline("java does not seem to be correctly installed, would you like to download it? (y/n)")
        if (substr(answer, 1, 1) == "y") {
            browseURL(javaDownloadUrl)
            stop("\nPlease re-run updateSonia() after java has been installed\n")
        }
        else {
            stop("Java must be installed before SoNIA")
        }
    }
    else {
        if (verNum < 1.4) {
            answer <- readline("The version of java must be newer than 1.4, would you like to download a newer version? (y/n)")
            if (substr(answer, 1, 1) == "y") {
                browseURL(javaDownloadUrl)
                stop("\nPlease re-run updateSonia() after java has been installed\n")
            }
            else {
                stop("Java must be installed before SoNIA")
            }
        }
    }
    dir.create(installDir)
    print("Downloading sonia web installer...")
    download.file(paste(installerLoc, installerName, sep = ""), 
        paste(installDir, installerName, sep = ""), mode = "wb")
    launchString <- paste("java -jar ", installDir, installerName, 
        " ", installDir, sep = "")
    returnCode <- system(launchString, show.output.on.console = FALSE)
    if (returnCode) {
        print("SoNIA java libraries have been installed")
    }
    else {
        stop("Error installing SoNIA java libraries")
    }
    installed <- .packages(all.available = TRUE)
    print("checking required package dynamicnetwork")
    if ("dynamicnetwork" %in% installed) {
    }
    else {
        print("missing package dynamicnetwork")
    }
    print("Update  of SoNIA java libraries complete")
  }

[Package rSoNIA version 0.0-4 Index]