View Javadoc

1   /* 
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     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 implements HierarchyResolver
47  {
48      /***
49       * @see org.apache.jetspeed.security.HierarchyResolver#resolve(Preferences)
50       */
51      public String[] resolve(Preferences prefs)
52      {
53          ArgUtil.notNull(new Object[] { prefs }, new String[] { "preferences" }, "resolve(java.util.prefs.Preferences)");
54  
55          return resolveChildren(prefs);
56      }
57  
58  }