1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.services.persistence;
18
19 import java.util.List;
20
21 import org.apache.jetspeed.om.profile.Profile;
22 import org.apache.jetspeed.portal.*;
23 import org.apache.jetspeed.portal.Portlet;
24 import org.apache.jetspeed.portal.PortletException;
25 import org.apache.turbine.services.TurbineServices;
26 import org.apache.turbine.util.RunData;
27
28 /***
29 * Static accessor to the Portal Persistence Service for storing and
30 * retrieving portlet instances.
31 *
32 * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>
33 * @version $Id: PersistenceManager.java,v 1.3 2004/02/23 03:33:52 jford Exp $
34 */
35 public abstract class PersistenceManager
36 {
37 /***
38 * Retrieves a List of portlet instances for the given profile.
39 *
40 * @param profile Retrieve instances from this profile.
41 * @return List The list of all instances in current profile.
42 */
43 public static List getInstances(Profile profile) throws PortletException
44 {
45 return getService().getInstances(profile);
46 }
47
48 /***
49 * Retrieves a List of portlet instances for the current profile.
50 *
51 * @param data Request rundata.
52 * @return List The list of all instances in current profile.
53 */
54 public static List getInstances(RunData data) throws PortletException
55 {
56 return getService().getInstances(data);
57 }
58
59 /***
60 * Retrieves a portlet instance from persistent storage for the given portlet.
61 *
62 * @param portlet The portlet to retrieve an instance for
63 * @param data Request rundata.
64 * @return PortletInstance The instance for the given portlet.
65 */
66 public static PortletInstance getInstance(Portlet portlet, Profile profile)
67 {
68 return getService().getInstance(portlet, profile);
69 }
70
71 /***
72 * Retrieves a portlet instance from persistent storage for the given portlet.
73 *
74 * @param portlet The portlet to retrieve an instance for
75 * @param data Request rundata.
76 * @return PortletInstance The instance for the given portlet.
77 */
78 public static PortletInstance getInstance(Portlet portlet, RunData data)
79 {
80 return getService().getInstance(portlet, data);
81 }
82
83 /***
84 * Store a portlet instance to permenant storage.
85 *
86 * @param instance The portlet instance to be stored.
87 * @exception PortalPersistenceException if there were problems
88 * storing the PSMLDocument to persistent storage.
89 *
90 */
91 public static void store(PortletInstance pPortlet) throws PortalPersistenceException
92 {
93 getService().store(pPortlet);
94 }
95
96
97 protected static PortalPersistenceService getService()
98 {
99 return (PortalPersistenceService) TurbineServices.getInstance().getService(
100 "PortalPersistenceService");
101 }
102
103 }