01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.security.impl;
18:
19: import java.util.prefs.Preferences;
20:
21: import org.apache.jetspeed.security.HierarchyResolver;
22: import org.apache.jetspeed.util.ArgUtil;
23:
24: /**
25: * <p>
26: * Implementation for "part of" hierarchy. For Example: There're roles:
27: * <ul>
28: * <li>roleA</li>
29: * <li>roleA.roleB</li>
30: * <li>roleA.roleB.roleC</li>
31: * </ul>
32: * if a user has the role [roleA] than
33: * </p>
34: * <code>user.getSubject().getPrincipals()</code> returns:
35: * <ul>
36: * <li>/role/roleA</li>
37: * <li>/role/roleA/roleB</li>
38: * <li>/role/roleA/roleB/roleC</li>
39: * </ul>
40: * </p>
41: *
42: * @author <a href="mailto:Artem.Grinshtein@t-systems.com">Artem Grinshtein </a>
43: * @version $Id: AggregationHierarchyResolver.java,v 1.2 2004/09/18 19:33:58
44: * dlestrat Exp $
45: */
46: public class AggregationHierarchyResolver extends BaseHierarchyResolver
47: implements HierarchyResolver {
48: /**
49: * @see org.apache.jetspeed.security.HierarchyResolver#resolve(Preferences)
50: */
51: public String[] resolve(Preferences prefs) {
52: ArgUtil.notNull(new Object[] { prefs },
53: new String[] { "preferences" },
54: "resolve(java.util.prefs.Preferences)");
55:
56: return resolveChildren(prefs);
57: }
58:
59: }
|