KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > action > core > backup > ListArchivesAction


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.webapp.action.core.backup;
17
18 import com.blandware.atleap.webapp.action.core.grid.BaseGridAction;
19 import com.blandware.atleap.service.core.BackupManager;
20 import com.blandware.atleap.common.Constants;
21 import org.apache.struts.action.*;
22
23 import javax.servlet.http.HttpServletRequest JavaDoc;
24 import javax.servlet.http.HttpServletResponse JavaDoc;
25
26 /**
27  * <p>Action to show full list of all backup archives</p>
28  * <p/>
29  * <p><a HREF="ListArchivesAction.java.htm"><i>View Source</i></a></p>
30  *
31  * @author Andrey Grebnev <a HREF="mailto:andrey.grebnev@blandware.com">&lt;andrey.grebnev@blandware.com&gt;</a>
32  * @version $Revision: 1.4 $ $Date: 2006/03/25 09:04:41 $
33  * @struts.action path="/core/backup/list"
34  * validate="false"
35  * roles="core-backup-list"
36  * @struts.action-forward name="listArchives"
37  * path=".core.backup.list"
38  */

39 public class ListArchivesAction extends BaseGridAction {
40
41     /**
42      * @param mapping The ActionMapping used to select this instance
43      * @param form The optional ActionForm bean for this request (if any)
44      * @param request The HTTP request we are proceeding
45      * @param response The HTTP response we are creating
46      * @return an ActionForward instance describing where and how
47      * control should be forwarded, or null if response
48      * has already been completed
49      */

50     public ActionForward execute(ActionMapping mapping, ActionForm form,
51                                  HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
52
53         BackupManager backupManager = (BackupManager) getBean(Constants.BACKUP_MANAGER_BEAN);
54         backupManager.createDirIfNotExists();
55         boolean canListArchives = backupManager.canListArchives();
56         request.setAttribute("canListArchives", new Boolean JavaDoc(canListArchives));
57         if (!canListArchives) {
58             ActionMessages errors = new ActionMessages();
59             errors.add("cannotList", new ActionMessage("core.backup.errors.cannotList"));
60             saveErrors(request, errors);
61         }
62
63         // save transaction token in request
64
saveToken(request);
65         return mapping.findForward("listArchives");
66     }
67 }
68
Popular Tags