1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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.geronimo.directory;
18
19 import java.net.InetAddress;
20
21 import org.apache.ldap.server.configuration.ConfigurationException;
22 import org.apache.ldap.server.configuration.StartupConfiguration;
23 import org.apache.mina.registry.ServiceRegistry;
24 import org.apache.mina.registry.SimpleServiceRegistry;
25
26 /**
27 * A {@link StartupConfiguration} that starts up ApacheDS with network layer support.
28 *
29 * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
30 */
31 public class ServerStartupConfiguration extends StartupConfiguration
32 {
33 private static final long serialVersionUID = -7138616822614155454L;
34
35 private boolean enableNetworking = true;
36 private ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
37 private int ldapPort = 389;
38 private int ldapsPort = 636;
39 private InetAddress host = null;
40 private boolean enableKerberos;
41
42 protected ServerStartupConfiguration()
43 {
44 }
45
46 protected InetAddress getHost() {
47 return host;
48 }
49
50 protected void setHost(InetAddress host) {
51 this.host = host;
52 }
53
54 /**
55 * Returns <tt>true</tt> if networking (LDAP, LDAPS, and Kerberos) is enabled.
56 */
57 public boolean isEnableNetworking()
58 {
59 return enableNetworking;
60 }
61
62 /**
63 * Sets whether to enable networking (LDAP, LDAPS, and Kerberos) or not.
64 */
65 public void setEnableNetworking( boolean enableNetworking )
66 {
67 this.enableNetworking = enableNetworking;
68 }
69
70 /**
71 * Returns <tt>true</tt> if Kerberos support is enabled.
72 */
73 public boolean isEnableKerberos()
74 {
75 return enableKerberos;
76 }
77
78 /**
79 * Sets whether to enable Kerberos support or not.
80 */
81 protected void setEnableKerberos( boolean enableKerberos )
82 {
83 this.enableKerberos = enableKerberos;
84 }
85
86 /**
87 * Returns LDAP TCP/IP port number to listen to.
88 */
89 public int getLdapPort()
90 {
91 return ldapPort;
92 }
93
94 /**
95 * Sets LDAP TCP/IP port number to listen to.
96 */
97 protected void setLdapPort( int ldapPort )
98 {
99 this.ldapPort = ldapPort;
100 }
101
102 /**
103 * Returns LDAPS TCP/IP port number to listen to.
104 */
105 public int getLdapsPort()
106 {
107 return ldapsPort;
108 }
109
110 /**
111 * Sets LDAPS TCP/IP port number to listen to.
112 */
113 protected void setLdapsPort( int ldapsPort )
114 {
115 this.ldapsPort = ldapsPort;
116 }
117
118 /**
119 * Returns <a href="http://directory.apache.org/subprojects/network/">MINA</a>
120 * {@link ServiceRegistry} that will be used by ApacheDS.
121 */
122 public ServiceRegistry getMinaServiceRegistry()
123 {
124 return minaServiceRegistry;
125 }
126
127 /**
128 * Sets <a href="http://directory.apache.org/subprojects/network/">MINA</a>
129 * {@link ServiceRegistry} that will be used by ApacheDS.
130 */
131 protected void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
132 {
133 if( minaServiceRegistry == null )
134 {
135 throw new ConfigurationException( "MinaServiceRegistry cannot be null" );
136 }
137 this.minaServiceRegistry = minaServiceRegistry;
138 }
139 }