private static final int[] INTS = {Access.NONE, Access.READ, Access.WRITE, Access.EXECUTE, Access.CREATE};
public void process() throws dbXMLException {
CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
if ( col == null )
throw new dbXMLException("Collection context required");
String roleID = cl.getNextToken("Role ID");
int permissions = 0;
boolean recursive = false;
if ( !cl.hasMoreTokens() )
throw new dbXMLException("At least one permission must be specified");
while ( cl.hasMoreTokens() ) {
String mode = cl.getNextToken("Mode").toUpperCase();
boolean found = false;
for ( int i = 0; i < STRS.length; i++ ) {
if ( mode.equals(STRS[i]) ) {
permissions |= INTS[i];
found = true;
}
}
if ( mode.equals(ALL) ) {
for ( int i = 0; i < INTS.length; i++ )
permissions |= INTS[i];
found = true;
}
if ( mode.equals(RECURSIVE) ) {
recursive = true;
found = true;
}
if ( !found )
throw new dbXMLException("Unknown mode '"+mode+"'");
}
process(col, roleID, permissions, recursive);
StringBuffer sb = new StringBuffer();