View Javadoc

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 at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * 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 and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.psmlmanager;
18  
19  import java.util.Iterator;
20  import java.util.List;
21  import org.apache.turbine.services.Service;
22  import org.apache.jetspeed.om.profile.PSMLDocument;
23  import org.apache.jetspeed.om.profile.ProfileLocator;
24  import org.apache.jetspeed.om.profile.QueryLocator;
25  import org.apache.jetspeed.om.profile.Profile;
26  import org.apache.jetspeed.om.security.JetspeedUser;
27  import org.apache.jetspeed.om.security.Role;
28  import org.apache.jetspeed.om.security.Group;
29  
30  /***
31   * This service is responsible for loading and saving PSML documents.
32   *
33   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
34   * @version $Id: PsmlManagerService.java,v 1.12 2004/02/23 03:32:51 jford Exp $
35   */
36  public interface PsmlManagerService extends Service
37  {
38  
39      /*** The name of the service */
40      public String SERVICE_NAME = "PsmlManager";
41  
42      /***
43       * Returns a PSML document of the given name.
44       * For this implementation, the name must be the document
45       * URL or absolute filepath
46       *
47       * @deprecated
48       * @param name the name of the document to retrieve
49       */
50      public PSMLDocument getDocument( String name );
51  
52      /***
53       * Returns a PSML document for the given locator
54       *
55       * @param locator The locator descriptor of the document to be retrieved.
56       */
57      public PSMLDocument getDocument( ProfileLocator locator );
58  
59      /*** Given a ordered list of locators, find the first document matching
60       *  a profile locator, starting from the beginning of the list and working
61       *  to the end.
62       *
63       * @param locator The ordered list of profile locators.
64       */
65      public PSMLDocument getDocument( List locators );
66  
67      /*** Store the PSML document on disk, using its locator
68       * 
69       * @param profile the profile locator description.
70       * @return true if the operation succeeded
71       */
72      public boolean store(Profile profile);
73  
74      /*** Save the PSML document on disk, using its name as filepath
75       * 
76       * @deprecated
77       * @param doc the document to save
78       * @return true if the operation succeeded
79       */
80      public boolean saveDocument(PSMLDocument doc);
81      
82      /*** Save the PSML document on disk to the specififed fileOrUrl
83       *
84       * @deprecated
85       * @param fileOrUrl a String representing either an absolute URL
86       * or an absolute filepath
87       * @param doc the document to save
88       * @return true if the operation succeeded
89       */
90      public boolean saveDocument(String fileOrUrl, PSMLDocument doc);
91  
92      /*** Create a new document.
93       *
94       * @param profile the profile to use
95       * @return The newly created document.
96       */
97      public PSMLDocument createDocument( Profile profile );
98  
99      /*** Remove a document.
100      *
101      * @param locator The description of the profile to be removed.
102      */
103     public void removeDocument( ProfileLocator locator );
104 
105     /*** Removes all documents for a given user.
106      *
107      * @param user The user object.
108      */
109     public void removeUserDocuments( JetspeedUser user );
110 
111     /*** Removes all documents for a given group.
112      *
113      * @param group The group object.
114      */
115     public void removeGroupDocuments( Group group );
116 
117     /*** Removes all documents for a given role.
118      *
119      * @param role The role object.
120      */
121     public void removeRoleDocuments( Role role );
122 
123     /*** Query for a collection of profiles given a profile locator criteria.
124      *
125      * @param locator The profile locator criteria.
126      *
127      * @return A collection of profiles that match the criteria specified in the locator.
128      */
129     public Iterator query( QueryLocator locator );
130 
131     /*** Export profiles from this service into another service
132      *
133      * @param consumer The PSML consumer service, receives PSML from this service.
134      * @param locator The profile locator criteria.
135      *
136      * @return The count of profiles exported.
137      */
138     public int export(PsmlManagerService consumer, QueryLocator locator);
139 
140     /***
141      * Returns a PSML document for the given locator bypassing the cache (if applicable)
142      *
143      * @param locator The locator descriptor of the document to be retrieved.
144      */
145     public PSMLDocument refresh( ProfileLocator locator );
146 
147 }
148