KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > dav > server > webservice > UtilityService


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19
20 package org.openharmonise.dav.server.webservice;
21
22 import java.rmi.RemoteException JavaDoc;
23
24 import org.openharmonise.dav.server.utils.*;
25 import org.openharmonise.rm.resources.users.User;
26 import org.openharmonise.rm.search.HarmoniseAnalyzer;
27 import org.openharmonise.rm.security.authentication.*;
28
29
30 /**
31  * Utility class to exposed as a webservice allowing a webservice client to
32  * find the DAV path for a user with a specified user name.
33  *
34  * @author Michael Bell
35  * @version $Revision: 1.3 $
36  * @since March 4, 2004
37  */

38 public class UtilityService {
39
40     /**
41      *
42      */

43     public UtilityService() {
44         super();
45     }
46     
47     
48     /**
49      * Returns the DAVpath for the user resource which has the given user name
50      *
51      * @param sUserName
52      * @return
53      */

54     public static String JavaDoc getUserPath(String JavaDoc sUserName) throws RemoteException JavaDoc {
55         String JavaDoc sDAVPath = null;
56         
57         UserAuthenticator auth = UserAuthenticatorFactory.getAuthenticator();
58         
59         try {
60             User usr = auth.getUser(sUserName);
61             
62             sDAVPath = HarmoniseNameResolver.getDAVPath(usr);
63         } catch (UserAuthenticationException e) {
64             throw new RemoteException JavaDoc(e.getLocalizedMessage(),e);
65         } catch (NameResolverException e) {
66             throw new RemoteException JavaDoc(e.getLocalizedMessage(),e);
67         }
68         
69         return sDAVPath;
70     }
71     
72     /**
73      * Returns the array of stop words used by the <code>HarmoniseAnalyzer</code>
74      *
75      * @return the array of stop words used by the <code>HarmoniseAnalyzer</code>
76      */

77     public static String JavaDoc[] getIndexerStopWords() {
78         return HarmoniseAnalyzer.getStopWords();
79     }
80
81 }
82
Popular Tags