/** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at * https://opensso.dev.java.net/public/CDDLv1.0.html or * opensso/legal/CDDLv1.0.txt * See the License for the specific language governing * permission and limitations under the License. * * When distributing Covered Code, include this CDDL * Header Notice in each file and include the License file * at opensso/legal/CDDLv1.0.txt. * If applicable, add the following below the CDDL Header, * with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * $Id: StartupScriptBase.java,v 1.5 2008/06/25 05:52:21 qcheng Exp $ * */ package com.sun.identity.agents.tools.weblogic.v10; import java.io.File; import com.sun.identity.install.tools.util.ConfigUtil; import com.sun.identity.install.tools.util.Debug; import com.sun.identity.install.tools.util.FileEditor; import com.sun.identity.install.tools.util.FileUtils; import com.sun.identity.install.tools.util.DeletePattern; import com.sun.identity.install.tools.configurator.IStateAccess; import com.sun.identity.install.tools.configurator.InstallConstants; /** * This task configure setAgentEvn script. */ public class StartupScriptBase implements InstallConstants, IConfigKeys { public StartupScriptBase() { } /** * Set classpath to j2ee_agents/am_wl10_agent/lib/agent.jar: * j2ee_agents/weblogic_v10_agent/lib/openssoclientsdk.jar: * j2ee_agents/weblogic_v10_agent/agent_xxx/config: * j2ee_agents/weblogic_v10_agent/locale */ protected String getAgentClasspathEntries(IStateAccess stateAccess) { StringBuffer sb = new StringBuffer(256); String[] entries = getAgentClasspathArrayEntries(stateAccess); int count = entries.length; for(int i = 0; i < count; i++) { sb.append(entries[i]); if (i < count - 1) { sb.append(File.pathSeparator); } } return sb.toString(); } private String[] getAgentClasspathArrayEntries(IStateAccess stateAccess) { if (agentClasspathEntries == null) { String homeDir = ConfigUtil.getHomePath(); String libPath = ConfigUtil.getLibPath(); String localeDir = ConfigUtil.getLocaleDirPath(); String[] entries = null; if (getCoexistFlag(stateAccess)) { entries = new String[] { libPath + FILE_SEP + STR_AGENT_JAR, localeDir, }; } else { String instanceName = stateAccess.getInstanceName(); if (instanceName == null) { instanceName = DEFAULT_INSTANCE_NAME; } StringBuffer sb = new StringBuffer(256); sb.append(homeDir).append(FILE_SEP); sb.append(instanceName).append(FILE_SEP); sb.append(INSTANCE_CONFIG_DIR_NAME); String instanceConfigDirPath = sb.toString(); entries = new String[] { libPath + FILE_SEP + STR_AGENT_JAR, libPath + FILE_SEP + STR_FAM_CLIENT_SDK_JAR, localeDir, instanceConfigDirPath }; } for (int i=0; i