dev@glassfish.java.net

Re: Example of support for --target option?

From: Vijay Ramachandran <vijay.ramachandran_at_oracle.com>
Date: Thu, 10 Jun 2010 13:38:48 -0700

Well - if target is cluster, domain.getServerNamed(target) is going to
return null and hence you get NPE

On 6/9/10 11:45 PM, Naman Mehta wrote:
>
> hi vijay,
>
> I am trying to use below code in my CLI.
>
> Server targetServer = domain.getServerNamed(target);
>
> if (targetServer.isDas()) {
> // something for das
> } else if (targetServer.isCluster()) {
> // something for cluster
> } else {
> // error message
> }
>
> Now when I pass --target opiont values as below:
>
> 1. --target server = works fine.
> 2. --target <instance name> = works fine.
> 3. --target <cluster name> = giving null pointer exception on line
> targetServer.isDas().
>
> Let me know on this.
>
> Regards,
> Naman
>
>
>
> On Wednesday 09 June 2010 12:38 AM, Vijay Ramachandran wrote:
>> I have updated the wiki
>> <http://wiki.glassfish.java.net/Wiki.jsp?page=CLIDeveloperGuide> with
>> more info, pointers to code samples, added section with answers to
>> FAQ etc
>>
>> Let me know if you would like to see more info
>>
>> Vijay
>>
>> On 6/3/10 3:17 PM, Marina Vatkina wrote:
>>> It'd be nice to have more detailed code examples, with answers to a)
>>> how to specify the 'target' option, and b) how would one use it in
>>> the command processing.
>>>
>>> From reading the wiki it seems that we don't need the target
>>> altogether because some code executed on the stack before reaching
>>> my code will take care of it anyway...
>>>
>>> thanks,
>>> -marina
>>>
>>> Vijay Ramachandran wrote:
>>>> This wiki page is a work in progress and I have been updating the
>>>> wiki page with answers for FAQs I have got so far.
>>>>
>>>> It can be improved faster if there are specific questions / inputs :)
>>>>
>>>> Vijay
>>>>
>>>> ----- Original Message -----
>>>> From: marina.vatkina_at_oracle.com
>>>> To: dev_at_glassfish.dev.java.net
>>>> Sent: Thursday, June 3, 2010 2:42:55 PM GMT -08:00 US/Canada Pacific
>>>> Subject: Re: Example of support for --target option?
>>>>
>>>> Vijay Ramachandran wrote:
>>>>> On 6/2/10 3:26 PM, Marina Vatkina wrote:
>>>>>> Can it be expanded to be easier understood by CLI dummies (like me)?
>>>>> Nazrul is scheduling a TOI - that should help you, hopefully
>>>>
>>>> It'd still be nice to have the wiki page be self-sufficient.
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>>> Vijay
>>>>>
>>>>>> thanks,
>>>>>> -marina
>>>>>>
>>>>>> Tom Mueller wrote:
>>>>>>> Please see this writeup by Vijay on how to implement the
>>>>>>> --target option:
>>>>>>>
>>>>>>> http://wiki.glassfish.java.net/Wiki.jsp?page=CLIDeveloperGuide
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> On 6/1/2010 6:04 PM, Marina Vatkina wrote:
>>>>>>>
>>>>>>>> Do we have an example of how --target option should be
>>>>>>>> defaulted/implemented?
>>>>>>>>
>>>>>>>> There are multiple cases of annotating the option with
>>>>>>>> @Param(name = "target", optional = true, defaultValue =
>>>>>>>> "server")
>>>>>>>>
>>>>>>>> but I'm wondering if it's safe to hardcode "server" string
>>>>>>>> everywhere...
>>>>>>>>
>>>>>>>> thanks,
>>>>>>>> -marina
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>>
>>>>>>> --
>>>>>>> Oracle <http://www.oracle.com>
>>>>>>> Tom Mueller | Principal Member of Technical Staff
>>>>>>> Phone: +1 4029169943 | Fax: +1 4029169943 | Mobile: +1 4027206872
>>>>>>> 21915 Hillandale Dr | Elkhorn, NE 68022
>>>>>>> Green Oracle <http://www.oracle.com/commitment> Oracle is
>>>>>>> committed to developing practices and products that help protect
>>>>>>> the environment
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>