commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manoj velliyatt <manojvelliy...@yahoo.com>
Subject Need Help on FileResourceManager Usage...
Date Tue, 10 Oct 2006 21:36:52 GMT
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


Mime
View raw message