01: /*
02: * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.monitoring.security;
06:
07: import com.sun.portal.monitoring.utilities.Hallmark;
08: import com.sun.portal.monitoring.utilities.UtilityException;
09: import com.sun.portal.monitoring.utilities.PropertyHelper;
10:
11: import java.util.Properties;
12:
13: public class UserManager {
14: public UserManager(PropertyHelper propertyHelper) {
15: this .propertyHelper = propertyHelper;
16: if (propertyHelper == null) {
17: this .propertyHelper = new PropertyHelper(new Properties());
18: }
19:
20: hallmark = new Hallmark(propertyHelper);
21: }
22:
23: private PropertyHelper propertyHelper;
24: private Hallmark hallmark;
25:
26: public User create(String name, int length)
27: throws SecurityException {
28: User result = new User(propertyHelper);
29: result.setName(name);
30: result.createPassword(length);
31:
32: return result;
33: }
34:
35: public void write(User user, String pathName)
36: throws SecurityException {
37: try {
38: hallmark.write(user, pathName);
39: } catch (UtilityException ue) {
40: throw new SecurityException(ue);
41: }
42: }
43:
44: public User read(String pathName) throws SecurityException {
45: User result;
46: try {
47: result = (User) hallmark.read(pathName);
48: } catch (UtilityException ue) {
49: throw new SecurityException(ue);
50: }
51:
52: return result;
53: }
54: }
|