Differences between revisions 9 and 10
| Deletions are marked like this. | Additions are marked like this. |
| Line 101: | Line 101: |
| might indicate that axis.home is not set correctly in RWebServicesEnv.properties. The missing jar file is ``commons-discovery-*.jar`` | might indicate that ``axis.home`` is not set correctly in RWebServicesEnv.properties. The missing jar file is ``commons-discovery-*.jar`` |
Hints for programmers
Map generation
- The following may indicate incomplete documentation (e.g., no man page for a class or function)
ant -Dpkg=<pkg> map-package > map-package: > [exec] > > [exec] > library(RWebServices) > [exec] Loading required package: SJava > [exec] Loading required package: TypeInfo > [exec] Loading required package: tools > [exec] > createMap(pkgs="<pgk>", ... > [exec] Error in get(x, envir, mode, inherits) : invalid first argument > [exec] Execution halted > [exec] Result: 1
> options(error=recover)
> createMap(pkgs='<pkg>', [etc])
Error in get(x, envir, mode, inherits) : invalid first argument
Enter a frame number, or 0 to exit
1: createMap([etc]
2: createMap([etc]
3: .local(funcs, pkgs, generateTests, outputDirectory, typeMode, deployMode, v
4: generateFunctionMap(unlist(sigs, recursive = FALSE), genTest = generateTest
5: rjSigsToRJMap(rTypeInfo, lookup = lookup, deployMode = deployMode, typeMode
6: generateDataMap(arg, javaToR = TRUE, deployMode = deployMode, typeMode = ty
7: updateLookup_jType(rType)
8: generateJavaBean(rType, jPkgName, slotListJ, typeMode)
9: createJavaBean(javaType, jPkgName, slotListJ, classDoc, typeMode)
10: paste("\n\t/**\n", "\t* Sets the ", slotName, " value for this ", javaType,
11: get(rSlotName, classDoc)Equality of data objects in R and Java
ant rservices-test
performs tests to see that numeric values are identical after a round trip to R. These tests should not usually fail.
The default code in test/src/org/bioconductor/rservicesJms/worker/RWorkerDataTest.java checking on data transfer from Java to R use 'identical' on the R side to check that the objects are the same. Thus it is possible to create a custom method for assessing identity on the R side with code like
setMethod("identical",
signature(x="MyClass", y="MyClass"),
function(x, y) {
## return TRUE if identical,
## FALSE or stop("<msg>") otherwise
TRUE
})If you add this to your package (it could also be added to R/<MyClass>.R, starting in the same directory as RWorkerDataTest.java), then be sure to add
exportMethods(identical)
to your NAMESPACE file
Tracking down errors
- Test the function in R alone. Generate the relevant data objects in R and invoke the function.
- Write test cases for data transfer first; there should be templates in test/.../worker/RWorkerDataTest.java. For R to Java, there are facilities to generate a 'mock' data set by calling an R script (in the R/ directory of this class).
- If the data and parameters are transfered correctly, then try evaluating the service
Web service generation
gen-service-wsdl-jms:
[echo] for service: <pkg>
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingletonmight indicate that axis.home is not set correctly in RWebServicesEnv.properties. The missing jar file is commons-discovery-*.jar
