You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2018/07/13 11:54:06 UTC
directory-fortress-core git commit: FC-108 - Add support for RFC2307
BIS - bugfix
Repository: directory-fortress-core
Updated Branches:
refs/heads/master 59f5b3be0 -> 845169c8a
FC-108 - Add support for RFC2307 BIS - bugfix
Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/845169c8
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/845169c8
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/845169c8
Branch: refs/heads/master
Commit: 845169c8ab14e169e5f353fe8c85a0d17704ff5d
Parents: 59f5b3b
Author: Shawn McKinney <sm...@apache.org>
Authored: Fri Jul 13 06:54:03 2018 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Fri Jul 13 06:54:03 2018 -0500
----------------------------------------------------------------------
.../directory/fortress/core/impl/ConfigDAO.java | 14 ++++++--------
.../apache/directory/fortress/core/util/Config.java | 9 ++++++---
2 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/845169c8/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index ad75d68..cc1dd2f 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -105,7 +105,6 @@ final class ConfigDAO extends LdapDataProvider
ConfigDAO()
{
super();
-
CONFIG_ROOT_DN = Config.getInstance().getProperty( GlobalIds.CONFIG_ROOT_PARAM );
}
@@ -168,7 +167,7 @@ final class ConfigDAO extends LdapDataProvider
LOG.info( "update dn [{}]", dn );
try
{
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
if ( PropUtil.isNotEmpty( props ) )
{
loadProperties( props, mods, GlobalIds.PROPS, false );
@@ -207,8 +206,7 @@ final class ConfigDAO extends LdapDataProvider
{
LdapConnection ld = null;
String dn = getDn( name );
- LOG.debug
- ( "update dn [{}], key [{}], value [{}], newValue [{}]", dn, key, value, newValue );
+ LOG.debug( "update dn [{}], key [{}], value [{}], newValue [{}]", dn, key, value, newValue );
try
{
List<Modification> mods = new ArrayList<Modification>();
@@ -272,7 +270,7 @@ final class ConfigDAO extends LdapDataProvider
LOG.info( "remove props dn [{}]", dn );
try
{
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
if ( PropUtil.isNotEmpty( props ) )
{
removeProperties( props, mods, GlobalIds.PROPS );
@@ -307,7 +305,7 @@ final class ConfigDAO extends LdapDataProvider
Properties props = null;
LdapConnection ld = null;
String dn = getDn( name );
- LOG.info( "getConfig dn [{}]", dn );
+ LOG.debug( "getConfig dn [{}]", dn );
try
{
ld = getAdminConnection();
@@ -317,7 +315,7 @@ final class ConfigDAO extends LdapDataProvider
catch ( LdapNoSuchObjectException e )
{
String warning = "getConfig COULD NOT FIND ENTRY for dn [" + dn + "]";
- throw new FinderException( GlobalErrIds.USER_NOT_FOUND, warning, e );
+ throw new FinderException( GlobalErrIds.FT_CONFIG_NOT_FOUND, warning, e );
}
catch ( LdapException e )
{
@@ -341,4 +339,4 @@ final class ConfigDAO extends LdapDataProvider
{
return SchemaConstants.CN_AT + "=" + name + "," + CONFIG_ROOT_DN;
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/845169c8/src/main/java/org/apache/directory/fortress/core/util/Config.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/Config.java b/src/main/java/org/apache/directory/fortress/core/util/Config.java
index 5495688..f18cdc3 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/Config.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/Config.java
@@ -119,7 +119,7 @@ public final class Config
}
/**
- * Replaces property stored in the named configuration node and updates what's held in memory by commons config.
+ * Replaces property stored in the named configuration node.
* Method is synchronized to prevent race condition where two threads access and update the same property value.
*
* @param name of the config node, mostly likely 'DEFAULT'.
@@ -129,11 +129,14 @@ public final class Config
*/
public synchronized String replaceProperty( String name, String key, PropUpdater propUpdater ) throws CfgException
{
- String value = getProperty( key );
+ String value;
try
{
- String newValue = propUpdater.newValue( value );
ConfigMgr cfgMgr = ConfigMgrFactory.createInstance();
+ Properties props = cfgMgr.read( name );
+ // TODO: The key should be scoped to an instance, e.g. FORT104
+ value = props.getProperty( key );
+ String newValue = propUpdater.newValue( value );
cfgMgr.updateProperty( name, key, value, newValue );
setProperty( key, newValue );
}