KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > ViewListUp2DateAction


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.applications.managementtool.actions;
25
26 import java.net.MalformedURLException JavaDoc;
27 import java.util.Date JavaDoc;
28 import java.util.List JavaDoc;
29 import java.util.Vector JavaDoc;
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 /**
39  * @author ss
40  *
41  */

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 JavaDoc currentUpdateServer = "";
50     
51
52     protected String JavaDoc doExecute() throws Exception JavaDoc {
53         String JavaDoc path = getRequest().getRealPath("/") + "up2date/";
54         String JavaDoc url = CmsPropertyHandler.getUp2dateUrl();
55
56         try {
57             URL u = new URL(url);
58             setCurrentUpdateServer(u.getHost());
59         }
60         catch(MalformedURLException JavaDoc 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 JavaDoc getInstalledUpdates()
73     {
74         Vector JavaDoc ret = uc.getInstalledUpdates();
75         if (ret == null) ret = new Vector JavaDoc();
76         return ret;
77     }
78
79     public List JavaDoc getAvailableUpdates()
80     {
81         Vector JavaDoc ret = uc.getAvailableUpdates();
82         if (ret == null) ret = new Vector JavaDoc();
83         return ret;
84     }
85
86     public Date JavaDoc getLatestRefresh()
87     {
88         return uc.getLatestRefresh();
89     }
90
91     
92     /**
93      * @return
94      */

95     public String JavaDoc getCurrentUpdateServer() {
96         return currentUpdateServer;
97     }
98
99     /**
100      * @param string
101      */

102     public void setCurrentUpdateServer(String JavaDoc string) {
103         currentUpdateServer = string;
104     }
105
106 }
107
Popular Tags