KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > mapper > LdapGroupMembers


1 /**
2  *
3  * Bonita
4  * Copyright (C) 1999 Bull S.A.
5  * Bull 68 route de versailles 78434 Louveciennes Cedex France
6  * Further information: bonita@objectweb.org
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  * USA
22  *
23  *
24 --------------------------------------------------------------------------
25  * $Id: LdapGroupMembers.java,v 1.2 2004/11/10 17:10:50 mvaldes Exp $
26  *
27 --------------------------------------------------------------------------
28  */

29
30 package hero.mapper;
31
32 import hero.util.HeroException;
33 import hero.interfaces.BnRoleLocal;
34
35 // Use of BnLdap session Bean
36
import hero.interfaces.BnLdap;
37 import hero.interfaces.BnLdapHome;
38 import hero.interfaces.BnLdapUtil;
39 import java.util.*;
40
41
42 public class LdapGroupMembers implements hero.mapper.RoleMapperI {
43
44     public Collection searchMembers(Object JavaDoc b,BnRoleLocal n, String JavaDoc userName) throws HeroException {
45     
46         String JavaDoc roleName=n.getName();
47         String JavaDoc projectName=n.getBnProject().getName();
48         System.out.println("[Search Group Members] BnRole name:"+roleName + " - Project name = " + projectName);
49         ArrayList al =null;
50         
51         BnLdapHome home = null;
52         try {
53             home = BnLdapUtil.getHome();
54         } catch (Exception JavaDoc e) {
55             System.err.println( "Cannot lookup BnLdapHome: " + e);
56             System.exit(2);
57         }
58     
59         BnLdap t1 = null;
60         try {
61             // logs trace
62
System.out.println("Create a bean bnLdap");
63             t1 = home.create();
64         } catch (Exception JavaDoc e) {
65             throw new HeroException("Cannot create BnLdapBean : " + e);
66         }
67         try {
68         al = (ArrayList)t1.getGroupMembers(roleName);
69         } catch (Exception JavaDoc e){
70             throw new HeroException("Error getting group members for group: " + roleName + " " + e.getMessage());
71         }
72         return al;
73               
74     }
75
76 }
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Popular Tags