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

COVERAGE SUMMARY FOR SOURCE FILE [DefaultPrincipalHelperImpl.java]

nameclass, %method, %block, %line, %
DefaultPrincipalHelperImpl.java0%   (0/1)0%   (0/5)0%   (0/44)0%   (0/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultPrincipalHelperImpl0%   (0/1)0%   (0/5)0%   (0/44)0%   (0/9)
DefaultPrincipalHelperImpl (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getLogin (Principal): String 0%   (0/1)0%   (0/5)0%   (0/1)
getName (Principal): String 0%   (0/1)0%   (0/5)0%   (0/1)
getPrincipal (Principal): DefaultPrincipal 0%   (0/1)0%   (0/26)0%   (0/5)
getRoles (Principal): String [] 0%   (0/1)0%   (0/5)0%   (0/1)

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.security.Principal;
18 
19// singleton
20public class DefaultPrincipalHelperImpl implements PrincipalHelperService
21{
22        public String                getLogin(Principal userPrincipal)
23        {
24                return getPrincipal(userPrincipal).getLogin();
25        }
26        
27        public String                getName(Principal userPrincipal)
28        {
29                return getPrincipal(userPrincipal).getName();
30        }
31        
32        public String[]                getRoles(Principal userPrincipal)
33        {
34                return getPrincipal(userPrincipal).getRoles();
35        }
36        
37        private DefaultPrincipal        getPrincipal(Principal userPrincipal)
38        {
39                if (userPrincipal == null)
40                {
41                        throw new SecurityException("Principal argument must not be null");
42                }
43                if (userPrincipal instanceof DefaultPrincipal)
44                {
45                        return (DefaultPrincipal) userPrincipal;
46                }
47                throw new SecurityException("Unknown Principal class " + userPrincipal.getClass());
48        }
49}

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