fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * The contents of this file are subject to the terms
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * of the Common Development and Distribution License
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * (the License). You may not use this file except in
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * compliance with the License.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * You can obtain a copy of the License at
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * https://opensso.dev.java.net/public/CDDLv1.0.html or
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * See the License for the specific language governing
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * permission and limitations under the License.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * When distributing Covered Code, include this CDDL
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * Header Notice in each file and include the License file
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * If applicable, add the following below the CDDL Header,
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * with the fields enclosed by brackets [] replaced by
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * your own identifying information:
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * "Portions Copyrighted [year] [name of copyright owner]"
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major * $Id: InteractionsRunner.java,v 1.2 2008/06/25 05:51:21 qcheng Exp $
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Majorpackage com.sun.identity.install.tools.configurator;
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Majorimport com.sun.identity.install.tools.util.Debug;
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Majorfinal class InteractionsRunner extends InteractionsRunnerBase {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major InteractionsRunner(InstallRunInfo installRunInfo,
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major UserResponseHandler uHandler) throws InstallException {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major if (index < getInstanceInteractionsOffset()) { // Common interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major ((PersistentStateAccess) getStateAccess()).setCommonDataFlag(true);
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major } else { // Instance interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major ((PersistentStateAccess) getStateAccess()).setCommonDataFlag(
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void setStateAccess(PersistentStateAccess newStateAccess) {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major if (newStateAccess != null) { // If you are here
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // NOTE: newStateAccess must be having NEW instance finder data and
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // if the previous stateAccess is not null, then it needs to
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // updated with new instance finder data.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major Debug.log("InteractionsRunner.setStateAccess() - newStateAccess"
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major + " is" + newStateAccess + "\n Old StateAccess is:"
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major if (oldStateAccess != null) { // Not first time.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // StateAccess has already been set. So update it to the
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // new one now. Best way is to use the newStateAccess, add the
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // data corresponding to all the previously executed (common
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // + instance) interactions from oldStateAccess ignoring the
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // specified keys (updated instance Finder keys).
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // NOTE: The getAllInteractionKeys() will return only the
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // common + instance interactions that have been excecuted so
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // far in the (previous attempt).
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Finally modify iStateAccess to newStateAccess
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major Debug.log("InteractionsRunner.setStateAccess() - finally StateAccess"
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void createAllInteractions(InstallRunInfo installRunInfo)
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Note initInteractions will also populate all configured
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // interaction keys defined in the configuration XML file.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major ArrayList cInteractionsInfo = installRunInfo.getCommonInteractions();
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Fresh install intialize the common interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major setInstanceInteractionsOffset(cInteractionsInfo.size());
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // We need to explicitly add the config keys for common
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // interactions these will be needed when creating the response
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // file. In the above if clause, they are stored by the init
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Interactions method.
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Initialize the instance interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major ArrayList iInteractionsInfo = installRunInfo.getInstanceInteractions();
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major private void storeCommonInteractionKeys(ArrayList cInteractionsInfo)
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major UserDataInteraction interaction = InteractionFactory
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major .createInteraction((InteractionInfo) cInteractionsInfo
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major getAllConfiguredInteractionKeys().add(interaction.getKey());
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void initInteractions(ArrayList iInteractionsInfo)
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // Intialize the Set's before their usage methods are invoked by super
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void storeNonPersistentKeys(String key, int index) {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major if (index < getInstanceInteractionsOffset()) { // Common interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major } else { // Instance interactions
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void setNonPersistentCommonKeys(Set set) {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major public void setNonPersistentInstanceKeys(Set set) {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major private void setInstanceInteractionsOffset(int offset) {
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // iStateAccess is initialized to null => as a means to determine, first
fb379c70e3fd8a537f311b99be4759ae41e02750Peter Major // time run or a re-run of interactions.