EldoS | Feel safer!

Software components for data protection, secure storage and transfer

JNI Interface and onEnumerateNamedStreams

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 01/21/2011 15:25:14
by Ian Davies (Basic support level)
Joined: 01/07/2011
Posts: 3

In the documentation it states that onEnumerateNamedStreams is an optional callback. As such for .NET and C implementations there is no need to register this callback, which tells windows that named streams aren't supported.

My question is from the Java interface what is the equivalent to this? As the method is defined in the ICbFsEnumerateEvents which I must implement to provide other base functionality.

Is there a specific error code I should return or is there another potential option to let the CallbackFileSystem know I don't want named streams?

I'm using the latest version of CBFS (v3.1.85).
Posted: 01/24/2011 02:51:57
by  shevchenko
You can leave this event's empty.

So, which method you must implement to provide other base functionality? Maybe we need to provide other event group for this method.
Posted: 01/24/2011 07:57:33
by Ian Davies (Basic support level)
Joined: 01/07/2011
Posts: 3

The interface definition for ICbFsEnumerateEvents is:

public interface ICbFsEnumerateEvents {
void onEnumerateDirectory(...) throws java.lang.Exception;
void onEnumerateNamedStreams(...) throws java.lang.Exception;
void onCloseEnumeration(...) throws java.lang.Exception;
void onIsDirectoryEmpty(...) throws java.lang.Exception;

If leaving the implementation for onEnumerateNamedStreams as empty works that's fine. Was just double checking as the documentation wasn't clear on this.

Would it make sense to pull the onEnumerateNamedStreams method into a new event group interface?
Posted: 01/24/2011 08:59:43
by  shevchenko
Event's grouping by interface specified only for cbfs java version. I think the name of the method "onEnumerateNamedStreams" justifies its presence in the group "ICbFsEnumerateEvents".
Posted: 02/11/2011 04:50:32
by Ian Davies (Basic support level)
Joined: 01/07/2011
Posts: 3

Apologies for the long delay in responding again. I've been carrying out some further testing and have seen that I'm getting invocations of onCreateFile and onOpenFile with data streams, i.e the file names are of the form:


I'm using the JNI interfaces and have implemented the ICbFsEnumerateEvents interface (to allow directory listing). I don't wish to support named streams so have left the implementation of onEnumerateNamedStreams empty. I suspect if I were using .Net and hadn't provided any hook for that specific callback I would not be seeing the onCreateFile invocation for a data stream.

Obviously I could return an exception when asked to create/open a datastream but that will (I presume) ripple up to the user depending upon the application. What I would like is the behaviour described in the documentation:

"If the file name contains semicolon (":"), this means that the request is made to create a named stream in a file. The part before the semicolon is the name of the file itself and the name after the semicolon is the name of the named stream. If you don't want to deal with named streams, don't implement the handler for OnEnumerateNamedStreams event. In this case CBFS API will tell the OS that the named streams are not supported by the file system. "


"The event is optional, i.e. you should not to attach an event handler if you don't plan to work with alternate (named) streams. In this case CBFS API will tell the OS that the named streams are not supported by the file system."

But from the java interfaces I believe that would require the 'optional' onEnumerateNamedStreams callback to be separated from the required callbacks that exist in ICbFsEnumerateEvents. Or for the library to detect that the implementation is empty and notify windows that named streams are not supported. It seems the latter would be far harder.

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.



Topic viewed 1481 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!