directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1005667 - in /directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config: ConfigPartitionReader.java beans/NtpServerBean.java beans/ProtocolServiceBean.java
Date Thu, 07 Oct 2010 23:48:57 GMT
Author: elecharny
Date: Thu Oct  7 23:48:57 2010
New Revision: 1005667

URL: http://svn.apache.org/viewvc?rev=1005667&view=rev
Log:
Added the NtpServer bean

Added:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/NtpServerBean.java
Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ProtocolServiceBean.java

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1005667&r1=1005666&r2=1005667&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Thu Oct  7 23:48:57 2010
@@ -60,6 +60,7 @@ import org.apache.directory.server.chang
 import org.apache.directory.server.config.beans.ChangeLogBean;
 import org.apache.directory.server.config.beans.JournalBean;
 import org.apache.directory.server.config.beans.KdcServerBean;
+import org.apache.directory.server.config.beans.NtpServerBean;
 import org.apache.directory.server.config.beans.TcpTransportBean;
 import org.apache.directory.server.config.beans.TransportBean;
 import org.apache.directory.server.config.beans.UdpTransportBean;
@@ -331,6 +332,12 @@ public class ConfigPartitionReader
     }
 
 
+    /**
+     * Read the KdcServer configuration from the DIT
+     * 
+     * @return A bean containing the KdcServer configuration
+     * @throws Exception If the configuration cannot be read
+     */
     public KdcServerBean readKdcServer() throws Exception
     {
         EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT,
new StringValue(
@@ -592,7 +599,13 @@ public class ConfigPartitionReader
     }
 
 
-    public NtpServer createNtpServer() throws Exception
+    /**
+     * Read the NtpServer configuration from the DIT
+     * 
+     * @return A bean containing the NtpServer configuration
+     * @throws Exception If the configuration cannot be read
+     */
+    public NtpServerBean readNtpServer() throws Exception
     {
         EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT,
new StringValue(
             ConfigSchemaConstants.ADS_NTP_SERVER_OC ) );
@@ -620,13 +633,38 @@ public class ConfigPartitionReader
             return null;
         }
 
-        NtpServer ntpServer = new NtpServer();
+        NtpServerBean ntpServerBean = new NtpServerBean();
 
-        ntpServer.setServiceId( getString( ConfigSchemaConstants.ADS_SERVER_ID, ntpEntry
) );
+        ntpServerBean.setServiceId( getString( ConfigSchemaConstants.ADS_SERVER_ID, ntpEntry
) );
 
-        Transport[] transports = createTransports( ntpEntry.getDn() );
-        ntpServer.setTransports( transports );
+        TransportBean[] transports = readTransports( ntpEntry.getDn() );
+        ntpServerBean.setTransports( transports );
 
+        return ntpServerBean;
+    }
+
+    
+    /**
+     * Create the NtpServer instance from configuration in the DIT
+     * 
+     * @return An instance of NtpServer
+     * @throws Exception If the configuration cannot be read
+     */
+    public NtpServer createNtpServer() throws Exception
+    {
+        NtpServerBean ntpServerBean = readNtpServer();
+        
+        NtpServer ntpServer = new NtpServer();
+        
+        for ( TransportBean transportBean : ntpServerBean.getTransports() )
+        {
+            Transport transport = createTransport( transportBean );
+            
+            ntpServer.addTransports( transport );
+        }
+        
+        ntpServer.setServiceId( ntpServerBean.getServiceId() );
+        
         return ntpServer;
     }
 

Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/NtpServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/NtpServerBean.java?rev=1005667&view=auto
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/NtpServerBean.java
(added)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/NtpServerBean.java
Thu Oct  7 23:48:57 2010
@@ -0,0 +1,38 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.server.config.beans;
+
+
+/**
+ * A class used to store the NtpServer configuration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NtpServerBean extends ProtocolServiceBean
+{
+    /**
+     * Create a new NtpServerBean instance
+     */
+    public NtpServerBean()
+    {
+        // Enabled by default
+        setEnabled( true );
+    }
+}

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ProtocolServiceBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ProtocolServiceBean.java?rev=1005667&r1=1005666&r2=1005667&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ProtocolServiceBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ProtocolServiceBean.java
Thu Oct  7 23:48:57 2010
@@ -35,9 +35,6 @@ public class ProtocolServiceBean 
     /** The server ID */
     private String serviceId;
     
-    /** The service name */
-    private String serviceName;
-    
     /** The service transports. We may have more than one */
     protected Set<TransportBean> transports = new HashSet<TransportBean>();
 



Mime
View raw message