KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > portal > information > InformationProviderServiceFactoryIG


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 package org.infoglue.deliver.portal.information;
24
25 import java.util.Map JavaDoc;
26
27 import javax.servlet.ServletConfig JavaDoc;
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32 import org.apache.pluto.portalImpl.core.StaticInformationProviderImpl;
33 import org.apache.pluto.portalImpl.factory.InformationProviderFactory;
34 import org.apache.pluto.services.information.DynamicInformationProvider;
35 import org.apache.pluto.services.information.InformationProviderService;
36 import org.apache.pluto.services.information.StaticInformationProvider;
37
38 /**
39  * @author jand
40  *
41  */

42 public class InformationProviderServiceFactoryIG
43     implements InformationProviderFactory, InformationProviderService {
44     private static final Log log = LogFactory.getLog(InformationProviderServiceFactoryIG.class);
45
46     private static final String JavaDoc DYNAMIC = DynamicInformationProviderIG.class.getName();
47     private static final String JavaDoc STATIC = StaticInformationProviderImpl.class.getName();
48
49     private ServletConfig JavaDoc config;
50
51     public InformationProviderServiceFactoryIG() {
52         log.debug("constructor");
53     }
54
55     /* (non-Javadoc)
56      * @see org.apache.pluto.services.information.InformationProviderService#getStaticProvider()
57      */

58     public StaticInformationProvider getStaticProvider() {
59         // TODO stolen from portalImpl
60
log.debug("getStaticProvider(): using default from portalImpl, fix this!");
61         javax.servlet.ServletContext JavaDoc context = config.getServletContext();
62
63         StaticInformationProvider provider =
64             (StaticInformationProvider) context.getAttribute(STATIC);
65
66         if (provider == null) {
67             provider = new StaticInformationProviderImpl(config);
68             context.setAttribute(STATIC, provider);
69         }
70
71         return provider;
72     }
73
74     /* (non-Javadoc)
75      * @see org.apache.pluto.services.information.InformationProviderService#getDynamicProvider(javax.servlet.http.HttpServletRequest)
76      */

77     public DynamicInformationProvider getDynamicProvider(HttpServletRequest JavaDoc request) {
78         log.debug("getDynamicProvider(): using infoglue's");
79         DynamicInformationProvider provider =
80             (DynamicInformationProvider) request.getAttribute(DYNAMIC);
81         if (provider == null) {
82             provider = new DynamicInformationProviderIG(request, config);
83             request.setAttribute(DYNAMIC, provider);
84         }
85         return provider;
86     }
87
88     /* (non-Javadoc)
89      * @see org.apache.pluto.factory.Factory#init(javax.servlet.ServletConfig, java.util.Map)
90      */

91     public void init(ServletConfig JavaDoc config, Map JavaDoc properties) throws Exception JavaDoc {
92         this.config = config;
93     }
94
95     /* (non-Javadoc)
96      * @see org.apache.pluto.factory.Factory#destroy()
97      */

98     public void destroy() throws Exception JavaDoc {
99
100     }
101
102 }
103
Popular Tags