Nov 1, 2018

Dotted Name attributes in GlassFish and Payara Application Server Configuration

Every attribute that can be defined in the domain.xml also has a corresponding dotted name attribute, which can be viewed and configured with the get, set, and list commands. This provides a safer method of configuring a domain over manually editing the domain.xml thanks to the validation it provides. Configuring domains using asadmin commands is also preferred due to the ability to include the commands in a script.

Dotted names in Payara and GlassFish refer to the attributes of a domain, taking a form commonly seen in properties files. The dotted names form a tree structure of attributes, with each dot acting as a node. For those of a certain mindset, this provides an easy to understand means of viewing and configuring the values of each attribute.

As an example, in the default domain template there is an HTTP listener named http-listener-1.  This listener has two attributes: name and security-enabled, determining the name of the listener and whether it has security (HTTPS) enabled or not. These attributes would respectively be represented in dotted name format by:

configs.config.default-config.network-config.protocols.protocol.http-listener-1.name
configs.config.default-config.network-config.protocols.protocol.http-listener-1.security-enabled

As an example, to get the values of the http-listener-1 attributes (see the diagram above), you can run:

asadmin get configs.config.default-config.network-config.protocols.protocol.http-listener-1
The output of this command looks like this:

configs.config.default-config.network-config.protocols.protocol.http-listener-1.name=http-listener-1
configs.config.default-config.network-config.protocols.protocol.http-listener-1.security-enabled=false
Alternatively, if you’re having trouble finding an attribute, you can simply list every single attribute and their values by using an asterisk as a wildcard:

asadmin get "*"

The List Command serves the same function as the ls command from the Linux/PowerShell terminal, listing the tree nodes (or directories) that have attributes or further child nodes (subdirectories). Differing from the get command, this command is more suitable for navigating the tree as it returns the names of nodes, allowing you to more easily navigate the dotted name tree.

For example, to list the children of the http-listener-1 HTTP listener:

asadmin list configs.config.default-config.network-config.protocols.protocol.http-listener-1
This returns:

configs.config.default-config.network-config.protocols.protocol.http-listener-1
configs.config.default-config.network-config.protocols.protocol.http-listener-1.http
configs.config.default-config.network-config.protocols.protocol.http-listener-1.ssl
This lets us know that this listener has two child nodes, http and ssl, as well as its own attributes (signified by the command returning itself as a result). We can then follow this up and navigate further into the tree by running list in one of the child nodes, or using the get command to list the attributes and their values of the http-listener-1 node.

As a bonus, this command also accepts wildcards, making searching and navigation easier.

As an example, to enable security on the http-listener-1 HTTP listener, you would run this:

asadmin set configs.config.default-config.network-config.protocols.protocol.http-listener-1.security-enabled=true