Monday Feb 20, 2006

Dotted Names of GlassFish Administration ...

Following text pertains to GlassFish App Server and Sun's App server 9.0 Beta.

Learning any Language is a cognitive activity. Language designers have to strive hard to design it such that its constructs are simple.

The idea is simple. You want to manage the GlassFish server and you are a fan of Command Line Interfaces (CLI's). The CLI's can become arbitrarily complex and unless there is an attempt made to ease the administrator's woes, they are going to give in to other sophisticated UI's. It is obvious that CLI's enjoy the so-called "batch-mode" that user community is used to, but that alone should not be a license to make it hard for a normal human being because at some point, the CLI's themselves tend to become "Languages". Examples of this include:

  • Just ls the directory (list it).
  • Now, cd to where you installed Software.
  • Grep for "analysis" in this file.
  • ...

GlassFish Administration takes several steps in this direction of making the life of administrators easier. One of the steps is to reduce the number of commands that administrator has to remember or find out. Imagine that administrator needs to configure several elements that are arranged in an abstract hierarchy as shown below.

my-server
    |---- web-engine (name=web-engine, port=88, host=localhost)
	         |---- virtual-server (name=vs1, id=foo.com)
	|---- ejb-engine (name=ejb30, pool-size=40)
	|---- thread-pools (size=32)
	|---- applications
	         |---- app1 (name=petstore, context-root=/pets)
...

The elements have several attributes. The basic operations that are of stereotyped nature are:

  • Listing the immediate or all children of a node at any level in the hierarchy
  • Getting and setting the attributes of a node at any level in the hierarchy.

These two operations resemble the familiar File System Explorer kind of UI. User wants to see a list of nodes in the hierarchy and also, wants to get/set the attributes of a node of choice.

The GlassFish Administration CLI aka asadmin capitalizes on this observation and delivers a powerful UI in conjuction with two symbols one that is made popular by Java's package names, the '.' and a symbol that matches anything -- the asterisk '\*' to denote anything and everything. So, where will you begin?

Obviously, by asking asadmin "What have you got?". And the asterisk is the succint notation to do that! Yes, you got it, the command is:

asadmin list "\*"

Voila! Here is curtailed output: (See here for the complete output).

domain.applications
domain.applications.j2ee-application.MEjbApp
domain.applications.j2ee-application.__JWSappclients
...

server.ejb-container
server.ejb-container.ejb-timer-service
server.http-service
...

server.http-service.http-listener.admin-listener
server.http-service.http-listener.http-listener-1
server.http-service.http-listener.http-listener-2
...

server.http-service.virtual-server.__asadmin
server.http-service.virtual-server.server
server.iiop-service
...
server.java-config

...

Thus, this command shows the children in the abstract configuration hierarchy that GlassFish domain is comprised of! Now one can use get and set on a particular node as:

asadmin get server.java-config.\*

-- I want to get all the attributes -- now I don't want any nodes because that is the forte of the list command. Here is the output of the get command:

server.java-config.bytecode-preprocessors =
server.java-config.classpath-prefix =
server.java-config.classpath-suffix =
server.java-config.debug-enabled = false
server.java-config.debug-options = -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=
9009
server.java-config.env-classpath-ignored = true
server.java-config.java-home = ${com.sun.aas.javaRoot}
server.java-config.javac-options = -g
server.java-config.jvm-options = -client,-Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed,-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy,-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf,-Dsun.rmi.dgc.server.gcInterval=3600000,-Dsun.rmi.dgc.client.gcInterval=3600000,-Xmx512m,-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks,-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks,-Djava.ext.dirs=${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext${path.separator}${com.sun.aas.derbyRoot}/lib,-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver,-Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder,-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory,-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-impl.jar,-Dcom.sun.enterprise.taglisteners=jsf-impl.jar,-XX:NewRatio=2
server.java-config.native-library-path-prefix =
server.java-config.native-library-path-suffix =
server.java-config.rmic-options = -iiop -poa -alwaysgenerate -keepgenerated -g
server.java-config.server-classpath =
server.java-config.system-classpath = ${com.sun.aas.installRoot}/lib/appserv-launch.jar

Alternatively, while doing the "set", you just get the full name of the attribute, use the '=' symbol and the value for that attribute. And that's there to it.

Languages are infinite. Their grammars are finite. This is a little language with only 3 powerful constructs -- list, get and set. I am not going to fill more pages describing the each and every dotted name because that's not the purpose of this post. It is just to encourage you to do it. So, download the 9.0 PE Beta , start the server and get-list-set!

And do you know the biggest enabler of this powerful feature? --- Right, it is your (as a user) intuition and logical use of common actions that we associate with some English verbs! No need to read any manual.

There are so many scripts that use these dotted names to configure GlassFish. All these users thank us because we did not make them RTFM and remember a distinct command (e.g. setApplicationScanInterval) for each attribute.

Output of the list command -- your entry point into the dotted names ...

asadmin list "\*"

domain.applications
domain.applications.j2ee-application.MEjbApp
domain.applications.j2ee-application.__JWSappclients
domain.applications.j2ee-application.__ejb_container_timer_app
domain.applications.web-module.adminapp
domain.applications.web-module.admingui
domain.resources
domain.resources.jdbc-connection-pool.DerbyPool
domain.resources.jdbc-connection-pool.__CallFlowPool
domain.resources.jdbc-connection-pool.__TimerPool
domain.resources.jdbc-resource.jdbc/__CallFlowPool
domain.resources.jdbc-resource.jdbc/__TimerPool
domain.resources.jdbc-resource.jdbc/__default
server
server.admin-service
server.admin-service.das-config
server.admin-service.jmx-connector.system
server.application-ref.MEjbApp
server.application-ref.__JWSappclients
server.application-ref.__ejb_container_timer_app
server.application-ref.adminapp
server.application-ref.admingui
server.applications
server.applications.j2ee-application.MEjbApp
server.applications.j2ee-application.__JWSappclients
server.applications.j2ee-application.__ejb_container_timer_app
server.applications.web-module.adminapp
server.applications.web-module.admingui
server.diagnostic-service
server.ejb-container
server.ejb-container.ejb-timer-service
server.http-service
server.http-service.access-log
server.http-service.connection-pool
server.http-service.http-file-cache
server.http-service.http-listener.admin-listener
server.http-service.http-listener.http-listener-1
server.http-service.http-listener.http-listener-2
server.http-service.http-protocol
server.http-service.keep-alive
server.http-service.request-processing
server.http-service.virtual-server.__asadmin
server.http-service.virtual-server.server
server.iiop-service
server.iiop-service.iiop-listener.SSL
server.iiop-service.iiop-listener.SSL.ssl
server.iiop-service.iiop-listener.SSL_MUTUALAUTH
server.iiop-service.iiop-listener.SSL_MUTUALAUTH.ssl
server.iiop-service.iiop-listener.orb-listener-1
server.iiop-service.orb
server.java-config
server.jms-service
server.jms-service.jms-host.default_JMS_host
server.log-service
server.log-service.module-log-levels
server.management-rules
server.mdb-container
server.monitoring-service
server.monitoring-service.module-monitoring-levels
server.resource-ref.jdbc/__CallFlowPool
server.resource-ref.jdbc/__TimerPool
server.resource-ref.jdbc/__default
server.resources
server.resources.jdbc-connection-pool.DerbyPool
server.resources.jdbc-connection-pool.__CallFlowPool
server.resources.jdbc-connection-pool.__TimerPool
server.resources.jdbc-resource.jdbc/__CallFlowPool
server.resources.jdbc-resource.jdbc/__TimerPool
server.resources.jdbc-resource.jdbc/__default
server.security-service
server.security-service.audit-module.default
server.security-service.auth-realm.admin-realm
server.security-service.auth-realm.certificate
server.security-service.auth-realm.file
server.security-service.jacc-provider.default
server.security-service.message-security-config.SOAP
server.security-service.message-security-config.SOAP.provider-config.ClientProvider
server.security-service.message-security-config.SOAP.provider-config.ClientProvider.request-policy
server.security-service.message-security-config.SOAP.provider-config.ClientProvider.response-policy
server.security-service.message-security-config.SOAP.provider-config.ServerProvider
server.security-service.message-security-config.SOAP.provider-config.ServerProvider.request-policy
server.security-service.message-security-config.SOAP.provider-config.ServerProvider.response-policy
server.thread-pools
server.thread-pools.thread-pool.thread-pool-1
server.transaction-service
server.web-container

Note: the <property> elements are a special case. They are handled verbatim as long as they are allowed at a particular level and have two attributes, name and value. Thus, let's say security-service allows a property sub-element and you want to define a property named "foo" with a value "bar", you would do:

asadmin set "server.security-service.property.foo=bar"

Neat?

About

Welcome to my blog where mostly my work related thoughts are expressed.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today