commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Zeigermann" <oliver.zeigerm...@gmail.com>
Subject Re: Regarding apache commons file transactions ~script
Date Fri, 15 Sep 2006 15:17:26 GMT
Hi Praven!

You have to delete the file using the FileResourceManager.

Oliver

2006/9/15, Praveen Kumar <Praveen.Kumar2@ericssonservices.co.uk>:
> *** CAUTION ***
>
> The sender of this email has requested that its content is not checked
> for potentially mailicious scripts.  Therefore this email has been virus
> checked, but advanced content security checks have not been carried
> out. Please take extra care when handling this email and any associated
> attachments.  The original message now follows.
> ________________________________________________________________
> > Hi,
> >
> > I need your help to solve my technical problem. Many thanks in
> > advance.
> >
> > I am using apache commons file transactions for my application. As per
> > my requirement i have to rollback the file deletion if any abnormal
> > condition occurs in a transaction. For that i wrote below code.
> >
> >
> >                 Logger logger =
> > Logger.getLogger(test.class.getName());
> >                 LoggerFacade sLogger = new Jdk14Logger(logger);
> >
> >                 FileResourceManager frm = new
> > FileResourceManager("store", "work", false, sLogger, true);
> >                 Object txId = getTranscationId(new Date().getTime());
> >                 try {
> >                                       frm.start();
> >                                       frm.prepareTransaction(txId);
> >                                       frm.startTransaction(txId);
> >                                       frm.lockResource(url, txId);
> >                                       FileHelper fh = new
> > FileHelper();
> >                                       fh.deleteFile(url);
> >                                       frm.commitTransaction(txId);
> >                 } catch (ResourceManagerException  e) {
> >                                       try {
> >                                     frm.rollbackTransaction(txId);
> >                                   }
> >
> >
> > When i test the above code by placing "throw new
> > ResourceManagerException()" after  fh.deleteFile(url) statement, by
> > commenting the frm.commitTransaction(txId) statement, the control is
> > coming to catch block. But, file deletion can't rollback. I mean after
> > transaction rollback the file doesn't place in actual directory.
> >
> > One more doubt using apache commons, can i delete a file which is
> > exist in remote server?
> >
> > Kindly, help me. Awaiting for your reply.
> >
> > Thanks & Regards,
> > Praveen
>
> This communication is confidential and intended solely for the addressee(s). Any unauthorized
review, use, disclosure or distribution is prohibited. If you believe this message has been
sent to you in error, please notify the sender by replying to this transmission and delete
the message without disclosing it. Thank you.
>
> E-mail including attachments is susceptible to data corruption, interruption, unauthorized
amendment, tampering and viruses, and we only send and receive e-mails on the basis that we
are not liable for any such corruption, interception, amendment, tampering or viruses or any
consequences thereof.
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message