1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.persistence;
1819import java.util.List;
2021import org.apache.jetspeed.om.profile.Profile;
22importorg.apache.jetspeed.portal.*;
23import org.apache.jetspeed.portal.Portlet;
24import org.apache.jetspeed.portal.PortletException;
25import org.apache.turbine.services.TurbineServices;
26import org.apache.turbine.util.RunData;
2728/***29 * Static accessor to the Portal Persistence Service for storing and30 * 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 */35publicabstractclassPersistenceManager36 {
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 */43publicstatic List getInstances(Profile profile) throws PortletException
44 {
45return getService().getInstances(profile);
46 }
4748/***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 */54publicstatic List getInstances(RunData data) throws PortletException
55 {
56return getService().getInstances(data);
57 }
5859/***60 * Retrieves a portlet instance from persistent storage for the given portlet.61 *62 * @param portlet The portlet to retrieve an instance for63 * @param data Request rundata.64 * @return PortletInstance The instance for the given portlet.65 */66publicstaticPortletInstance getInstance(Portlet portlet, Profile profile)
67 {
68return getService().getInstance(portlet, profile);
69 }
7071/***72 * Retrieves a portlet instance from persistent storage for the given portlet.73 *74 * @param portlet The portlet to retrieve an instance for75 * @param data Request rundata.76 * @return PortletInstance The instance for the given portlet.77 */78publicstaticPortletInstance getInstance(Portlet portlet, RunData data)
79 {
80return getService().getInstance(portlet, data);
81 }
8283/***84 * Store a portlet instance to permenant storage.85 *86 * @param instance The portlet instance to be stored.87 * @exception PortalPersistenceException if there were problems88 * storing the PSMLDocument to persistent storage.89 * 90 */91publicstaticvoid store(PortletInstance pPortlet) throws PortalPersistenceException
92 {
93 getService().store(pPortlet);
94 }
959697protectedstaticPortalPersistenceService getService()
98 {
99return (PortalPersistenceService) TurbineServices.getInstance().getService(
100"PortalPersistenceService");
101 }
102103 }