} else if (oldVersion.isLower(newVersion)) {
addonStatus = AddonRegistry.status.UNCHANGED;
}
}
} catch (AddonException aoe) {
throw new AddonFatalException(aoe);
}
Configurator conf = Configurator.class.cast(obj);
InstallationContext ic = new InstallationContext();
ic.setInstallationDirectory(getInstallRoot());
ConfigurationContext cc = new ConfigurationContext();
cc.setInstallationContext(ic);
cc.setDomainDirectory(getDomainRoot());
cc.setConfigurationType(type);
if (type.equals(ConfigurationContext.ConfigurationType.INSTANCE))
cc.setAMXDomainRoot(getAMXDomainRoot());
setAdminCredentials(cc);
try {
switch (addonStatus) {
case CONFIGURE :
checkDependencies(addonName);
conf.configure(cc);
ar.setStatus(addonName, AddonRegistry.status.CONFIGURE);
ar.setStatus(addonName, AddonRegistry.status.ENABLE);
break;
case ENABLE :
conf.enable(cc);
ar.setStatus(addonName, AddonRegistry.status.ENABLE);
break;
case DISABLE :
conf.disable(cc);
ar.setStatus(addonName, AddonRegistry.status.DISABLE);
break;
case UNCONFIGURE :
conf.unconfigure(cc);
ar.setStatus(addonName, AddonRegistry.status.UNCONFIGURE);
break;
case UPGRADE :
ar.setStatus(oldVersion.getName(), AddonRegistry.status.REMOVE);
conf.upgrade(cc, oldVersion);
ar.setStatus(addonName, AddonRegistry.status.CONFIGURE);
ar.setStatus(addonName, AddonRegistry.status.ENABLE);
// move old component to .deleted directory
break;
default :
}
if (getLogger().isLoggable(Level.INFO)) {
if (! addonStatus.equals(AddonRegistry.status.UNCHANGED)) {
String s = localStrings.getString("addon.configurecomplete",
addonStatus.toString(), addonName);
getLogger().info(s);
}
}
} catch (AddonFatalException afe) {
getLogger().log(Level.FINE, "Fatal Exception while " +
"configuring the addon " + addonName, afe);
throw afe;
} catch (AddonException ae) {
getLogger().warning
(localStrings.getString("addon.configurationcomplete.error",
addonStatus.toString(), addonName, ae.getLocalizedMessage() ));
} catch (Exception e) {
getLogger().log(Level.FINE, "Fatal Exception while " +
"configuring the addon " + addonName, e);
throw new AddonFatalException(e);
}
}