01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.test.server.appserver.weblogic8x;
06:
07: import org.codehaus.cargo.container.InstalledLocalContainer;
08: import org.codehaus.cargo.container.State;
09: import org.codehaus.cargo.container.configuration.LocalConfiguration;
10: import org.codehaus.cargo.container.weblogic.WebLogic8xInstalledLocalContainer;
11:
12: import com.tc.test.server.appserver.AppServerParameters;
13: import com.tc.test.server.appserver.cargo.CargoAppServer;
14: import com.tc.util.ReplaceLine;
15:
16: import java.io.File;
17: import java.io.IOException;
18:
19: /**
20: * Weblogic8x AppServer implementation
21: */
22: public final class Weblogic8xAppServer extends CargoAppServer {
23:
24: public Weblogic8xAppServer(
25: Weblogic8xAppServerInstallation installation) {
26: super (installation);
27: }
28:
29: protected String cargoServerKey() {
30: return "weblogic8x";
31: }
32:
33: protected InstalledLocalContainer container(
34: LocalConfiguration config) {
35: return new TCWebLogic8xInstalledLocalContainer(config);
36: }
37:
38: protected void setExtraClasspath(AppServerParameters params) {
39: container().setExtraClasspath(
40: params.classpath().split(
41: String.valueOf(File.pathSeparatorChar)));
42: }
43:
44: protected void setConfigProperties(LocalConfiguration config)
45: throws Exception {
46: // config.setProperty(WebLogicPropertySet.DOMAIN, "domain");
47: }
48:
49: private static class TCWebLogic8xInstalledLocalContainer extends
50: WebLogic8xInstalledLocalContainer {
51:
52: public TCWebLogic8xInstalledLocalContainer(
53: LocalConfiguration configuration) {
54: super (configuration);
55: }
56:
57: protected void setState(State state) {
58: if (state.equals(State.STARTING)) {
59: adjustConfig();
60: File license = new File(getHome(), "license.bea");
61: if (license.exists()) {
62: this .setBeaHome(this .getHome());
63: }
64: }
65: }
66:
67: private void adjustConfig() {
68: ReplaceLine.Token[] tokens = new ReplaceLine.Token[1];
69: tokens[0] = new ReplaceLine.Token(
70: 5,
71: "(NativeIOEnabled=\"false\")",
72: "NativeIOEnabled=\"false\" SocketReaderTimeoutMaxMillis=\"1000\" SocketReaderTimeoutMinMillis=\"1000\" StdoutDebugEnabled=\"true\" StdoutSeverityLevel=\"64\"");
73:
74: try {
75: ReplaceLine.parseFile(tokens, new File(
76: getConfiguration().getHome(), "config.xml"));
77: } catch (IOException ioe) {
78: throw new RuntimeException(ioe);
79: }
80: }
81: }
82:
83: }
|