KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > snapper > presentation > DeleteSite


1 /*
2  * snapper
3  *
4  * Enhydra super-servlet presentation object
5  *
6  */

7
8 package org.enhydra.snapper.presentation;
9
10 // Enhydra SuperServlet imports
11
import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException;
12 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
13
14
15 // Enhydra SuperServlet specification imports
16
import org.enhydra.snapper.SnapperManager;
17 import org.enhydra.snapper.spec.*;
18
19 import org.enhydra.snapper.presentation.html.*;
20 import org.enhydra.xml.xmlc.XMLObject;
21
22 // Standard imports
23

24 public class DeleteSite extends BasePO {
25
26
27     protected XMLObject getDOM() throws Exception JavaDoc {
28         
29         String JavaDoc siteID = comms.request.getParameter("id");
30
31         SiteListHTML siteList;
32
33         Site site = null;
34         
35         try {
36             site = (SiteFactory.getSite("org.enhydra.snapper.business.SiteImpl")).findSiteByID(siteID, dbTransaction);
37             String JavaDoc name = site.getName();
38             
39             if (site.getLOCKED() == true) {
40                 
41                 SnapperManager.getInstance().getLoggingManager().info(
42                 "Site locked! Indexing Aborted.");
43                 throw new ClientPageRedirectException(comms.request
44                         .getAppFileURIPath("SiteListPresentation.po?l="+site.getName()));
45             }
46             String JavaDoc siteHandle = site.getID();
47             site.deleteDir(name);
48             site.delete();
49                 } catch(Exception JavaDoc ex) {
50                      throw new HttpPresentationException("Could not delete", ex);
51                 }
52
53         //siteList = (SiteListHTML)comms.xmlcFactory.create(SiteListHTML.class);
54

55         //return siteList;
56

57         throw new ClientPageRedirectException(comms.request.getAppFileURIPath("SiteListPresentation.po"));
58
59     }
60 }
61
Popular Tags