KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > web > servlet > SanitizeLibrary


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: SanitizeLibrary.java,v $
31  * Revision 1.3 2005/04/10 20:09:45 colinmacleod
32  * Added new themes.
33  * Changed id type to String.
34  * Changed i tag to em and b tag to strong.
35  * Improved PicoContainerFactory with NanoContainer scripts.
36  *
37  * Revision 1.2 2005/04/09 17:19:47 colinmacleod
38  * Changed copyright text to GPL v2 explicitly.
39  *
40  * Revision 1.1.1.1 2005/03/10 17:52:07 colinmacleod
41  * Restructured ivata op around Hibernate/PicoContainer.
42  * Renamed ivata groupware.
43  *
44  * Revision 1.4 2004/11/12 18:16:06 colinmacleod
45  * Ordered imports.
46  *
47  * Revision 1.3 2004/11/12 15:57:16 colinmacleod
48  * Removed dependencies on SSLEXT.
49  * Moved Persistence classes to ivata masks.
50  *
51  * Revision 1.2 2004/11/03 15:55:46 colinmacleod
52  * Changed todo comments to TODO: all caps.
53  *
54  * Revision 1.1 2004/09/30 14:59:06 colinmacleod
55  * Added methods to sanitize the entire library and update the search index.
56  *
57  * -----------------------------------------------------------------------------
58  */

59 package com.ivata.groupware.web.servlet;
60
61 import java.io.IOException JavaDoc;
62
63 import javax.servlet.ServletException JavaDoc;
64 import javax.servlet.http.HttpServlet JavaDoc;
65 import javax.servlet.http.HttpServletRequest JavaDoc;
66 import javax.servlet.http.HttpServletResponse JavaDoc;
67
68 import org.apache.log4j.Category;
69 import org.picocontainer.PicoContainer;
70
71 import com.ivata.groupware.admin.security.Security;
72 import com.ivata.groupware.admin.security.server.SecuritySession;
73 import com.ivata.groupware.business.library.Library;
74 import com.ivata.groupware.container.PicoContainerFactory;
75 import com.ivata.mask.util.SystemException;
76
77 /**
78  * <p>
79  * TODO
80  * </p>
81  *
82  * @since Aug 9, 2004
83  * @author Colin MacLeod
84  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
85  * @version $Revision: 1.3 $
86  */

87
88 public class SanitizeLibrary extends HttpServlet JavaDoc {
89     /**
90      * <p>
91      * <strong>Log4J</strong> logger.
92      * </p>
93      */

94     private static Category log = Category.getInstance(SanitizeLibrary.class);
95
96     /**
97      * <p>Clean up resources.</p>
98      */

99     public void destroy() {}
100
101     /**
102      * <p>TODO: add a comment here.</p>
103      */

104     public void doGet(final HttpServletRequest JavaDoc request,
105             final HttpServletResponse JavaDoc response) throws ServletException JavaDoc,
106             IOException JavaDoc {
107         log.info("START Sanitize library.");
108
109         PicoContainer container;
110         try {
111             container = PicoContainerFactory.getInstance()
112                 .getGlobalContainer();
113         } catch (SystemException e) {
114             throw new ServletException JavaDoc(e);
115         }
116         Security security = (Security) container.getComponentInstance(Security.class);
117         try {
118             // get a session container - we need a session for the date formatter
119
SecuritySession session = security.loginGuest();
120             container = session.getContainer();
121             Library library = (Library) container.getComponentInstance(Library.class);
122             library.sanitize(session);
123         } catch (SystemException e) {
124             e.printStackTrace();
125             log.error(e);
126         }
127
128         log.info("END Sanitize library.");
129     }
130
131     /**
132      * <p>Initialize global variables.</p>
133      */

134     public void init() throws ServletException JavaDoc {}
135
136 }
137
Popular Tags