1 23 24 package org.infoglue.cms.applications.managementtool.actions; 25 26 import java.net.MalformedURLException ; 27 import java.util.Date ; 28 import java.util.List ; 29 import java.util.Vector ; 30 31 import org.apache.catalina.util.URL; 32 import org.apache.log4j.Logger; 33 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 34 import org.infoglue.cms.controllers.kernel.impl.simple.UpdateController; 35 import org.infoglue.cms.util.CmsPropertyHandler; 36 37 38 42 public class ViewListUp2DateAction extends InfoGlueAbstractAction { 43 44 private final static Logger logger = Logger.getLogger(ViewListUp2DateAction.class.getName()); 45 46 private static final long serialVersionUID = 1L; 47 48 UpdateController uc; 49 private String currentUpdateServer = ""; 50 51 52 protected String doExecute() throws Exception { 53 String path = getRequest().getRealPath("/") + "up2date/"; 54 String url = CmsPropertyHandler.getUp2dateUrl(); 55 56 try { 57 URL u = new URL(url); 58 setCurrentUpdateServer(u.getHost()); 59 } 60 catch(MalformedURLException e) 61 { 62 e.printStackTrace(); 63 } 64 65 uc = new UpdateController(url, path); 66 67 logger.info("Executing doExecute on ViewListUp2Date.."); 68 logger.info("Finished executing doExecute on ViewListUp2Date.."); 69 return "success"; 70 } 71 72 public Vector getInstalledUpdates() 73 { 74 Vector ret = uc.getInstalledUpdates(); 75 if (ret == null) ret = new Vector (); 76 return ret; 77 } 78 79 public List getAvailableUpdates() 80 { 81 Vector ret = uc.getAvailableUpdates(); 82 if (ret == null) ret = new Vector (); 83 return ret; 84 } 85 86 public Date getLatestRefresh() 87 { 88 return uc.getLatestRefresh(); 89 } 90 91 92 95 public String getCurrentUpdateServer() { 96 return currentUpdateServer; 97 } 98 99 102 public void setCurrentUpdateServer(String string) { 103 currentUpdateServer = string; 104 } 105 106 } 107 | Popular Tags |