dev@glassfish.java.net

Re: Add --force to add-resources

From: Vince Kraemer <Vince.Kraemer_at_Sun.COM>
Date: Wed, 19 Mar 2008 11:20:04 -0700

Response in-line below.

vbk

Jerome Dochez wrote:
> Vince Kraemer wrote:
>> OK.
>>
>> Let's go back to add-resources for minute.
>>
>> I think you are saying that the user needs to enter 'add-resources
>> --force=true foo.xml' to allow them to have a command that initially
>> registers and/or overwrites existing registrations.
>> It looks like you are saying that having the new functionality will
>> cost users about 13 characters.
>>
>> Another approach would be to create a new asadmin command that has
>> the new functionality for less that 26 characters [length of
>> 'add-resources' plus the length of '--force=true']. The new command
>> would avoid the introduction of per-usage "cost" (typing extra
>> characters) , because it would not have to be backward compatible
>> with a command that is weaker (less functional). An easy choice
>> might be 'update-resources'....
>>
>> So....
>>
>> 'add-resources foo.xml' (first call) would be equiv to something like
>> 'update-resources foo.xml' or 'update-resources --add=true foo.xml'
> so if the resource does not exist, and you do update-resources, you
> would expect it to succeed or fail ? In other words, do you force the
> user to put --add=true to cover this case ?

I am lazy. I would like to see 'update-resources foo.xml' succeed, even
when a resource defined in the foo.xml file is not already present on
the server as the default behavior. In other words, the default value
for the --add option would be true.

If the user wanted to force a failure, they could use '--add=false'.
Part of the reasoning behind my preference is the fact that I haven't
come up with a use-case where I would want update-resources to fail...
(Just like I wish there was a method to keep add-resources from failing
on 'second use'.) I figure there is some case where failure is a useful
behavior... but I don't see it being the 80% side of the 80/20 rule...

vbk

>
>> 'add-resources --force=true foo.xml' would be equiv to something like
>> 'update-resources foo.xml'
> that would be fine.
>>
>> vbk
>>