14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * Copyright (c) 2010-2015 ForgeRock AS. All Rights Reserved
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * The contents of this file are subject to the terms
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * of the Common Development and Distribution License
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * (the License). You may not use this file except in
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * compliance with the License.
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * You can obtain a copy of the License at
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * See the License for the specific language governing
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * permission and limitations under the License.
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * When distributing Covered Code, include this CDDL
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * Header Notice in each file and include the License file
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * If applicable, add the following below the CDDL Header,
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * with the fields enclosed by brackets [] replaced by
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * your own identifying information:
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * "Portions Copyrighted [year] [name of copyright owner]"
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilsonpackage com.sun.identity.agents.tools.tomcat.v6;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilsonimport com.sun.identity.install.tools.configurator.IStateAccess;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilsonimport com.sun.identity.install.tools.util.ConfigUtil;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilsonimport com.sun.identity.install.tools.util.Debug;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson * @author Steve Ferris steve.ferris@forgerock.com
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilsonpublic class AgentFilesBase implements IConstants, IConfigKeys {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson protected static final String[] localeExts = new String[] { "txt", "properties" };
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson protected static final String[] libJarFiles = new String[] { "agent.jar", "openssoclientsdk.jar" };
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson protected void getAgentConfigLocation(IStateAccess stateAccess) {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson _agentLocalePath = ConfigUtil.getLocaleDirPath();
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson _catalinaHomeDir = (String) stateAccess.get(STR_KEY_CATALINA_HOME_DIR);
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson _catalinaCommonLibDir = _catalinaHomeDir + STR_FORWARD_SLASH
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson protected boolean removeAgentFiles(IStateAccess stateAccess) {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson boolean status = false;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson protected Collection<File> listAgentLocaleFiles() {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson return FileUtils.listFiles(new File(_agentLocalePath), localeExts, false);
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson boolean status = false;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson for (int i = 0; i < libJarFiles.length; i++) {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson Debug.log("AgentFilesBase.removeAgentJarFiles(): " +
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson File file = new File(_catalinaCommonLibDir + STR_FORWARD_SLASH + libJarFiles[i]);
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson boolean status = false;
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson for (File localeFile : listAgentLocaleFiles()) {
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson Debug.log("AgentFilesBase.removeAgentLocaleFiles(): " +
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson " Removing file " + _catalinaCommonLibDir + STR_FORWARD_SLASH +
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson File toDelete = new File(_catalinaCommonLibDir + STR_FORWARD_SLASH + localeFile.getName());
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson String agentAppWar = new StringBuilder(_catalinaHomeDir).append(File.separator)
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson .append(STR_WEBAPP_DIR).append(File.separator).append(STR_AGENT_APP_WAR_FILE).toString();
14b0770b613896800c1b5544730da9b736e1c9baneil_a_wilson Debug.log("AgentFilesBase.removeAgentAppWar(): Removing file " + agentAppWar);