Here is an example of constructing a submit request that can be used as input to rdmgr. Request headers do not have an associated URL and use "-" instead.
Search req = new Search("REQUEST", "-"); |
A submit request can have the following attributes:
submit-csid submit-database submit-type submit-operation submit-view |
Add values for each of these attributes to the request header. This example shows an update operation into the default database. The database attribute is optional, the default database is used if none is supplied. The submit view restricts which attributes are updated, by default all of the supplied input attributes will be updated for each resource description.
req.insert("submit-database", "default"); req.insert("submit-type", "nonpersistent"); req.insert("submit-operation", "update"); req.insert("submit-view", "title,author,description"); |
Now we create the body part of the submit request. We’ll be updating the resource description of a document, whose URL is http://www.sesta.com/~jocelyn/resdogs.index.htm, whose title is “Saving English Springer Spaniels,” whose author is Jocelyn Becker, and whose description is “English Springer Spaniels in need of homes.”
Search data = new Search("DOCUMENT", "http://www.sesta.com/~jocelyn/resdogs.index.htm\\n"); data.insert("title", "Saving English Springer Spaniels"); data.insert("author", "Jocelyn Becker"); data.insert("description", "English Springer Spaniels in need of homes"); |
Now, the request is saved to a file for input to rdmgr:
SearchOutputStream sos = new SearchOutputStream("search_file"); sos.write(req); sos.write(data); sos.close(); |
At this point search_file should contain:
@REQUEST { - submit-database{7}: default submit-type{13}: nonpersistent submit-operation{6}: update submit-view{24}: title,author,description } @DOCUMENT { http://www.best.com/~jocelyn/resdogs/index.html title{32}: Saving English Springer Spaniels author{14}: Jocelyn Becker description{42}: English Springer Spaniels in need of homes } |