// Perform the comand :
String comment = data.getValue("comment") ;
if (action.equals("remove")) {
//get the parent resource of our own resource
ResourceReference rr = getResource().getParent();
try {
Resource res = rr.lock();
DirectoryResource dirres = null;
if (! (res instanceof DirectoryResource)) {
getServer().errlog(res,
"CvsFrame: not a child of a DirectoryResource");
return error(this, request,
"The server is misconfigured.",
"The CVS Directory is not a children of a"+
"Directory Resource.");
}
dirres = (DirectoryResource) res;
for (int i=0; i < size; i++ ) {
String name = names[i];
ResourceReference childref = dirres.lookup(name);
if (childref != null) {
try {
Resource children = childref.lock();
if (children instanceof FileResource) {
FileResource fres =
(FileResource) children;
// delete the file
fres.getFile().delete();
// delete the resource
fres.delete();
}
} catch(MultipleLockException mex) {
mex.printStackTrace();
return error(this, request,
"MultipleLockException: "+
mex.getMessage(),
"Resource "+name+" in use"+
", can't be deleted now.");
} catch(InvalidResourceException iex) {
iex.printStackTrace();
return error(this, request,
"InvalidResourceException. ",
iex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
return error(this, request,
"Exception occurs.",
ex.getMessage());
} finally {
childref.unlock();
}
} else {
//no resource, remove the file only
File file = new File( dirres.getDirectory(),
name );