Re: Local vs. network file

Discussion in 'Java' started by Robert Klemme, Jun 24, 2012.

  1. On 24.06.2012 18:18, Qu0ll wrote:
    > Is it possible to determine if a given String contains the path of a
    > file on a network drive (versus a local file) in Java 7?


    Yes.

    robert


    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Jun 24, 2012
    #1
    1. Advertising

  2. Robert Klemme

    Eric Sosman Guest

    On 6/24/2012 2:01 PM, Qu0ll wrote:
    >[...]
    > I have a requirement to limit a program which is licensed as "stand
    > alone" to not be run from a network location so I figured if I could
    > tell whether the launch directory was a network share then I could block
    > it. Is there another way I could implement this?


    I think you need to go back to the people who imposed the
    requirement, and get them to supply a precise definition of
    "network share." Does a NAS count? It's certainly on a network
    but not necessarily shared. What about iSCSI? What about
    InfiniBand, for that matter? What about today's favorite
    buzzphrase, "the Cloud?"

    --
    Eric Sosman
    d
    Eric Sosman, Jun 24, 2012
    #2
    1. Advertising

  3. On 24.06.2012 19:49, Peter Duniho wrote:

    > Actually, I doubt you can do this in a platform-independent way. Even on
    > Windows, a UNC path (which is normally used to specify a network path) can
    > refer to a local drive and a drive-letter path can refer to a network
    > location. You need to use platform-specific calls to tell the difference.


    How would an UNC path look that points to a local file / directory? Or
    did you think of \\local_server_name\any\path ? AFAIK that would still
    be a network path even though the share would be local.

    Cheers

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Jun 24, 2012
    #3
  4. On 24.06.2012 20:01, Qu0ll wrote:

    > I have a requirement to limit a program which is licensed as "stand
    > alone" to not be run from a network location so I figured if I could
    > tell whether the launch directory was a network share then I could block
    > it. Is there another way I could implement this?


    Ah, now we're cooking! I am afraid you need to implement a solution for
    every platform your software could be used on. On *nix you could
    evaluate the output of "mount" to find out, on Windows you probably need
    to look at "net use" etc. Maybe on POSIX OS there is a system call that
    will help so you could write a JNI extension.

    This method certainly helps:
    http://docs.oracle.com/javase/6/docs/api/java/io/File.html#getCanonicalFile()

    If you want to prevent multiple instances running concurrently from one
    installation you could use a file in the installation location.
    However, proper file locking in a platform independent way is another
    tricky task in Java.

    Btw, I don't see how the installation location actually makes a
    difference. You could still install the program on each system and run
    it multiple times. Why do you need to prevent running from a network drive?

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Jun 24, 2012
    #4
  5. On 06/28/2012 11:10 AM, Qu0ll wrote:
    > Reply at the end...


    SNIP

    >
    > The situation is that I have developed some software which the client
    > wishes to license as either a stand-alone product or with a network
    > model. The network license permits a fixed maximum number of concurrent
    > users to load the software from a single network share. The stand-alone
    > license permits a fixed maximum number of concurrent users to run the
    > software on their local machine (the maximum controls the number of
    > concurrent machines on which it is running). It's a pricing and
    > marketing thing; the network license is more expensive but doesn't
    > really offer any extra functionality or benefit.


    That is a strange license scheme that might have sounded reasonable in
    the 19xx years. Why make the distinction at all?

    On common OS-es like Windows and *nix a path to a resource on what you
    call a "network share" can take the exact same form as one that is
    located on what you call the "local machine". I do not think you will
    have any luck working on paths only.

    You could setup some file locking scheme, akin to what H2SQL does with
    embedded database connections. This disallows accessing the same
    resource (which in the H2 case is a database) from more than one running
    process at the same time.
    However, this simply limits the number of concurrent uses of a single
    installation to 1. It does not prevent running from a remote location
    and it does not prevent running the same installation from different
    locations at different points in time. In fact, this would simply
    implement a network license for N=1.
    Silvio Bierman, Jun 28, 2012
    #5
  6. On 28.06.2012 11:10, Qu0ll wrote:

    > The situation is that I have developed some software which the client
    > wishes to license as either a stand-alone product or with a network
    > model. The network license permits a fixed maximum number of concurrent
    > users to load the software from a single network share. The stand-alone
    > license permits a fixed maximum number of concurrent users to run the
    > software on their local machine (the maximum controls the number of
    > concurrent machines on which it is running). It's a pricing and
    > marketing thing; the network license is more expensive but doesn't
    > really offer any extra functionality or benefit.


    Err, why would anyone want to pay more for the network share license?
    Maybe I am missing something but I don't understand the business case here.

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Jul 2, 2012
    #6
  7. Robert Klemme

    Joerg Meier Guest

    On Mon, 02 Jul 2012 19:33:54 +0200, Robert Klemme wrote:

    > On 28.06.2012 11:10, Qu0ll wrote:
    >> The situation is that I have developed some software which the client
    >> wishes to license as either a stand-alone product or with a network
    >> model. The network license permits a fixed maximum number of concurrent
    >> users to load the software from a single network share. The stand-alone
    >> license permits a fixed maximum number of concurrent users to run the
    >> software on their local machine (the maximum controls the number of
    >> concurrent machines on which it is running). It's a pricing and
    >> marketing thing; the network license is more expensive but doesn't
    >> really offer any extra functionality or benefit.

    > Err, why would anyone want to pay more for the network share license?
    > Maybe I am missing something but I don't understand the business case here.


    Collusion ?

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
    Joerg Meier, Jul 2, 2012
    #7
  8. Robert Klemme

    Eric Sosman Guest

    On 7/2/2012 1:33 PM, Robert Klemme wrote:
    > On 28.06.2012 11:10, Qu0ll wrote:
    >
    >> The situation is that I have developed some software which the client
    >> wishes to license as either a stand-alone product or with a network
    >> model. The network license permits a fixed maximum number of concurrent
    >> users to load the software from a single network share. The stand-alone
    >> license permits a fixed maximum number of concurrent users to run the
    >> software on their local machine (the maximum controls the number of
    >> concurrent machines on which it is running). It's a pricing and
    >> marketing thing; the network license is more expensive but doesn't
    >> really offer any extra functionality or benefit.

    >
    > Err, why would anyone want to pay more for the network share license?
    > Maybe I am missing something but I don't understand the business case here.


    It might be more economical to support N occasional users with
    M << N expensive "floating" licenses than to buy N cheaper dedicated
    licenses and see them sit unused most of the time.

    http://lmgtfy.com/?q=floating license

    --
    Eric Sosman
    d
    Eric Sosman, Jul 2, 2012
    #8
  9. Robert Klemme

    Eric Sosman Guest

    On 7/2/2012 4:32 PM, Peter Duniho wrote:
    > On Mon, 02 Jul 2012 16:18:59 -0400, Eric Sosman wrote:
    >
    >>>> [...] The stand-alone
    >>>> license permits a fixed maximum number of concurrent users to run the
    >>>> software on their local machine (the maximum controls the number of
    >>>> concurrent machines on which it is running). It's a pricing and
    >>>> marketing thing; the network license is more expensive but doesn't
    >>>> really offer any extra functionality or benefit.
    >>>
    >>> Err, why would anyone want to pay more for the network share license?
    >>> Maybe I am missing something but I don't understand the business case here.

    >>
    >> It might be more economical to support N occasional users with
    >> M << N expensive "floating" licenses than to buy N cheaper dedicated
    >> licenses and see them sit unused most of the time.

    >
    > Except that the OP has already stated that the license covers _concurrently
    > running instances_ and not installed machines. In that scenario, the
    > licensee has no real reason to pay more for a "network" license than a
    > "standalone" one, because they only need to license standalone instances
    > that are running either way (i.e. they don't need more licenses than would
    > actually be running at a given time).


    One of the things the O.P. actually wrote was

    "The network license permits a fixed maximum number of
    concurrent users to load the software from a single network
    share. The stand-alone license permits a fixed maximum number
    of concurrent users to run the software on their local machine
    (the maximum controls the number of concurrent machines on
    which it is running)."

    Okay, the description is not exactly clear. But one thing that
    *is* clear is that two kinds of licenses are contemplated. As I read
    it (and/or guess at it), a "stand-alone" license is tied to a specific
    machine, and allows up to N concurrent usages on that machine. For
    a workstation, N is probably 1. For a server, N may be greater. But
    if machine X is using all N licenses while machine Y is using none,
    Y can't lend a license to X.

    The "network" license, on the other hand, allows up to N concurrent
    usages across the entire "network" (however that's defined). It doesn't
    matter which machine(s) are being used, so if Y hasn't claimed a license
    X can do so.

    Fine, lots of guesswork from an incomplete description. But IMHO
    the guesswork is plausible, and answers Robert Klemme's question.

    --
    Eric Sosman
    d
    Eric Sosman, Jul 2, 2012
    #9
  10. Robert Klemme

    Lew Guest

    On Monday, July 2, 2012 3:32:40 PM UTC-7, Eric Sosman wrote:
    > ... [snip] ...
    > One of the things the O.P. actually wrote was
    >
    > "The network license permits a fixed maximum number of
    > concurrent users to load the software from a single network
    > share. The stand-alone license permits a fixed maximum number
    > of concurrent users to run the software on their local machine
    > (the maximum controls the number of concurrent machines on
    > which it is running)."
    >
    > Okay, the description is not exactly clear. But one thing that
    > *is* clear is that two kinds of licenses are contemplated. As I read
    > it (and/or guess at it), a "stand-alone" license is tied to a specific
    > machine, and allows up to N concurrent usages on that machine. For
    > a workstation, N is probably 1. For a server, N may be greater. But
    > if machine X is using all N licenses while machine Y is using none,
    > Y can't lend a license to X.
    >
    > The "network" license, on the other hand, allows up to N concurrent
    > usages across the entire "network" (however that's defined). It doesn't
    > matter which machine(s) are being used, so if Y hasn't claimed a license
    > X can do so.
    >
    > Fine, lots of guesswork from an incomplete description. But IMHO
    > the guesswork is plausible, and answers Robert Klemme's question.


    Let's say for the sake of argument that your description doesn't yet
    match what the OP is doing. You have in the last few posts introduced
    new ideas (floating vs. fixed license, for example) that the OP should
    find extremely helpful. Ditto future readers of this thread, including me.

    One thing is clear and unequivocal - if the OP's employer is no better at
    explaining the value proposition of the "network" license than is the OP,
    their customers will not be able to suss it out either.

    I agree with earlier posters that the license scheme as described, even if
    it adopts the refinements you describe, sucks.

    --
    Lew
    Lew, Jul 3, 2012
    #10
  11. On 02/07/2012 8:35 PM, Peter Duniho wrote:
    > At the very least, you might want to simply consider apologizing for the
    > petty nature of your previous reply, instead of putting in more effort
    > rationalizing it. Even if your interpretation is correct (and I think
    > that's debatable), by your own admission there is certainly some ambiguity
    > justifying Robert's take on the question.
    >
    > I'll readily grant that some people are in need of a condescending "Let Me
    > Google That For You", but I really don't see how that was called for here,
    > especially since the phrase you expected Robert to search for had never
    > been mentioned in the entire discussion.


    What makes this even more amusing is that this whole argument is about a
    completely *artificial* problem that some software vendor wants to
    create for some of its customers so it can sell them the
    equally-artificial solution.

    We really do make our own hells.
    Nine of Seventeen, Jul 3, 2012
    #11
  12. Robert Klemme

    uBend Guest

    Nine [paul] <> played fast and loose
    from NNTP-Posting-Host: HenCI89P/9x16w9fdQlY5Q.user.speranza.aioe.org

    $$$$From: "Heike.Svensson" <>
    $$$$Newsgroups: alt.free.newsservers,sci.physics
    $$$$Subject: Re: Tired Gravity. =?UTF-8?B?77u/77u/?=
    $$$$Date: Mon, 02 Jul 2012 20:53:17 -0400
    $$$$Message-ID: <jstfq0$rvd$>
    $$$$NNTP-Posting-Host: HenCI89P/9x16w9fdQlY5Q.user.speranza.aioe.org

    >What makes this even more amusing /slap


    STFU, paul (seamus) kOOk.


    Thanks for playing. Here's your booby prize: *PLONK*

    --

    FYI, CLJP users.
    links to the KooK Kamp;


    I point to this Paul G Derbyshlre::

    http://mushroomobserver.org/observer/show_user/621
    http://tinyurl.com/7zyb83e
    http://www.facebook.com/pDerbyshlre:2
    http://tinyurl.com/75wnvcg

    I found Paul Derbyshlre from reading this post, following the trail
    from there.
    http://groups.google.com/group/comp.lang.java.programmer/browse_
    thread/thread/98c5c0b1c07a5ad5/8b0b1ae85061c197?q=Derbyshlre
    +group:comp.lang.java.programmer
    http://tinyurl.com/7fa6lq9

    Paul Derbyshlre outs himself here:
    http://groups.google.com/group/comp.lang.java.programmer/
    msg/90b1ba4e63328fc4?dmode=source
    http://tinyurl.com/7bsfkdx

    Paul Derbyshlre threatens kooksoot here:
    http://groups.google.com/group/rec.music.makers.trumpet/
    msg/e206958e6febcd31?dmode=source
    http://tinyurl.com/7a22em5

    **note**
    URLs may be munged to deny the "bad word" rule paul (seamus) arranged with aioe.org
    so as to deny the world knowing just who was yanking the collective chain using aioe.org.
    Use the tinyURL links where the full link does not work.
    uBend, Jul 3, 2012
    #12
  13. Robert Klemme

    j00sUck Guest

    On 02/07/2012 10:45 PM, "uBend", an obvious murphy sock, wrote:
    NaN> Nine [paul] <> played fast and loose
    NaN> from NNTP-Posting-Host: HenCI89P/9x16w9fdQlY5Q.user.speranza.aioe.org

    Who is "Nine [paul]", murphy? There is nobody in this newsgroup using
    that alias.

    NaN> $$$$From: "Heike.Svensson" <>
    NaN> $$$$Newsgroups: alt.free.newsservers,sci.physics
    NaN> $$$$Subject: Re: Tired Gravity. =?UTF-8?B?77u/77u/?=
    NaN> $$$$Date: Mon, 02 Jul 2012 20:53:17 -0400
    NaN> $$$$Message-ID: <jstfq0$rvd$>
    NaN> $$$$NNTP-Posting-Host: HenCI89P/9x16w9fdQlY5Q.user.speranza.aioe.org

    What does that have to do with Java, murphy?

    NaN> STFU, paul (seamus) kOOk.

    Who is "paul (seamus) kOOk", murphy? There is nobody in this newsgroup
    using that alias. And why don't you practice what you preach, murphy?
    What does your foul language have to do with Java, free newsservers, or
    physics, murphy?

    NaN> Thanks for playing. Here's your booby prize: *PLONK*

    In fact, I don't see anything in your post with any apparent
    relationship to Java at all, murphy.

    "violating one basic rule in continually posting to or creating "off
    topic" messages is a violation of group's charters."
    --murphy

    How ironic.

    "I had 'volunteered (years back) to support those who do endeavor
    to provide free Free Usenet access, support those who offered
    subscription based Free Usenet access, nothing more than
    cooperation expected in return for what has been many
    thousands of hours of work. I note most of those I joined with
    are either deceased, severely disabled, or plain ole' MIA..
    now it is my Time. ...

    You just read my last. ...

    For those who think they see me in future times I can only wish
    you severe Tinnitus in your dreams. For those who know me
    well (eMail, whatever) and see me, know I will be smiling also.
    It is to you I say "adieu mein frenz and adios .. grazie' [hugs]
    for all the Good Times! May you and yours always bear well
    with all Life brings you".

    /0ut"
    --murphy

    http://www.uffnet.com/kookkamp/goodbye.htm

    And some people wonder why I call them Famous Last Words.
    j00sUck, Jul 3, 2012
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kal
    Replies:
    1
    Views:
    9,497
    Kevin Spencer
    Jun 21, 2004
  2. =?Utf-8?B?WVNVVA==?=

    Access local port or Running local exe file

    =?Utf-8?B?WVNVVA==?=, Jan 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    482
    =?Utf-8?B?WVNVVA==?=
    Jan 14, 2006
  3. lurker
    Replies:
    1
    Views:
    684
    Disco Octopus
    Apr 5, 2005
  4. Lyndon
    Replies:
    1
    Views:
    498
    Leonard Blaisdell
    Jul 25, 2005
  5. pandi
    Replies:
    6
    Views:
    876
    James Kanze
    Dec 18, 2009
Loading...

Share This Page