001 /**
002 *
003 * Copyright 2003-2004 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.directory;
018
019 import java.net.InetAddress;
020
021 import org.apache.ldap.server.configuration.ConfigurationException;
022 import org.apache.ldap.server.configuration.StartupConfiguration;
023 import org.apache.mina.registry.ServiceRegistry;
024 import org.apache.mina.registry.SimpleServiceRegistry;
025
026 /**
027 * A {@link StartupConfiguration} that starts up ApacheDS with network layer support.
028 *
029 * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
030 */
031 public class ServerStartupConfiguration extends StartupConfiguration
032 {
033 private static final long serialVersionUID = -7138616822614155454L;
034
035 private boolean enableNetworking = true;
036 private ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
037 private int ldapPort = 389;
038 private int ldapsPort = 636;
039 private InetAddress host = null;
040 private boolean enableKerberos;
041
042 protected ServerStartupConfiguration()
043 {
044 }
045
046 protected InetAddress getHost() {
047 return host;
048 }
049
050 protected void setHost(InetAddress host) {
051 this.host = host;
052 }
053
054 /**
055 * Returns <tt>true</tt> if networking (LDAP, LDAPS, and Kerberos) is enabled.
056 */
057 public boolean isEnableNetworking()
058 {
059 return enableNetworking;
060 }
061
062 /**
063 * Sets whether to enable networking (LDAP, LDAPS, and Kerberos) or not.
064 */
065 public void setEnableNetworking( boolean enableNetworking )
066 {
067 this.enableNetworking = enableNetworking;
068 }
069
070 /**
071 * Returns <tt>true</tt> if Kerberos support is enabled.
072 */
073 public boolean isEnableKerberos()
074 {
075 return enableKerberos;
076 }
077
078 /**
079 * Sets whether to enable Kerberos support or not.
080 */
081 protected void setEnableKerberos( boolean enableKerberos )
082 {
083 this.enableKerberos = enableKerberos;
084 }
085
086 /**
087 * Returns LDAP TCP/IP port number to listen to.
088 */
089 public int getLdapPort()
090 {
091 return ldapPort;
092 }
093
094 /**
095 * Sets LDAP TCP/IP port number to listen to.
096 */
097 protected void setLdapPort( int ldapPort )
098 {
099 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 }