ValidationHelper vHelper = new ValidationHelper();
String locator;
String[] parsed;
ISupportedValues supported;
NodeList nlActions;
IOperationProvider opProvider = null;
// service and version are parsed by the parent RequestHandler
// output format
locator = "@outputFormat";
parsed = pHelper.getParameterValues(root,xpath,locator);
supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
context.getOperationResponse().setOutputFormat(
vHelper.validateValue(supported,locator,parsed,false));
// verbose response
locator = "@verboseResponse";
parsed = pHelper.getParameterValues(root,xpath,locator);
supported = new SupportedValues("true,false",",");
String verbose = Val.chkStr(vHelper.validateValue(supported,locator,parsed,false));
tOptions.setVerboseResponse(verbose.equalsIgnoreCase("true"));
// request ID
locator = "@requestId";
parsed = pHelper.getParameterValues(root,xpath,locator);
tOptions.setRequestId(vHelper.validateValue(locator,parsed,false));
// determine the sub-operation
// Insert
if (opProvider == null) {
locator = "csw:Insert";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Insert);
opProvider = new InsertProvider();
}
}
// Update
if (opProvider == null) {
locator = "csw:Update";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Update);
opProvider = new UpdateProvider();
}
}
// Delete
if (opProvider == null) {
locator = "csw:Delete";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Delete);
opProvider = new DeleteProvider();
}
}
// handle the sub-operation
if (opProvider != null) {
opProvider.handleXML(context,root,xpath);
} else {
locator = "csw:Transaction";
String msg = "The transaction operation node was missing.";
throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
}