de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * The contents of this file are subject to the terms
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * of the Common Development and Distribution License
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * (the License). You may not use this file except in
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * compliance with the License.
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * You can obtain a copy of the License at
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * https://opensso.dev.java.net/public/CDDLv1.0.html or
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * See the License for the specific language governing
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * permission and limitations under the License.
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * When distributing Covered Code, include this CDDL
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * Header Notice in each file and include the License file
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * If applicable, add the following below the CDDL Header,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * with the fields enclosed by brackets [] replaced by
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * your own identifying information:
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * "Portions Copyrighted [year] [name of copyright owner]"
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * $Id: CopyMbeansTask.java,v 1.2 2008/06/25 05:52:21 qcheng Exp $
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperpackage com.sun.identity.agents.tools.weblogic.v10;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.configurator.ITask;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.configurator.IStateAccess;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.configurator.InstallException;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.util.LocalizedMessage;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.util.Debug;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.util.ConfigUtil;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperimport com.sun.identity.install.tools.util.FileUtils;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * This task copies Agent's mbean jar file into Weblogic's mbeantypes
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperpublic class CopyMbeansTask implements ITask, IConfigKeys {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public boolean execute(String name, IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper boolean status = true;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = getMbeanTypesDir(stateAccess);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper FileUtils.copyJarFile(srcDir, mbeansDir, STR_MBEANS_JAR_FILE);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper Debug.log("CopyMbeansTask.execute() - copy " +
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper "CopyMbeansTask.execute() - Error occured while copying " +
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public boolean rollBack(String name, IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper boolean status = true;
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper // Delete the file amauthprovider.jar
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = getMbeanTypesDir(stateAccess);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper File file = new File(mbeansDir, STR_MBEANS_JAR_FILE);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper Debug.log("CopyMbeansTask.rollBack () - " + mbeansDir);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper Debug.log("CopyMbeansTask.rollBack() Unable to delete file: " +
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public LocalizedMessage getExecutionMessage(IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = getMbeanTypesDir(stateAccess);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper LocalizedMessage.get(LOC_TSK_MSG_COPY_MBEANS_EXECUTE,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public LocalizedMessage getRollBackMessage(IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = getMbeanTypesDir(stateAccess);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper LocalizedMessage.get(LOC_TSK_MSG_COPY_MBEANS_ROLLBACK,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper private String getMbeanTypesDir(IStateAccess stateAccess) {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = (String)stateAccess.get(STR_KEY_WEBLOGIC_MBEANS_DIR);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper if (mbeansDir != null && mbeansDir.length() > 0) {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper (String) stateAccess.get(STR_KEY_WEBLOGIC_HOME_DIR);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper result = wlhomeDir + STR_FORWARD_SLASH + "server" +
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper // Update state information
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper stateAccess.put(STR_KEY_WEBLOGIC_MBEANS_DIR, result);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public static final String LOC_TSK_MSG_COPY_MBEANS_EXECUTE =
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper "TSK_MSG_COPY_MBEANS_EXECUTE";
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public static final String LOC_TSK_MSG_COPY_MBEANS_ROLLBACK =
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper "TSK_MSG_COPY_MBEANS_ROLLBACK";