GlassFish v3 Dotted Names for Prelude Release

[

Unknown macro: {TableOfContents title=' '}

|(TableOfContentstitle='')]

1 Current Behavior

In V2, the dotted names are implemented such that when some one queries for server.*, it also returns the names corresponding to all of server references such as application-ref, resource-ref, etc. In V3, the dotted names are returned corresponding to domain.xml representation without additional processing.

1.1 References

<pre>
jyothi 154 : ./asadmin lsit "server.*"

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
</pre>

In V3, it returns
<pre>
punit 455 : ./asadmin list "server.*"

resource-ref.jdbc/__default
application-ref.WSTXServices
application-ref.WSTCPConnectorLCModule
resource-ref.jdbc/__TimerPool
application-ref.JBIFramework
resource-ref.jdbc/__CallFlowPool
application-ref.adminapp
</pre>

1.2 Behaviour of list "*"

In V2, it returns the names corresponding to entities, for ex. server.http-service.connection-pool and in V3 it returns the domain elements as is, for example: configs.config.server-config.http-service.connection-pool.

In V2:

<pre>
asadmin list "*"

server-config.admin-service
server
...
</pre>

In V3:

<pre>
asadmin list "*"

configs.config.server-config.admin-service
servers.server.server
...
</pre>

1.3 Domain.*

In V2:

<pre>
jyothi 155 : ./asadmin list "domain.*"

cl1
cl1-config
default-config
domain.applications
domain.applications.j2ee-application.MEjbApp
domain.clusters
domain.configs
domain.lb-configs
domain.load-balancers
domain.node-agent.na1
domain.node-agent.na1.auth-realm
domain.node-agents
domain.resources
domain.resources.jdbc-connection-pool.DerbyPool
domain.servers
server
...
</pre>

In V3, no values are returned.
<pre>
punit 456 : ./asadmin list "domain.*"

Command list executed successfully.
</pre>

1.4 Get and Set

Similarly without doing extensive investigation, I noticed some differences in the areas of get and set. For ex. asadmin get "." returns all values on all dotted name prefixes in V2 but does not return any values in V3.

2 Proposed Solution to be Compatible with V2

The motive here is just to be compatible with V2 and not expose any V3 behavior of showing dotted names as domain names.

  • list "*" will return only dotted names corresponding to entities server, config, cluster, and domain elements which are not reflected in others. The returned dotted-names are reference resolved.
  • get and set will base on the above list behavior.
  • Pseudocode

<pre>
if ("*") {
//generate and return dotted names for all entities (server, cluster, etc.) in domain;
generateDottedNames(domain);
} else if ("server") {
generateDottedNames(server);
} else if ("cluster") {
generateDottedNames(cluster);
}

Map generateDottedNames(String entity) {
// the entity could be one of server, cluster, config
fill the map with entity and its children nodes;
fill the map with resolved references for entity's resource-refs, application-refs, etc.;
return map;
}
</pre>

3 Alternatives Considered

3.1 V3 Behavior and compatible with V2

If the command is specific to V3 then return the dotted names the way it is done now. However if the command is for V2 then using decorator pattern provide V2 wrapper implementation to resolve the references and return the dotted names in V2 format. One risk is that there is no specification for V2 behavior so the compatibility will be ensured to satisfy the existing sqe/cts test cases.

Whenever the command received is for V2, a deprecation message will be sent along with the response informing that V2 style support will be removed in next release.

  • Pseudocode

<pre>

Set getDottedNames("pattern") {
node = determine the domain node (server, cluster, etc.) based on given pattern;
// if ambiguous, assume it is V2
version = determine the command version based on given pattern;
map = generateDottedNames(node);
if (version == V2)

Unknown macro: { map = addV2dottednames(map); }

// filter based on given matching pattern
set = filter(map, pattern);
if (version == V2)

Unknown macro: { set = filterV2(map, pattern); }


resturn set;
}

Note, both generateDottedNames and addV2dottednames implement the
same interface and provides for separate implementation based on
version. This allows for clean separation of code and easy maintenance.

Map generateDottedNames(node) {
// the prefix mentioned below is used to
// - ensure consistency
// - avoid confusion with V2
// - provide for filtering for V2 based on common and consistent prefix
if ("*")

Unknown macro: { generate dotted names for the entire domain without resolving the references with prefix domain; }

else if ("server")

Unknown macro: { generate and return dotted names for server with prefix domain.servers.server without resolving references; }

else if ("cluster")

Unknown macro: { generate and return dotted names for cluster with prefix domain.clusters.cluster without resolving references; }


}

</pre>

3.2 Just V3 Behavior.

I am not sure if this is acceptable. If this is OK then we can keep the existing code.