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: RemoveMbeansTask.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 Reeper * This task remove agent's mbean jar from Weblogic's mbeantypes directory
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper * during uninstall.
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeperpublic class RemoveMbeansTask implements ITask, IConfigKeys {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public boolean execute(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("RemoveMbeansTask.execute() - " + mbeansDir);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper Debug.log("RemoveMbeansTask.rollBack() Unable to delete file: " +
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public boolean rollBack(String name, IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper // Nothing to roll back during un-install
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public LocalizedMessage getExecutionMessage(IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String mbeansDir = getMbeanTypesDir(stateAccess);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper LOC_TSK_MSG_REMOVE_MBEANS_EXECUTE, STR_WL_GROUP, args);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public LocalizedMessage getRollBackMessage(IStateAccess stateAccess,
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper // No roll back during un-install
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper private String getMbeanTypesDir(IStateAccess stateAccess) {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String wlhomeDir = (String) stateAccess.get(STR_KEY_WEBLOGIC_HOME_DIR);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper String osName = System.getProperty(STR_OS_NAME_PROPERTY);
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper if (osName.toLowerCase().startsWith(STR_WINDOWS)) {
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper result = wlhomeDir + "\\server\\lib\\mbeantypes\\";
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper result = wlhomeDir + "/server/lib/mbeantypes";
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public static final String LOC_TSK_MSG_REMOVE_MBEANS_EXECUTE =
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper "TSK_MSG_REMOVE_MBEANS_EXECUTE";
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper public static final String LOC_TSK_MSG_REMOVE_MBEANS_ROLLBACK =
de47fb992b4c3414ac5b445d5cab364b0b8b8b43Mark de Reeper "TSK_MSG_REMOVE_MBEANS_ROLLBACK";