Options.java revision 17896349593859825d7867feb831f31376a36e01
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/**
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * The contents of this file are subject to the terms
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * of the Common Development and Distribution License
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * (the License). You may not use this file except in
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * compliance with the License.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * You can obtain a copy of the License at
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * https://opensso.dev.java.net/public/CDDLv1.0.html or
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * opensso/legal/CDDLv1.0.txt
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * See the License for the specific language governing
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * permission and limitations under the License.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * When distributing Covered Code, include this CDDL
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Header Notice in each file and include the License file
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * at opensso/legal/CDDLv1.0.txt.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * If applicable, add the following below the CDDL Header,
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * with the fields enclosed by brackets [] replaced by
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * your own identifying information:
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * "Portions Copyrighted [year] [name of copyright owner]"
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * $Id: Options.java,v 1.7 2009/01/05 23:17:09 veiming Exp $
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/*
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Portions Copyrighted 2011-2014 ForgeRock AS
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncpackage com.sun.identity.config;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncimport com.sun.identity.config.util.TemplatedPage;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncimport com.sun.identity.setup.AMSetupServlet;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncimport com.sun.identity.setup.EmbeddedOpenDS;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncimport org.apache.click.control.ActionLink;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncimport org.forgerock.openam.upgrade.UpgradeUtils;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsyncpublic class Options extends TemplatedPage {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync public ActionLink createConfigLink = new ActionLink("upgradeLink", this, "upgrade" );
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync public ActionLink testUrlLink = new ActionLink("coexistLink", this, "coexist" );
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync public ActionLink pushConfigLink = new ActionLink("olderUpgradeLink", this, "olderUpgrade" );
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync protected boolean upgrade = false;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync protected boolean upgradeCompleted = false;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync protected boolean isOpenDS1x = false;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync protected boolean debugOn = false;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync private java.util.Locale configLocale = null;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync protected String getTitle() {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync return isNewInstall() ? "configuration.options.title" : "upgrade.title";
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync public void doInit() {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync upgrade = !isNewInstall();
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync upgradeCompleted = AMSetupServlet.isUpgradeCompleted();
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync addModel("upgradeCompleted", Boolean.valueOf(upgradeCompleted));
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync addModel( "upgrade", Boolean.valueOf( upgrade ) );
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync if (upgrade) {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync addModel("currentVersion", UpgradeUtils.getCurrentVersion());
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync isOpenDS1x = EmbeddedOpenDS.isOpenDSVer1Installed();
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync addModel("isOpenDS1x", Boolean.valueOf(isOpenDS1x));
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync if (isOpenDS1x) {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync addModel("odsdir", AMSetupServlet.getBaseDir());
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync debugOn = getContext().getRequest().getParameter( "debug" ) != null;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync if (debugOn) {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync AMSetupServlet.enableDebug();
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /**
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * @return boolean If <tt>true</tt>, the options.htm page will be cusotmized for a new installation, otherwise it will be
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * customized for an upgrade.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync public boolean isNewInstall() {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync if (AMSetupServlet.isConfigured() && UpgradeUtils.isVersionNewer()) {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync return !UpgradeUtils.canUpgrade();
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync } else {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync return true;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync }
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync}
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync