You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by manoj velliyatt <ma...@yahoo.com> on 2006/10/10 23:36:52 UTC
Need Help on FileResourceManager Usage...
Hi All,
I was trying out the below code snippet for deleting one of the file in my File System.
But after executing the code, the file is not getting deleted. Am i doing some thing wrong here?
Can anybody help me out on this one?
regards
Manoj Velliyatt
///////////////////////////////////////////
public class FileOperationsTest {
private static final Logger logger = Logger.getLogger(FileOperationsTest.class.getName());
private static final LoggerFacade sLogger = new Jdk14Logger(logger);
private static final String STORE = "C:/eclipse/workspace/MyExp";
private static final String WORK = "C:/eclipse/workspace/MyExp/tmp/work";
/**
*
*/
public FileOperationsTest() {
super();
deleteTheFile();
}
/**
* @param args
*/
public static void main(String[] args) {
FileOperationsTest fot = new FileOperationsTest();
}
public void deleteTheFile()
{
FileResourceManager rm = new FileResourceManager(STORE, WORK, true, sLogger, true);
try
{
rm.start();
String txId = rm.generatedUniqueTxId();
String tempFile = "C:/eclipse/workspace/MyExp/Test/todelete.txt";
File f = new File(tempFile);
System.out.println(f.toString());
rm.startTransaction(txId);
//rm.createResource(txId,f );
rm.deleteResource(txId,f,false);
rm.commitTransaction(txId);
//rm.rollbackTransaction(txId);
rm.stop(ResourceManager.SHUTDOWN_MODE_NORMAL);
}catch (Exception ex)
{
ex.printStackTrace();
}
}
/////////////////////////////
Send instant messages to your online friends http://uk.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org