KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > ServerCrashingAppBase


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tctest;
6
7 import com.tc.simulator.app.ApplicationConfig;
8 import com.tc.simulator.listener.ListenerProvider;
9 import com.tctest.runner.AbstractTransparentApp;
10
11 import java.io.File JavaDoc;
12
13 public abstract class ServerCrashingAppBase extends AbstractTransparentApp {
14
15   public static final String JavaDoc CONFIG_FILE = "config-file";
16   public static final String JavaDoc PORT_NUMBER = "port-number";
17   public static final String JavaDoc HOST_NAME = "host-name";
18
19   private ApplicationConfig config;
20
21   public ServerCrashingAppBase(String JavaDoc appId, ApplicationConfig config, ListenerProvider listenerProvider) {
22     super(appId, config, listenerProvider);
23     this.config = config;
24   }
25
26   public ApplicationConfig getConfig() {
27     return config;
28   }
29
30   public String JavaDoc getHostName() {
31     return config.getAttribute(HOST_NAME);
32   }
33   
34   public int getPort() {
35     return Integer.parseInt(config.getAttribute(PORT_NUMBER));
36   }
37   
38   public String JavaDoc getConfigFilePath() {
39     return config.getAttribute(CONFIG_FILE);
40   }
41   
42   public String JavaDoc getConfigFileDirectoryPath() {
43     String JavaDoc configFile = getConfigFilePath();
44     int i = configFile.lastIndexOf(File.separatorChar);
45     return configFile.substring(0, i);
46   }
47 }
48
Popular Tags