createMap: Create Java function signatures from R functions

Description Usage Arguments Details Value Author(s) See Also Examples

Description

createMap extracts type information from R function definitions, and uses this to create Java-style function calls with appropriately typed arguments. Types are then converted to Java objects.

A side effect is to create or modify a directory structure in the current working directory containing Java class information.

There are three methods defined:

createMap(standardGeneric, missing, ...)

Intended to dispatch on S4 generics, creating maps for all currently visible methods.

createMap(character, missing, ...)

Intended to dispatch on a character vector of function names, creating maps for each function.

createMap(missing, pkgs=character, ...)

Inteded to map all functions in pkgs with typeInfo applied. pkgs can be a character vecorr of package names, or in conjunction with the argument splitPkgsToVector=TRUE a comma-delimited list of packages. The latter behavior is meant to faciliate use with the ant command line, as ant -Dpkg=caDNAcopy,caPROcess gen-map-from-package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
createMap(funcs, pkgs, generateTests = TRUE,
          outputDirectory = stop("specify outputDirectory"),
          typeMode = "javalib", deployMode = "jms",
          verbose = FALSE, ...)
## S4 method for signature 'missing,character'
createMap(funcs, pkgs, generateTests = TRUE,
          outputDirectory = stop("specify outputDirectory"),
          typeMode = "javalib", deployMode = "jms",
          verbose = FALSE, splitPkgsToVector=TRUE, ...,
          extraClasses=character())

Arguments

funcs

Function or list of functions with typeInfo already applied, or S4 generic method.

pkgs

Character string or vector of package names. Package namespaces are parsed for functions with TypeInfo, and R-Java maps are created for these.

generateTests

Logical. Should test code be generated?

outputDirectory

Directory where Java hierarchy will be created.

typeMode

Character, either "robject" or "javalib". How Java objects should be generated; see generateDataMap and converters. typemode may be over-written by values in system.file("rservices", "properties.R", package=pkg).

deployMode

Character, either "demo" or "jms". How the service will be deployed. "demo" is no longer supported.

verbose

Print information during mapping generationg; useful for debugging.

...

Additional arguments, e.g., S4DefaultTypedSig used for providing type specifications for S4 functions when funcs is of class standardGeneric, or splitPkgsToVector=TRUE to treat pkgs as a comma-delimited list of packages.

splitPkgsToVector

Parse character(1) pkgs as split(pkgs, ","), primarily for ant-based integration.

extraClasses

A character vector of extra classes to map, in addition to those specified in the TypeInfo signature. extraClasses for this method are augmented by any classes defined in the file system.file("rservices", "properties.R", package=pkg).

Details

createMap operates either on functions with typeInfo applied, or on S4 generic methods.

Some coercion occurs with typeInfo functions. All signatures have an explict return type. IndependentTypeSpecification classes are 'expanded' to a complete set of typed signatures.

Function signatures for S4 methods are created from information used in generic method construction, supplemented by an optional default type signature supplied as a named argument S4DefaultTypedSig. Each method defined for a generic results in a Java signature. Arguments used for method dispatch are typed according to the dispatch rules for the function. Return types are determined by the valueClass of the generic (the valueClass of methods seem not to defined, despite what the documentation indicates). Default values for other arguments, and for return values if valueClass is not used, can be created with a TypedSignature passed as a named argument S4DefaultTypedSig. Values implied by S4 method definitions override the defaults.

See typeInfo2Java for additional information on how conversion occurs.

Value

Primarily inovkes for the side-effect of creating a java class hierarchy reflecting the data and methods present in the call to createMap. Returns a list of Java signatures function definitions..

Author(s)

Martin Morgan <mtmorgan@fhcrc.org>

See Also

createMap,missing,character-method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(RWebServices)

## S4
## Not run: 
setClass("A", representation(x="character"))
setGeneric("foo", function(obj) standardGeneric("foo"))
setMethod("foo", "numeric", function(obj) new("A", x=as.character(obj)))
setMethod("foo", "character", function(obj) new("A", x=obj))

createMap(foo, outputDirectory=tempdir(), S4DefaultTypedSig=TypedSignature(returnType="A"))






## End(Not run)

RWebServices documentation built on Oct. 5, 2016, 4:53 a.m.