camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kesireddy, Chandana (ITD)" <chandana.kesire...@state.ma.us>
Subject creating .camelLock extension on file using custom GenericFileProcessStrategy
Date Wed, 28 Nov 2012 21:44:50 GMT
Hi,

I am writing custom GenericFileProcessStrategy  class .  Iam not able to create .camelLock
extension on the file when it processes the file.
I want the file to be deleted after it is processed.
Please let me know how to create .camelLock  extension on the file using using custom GenericFileProcessStrategy.
Iam using camel 2.4. I want to provide options:
delete=true,  readLock=changed, readLockTimeout=20000 options applied in my custom process
strategy class.
Following is my code:

public class CustomProcessStrategy implements GenericFileProcessStrategy{

                @Override
                public boolean begin(GenericFileOperations arg0, GenericFileEndpoint arg1,
                                                Exchange arg2, GenericFile arg3) throws Exception
{
                                // TODO Auto-generated method stub
                                arg1.setAutoCreate(false);
                                arg1.setDelete(true);
                                arg1.setRecursive(true);
                                arg1.setReadLock("changed");
                                arg1.setReadLockTimeout(20000);
                                System.out.println("in begin..");
                                return true;
                }

                @Override
                public void commit(GenericFileOperations arg0, GenericFileEndpoint arg1,
                                                Exchange arg2, GenericFile arg3) throws Exception
{
                                // TODO Auto-generated method stub
                                System.out.println("in commit");

                }

                @Override
                public void prepareOnStartup(GenericFileOperations arg0,
                                                GenericFileEndpoint arg1) throws Exception
{
                                System.out.println("prepareOnStartup method..");

                                arg1.setAutoCreate(false);
                                arg1.setDelete(true);
                                arg1.setRecursive(true);
                                arg1.setReadLock("changed");
                                arg1.setReadLockTimeout(20000);

                                System.out.println("end of prepareOnStartup method..");

                }

                @Override
                public void rollback(GenericFileOperations arg0, GenericFileEndpoint arg1,
                                                Exchange arg2, GenericFile arg3) throws Exception
{
                                // TODO Auto-generated method stu
                                System.out.println("in commit..");
                }

}

Thanks,
Chandana

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message