[jcifs] Static CIFS properties

Michael B Allen mba2000 at ioplex.com
Sat Jul 16 20:15:35 GMT 2005

On Sat, 16 Jul 2005 11:36:52 +0000 (UTC)
Neil Clayton <neil at cloudnine.net.nz> wrote:

> Firstly, thank you to all that have contributed to the JCIFS API - I've found it
> nice to work with so far.
> Configureation wise: are there plans to change the Config classes (or those that
> depend upon Config) - so that properties do not have been set before the JCIFS
> classes are loaded?

At one point I proclaimed I might change this around so that it was more sophisticated but after having looked at it a few times I'm not certain that it will be changed. Properties simply should not be used for anything that is context specific. Rather the API should provide a way to specify those parameters directly.

> I can think of at least two reasons why this would be beneficial:
> 1) It would enable a program to address multiple servers; where multiple WINS
> servers are required (I'm using the WINS property as an example, since this
> cannot be set in the SmbFile URL).   It is possible that this example is not
> valid (that multiple WINS servers would never be a situation that occurs), but
> I'm not a CIFS expert.

Indeed it is not valid. If you had two network interfaces referring to entirely different networks and you wanted to copy data from a server on one to a server on the other then there would be a problem. But that's a pretty odd case.

> 2) It would mean that a user would be able to change parameters half way through
> a program (for example; connect to an alternate share point on another domain).
>  At present; I understand that if I change domain AFTER using the CIFS
> libraries, I'd need to restart the VM for those changes to take effect (statics,
> etc etc).

Construct different NtlmPasswordAuthentication objects with whatever domain,username,password you want to and use them with the SmbFile constructors.

> If the CIFS lib actually referenced the Config variables every time they were
> required; this would get around (2) - but the docs state that some of the
> classes grab config items from the Config class and cache them.

There not really "cached". There simpy set during static initialization for the duration of the program and that's it.

The only really good argument for making properties a little more dynamic would be for servlet containers so that you can update jcifs properties without restarting the container.


More information about the jcifs mailing list