You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/10/07 18:59:10 UTC
svn commit: r1005525 - in
/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config:
ConfigPartitionReader.java beans/ChangeLogBean.java beans/JournalBean.java
Author: elecharny
Date: Thu Oct 7 16:59:10 2010
New Revision: 1005525
URL: http://svn.apache.org/viewvc?rev=1005525&view=rev
Log:
Added the ChangeLog bean
Added:
directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangeLogBean.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/JournalBean.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=1005525&r1=1005524&r2=1005525&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 16:59:10 2010
@@ -57,6 +57,7 @@ import java.util.TreeSet;
import javax.naming.directory.SearchControls;
import org.apache.directory.server.changepw.ChangePasswordServer;
+import org.apache.directory.server.config.beans.ChangeLogBean;
import org.apache.directory.server.config.beans.JournalBean;
import org.apache.directory.server.config.beans.TcpTransportBean;
import org.apache.directory.server.config.beans.TransportBean;
@@ -1356,27 +1357,54 @@ public class ConfigPartitionReader
}
- public ChangeLog createChangeLog( DN changelogDN ) throws Exception
+ /**
+ * Read the ChangeLog configuration
+ *
+ * @param changelogDN The DN in teh DIT for the ChangeLog configuration
+ * @return The instanciated bean containing the ChangeLog configuration
+ * @throws Exception If the configuration can't be read
+ */
+ public ChangeLogBean readChangeLog( DN changelogDN ) throws Exception
{
long id = configPartition.getEntryId( changelogDN );
Entry clEntry = configPartition.lookup( id );
- ChangeLog cl = new DefaultChangeLog();
+ ChangeLogBean changeLogBean = new ChangeLogBean();
+
EntryAttribute clEnabledAttr = clEntry.get( ConfigSchemaConstants.ADS_CHANGELOG_ENABLED );
if ( clEnabledAttr != null )
{
- cl.setEnabled( Boolean.parseBoolean( clEnabledAttr.getString() ) );
+ changeLogBean.setEnabled( Boolean.parseBoolean( clEnabledAttr.getString() ) );
}
EntryAttribute clExpAttr = clEntry.get( ConfigSchemaConstants.ADS_CHANGELOG_EXPOSED );
if ( clExpAttr != null )
{
- cl.setExposed( Boolean.parseBoolean( clExpAttr.getString() ) );
+ changeLogBean.setExposed( Boolean.parseBoolean( clExpAttr.getString() ) );
}
- return cl;
+ return changeLogBean;
+ }
+
+
+ /**
+ * Read the configuration for the ChangeLog system
+ *
+ * @param changelogDN The DN for the ChngeLog configuration
+ * @return
+ * @throws Exception
+ */
+ public ChangeLog createChangeLog( DN changelogDN ) throws Exception
+ {
+ ChangeLogBean changeLogBean = readChangeLog( changelogDN );
+
+ ChangeLog changeLog = new DefaultChangeLog();
+ changeLog.setEnabled( changeLogBean.isEnabled() );
+ changeLog.setExposed( changeLogBean.isExposed() );
+
+ return changeLog;
}
@@ -1421,6 +1449,13 @@ public class ConfigPartitionReader
}
+ /**
+ * Instanciate the Journal object from the stored configuration
+ *
+ * @param journalDN The DN in the DIt for the Journal configuration
+ * @return An instance of Journal
+ * @throws Exception If the Journal creation failed
+ */
public Journal createJournal( DN journalDN ) throws Exception
{
JournalBean journalBean = readJournal( journalDN );
Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangeLogBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangeLogBean.java?rev=1005525&view=auto
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangeLogBean.java (added)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangeLogBean.java Thu Oct 7 16:59:10 2010
@@ -0,0 +1,82 @@
+/*
+ * 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 ChangeLog configuration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ChangeLogBean
+{
+ /** Tells if the ChangeLog is exposed to the users */
+ private boolean exposed;
+
+ /** Tells if the ChangeLog is enabled */
+ private boolean enabled;
+
+ /**
+ * Create a new ChangeLogBean instance
+ */
+ public ChangeLogBean()
+ {
+ // Not exposed by default
+ exposed = false;
+
+ // Not enabled by default
+ enabled = false;
+ }
+
+
+ /**
+ * @return <code>true</code> if the ChangeLog is exposed
+ */
+ public boolean isExposed()
+ {
+ return exposed;
+ }
+
+
+ /**
+ * @param exposed Set the exposed flag
+ */
+ public void setExposed( boolean exposed )
+ {
+ this.exposed = exposed;
+ }
+
+
+ /**
+ * @return <code>true</code> if ChangeLog is enabled
+ */
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+
+ /**
+ * @param enabled Set the enabled flag
+ */
+ public void setEnabled( boolean enabled )
+ {
+ this.enabled = enabled;
+ }
+}
Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JournalBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JournalBean.java?rev=1005525&r1=1005524&r2=1005525&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JournalBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JournalBean.java Thu Oct 7 16:59:10 2010
@@ -106,7 +106,7 @@ public class JournalBean
/**
- * @return the enabled
+ * @return <code>true</code> if the Journal is enabled
*/
public boolean isEnabled()
{
@@ -115,7 +115,7 @@ public class JournalBean
/**
- * @param enabled the enabled to set
+ * @param enabled Set the enabled flag
*/
public void setEnabled( boolean enabled )
{