1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.services;
18
19
20 import org.apache.jetspeed.portal.Portlet;
21 import org.apache.jetspeed.portal.PortletException;
22 import org.apache.jetspeed.om.profile.Entry;
23 import org.apache.jetspeed.services.portletfactory.PortletFactoryService;
24 import org.apache.turbine.services.TurbineServices;
25
26 /***
27 * Static wrapper around the PortletFactoryService
28 *
29 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
30 * @version $Id: PortletFactory.java,v 1.4 2004/02/23 04:00:57 jford Exp $
31 */
32 public class PortletFactory
33 {
34
35 /***
36 * Commodity method for getting a reference to the service
37 * singleton
38 */
39 private static PortletFactoryService getService()
40 {
41 return (PortletFactoryService)TurbineServices
42 .getInstance()
43 .getService(PortletFactoryService.SERVICE_NAME);
44 }
45
46 /***
47 * Given a PSML Entry return an instanciated Portlet.
48 *
49 * @param entry a PSML Entry describing a portlet
50 * @return an instanciated portlet corresponding to this entry
51 */
52 public static Portlet getPortlet( Entry entry ) throws PortletException
53 {
54 return getService().getPortlet( entry );
55 }
56
57 /***
58 * Given a Portlet registry entry name, instanciate it
59 *
60 * @param name the name of a portlet in the registry
61 * @return an instanciated portlet corresponding to this entry
62 */
63 public static Portlet getPortlet( String name, String id ) throws PortletException
64 {
65 return getService().getPortlet( name, id );
66 }
67 }
68