KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > sync > ldap > LDAPAdaptorFactory


1 package de.webman.sync.ldap;
2
3 import de.webman.sync.ACLAdaptor;
4 import de.webman.sync.ACLAdaptorFactory;
5 import de.webman.sync.SyncException;
6 import org.apache.log4j.Category;
7 import java.io.File JavaDoc;
8
9 /**
10  * Factory type for {@link de.webman.sync.ACLAdaptor} implementations
11  *
12  * @author <a HREF="mailto:gregor@webman.de">Gregor Klinke</a>
13  * @version $Revision: 1.2 $
14  **/

15 public class LDAPAdaptorFactory
16 implements ACLAdaptorFactory
17 {
18     /* $Id: LDAPAdaptorFactory.java,v 1.2 2002/04/12 14:56:02 gregor Exp $ */
19     /**
20      * loggin facility
21      **/

22     private static Category cat = Category.getInstance(LDAPAdaptorFactory.class);
23
24     /**
25      * the basedir to use for configuration
26      **/

27     private String JavaDoc basedir = "/";
28     
29     /**
30      * create new acl adaptor instance
31      * @return the new adaptor
32      * @throws SyncException cheese and bread
33      **/

34     public ACLAdaptor newACLAdaptor()
35         throws SyncException
36     {
37         try {
38             File JavaDoc cfgfile = new File JavaDoc(basedir, "WEB-INF/classes/ldap.xml");
39             return new LDAPAdaptor(cfgfile);
40         }
41         catch (Exception JavaDoc ioe) {
42             throw new SyncException(ioe);
43         }
44     }
45     
46     /**
47      * set properties which influences acl adaptor creation
48      **/

49     public void setProperty(String JavaDoc key, Object JavaDoc val) {
50         if ("basedir".equals(key))
51             basedir = (String JavaDoc)val;
52         else
53             cat.error("unknown property key '" + key + "'");
54     }
55 }
56
Popular Tags