1 16 package org.apache.cocoon.webapps.portal.generation; 17 18 import java.io.IOException ; 19 20 import org.apache.avalon.framework.service.ServiceException; 21 import org.apache.cocoon.ProcessingException; 22 import org.apache.cocoon.environment.ObjectModelHelper; 23 import org.apache.cocoon.environment.Request; 24 import org.apache.cocoon.generation.ServiceableGenerator; 25 import org.apache.cocoon.webapps.portal.components.PortalManager; 26 import org.xml.sax.SAXException ; 27 28 35 public final class ConfigurationGenerator 36 extends ServiceableGenerator { 37 38 public void generate() 39 throws IOException , SAXException , ProcessingException { 40 41 PortalManager portal = null; 42 try { 43 portal = (PortalManager) this.manager.lookup(PortalManager.ROLE); 44 this.xmlConsumer.startDocument(); 45 46 Request request = ObjectModelHelper.getRequest(this.objectModel); 47 if (request.getSession(false) != null) { 48 if (this.source == null 49 || this.source.equals("") 50 || this.source.equals("user")) { 51 portal.showPortal(this.xmlConsumer, true, false); 52 } else { 53 portal.showAdminConf(this.xmlConsumer); 54 } 55 } 56 57 this.xmlConsumer.endDocument(); 58 } catch (ServiceException ce) { 59 throw new ProcessingException("Lookup of portal failed.", ce); 60 } finally { 61 this.manager.release(portal); 62 } 63 } 64 65 } 66 | Popular Tags |