EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Rename folder and file is not working from other thread

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#20717
Posted: 07/03/2012 07:18:07
by szagriichuk  (Basic support level)
Joined: 03/28/2012
Posts: 51

Hi, Related to this description http://www.eldos.com/documentation/cbfs/ref_gen_timeouts.html I've tied to perform some long operation, in my case Rename in other thread.
For first test I've got VDisk Java sample and added minor changes to event onRenameOrMove,

Code
@Override
    public void onRenameOrMove(CallbackFileSystem callbackFileSystem, CbFsFileInfo FileInfo, final String NewFileName) throws Exception {
        final VirtualFile vfile = FindVirtualFile(FileInfo.getFileName());
        final VirtualFile vdir = FindVirtualDirectory(NewFileName);

        executorService.submit(new Runnable() {
            @Override
            public void run() {
                vfile.Remove();

                vfile.Rename(GetFileName(NewFileName));

                vdir.AddFile(vfile);
            }
        });
    }


So, After start to use rename functionality I am receiving error message look to atrtachement,
What have I done wrong ?
Thanks.


#20718
Posted: 07/03/2012 07:42:21
by Eugene Mayevski (EldoS Corp.)

You have changed backend data storage and didn't notify the OS about the change. The OS has no way to know about backend changes.


Sincerely yours
Eugene Mayevski
#20719
Posted: 07/03/2012 09:07:36
by szagriichuk  (Basic support level)
Joined: 03/28/2012
Posts: 51

Auto notification is performing from getInfo event, and this event is appear before rename event is performing, as I understand from debug. OK, How can I notify OS about changing ?
#20720
Posted: 07/03/2012 09:19:53
by Eugene Mayevski (EldoS Corp.)

See NotifyDirectoryChange method. Its use has been discussed here a number of times.


Sincerely yours
Eugene Mayevski
#20723
Posted: 07/03/2012 16:14:44
by szagriichuk  (Basic support level)
Joined: 03/28/2012
Posts: 51

Thank you for replay, I've tried to add
Code
callbackFileSystem.notifyDirectoryChange

to rename event in VDisk sample, but error dialog is appear all times.
For parameters I've used old file name and Modify flag. Tomorrow will try to do the same on .net sample.
#20724
Posted: 07/03/2012 23:44:13
by Eugene Mayevski (EldoS Corp.)

Please try directory name, which is more logical, as you are modifying *directory* contents, not file.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 1179 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!