EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hivelock]

COVERAGE SUMMARY FOR SOURCE FILE [AuthorizationContribution.java]

nameclass, %method, %block, %line, %
AuthorizationContribution.java0%   (0/1)0%   (0/7)0%   (0/80)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AuthorizationContribution0%   (0/1)0%   (0/7)0%   (0/80)0%   (0/24)
AuthorizationContribution (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getPattern (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getRole (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getRoles (): String [] 0%   (0/1)0%   (0/3)0%   (0/1)
setPattern (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setRole (String): void 0%   (0/1)0%   (0/46)0%   (0/14)
toString (): String 0%   (0/1)0%   (0/18)0%   (0/4)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (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
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hivelock;
16 
17import java.util.SortedSet;
18import java.util.StringTokenizer;
19import java.util.TreeSet;
20 
21import org.apache.hivemind.impl.BaseLocatable;
22import org.apache.hivemind.util.ToStringBuilder;
23 
24public class AuthorizationContribution extends BaseLocatable
25{
26        public void                setRole(String roles)
27        {
28                _roles = roles;
29                // Parse the list to build more convenient info
30                StringTokenizer tokens = new StringTokenizer(roles, ",");
31                SortedSet<String> allRoles = new TreeSet<String>();
32                while (tokens.hasMoreTokens())
33                {
34                        String next = tokens.nextToken();
35                        if ("".equals(next))
36                        {
37                                continue;
38                        }
39                        if ("*".equals(next))
40                        {
41                                _allRoles = null;
42                                return;
43                        }
44                        allRoles.add(next);
45                }
46                _allRoles = allRoles.toArray(new String[allRoles.size()]);
47        }
48 
49        public String        getRole()
50        {
51                return _roles;
52        }
53 
54        public String[]        getRoles()
55        {
56                return _allRoles;
57        }
58 
59    public void setPattern(String string)
60    {
61        _pattern = string;
62    }
63 
64    public String getPattern()
65    {
66        return _pattern;
67    }
68 
69    public String toString()
70    {
71        ToStringBuilder builder = new ToStringBuilder(this);
72        builder.append("pattern", _pattern);
73        builder.append("roles", _roles);
74        return builder.toString();
75    }
76    
77    private String[]        _allRoles;
78    private String                _roles;
79    private String                _pattern;
80}

[all classes][net.sourceforge.hivelock]
EMMA 2.0.5312 (C) Vladimir Roubtsov