admin@glassfish.java.net

Re: CODE REVIEW: IssueTracker 1882 "getDefaultValues() of HealthCheckerConfig always returns Empty map"

From: Prashanth Abbagani <Prashanth.Abbagani_at_Sun.COM>
Date: Sun, 22 Jul 2007 09:31:04 -0700

Fix looks good.

Lloyd L Chambers wrote:
> TIMEOUT: 12:00 PST Monday July 23
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1882
>
> Here is the fix seen working:
>
> jmxcmd> getDefaultAttributeValues:X-HealthCheckerConfig
> invoking getDefaultAttributeValues(X-HealthCheckerConfig) on
> j2eeType=X-DomainConfig
> ---amx:j2eeType=X-DomainConfig,name=na---
> {interval-in-seconds=30, timeout-in-seconds=10, url=/}
>
> Diffs below. A special case handling is added for this goofball
> case. Please see IssueTracker notes for details on why this was done.
>
>
> Index:
> src/java/com/sun/enterprise/management/config/DomainConfigImpl.java
> ===================================================================
> RCS file:
> /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/enterprise/management/config/DomainConfigImpl.java,v
>
> retrieving revision 1.18
> diff -w -u -r1.18 DomainConfigImpl.java
> ---
> src/java/com/sun/enterprise/management/config/DomainConfigImpl.java 5
> May 2007 05:23:17 -0000 1.18
> +++
> src/java/com/sun/enterprise/management/config/DomainConfigImpl.java 20
> Jul 2007 22:59:13 -0000
> @@ -46,6 +46,8 @@
> import javax.management.Attribute;
> import com.sun.appserv.management.base.Util;
> +import com.sun.appserv.management.base.XTypes;
> +import com.sun.appserv.management.util.misc.MapUtil;
> import com.sun.appserv.management.util.misc.GSetUtil;
> import com.sun.appserv.management.util.misc.TypeCast;
> import com.sun.appserv.management.util.misc.CollectionUtil;
> @@ -101,13 +103,26 @@
> return allObjectNames;
> }
>
> + private static final Map<String,String>
> SPECIAL_CASE_DEFAULT_ATTRIBUTES =
> + Collections.unmodifiableMap( MapUtil.newMap( new String[]
> + {
> + // screwball special case, should have been 'health-checker'
> + XTypes.HEALTH_CHECKER_CONFIG,
> "lb-server-ref-health-checker", // or lb-cluster-ref-health-checker
> + }
> + ));
> +
> public Map<String,String>
> getDefaultAttributeValues( final String j2eeType )
> {
> - final OldDomainMBean d =
> getOldConfigProxies().getOldDomainMBean();
> -
> - final String com_sun_appservType =
> OldConfigTypes.getInstance().j2eeTypeToOldType( j2eeType );
> + String com_sun_appservType =
> SPECIAL_CASE_DEFAULT_ATTRIBUTES.get( j2eeType );
> + if ( com_sun_appservType == null )
> + {
> + // not a special case, use the usual mappings
> + com_sun_appservType =
> OldConfigTypes.getInstance().j2eeTypeToOldType( j2eeType );
> debug( "j2eeType = " + j2eeType + ", com_sun_appservType = "
> + com_sun_appservType );
> + }
> +
> + final OldDomainMBean d =
> getOldConfigProxies().getOldDomainMBean();
> final List<Attribute> oldAttrs = TypeCast.asList(
> d.getDefaultAttributeValues( com_sun_appservType,
> (String[])null ) );
>
> @@ -129,3 +144,10 @@
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>