admin@glassfish.java.net

Re: cli command ++

From: Carla Mott <carla.mott_at_oracle.com>
Date: Tue, 25 May 2010 17:07:43 -0700

I've looked at the wiki page and still have questions. First is about
the general architecture for building the new elements. I know that I
can create a class called Node and add information that I need for that
element and it is created through the use of the CRUD API you have
explained. Now I need to add a sub-element to the node element. In the
Cluster example it looks like a new element is added but added to the
config element not to the cluster element and the structure is actually
copied from an existing element in the domain.xml.

Also in the Cluster class I think it creates a sub-element
systemproperties witout using the Decorator. So I think what I need to
do to add the sub-element to the node element is the following in the
Node class

    @Element
    @Param(name="ssh-connector", optional=true)
    List<SSHConnector> getSSHConnector();

and create a class called SSHConnector which has the necessary params
and attributes. What I did:

@Configured
@SuppressWarnings("unused")
public interface SSHConnector extends ConfigBeanProxy, Injectable,
Named, ReferenceContainer, RefContainer {

    /**
     * Sets the node name
     * @param value node name
     * @throws PropertyVetoException if a listener vetoes the change
     */
    @Param(name="port", primary = true)
    public void setPort(String value) throws PropertyVetoException;
   

    /**
     * points to a named host.
     *
     * @return a named host name
     */

    @Attribute
    String getNodeHome();

    /**
     * Sets the value of the name property.
     *
     * @param value allowed object is
     * {_at_link String }
     * @throws PropertyVetoException if a listener vetoes the change
     */
    @Param(name="nodehome", optional=true)
    void setNodeHome(String value) throws PropertyVetoException;


}

Unfortunately when I run the command now I get a NullPointerException
and no stack trace.

Is the decorator is used to validate what the user has passed to the
command? Is it used to create the sub-elements to the current element?
It's not clear what I should be doing. I guess I can get the Node class
using the habitat and make that the parent of the element I'm creating
in the Decorator but I don't see how to create that sub-element
exactly. The example is copying an existing element so the structure is
already created. I see a createChild method on the instance but not
sure how if that is something I should use.

Thanks,
Carla

Carla Mott wrote:
> ok. I know that cluster.java uses a decorator so I will look at that.
>
> Thanks,
> Carla
>
> Jerome Dochez wrote:
>> I am in the process of documenting all this, I will publish a wiki
>> page tonight so you should look for answers there. I will send the
>> link when it's ready.
>> you will need a decorator since you want to add multiple elements in
>> 1 command.
>>
>> On May 24, 2010, at 3:47 PM, Carla Mott wrote:
>>
>>
>>> Hi,
>>>
>>> I'm working on a command where I want the resulting xml in
>>> domain.xml to look like:
>>> <nodes>
>>> <node name="ssh_node" host="gf1.sfbay.sun.com"
>>> glassfish-home="/export/gf">
>>> <ssh-connector port="22">
>>> <ssh-auth type="key" username="dipol" keyfile="~/.ssh/id_dsa" />
>>> </ssh-connector>
>>> </node>
>>> </nodes>
>>>
>>> I can create nodes and node element but now am trying to figure out
>>> how to add the ssh-connector and ssh-auth elements. Is there an
>>> example that I can look at? I know there are other pieces of code
>>> that do this but I'm not sure which one to use a a model.
>>>
>>> Thanks,
>>> Carla
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>