View Javadoc

1   /*
2    *   @(#) $Id: ServerStartupConfiguration.java 264732 2005-08-30 08:04:51Z akarasulu $
3    *
4    *   Copyright 2004 The Apache Software Foundation
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   *
18   */
19  package org.apache.ldap.server.configuration;
20  
21  import org.apache.mina.registry.ServiceRegistry;
22  import org.apache.mina.registry.SimpleServiceRegistry;
23  
24  /***
25   * A {@link StartupConfiguration} that starts up ApacheDS with network layer support.
26   * 
27   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
28   * @version $Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
29   */
30  public class ServerStartupConfiguration extends StartupConfiguration
31  {
32      private static final long serialVersionUID = -7138616822614155454L;
33  
34      private boolean enableNetworking = true;
35      private ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
36      private int ldapPort = 389;
37      private int ldapsPort = 636;
38      private boolean enableKerberos;
39  
40      protected ServerStartupConfiguration()
41      {
42      }
43  
44      /***
45       * Returns <tt>true</tt> if networking (LDAP, LDAPS, and Kerberos) is enabled.
46       */
47      public boolean isEnableNetworking()
48      {
49          return enableNetworking;
50      }
51  
52      /***
53       * Sets whether to enable networking (LDAP, LDAPS, and Kerberos) or not.
54       */
55      public void setEnableNetworking( boolean enableNetworking )
56      {
57          this.enableNetworking = enableNetworking;
58      }
59  
60      /***
61       * Returns <tt>true</tt> if Kerberos support is enabled.
62       */
63      public boolean isEnableKerberos()
64      {
65          return enableKerberos;
66      }
67  
68      /***
69       * Sets whether to enable Kerberos support or not.
70       */
71      protected void setEnableKerberos( boolean enableKerberos )
72      {
73          this.enableKerberos = enableKerberos;
74      }
75  
76      /***
77       * Returns LDAP TCP/IP port number to listen to.
78       */
79      public int getLdapPort()
80      {
81          return ldapPort;
82      }
83  
84      /***
85       * Sets LDAP TCP/IP port number to listen to.
86       */
87      protected void setLdapPort( int ldapPort )
88      {
89          ConfigurationUtil.validatePortNumber( ldapPort );
90          this.ldapPort = ldapPort;
91      }
92  
93      /***
94       * Returns LDAPS TCP/IP port number to listen to.
95       */
96      public int getLdapsPort()
97      {
98          return ldapsPort;
99      }
100 
101     /***
102      * Sets LDAPS TCP/IP port number to listen to.
103      */
104     protected void setLdapsPort( int ldapsPort )
105     {
106         ConfigurationUtil.validatePortNumber( ldapsPort );
107         this.ldapsPort = ldapsPort;
108     }
109 
110     /***
111      * Returns <a href="http://directory.apache.org/subprojects/network/">MINA</a>
112      * {@link ServiceRegistry} that will be used by ApacheDS.
113      */
114     public ServiceRegistry getMinaServiceRegistry()
115     {
116         return minaServiceRegistry;
117     }
118 
119     /***
120      * Sets <a href="http://directory.apache.org/subprojects/network/">MINA</a>
121      * {@link ServiceRegistry} that will be used by ApacheDS.
122      */
123     protected void setMinaServiceRegistry( ServiceRegistry minaServiceRegistry )
124     {
125         if( minaServiceRegistry == null )
126         {
127             throw new ConfigurationException( "MinaServiceRegistry cannot be null" );
128         }
129         this.minaServiceRegistry = minaServiceRegistry;
130     }
131 }