-
Notifications
You must be signed in to change notification settings - Fork 16
Example: Updating a Node in a Document
When transforming a document there is no output report. It's a straightforward process of selecting documents for transformation and then performing the transformation. The updated document will then be placed in a collection. We'll need to set the name of the selector (URIS) query, the name of the transform query, number of threads to use, the collection name and database connection information. For this example the following information is given:
- Database name: FFE
- Database user name: ffe-user
- Database user password: ffe-user$pwd
- Database IP address: localhost
- Database port: 9500
- Modules database: FFE-Modules
- Name of URIS module: get-uris.xqy
- Name of PROCESS MODULE: update-node.xqy
- Number of threads to use: 8
There can be up to 16 arguments parsed by the main method in the java.com.marklogic.developer.corb.Manager
class. As with all arguments, order of placement is critical. If an option is not going to be used but is ordered before one that is going to be used empty quotes must be inserted in place of the unused option. The ordering for all is as follows:
- XCC-CONNECTION-URI
- COLLECTION-NAME
- PROCESS-MODULE
- THREAD-COUNT
- URIS-MODULE
- MODULE-ROOT
- MODULES-DATABASE
- INSTALL
- PROCESS-TASK
- PRE-BATCH-MODULE
- PRE-BATCH-TASK
- POST-XQUERY-MODULE
- POST-BATCH-TASK
- EXPORT-FILE-DIR
- EXPORT-FILE-NAME
- URIS-FILE
Therefore, to run CORB for the scenario described using method arguments would be:
java –cp "marklogic-corb-2.1.0.jar: marklogic-xcc-6.0.2.jar" com.marklogic.developer.corb.Manager \
xcc://ffe-user:ffe-user$pwd@localhost:9500/FFE "" \
update-node.xqy 8 get-uris.xqy \
"" FFE-Modules
Note that the '' is the line break designator for a bash command, the empty quotes ("") are necessary because we are not specifying a module root or a collection name for the query.
To use virtual machine property designators, '-D', for the same scenario you would use:
java –cp "marklogic-corb-2.1.0.jar: marklogic-xcc-6.0.2.jar" \
-DXCC-CONNECTION-URI= xcc://ffe-user:ffe-user$pwd@localhost:9500/FFE \
-DURIS-MODULE= get-uris.xqy –DPROCESS-MODULE= update-node.xqy \
–DTHREAD-COUNT=8 \
-DMODULES-DATABASE=FFE-Modules com.marklogic.developer.corb.Manager
Here, all the properties will be put into a file called corb.properties which must be available on the classpath. For the same scenario as above, the properties file would contain:
XCC-CONNECTION-URI= xcc://ffe-user:ffe-user$pwd@localhost:9500/FFE
URIS-MODULE= get-uris.xqy
PROCESS-MODULE= update-node.xqy
THREAD-COUNT=8
MODULES-DATABASE=FFE-Modules
The command line using the property file would be:
java –cp "marklogic-corb-2.1.0.jar: marklogic-xcc-6.0.2.jar" –DOPTIONS-FILE=corb.properties \
com.marklogic.developer.corb.Manager