in src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java [2591:2660]
private void updConfig() throws BuildException
{
LOG.info( "updateConfig" );
if( updconfig == null )
{
return;
}
// Loop through the entityclass elements
for ( Updconfig updcfg : updconfig )
{
Properties props = new Properties();
Configuration configuration = new Configuration();
String configNodeName = "";
List<ConfigAnt> cfgs = updcfg.getConfig();
for ( ConfigAnt cfg : cfgs )
{
LOG.info( "updateConfig" );
String val = cfg.getProps();
int indx = val.indexOf( GlobalIds.PROP_SEP );
if ( indx >= 1 )
{
String name = val.substring( 0, indx );
String value = val.substring( indx + 1 );
// The config realm property is required on updconfig op and points to the existing node in ldap to update with these new props.
if( name.equalsIgnoreCase( GlobalIds.CONFIG_REALM ))
{
configuration.setName( value );
}
else if( name.equalsIgnoreCase( GlobalIds.CONFIG_UID_NUMBER ))
{
configuration.setUidNumber( value );
}
else if( name.equalsIgnoreCase( GlobalIds.CONFIG_GID_NUMBER ))
{
configuration.setGidNumber( value );
}
else
{
props.setProperty( name, value );
LOG.info( "updateConfig name [{}] value [{}]", name, value );
}
}
}
// Can't go on w/out a name for the config node to update.
if ( StringUtils.isEmpty( configuration.getName() ))
{
LOG.warn( "updConfig realm name not specified, operation aborted." );
LOG.warn( "Add entry like this to input xml: <config props=\"config.realm:DEFAULT\"/>" );
}
else
{
configuration.addProperties( props );
LOG.info( "updConfig realm name [{}]", configuration.getName() );
LOG.info( "updConfig gid.number [{}]", configuration.getGidNumber() );
LOG.info( "updConfig uid.number [{}]", configuration.getUidNumber() );
try
{
cfgMgr.update( configuration );
}
catch ( SecurityException se )
{
LOG.warn( "updConfig realm name={} failed SecurityException={}", configNodeName, se );
LOG.warn( "Verify that config realm name={} exists", configNodeName);
}
}
}
}