1 23 package org.infoglue.deliver.portal.information; 24 25 import java.util.Map ; 26 27 import javax.servlet.ServletConfig ; 28 import javax.servlet.http.HttpServletRequest ; 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 42 public class InformationProviderServiceFactoryIG 43 implements InformationProviderFactory, InformationProviderService { 44 private static final Log log = LogFactory.getLog(InformationProviderServiceFactoryIG.class); 45 46 private static final String DYNAMIC = DynamicInformationProviderIG.class.getName(); 47 private static final String STATIC = StaticInformationProviderImpl.class.getName(); 48 49 private ServletConfig config; 50 51 public InformationProviderServiceFactoryIG() { 52 log.debug("constructor"); 53 } 54 55 58 public StaticInformationProvider getStaticProvider() { 59 log.debug("getStaticProvider(): using default from portalImpl, fix this!"); 61 javax.servlet.ServletContext 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 77 public DynamicInformationProvider getDynamicProvider(HttpServletRequest 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 91 public void init(ServletConfig config, Map properties) throws Exception { 92 this.config = config; 93 } 94 95 98 public void destroy() throws Exception { 99 100 } 101 102 } 103 | Popular Tags |