1 4 5 package com.tc.installer.util; 6 7 import java.text.Format ; 8 import java.text.SimpleDateFormat ; 9 import java.util.Date ; 10 11 import com.zerog.ia.api.pub.*; 12 13 27 public class DateStamp extends CustomCodeAction { 28 private static final String INSTALL_MESSAGE = "Creating Date Stamp"; 29 private static final String UNINSTALL_MESSAGE = ""; 30 31 44 public void install(InstallerProxy ip) throws InstallException { 45 46 try { 47 String DateFormat = ip.substitute("$DATE_FORMAT$"); 48 String formattedDate = createFormattedDate(DateFormat); 49 ip.setVariable("FORMATTED_DATE", formattedDate); 50 } catch (Exception e) { 51 throw new NonfatalInstallException(e.getMessage()); 52 } 53 } 54 55 61 public void uninstall(UninstallerProxy up) throws InstallException { 62 } 63 64 65 69 private String createFormattedDate(String dateFormat) { 70 Date now = new Date (); 72 String formattedDate; 73 Format formatter; 74 75 formatter = new SimpleDateFormat (dateFormat); 77 formattedDate = formatter.format(now); 78 return formattedDate; 79 } 80 81 86 public String getInstallStatusMessage() { 87 return INSTALL_MESSAGE; 88 } 89 90 95 public String getUninstallStatusMessage() { 96 return UNINSTALL_MESSAGE; 97 } 98 } 99 | Popular Tags |