1 7 8 package org.jboss.portal.core.theme.render.impl; 9 10 import org.apache.log4j.Logger; 11 import org.jboss.portal.common.MediaType; 12 import org.jboss.portal.server.theme.PortalRenderSet; 13 import org.jboss.portal.server.theme.render.DecorationRenderer; 14 import org.jboss.portal.server.theme.render.PortletRenderer; 15 import org.jboss.portal.server.theme.render.RegionRenderer; 16 import org.jboss.portal.server.theme.render.WindowRenderer; 17 18 import javax.activation.MimeTypeParseException ; 19 20 27 public class RenderSetImpl implements PortalRenderSet 28 { 29 private static final Logger log = Logger.getLogger(RenderSetImpl.class); 30 private final RegionRenderer regionRenderer; 31 private final WindowRenderer windowRenderer; 32 private final PortletRenderer portletRenderer; 33 private final DecorationRenderer decorationRenderer; 34 private final MediaType contentType; 35 private final String appName; 36 private final String name; 37 38 52 public RenderSetImpl(String appName, String setName, ClassLoader loader, String contentType, String regionRenderer, 53 String windowRenderer, String portletRenderer, String decorationRenderer) 54 throws MimeTypeParseException , ClassNotFoundException , IllegalAccessException , InstantiationException 55 { 56 if (appName == null || loader == null || regionRenderer == null || windowRenderer == null || 57 portletRenderer == null || decorationRenderer == null || contentType == null) 58 { 59 throw new IllegalArgumentException ("arguments must not be null"); 60 } 61 this.regionRenderer = (RegionRenderer)loader.loadClass(regionRenderer).newInstance(); 62 this.windowRenderer = (WindowRenderer)loader.loadClass(windowRenderer).newInstance(); 63 this.portletRenderer = (PortletRenderer)loader.loadClass(portletRenderer).newInstance(); 64 this.decorationRenderer = (DecorationRenderer)loader.loadClass(decorationRenderer).newInstance(); 65 this.contentType = MediaType.parseMimeType(contentType); 66 this.appName = appName; 67 this.name = setName; 68 69 log.debug("created a FactoryRenderSet for: " + contentType + " " + regionRenderer + " " + windowRenderer + 70 " " + portletRenderer + " " + decorationRenderer); 71 } 72 73 76 public RegionRenderer getRegionRenderer() 77 { 78 return regionRenderer; 79 } 80 81 84 public WindowRenderer getWindowRenderer() 85 { 86 return windowRenderer; 87 } 88 89 92 public PortletRenderer getPortletRenderer() 93 { 94 return portletRenderer; 95 } 96 97 100 public DecorationRenderer getDecorationRenderer() 101 { 102 return decorationRenderer; 103 } 104 105 108 public MediaType getMediaType() 109 { 110 return contentType; 111 } 112 113 118 public String getAppName() 119 { 120 return appName; 121 } 122 123 128 public String getName() 129 { 130 return name; 131 } 132 133 136 public String toString() 137 { 138 return "RenderSetImpl: " + getAppName() + "." + (getName() == null ? "<from layout>" : getName()) + ": " + 139 getMediaType() + " [" + getRegionRenderer() + "][" + getWindowRenderer() + "][" + getDecorationRenderer() + 140 "][" + getPortletRenderer() + "]"; 141 } 142 } 143 | Popular Tags |