admin@glassfish.java.net

auto-upgrades from 3.0.X

From: Bobby Bissett <bobby.bissett_at_oracle.com>
Date: Fri, 22 Oct 2010 13:48:19 -0400

This is from the first agenda item for 19 October meeting:
http://wikis.sun.com/display/GlassFish/AdminIteam

Though Anissa has fixed the issue now, Tom suggested I look into the code that determines when upgrades should happen automatically (e.g., starting a 3.1 server with a 2.1 domain without doing the upgrade step first). It looks like it's based on whether or not a network-config element is present in domain.xml.

From com.sun.enterprise.universal.xml.MiniXmlParser#parseConfig:

                else if ("network-config".equals(name)) {
                    sawNetworkConfig = true;
                    // etc
                }

com.sun.enterprise.admin.launcher.GFLauncher#setup does this check:

        needsUpgrade = !parser.hasNetworkConfig();

...and then StartDomainCommand checks this. v2.X does not contain this element, but 3.X does. If we decide we want to invoke upgrades automatically for 3.0.X, then we could also check in the parser for something like a config[@name="default-config"] element in addition to the network-config. I don't think we need to do this now, but it looks simple enough to check if we need it.

Thus:
    needsUpgrade = !parser.hasNetworkConfig() || !parser.hasDefaultConfig();

Cheers,
Bobby