[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jcifs
Subject:    Re: [jcifs] Proposal to enhance SmbFile.getInputStream and
From:       Michael B Allen <ioplex () gmail ! com>
Date:       2010-12-22 5:39:26
Message-ID: AANLkTikhTebg303VSKP4aiYz8vfxvxkJ_k4kQ746_MaL () mail ! gmail ! com
[Download RAW message or body]

Hi Sai,

I would say that if going through SmbFile to set shareAccess works,
that is the way to do it. I do not see why that is "not as elegant".
Supplying shareAccess is somewhat unusual. I would rather not clutter
the API with extra constructors for infrequently traveled code paths.

Mike

On Tue, Dec 21, 2010 at 9:18 AM, Sai Pullabhotla
<sai.pullabhotla@jmethods.com> wrote:
> Thought I should post this to the group and get some feedback. Below
> is what I need in my application.
>
> I will be reading and writing several files on a share. When I read a
> file, I need to ensure I acquire a Shared Read Lock, and when I'm
> writing to a file, I need to acquire an exclusive lock (NO other
> process should be able to open the file for anything).
>
> My code, for various reasons cannot use the SmbRandomAccessFile, and
> only calls SmbFile.getInputStream and getOutStream methods. It would
> be nice to overload these methods to indicate the desired shareAccess
> (or locking mode). Currently, it appears that you have to create an
> SmbFile object with the correct shareAccess or else you cannot enforce
> any specific shareAccess. This might work, but when we create SmbFile
> object, we will not know if the file is being created for reading or
> writing and what kind of locks we need. Currently when I've to
> read/write a file, I've to create a new SmbFile that is same as the
> one I already have on hand using - new SmbFile(mySmbFile, "",
> shareAccess). This seems to be working alright, but thought it is not
> as elegant.
>
> Please let me know if you think it would be a good idea to add a
> couple more overloaded methods to SmbFile. I can submit a patch if you
> are in favor.
>



-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic