admin@glassfish.java.net

Re: REST API and Case Issues

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Mon, 19 Apr 2010 12:14:04 -0700

Part of the problem here is that the asadmin command is expecting
all lower case option names, so that's what the commands are declaring.

It would be straightforward to have the commands declare the options
using appropriate CamelCase names, and then map them to lower case for
asadmin (or change asadmin to ignore case for option names), but it
would be a *ton* of work because all the commands would need to be updated.


Jason Lee wrote on 04/19/10 12:00 PM:
> No, it was not. I'm in Santa Clara this week (I'll be camping out in
> It's a Small World), so I'm going to try to get some of Jerome's time
> while I'm here and get this nailed down.
>
> On 4/19/10 11:52 AM, Bill Shannon wrote:
>> This thread seems to have died out without a resolution. Was this
>> resolved offline?
>>
>>
>> Jason Lee wrote on 04/16/10 09:46 AM:
>>> Perhaps a concrete example might help. Take this OPTIONS request for a
>>> JDBC connection pool
>>>
>>> $ curl -X OPTIONS
>>> http://localhost:4848/management/domain/resources/jdbc-connection-pool
>>> {"JdbcConnectionPool":
>>> {
>>> "Method":{
>>> "Name":"POST",
>>> "Message Parameters":{
>>> "validationmethod":{"Acceptable
>>> Values":"auto-commit,meta-data,table,custom-validation", "Default
>>> Value":"", "Type":"string", "Optional":"true"},
>>> "leaktimeout":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "creationretryinterval":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "lazyconnectionassociation":{"Acceptable Values":"", "Default
>>> Value":"false", "Type":"boolean", "Optional":"true"},
>>> "allownoncomponentcallers":{"Acceptable Values":"", "Default
>>> Value":"false", "Type":"boolean", "Optional":"true"},
>>> "statementtimeout":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "datasourceclassname":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "id":{"Acceptable Values":"", "Default Value":"", "Type":"string",
>>> "Optional":"false"},
>>> "maxpoolsize":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "steadypoolsize":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "description":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "wrapjdbcobjects":{"Acceptable Values":"", "Default Value":"true",
>>> "Type":"boolean", "Optional":"true"},
>>> "matchconnections":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "creationretryattempts":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "nontransactionalconnections":{"Acceptable Values":"", "Default
>>> Value":"false", "Type":"boolean", "Optional":"true"},
>>> "associatewiththread":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "sqltracelisteners":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "ping":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "maxconnectionusagecount":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "statementcachesize":{"Acceptable Values":"", "Default Value":"0",
>>> "Type":"string", "Optional":"true"},
>>> "isolationlevel":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "initsql":{"Acceptable Values":"", "Default Value":"", "Type":"string",
>>> "Optional":"true"},
>>> "poolresize":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "driverclassname":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "maxwait":{"Acceptable Values":"", "Default Value":"", "Type":"string",
>>> "Optional":"true"},
>>> "failconnection":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "idletimeout":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "property":{"Acceptable Values":"", "Default Value":"", "Type":"string",
>>> "Optional":"true"},
>>> "isconnectvalidatereq":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "isisolationguaranteed":{"Acceptable Values":"", "Default Value":"true",
>>> "Type":"boolean", "Optional":"true"},
>>> "validateatmostonceperiod":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "validationclassname":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "validationtable":{"Acceptable Values":"", "Default Value":"",
>>> "Type":"string", "Optional":"true"},
>>> "pooling":{"Acceptable Values":"", "Default Value":"true",
>>> "Type":"boolean", "Optional":"true"},
>>> "leakreclaim":{"Acceptable Values":"", "Default Value":"false",
>>> "Type":"boolean", "Optional":"true"},
>>> "target":{"Acceptable Values":"", "Default Value":"", "Type":"string",
>>> "Optional":"true"},
>>> "lazyconnectionenlistment":{"Acceptable Values":"", "Default
>>> Value":"false", "Type":"boolean", "Optional":"true"},
>>> "restype":{"Acceptable
>>> Values":"javax.sql.DataSource,javax.sql.XADataSource,javax.sql.ConnectionPoolDataSource,java.sql.Driver",
>>>
>>> "Default Value":"", "Type":"string", "Optional":"true"}
>>> }
>>> },
>>> "Method":{
>>> "Name":"GET"
>>> }
>>> }
>>> }
>>>
>>> Note that the keys for the message parameters for the POST method are
>>> all lower case. In the console, we have markup in our pages that look
>>> like this:
>>>
>>> <sun:textField id="ds" styleClass="integer" columns="$int{10}"
>>> text="#{pageSession.valueMap.SteadyPoolSize}" />
>>>
>>> <sun:textField id="ds2" styleClass="integer" columns="$int{10}"
>>> text="#{pageSession.valueMap.MaxPoolSize}" />
>>>
>>> and so on.
>>>
>>> Personally, I'd prefer we change the output of the REST API to preserve
>>> the case of these attributes, as that requires far fewer changes on the
>>> console (to be fair, I haven't yet an idea of the level of effort in
>>> changing the REST side), and also makes stub generation (for Python or
>>> Ruby, for example) a little nicer.
>>>
>>> Any thoughts? We can't move forward with the console migration until
>>> this issue is resolved.
>>>
>>> On 4/15/10 3:47 PM, Jerome Dochez wrote:
>>>> so the console is ignoring case while the REST API does not ?
>>>>
>>>> On Apr 15, 2010, at 11:53 AM, Jason Lee wrote:
>>>>
>>>>> On 4/14/10 5:24 PM, Jerome Dochez wrote:
>>>>>> it depends on what ConfigBean these REST APIs are mapped to. For the
>>>>>> most part the REST API to alter the ConfigBeans directly but there
>>>>>> are cases (like deployment) where you don't want to just alter the
>>>>>> configuration, you want to deploy so it makes more sense to redirect
>>>>>> the REST APIs to a command class rather than changing the config
>>>>>> bean directly.
>>>>>>
>>>>>> which ones were creating issue for you ?
>>>>>>
>>>>> Hrm. That's a good point. The resource in question, at the moment, is
>>>>> JdbcConnectionPoolResource.
>>>>>
>>>>> OK. So I understand the why of the command class, and that makes
>>>>> sense. I still prefer, I think, to see mixed case on property names
>>>>> returned by the REST API. Anyone have thoughts on that? Would it be
>>>>> unwise to change what the REST API returns? Should be try to address
>>>>> the case issue on the console side?
>>>>>
>>>>> --
>>>>> Jason Lee
>>>>> Senior Member of Technical Staff
>>>>> GlassFish Administration Console
>>>>>
>>>>> Oracle Corporation
>>>>> Phone x31197/+1 405-343-1964
>>>>> Blog http://blogs.steeplesoft.com
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>
>