directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1005742 - in /directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config: ConfigPartitionReader.java beans/DhcpServerBean.java beans/DnsServerBean.java
Date Fri, 08 Oct 2010 09:26:56 GMT
Author: elecharny
Date: Fri Oct  8 09:26:55 2010
New Revision: 1005742

URL: http://svn.apache.org/viewvc?rev=1005742&view=rev
Log:
Added the DHCPServer and DNSServer beans

Added:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DhcpServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DnsServerBean.java
Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.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=1005742&r1=1005741&r2=1005742&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
Fri Oct  8 09:26:55 2010
@@ -58,6 +58,7 @@ import javax.naming.directory.SearchCont
 
 import org.apache.directory.server.changepw.ChangePasswordServer;
 import org.apache.directory.server.config.beans.ChangeLogBean;
+import org.apache.directory.server.config.beans.DnsServerBean;
 import org.apache.directory.server.config.beans.JdbmIndexBean;
 import org.apache.directory.server.config.beans.JournalBean;
 import org.apache.directory.server.config.beans.KdcServerBean;
@@ -525,7 +526,13 @@ public class ConfigPartitionReader
     }
 
 
-    public DnsServer createDnsServer() throws Exception
+    /**
+     * Read the DnsServer configuration from the DIT
+     * 
+     * @return A bean containing the DnsServer configuration
+     * @throws Exception If the configuration cannot be read
+     */
+    public DnsServerBean readDnsServer() throws Exception
     {
         EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT,
new StringValue(
             ConfigSchemaConstants.ADS_DNS_SERVER_OC ) );
@@ -553,19 +560,43 @@ public class ConfigPartitionReader
             return null;
         }
 
-        DnsServer dnsServer = new DnsServer();
+        DnsServerBean dnsServerBean = new DnsServerBean();
 
-        dnsServer.setServiceId( getString( ConfigSchemaConstants.ADS_SERVER_ID, dnsEntry
) );
+        dnsServerBean.setServiceId( getString( ConfigSchemaConstants.ADS_SERVER_ID, dnsEntry
) );
 
-        Transport[] transports = createTransports( dnsEntry.getDn() );
-        dnsServer.setTransports( transports );
+        TransportBean[] transports = readTransports( dnsEntry.getDn() );
+        dnsServerBean.setTransports( transports );
 
-        return dnsServer;
+        return dnsServerBean;
     }
 
+    
+    /**
+     * Create an instance of DnsServer reading its configuration in the DIT
+     * 
+     * @return An instance of a DnsServer
+     * @throws Exception If the instance cannot be created
+     */
+    public DnsServer createDnsServer() throws Exception
+    {
+        DnsServerBean dnsServerBean = readDnsServer();
+        DnsServer dnsServer = new DnsServer();
+        
+        for ( TransportBean transportBean : dnsServerBean.getTransports() )
+        {
+            Transport transport = createTransport( transportBean );
+            
+            dnsServer.addTransports( transport );
+        }
+        
+        dnsServer.setServiceId( dnsServerBean.getServiceId() );
+
+
+        return dnsServer;
+    }
 
     //TODO making this method invisible cause there is no DhcpServer exists as of now
-    private DhcpService createDhcpServer() throws Exception
+    private DhcpService readDhcpServer() throws Exception
     {
         EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT,
new StringValue(
             ConfigSchemaConstants.ADS_DHCP_SERVER_OC ) );
@@ -593,13 +624,19 @@ public class ConfigPartitionReader
             return null;
         }
 
+        return null;
+    }
+    
+    
+    //TODO making this method invisible cause there is no DhcpServer exists as of now
+    private DhcpService createDhcpServer() throws Exception
+    {
         DhcpStore dhcpStore = new SimpleDhcpStore();
         DhcpService dhcpService = new StoreBasedDhcpService( dhcpStore );
 
         return dhcpService;
     }
 
-
     /**
      * Read the NtpServer configuration from the DIT
      * 

Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DhcpServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DhcpServerBean.java?rev=1005742&view=auto
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DhcpServerBean.java
(added)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DhcpServerBean.java
Fri Oct  8 09:26:55 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 DhcpServer configuration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DhcpServerBean extends DirectoryBackedServiceBean
+{
+    /**
+     * Create a new DhcpServerBean instance
+     */
+    public DhcpServerBean()
+    {
+        // Enabled by default
+        setEnabled( true );
+    }
+}

Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DnsServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DnsServerBean.java?rev=1005742&view=auto
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DnsServerBean.java
(added)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DnsServerBean.java
Fri Oct  8 09:26:55 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 DnsServer configuration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DnsServerBean extends DirectoryBackedServiceBean
+{
+    /**
+     * Create a new DnsServerBean instance
+     */
+    public DnsServerBean()
+    {
+        // Enabled by default
+        setEnabled( true );
+    }
+}



Mime
View raw message