01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.installer.action;
05:
06: import org.apache.commons.io.FileUtils;
07:
08: import com.zerog.ia.api.pub.CustomCodeAction;
09: import com.zerog.ia.api.pub.InstallerProxy;
10: import com.zerog.ia.api.pub.UninstallerProxy;
11:
12: import java.io.File;
13: import java.io.IOException;
14: import java.util.ArrayList;
15:
16: public class CopyWarApplications extends CustomCodeAction {
17:
18: public void install(InstallerProxy ip) {
19: ArrayList wars = new ArrayList();
20: String warName = null;
21: for (int i = 0;; i++) {
22: warName = (String) ip.getVariable("USR_CP_WAR_" + i);
23: if (warName == null)
24: break;
25: System.out.println(warName);
26: wars.add(warName);
27: }
28:
29: Object[] warList = wars.toArray();
30: String warDirPath = (String) ip.getVariable("WAR_FOLDER");
31: try {
32: for (int i = 0; i < warList.length; i++) {
33: System.out.println("copy_" + i);
34: FileUtils
35: .copyFileToDirectory(
36: new File(warDirPath + File.separator
37: + warList[i].toString()),
38: new File(
39: "C:\\Documents and Settings\\installer\\Desktop"));
40: }
41: } catch (IOException e) {
42: // set error variable
43: }
44: }
45:
46: public void uninstall(UninstallerProxy up) {
47: // not implemented
48: }
49:
50: public String getInstallStatusMessage() {
51: return "Validating WAR Files";
52: }
53:
54: /**
55: * This method will be called to display a status message during the uninstall.
56: */
57: public String getUninstallStatusMessage() {
58: return "";
59: }
60: }
|