admin@glassfish.java.net

Re: AMX create/remove working

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 28 Mar 2008 12:02:04 -0700

Anissa,

As far as optional Attributes, this behavior is governed by the
ConfigBean behavior, which is based on the @Attribute annotation.
Many default values are null.

However, writing an optional attribute as the string "null" is a bug;
the attribute should not be written at all.

JEROME?

The @Attribute annotation does this for defaults values; it specifies
a unicode 0, which AFAIK is a non-empty string consisting of a binary
0 character. I don't know if this is intended as a "magic number", or
is a bug, or what. Maybe it's done that way since 'null' is not
accepted for a default value in annotations.


// TODO
String defaultValue() default "\u0000";

-- VirtualServer.java ---

@AMXConfigInfo
( amxInterfaceName
="com.sun.appserv.management.config.VirtualServerConfig",
nameHint="id" )
@Configured
public interface VirtualServer extends ConfigBeanProxy, Injectable {

     /**
      * Gets the value of the id property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute(required = true, key=true)
     public String getId();

     /**
      * Sets the value of the id property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setId(String value) throws PropertyVetoException;

     /**
      * Gets the value of the httpListeners property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute
     public String getHttpListeners();

     /**
      * Sets the value of the httpListeners property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setHttpListeners(String value) throws
PropertyVetoException;

     /**
      * Gets the value of the defaultWebModule property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute
     public String getDefaultWebModule();

     /**
      * Sets the value of the defaultWebModule property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setDefaultWebModule(String value) throws
PropertyVetoException;

     /**
      * Gets the value of the hosts property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute(required = true)
     public String getHosts();

     /**
      * Sets the value of the hosts property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setHosts(String value) throws PropertyVetoException;

     /**
      * Gets the value of the state property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute
     public String getState();

     /**
      * Sets the value of the state property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setState(String value) throws PropertyVetoException;

     /**
      * Gets the value of the docroot property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute
     public String getDocroot();

     /**
      * Sets the value of the docroot property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setDocroot(String value) throws PropertyVetoException;

     /**
      * Gets the value of the logFile property.
      *
      * @return possible object is
      * {_at_link String }
      */
     @Attribute
     public String getLogFile();

     /**
      * Sets the value of the logFile property.
      *
      * @param value allowed object is
      * {_at_link String }
      */
     public void setLogFile(String value) throws PropertyVetoException;

     /**
      * Gets the value of the httpAccessLog property.
      *
      * @return possible object is
      * {_at_link HttpAccessLog }
      */
     @Element
     public HttpAccessLog getHttpAccessLog();

     /**
      * Sets the value of the httpAccessLog property.
      *
      * @param value allowed object is
      * {_at_link HttpAccessLog }
      */
     public void setHttpAccessLog(HttpAccessLog value) throws
PropertyVetoException;

     /**
      * Gets the value of the property property.
      * <p/>
      * <p/>
      * This accessor method returns a reference to the live list,
      * not a snapshot. Therefore any modification you make to the
      * returned list will be present inside the JAXB object.
      * This is why there is not a <CODE>set</CODE> method for the
property property.
      * <p/>
      * <p/>
      * For example, to add a new item, do as follows:
      * <pre>
      * getProperty().add(newItem);
      * </pre>
      * <p/>
      * <p/>
      * <p/>
      * Objects of the following type(s) are allowed in the list
      * {_at_link Property }
      */
     @Element("property")
     public List<Property> getProperty();



}


On Mar 28, 2008, at 2:13 AM, Anissa Lam wrote:
> - creating the config object,
> If we don't set the optional attributes, it will be set to "null"
> and written out to 'domain.xml' as "null".
> eg.<virtual-server default-web-module="" state="on"
> hosts="localhost" log-file="null" id="ABC" http-listeners="null" />

---
Lloyd L Chambers
lloyd.chambers_at_sun.com
Sun Microsystems, Inc