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;
1819import org.apache.jetspeed.services.psmlmanager.PsmlManagerService;
20import org.apache.jetspeed.om.profile.PSMLDocument;
21import org.apache.turbine.services.TurbineServices;
22import org.apache.jetspeed.om.profile.ProfileLocator;
23import org.apache.jetspeed.om.profile.QueryLocator;
24import org.apache.jetspeed.om.profile.Profile;
25import org.apache.jetspeed.om.security.JetspeedUser;
26import org.apache.jetspeed.om.security.Role;
27import org.apache.jetspeed.om.security.Group;
2829import java.util.Iterator;
30import java.util.List;
3132/***33 * Static accessor for the PsmlManagerService34 *35 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>36 * @version $Id: PsmlManager.java,v 1.10 2004/02/23 04:00:57 jford Exp $37 */38publicclassPsmlManager39 {
4041/*** 42 * Commodity method for getting a reference to the service43 * singleton44 */45publicstaticPsmlManagerService getService()
46 {
47return (PsmlManagerService)TurbineServices
48 .getInstance()
49 .getService(PsmlManagerService.SERVICE_NAME);
50 }
5152/***53 * Returns a PSML document of the given name.54 * For this implementation, the name must be the document55 * URL or absolute filepath56 *57 * @deprecated58 * @param name the name of the document to retrieve59 */60publicstaticPSMLDocument getDocument( String name )
61 {
62return getService().getDocument(name);
63 }
6465/***66 * Returns a PSML document for the given locator67 *68 * @param locator The locator descriptor of the document to be retrieved.69 */70publicstaticPSMLDocument getDocument( ProfileLocator locator )
71 {
72return getService().getDocument(locator);
73 }
7475/*** Given a ordered list of locators, find the first document matching76 * a profile locator, starting from the beginning of the list and working77 * to the end.78 *79 * @param locator The ordered list of profile locators.80 */81publicstaticPSMLDocument getDocument( List locators )
82 {
83return getService().getDocument(locators);
84 }
8586/*** Store the PSML document on disk, using its locator87 * 88 * @param profile the profile locator description.89 * @return true if the operation succeeded90 */91publicstaticboolean store(Profile profile)
92 {
93return getService().store(profile);
94 }
9596/*** Save the PSML document on disk, using its name as filepath97 * @deprecated98 * @param doc the document to save99 */100publicstaticboolean saveDocument(PSMLDocument doc)
101 {
102return getService().saveDocument(doc);
103 }
104105/*** Save the PSML document on disk to the specififed fileOrUrl106 * @deprecated107 * @param fileOrUrl a String representing either an absolute URL108 * or an absolute filepath109 * @param doc the document to save110 */111publicstaticboolean saveDocument(String fileOrUrl, PSMLDocument doc)
112 {
113return getService().saveDocument(fileOrUrl, doc);
114 }
115116/*** Create a new document.117 *118 * @param profile The description and default value for the new document.119 * @return The newly created document.120 */121publicstaticPSMLDocument createDocument( Profile profile )
122 {
123return getService().createDocument( profile );
124 }
125126/*** Removes a document.127 *128 * @param locator The description of the profile resource to be removed.129 */130publicstaticvoid removeDocument( ProfileLocator locator )
131 {
132 getService().removeDocument( locator );
133 }
134135/*** Removes all documents for a given user.136 *137 * @param user The user object.138 */139publicstaticvoid removeUserDocuments( JetspeedUser user )
140 {
141 getService().removeUserDocuments( user );
142 }
143144/*** Removes all documents for a given group.145 *146 * @param group The group object.147 */148publicstaticvoid removeGroupDocuments( Group group )
149 {
150 getService().removeGroupDocuments( group );
151 }
152153154/*** Removes all documents for a given role.155 *156 * @param role The role object.157 */158publicstaticvoid removeRoleDocuments( Role role )
159 {
160 getService().removeRoleDocuments( role );
161 }
162163164/*** Query for a collection of profiles given a profile locator criteria.165 *166 * @param locator The profile locator criteria.167 */168publicstatic Iterator query( QueryLocator locator )
169 {
170return getService().query( locator );
171 }
172173/*** Export profiles from this service into another service174 *175 * @param consumer The PSML consumer service, receives PSML from this service.176 * @param locator The profile locator criteria.177 *178 * @return The count of profiles exported.179 */180publicint export(PsmlManagerService consumer, QueryLocator locator)
181 {
182return getService().export(consumer, locator);
183 }
184185/***186 * Refreshes a PSML document for the given locator187 *188 * @param locator The locator descriptor of the document to be retrieved.189 */190publicstaticPSMLDocument refresh( ProfileLocator locator )
191 {
192return getService().refresh(locator);
193 }
194195 }
196