KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > installer > action > CopyWarApplications


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

4 package com.tc.installer.action;
5
6 import org.apache.commons.io.FileUtils;
7
8 import com.zerog.ia.api.pub.CustomCodeAction;
9 import com.zerog.ia.api.pub.InstallerProxy;
10 import com.zerog.ia.api.pub.UninstallerProxy;
11
12 import java.io.File JavaDoc;
13 import java.io.IOException JavaDoc;
14 import java.util.ArrayList JavaDoc;
15
16 public class CopyWarApplications extends CustomCodeAction {
17
18   public void install(InstallerProxy ip) {
19     ArrayList JavaDoc wars = new ArrayList JavaDoc();
20     String JavaDoc warName = null;
21     for (int i = 0;; i++) {
22       warName = (String JavaDoc) ip.getVariable("USR_CP_WAR_" + i);
23       if (warName == null) break;
24       System.out.println(warName);
25       wars.add(warName);
26     }
27
28     Object JavaDoc[] warList = wars.toArray();
29     String JavaDoc warDirPath = (String JavaDoc) ip.getVariable("WAR_FOLDER");
30     try {
31       for (int i = 0; i < warList.length; i++) {
32         System.out.println("copy_" + i);
33         FileUtils.copyFileToDirectory(new File JavaDoc(warDirPath + File.separator + warList[i].toString()), new File JavaDoc("C:\\Documents and Settings\\installer\\Desktop"));
34       }
35     } catch (IOException JavaDoc e) {
36       // set error variable
37
}
38   }
39
40   public void uninstall(UninstallerProxy up) {
41     // not implemented
42
}
43
44   public String JavaDoc getInstallStatusMessage() {
45     return "Validating WAR Files";
46   }
47
48   /**
49    * This method will be called to display a status message during the uninstall.
50    */

51   public String JavaDoc getUninstallStatusMessage() {
52     return "";
53   }
54 }
Popular Tags