1 16 17 package org.apache.jetspeed.portal.portlets; 18 19 import org.apache.jetspeed.om.profile.ProfileLocator; 20 import org.apache.jetspeed.services.Profiler; 21 import org.apache.jetspeed.om.profile.Profile; 22 import org.apache.jetspeed.om.profile.PSMLDocument; 23 import org.apache.jetspeed.om.profile.Portlets; 24 import org.apache.jetspeed.services.PortalToolkit; 25 import org.apache.jetspeed.portal.PortletSet; 26 import org.apache.jetspeed.services.rundata.JetspeedRunData; 27 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 28 import org.apache.jetspeed.services.logging.JetspeedLogger; 29 import org.apache.jetspeed.util.JetspeedClearElement; 30 31 import org.apache.ecs.ConcreteElement; 32 33 import org.apache.turbine.util.RunData; 34 35 43 44 public class AggregatePortlet extends AbstractPortlet 45 { 46 47 50 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(AggregatePortlet.class.getName()); 51 52 57 public ConcreteElement getContent(RunData rundata) 58 { 59 String key = ((JetspeedRunData)rundata).getProfile().getId() 60 + "." + this.getID(); 61 62 String path = (String )rundata.getUser().getTemp(key); 63 if (path == null) 64 { 65 path = this.getPortletConfig().getInitParameter("path"); 66 } 67 68 if (null == path) 69 { 70 return new JetspeedClearElement("Path parameter not set"); 71 } 72 ProfileLocator locator = Profiler.createLocator(); 73 locator.createFromPath(path); 74 String id = locator.getId(); 75 76 try 77 { 78 Profile profile = Profiler.getProfile(locator); 79 PSMLDocument doc = profile.getDocument(); 80 81 if (doc == null) 82 { 83 return null; 84 } 85 Portlets portlets = doc.getPortlets(); 86 PortletSet ps = PortalToolkit.getSet(portlets); 87 return ps.getContent(rundata); 88 } 89 catch (Exception e) 90 { 91 logger.error("Exception", e); 92 return new JetspeedClearElement("Error in aggregation portlet: " + e.toString()); 93 } 94 } 95 96 97 98 } 99 | Popular Tags |