if(!message.containsKey(DOCUMENT)) {
throw new Exception(MISSING_DOCUMENT_PARAM);
}
Collection col = getCollection((String) message.get(COLLECTION));
Document doc = DOMParser.toDocument((String) message.get(DOCUMENT));
if ( doc == null ) {
throw new Exception( "Unable to parse Document" );
}
String id = (String) message.get(NAME);
if ( id.equals( "" ) ) {
id = col.insertDocument( doc ).toString();
}
else {
col.insertDocument( id, doc );
}
Hashtable result = new Hashtable();
result.put(RESULT, id);
return result;