KickJava   Java API By Example, From Geeks To Geeks.

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


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.io.OutputStream JavaDoc;
27 import java.io.OutputStreamWriter JavaDoc;
28
29 import org.apache.log4j.Logger;
30 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
31 import org.infoglue.cms.controllers.kernel.impl.simple.UpdateController;
32 import org.infoglue.cms.util.CmsPropertyHandler;
33
34
35 /**
36  * @author ss
37  *
38  *
39  */

40 public class InstallUpdateAction extends InfoGlueAbstractAction
41 {
42     private final static Logger logger = Logger.getLogger(InstallUpdateAction.class.getName());
43
44     UpdateController uc;
45     private String JavaDoc updatePackageId;
46     
47
48     protected String JavaDoc doExecute() throws Exception JavaDoc {
49         
50         OutputStream JavaDoc os = getResponse().getOutputStream();
51         OutputStreamWriter JavaDoc writer = new OutputStreamWriter JavaDoc(os);
52         getResponse().setBufferSize(1);
53         getResponse().setContentType("text/html");
54         // getResponse().setBufferSize(10);
55
// PrintWriter out = getResponse().getWriter();
56
logger.info("Executing doExecute on RefreshUpdates..");
57         String JavaDoc path = getRequest().getRealPath("/") + "up2date/";
58         
59         System.out.println("UP2DATE: PATH: " + path);
60         String JavaDoc url = CmsPropertyHandler.getUp2dateUrl();
61     
62         
63         
64         uc = new UpdateController(url, path);
65         
66         writer.write("<!-- INFOGLUE AUTO-UPDATE SYSTEM -->\n");
67         for(int i = 0;i<1200;i++)
68         {
69             writer.write(" ");
70         }
71         writer.write("\n");
72         
73         writer.write("<html><head><link rel=\"stylesheet\" type=\"text/css\" HREF=\"css/cms.css\" /></head><body class=\"managementtooledit\"><font color=\"#888888\">");
74         writer.flush();
75         uc.runUpdatePackage(getUpdatePackageId(), writer);
76         // writer.write("</pre>");
77

78         writer.write("<script language='javascript'>\n");
79         writer.write("alert('Infoglue Up2Date\\n\\nThis installation has finished. ');\n");
80         // writer.write("parent.location.href = 'ViewListUp2Date.action?title=InfoGlue Up2Date';\n");
81

82         writer.write("</script>");
83         
84         writer.write("</font></body></html>");
85         writer.flush();
86         
87         os.flush();
88         
89         return null;
90     }
91     
92     
93     /**
94      * @return
95      */

96     public String JavaDoc getUpdatePackageId() {
97         return updatePackageId;
98     }
99
100     /**
101      * @param string
102      */

103     public void setUpdatePackageId(String JavaDoc string) {
104         updatePackageId = string;
105     }
106
107 }
108
Popular Tags