dev@glassfish.java.net

Re: AMX sample code

From: Ludovic Champenois <Ludovic.Champenois_at_Sun.COM>
Date: Sat, 13 Sep 2008 08:53:17 -0700

Lloyd Chambers wrote:
> First you need to get a DomainRoot.
>
> Out of process, this means connecting to the server. Currently RMI is
> not working due to a JNDI bug. So JMXMP is being used.
> AppserverConnectionSource is the way to connect once it works. For now:
>
> ...
>
> DomainConfig dc = domainRoot.getDomainConfig();
>
> ...
>
> HTTPListenerConfig listener =
> dc.getHTTPServiceConfig().getHTTPListenerConfigMap().get("listener-1");
>
> final String rawValue = listener.getPort();
> final int port = listener.resolveInteger("Port");
> listener.setPort( "7777" );
...

Hi Lloyd,
the code you sent does not compile...
The correct code for example to fix compilation errors above is:


        HTTPListenerConfig listener =
dc.getConfigsConfig().getConfigConfigMap().get("server-config").getHTTPServiceConfig()
.getHTTPListenerConfigMap().get("listener-1");

        final String rawValue = listener.getPort();
        final int port = listener.resolveInteger("Port"); // will be a
number
        listener.setPort("7777");



Which raises the following questions:
Is "listener-1" an exposed interface? What would be the server behavior
if domain.xml contains another name there?
Same for "server-config" or "Port". I did not look at the javadoc, maybe
it is described there.


The rest of the code does not still compile...I am trying to fix it but
it is not very easy so far.

When the code is functional, we'll put in on a AMX V3 wiki page.

Ludo