1 7 8 package org.jboss.portal.core.theme.strategy.impl; 9 10 import org.jboss.portal.server.theme.PortalLayout; 11 import org.jboss.portal.server.theme.strategy.PortletContext; 12 import org.jboss.portal.server.theme.strategy.StrategyContext; 13 import org.jboss.portal.server.theme.strategy.StrategyResponse; 14 15 import javax.servlet.http.HttpServletRequest ; 16 import java.util.Collection ; 17 import java.util.Collections ; 18 19 29 public class StrategyContextImpl implements StrategyContext 30 { 31 private final Collection portlets; 32 private final PortalLayout layout; 33 private final String portalName; 34 private final String pageName; 35 private final String [] regionNames; 36 private final PortletContext targetPortlet; 37 private final HttpServletRequest httpRequest; 38 39 53 public StrategyContextImpl(HttpServletRequest httpRequest, PortalLayout layout, 54 Collection portlets, PortletContext targetPortlet, String portalName, 55 String pageName, String [] regionNames) 56 { 57 if (httpRequest == null) 58 { 59 throw new NullPointerException ("HttpServletRequest cannot be null"); 60 } 61 if (portalName == null || "".equals(portalName)) 62 { 63 throw new NullPointerException ("PortalName cannot be null or empty"); 64 } 65 if (pageName == null || "".equals(pageName)) 66 { 67 throw new NullPointerException ("PageName cannot be null or empty"); 68 } 69 this.httpRequest = httpRequest; 70 this.portalName = portalName; 71 this.pageName = pageName; 72 73 this.portlets = portlets == null ? Collections.EMPTY_LIST : portlets; 74 this.regionNames = regionNames == null ? new String []{} : regionNames; 75 this.layout = layout; 76 this.targetPortlet = targetPortlet; 77 } 78 79 83 public Collection getPortletList() 84 { 85 return Collections.unmodifiableCollection(portlets); 86 } 87 88 91 public PortletContext getTargetPortlet() 92 { 93 return targetPortlet; 94 } 95 96 99 public PortalLayout getLayout() 100 { 101 return layout; 102 } 103 104 107 public String getPortalName() 108 { 109 return portalName; 110 } 111 112 115 public String getPageName() 116 { 117 return pageName; 118 } 119 120 123 public String [] getRegions() 124 { 125 return regionNames; 126 } 127 128 131 public StrategyResponse createResponse() 132 { 133 return new StrategyResponseImpl(); 134 } 135 136 139 public HttpServletRequest getHttpServletRequest() 140 { 141 return httpRequest; 142 } 143 } 144 | Popular Tags |