01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * 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;
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: * Utility class to exposed as a webservice allowing a webservice client to
31: * find the DAV path for a user with a specified user name.
32: *
33: * @author Michael Bell
34: * @version $Revision: 1.3 $
35: * @since March 4, 2004
36: */
37: public class UtilityService {
38:
39: /**
40: *
41: */
42: public UtilityService() {
43: super ();
44: }
45:
46: /**
47: * Returns the DAVpath for the user resource which has the given user name
48: *
49: * @param sUserName
50: * @return
51: */
52: public static String getUserPath(String sUserName)
53: throws RemoteException {
54: String sDAVPath = null;
55:
56: UserAuthenticator auth = UserAuthenticatorFactory
57: .getAuthenticator();
58:
59: try {
60: User usr = auth.getUser(sUserName);
61:
62: sDAVPath = HarmoniseNameResolver.getDAVPath(usr);
63: } catch (UserAuthenticationException e) {
64: throw new RemoteException(e.getLocalizedMessage(), e);
65: } catch (NameResolverException e) {
66: throw new RemoteException(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[] getIndexerStopWords() {
78: return HarmoniseAnalyzer.getStopWords();
79: }
80:
81: }
|