[yast-commit] r48621 - in /trunk/ldap-server/src: LdapServer.pm agent/SlapdConfigAgent.cc lib/backConfigTest.cpp lib/backConfigTest.h tree_structure.ycp widgets.ycp
Author: rhafer
Date: Fri Jun 27 15:58:49 2008
New Revision: 48621
URL: http://svn.opensuse.org/viewcvs/yast?rev=48621&view=rev
Log:
First step to write support for indexes
Modified:
trunk/ldap-server/src/LdapServer.pm
trunk/ldap-server/src/agent/SlapdConfigAgent.cc
trunk/ldap-server/src/lib/backConfigTest.cpp
trunk/ldap-server/src/lib/backConfigTest.h
trunk/ldap-server/src/tree_structure.ycp
trunk/ldap-server/src/widgets.ycp
Modified: trunk/ldap-server/src/LdapServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=48621&r1=48620&r2=48621&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapServer.pm (original)
+++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 15:58:49 2008
@@ -566,6 +566,18 @@
return $rc;
}
+BEGIN { $TYPEINFO {ChangeDatabaseIndex} = ["function", "boolean" , "integer", ["map", "string", "any" ] ]; }
+sub ChangeDatabaseIndex
+{
+ my ($self, $dbIndex, $newIdx ) = @_;
+ y2milestone("ChangeDatabaseIndex: ".Data::Dumper->Dump([$newIdx]) );
+ $newIdx->{'pres'} = YaST::YCP::Boolean($newIdx->{'pres'});
+ $newIdx->{'eq'} = YaST::YCP::Boolean($newIdx->{'eq'});
+ $newIdx->{'sub'} = YaST::YCP::Boolean($newIdx->{'sub'});
+ my $rc = SCR->Write(".ldapserver.database.{".$dbIndex."}.index", $newIdx );
+}
+
+
BEGIN { $TYPEINFO {GetSchemaList} = ["function", [ "list" , "string"] ]; }
sub GetSchemaList
{
Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=48621&r1=48620&r2=48621&view=diff
==============================================================================
--- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 15:58:49 2008
@@ -615,11 +615,37 @@
{
if ( (*i)->getIndex() == dbIndex )
{
- YCPValue val = changesMap.value( YCPString("rootdn") );
- if ( val->isString() )
+ if ( path->length() == 1 )
{
- (*i)->setStringValue( "olcRootDn", val->asString()->value_cstr() );
+ YCPValue val = changesMap.value( YCPString("rootdn") );
+ if ( val->isString() )
+ {
+ (*i)->setStringValue( "olcRootDn", val->asString()->value_cstr() );
+ }
+ } else {
+ std::string dbComponent = path->component_str(1);
+ y2milestone("Component '%s'", dbComponent.c_str());
+ if ( dbComponent == "index" )
+ {
+ std::vector<IndexType> idx;
+ std::string attr( arg->asMap()->value(YCPString("name"))->asString()->value_cstr() );
+ y2milestone("New Index for Attribute: '%s'", attr.c_str() );
+ if ( arg->asMap()->value(YCPString("pres"))->asBoolean()->value() == true )
+ {
+ idx.push_back(Present);
+ }
+ if ( arg->asMap()->value(YCPString("eq"))->asBoolean()->value() == true )
+ {
+ idx.push_back(Eq);
+ }
+ if ( arg->asMap()->value(YCPString("sub"))->asBoolean()->value() == true )
+ {
+ idx.push_back(Sub);
+ }
+ (*i)->addIndex(attr, idx);
+ }
}
+ break;
}
}
return YCPBoolean(false);
Modified: trunk/ldap-server/src/lib/backConfigTest.cpp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.cpp?rev=48621&r1=48620&r2=48621&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/backConfigTest.cpp (original)
+++ trunk/ldap-server/src/lib/backConfigTest.cpp Fri Jun 27 15:58:49 2008
@@ -122,6 +122,35 @@
return res;
}
+void OlcBdbDatabase::addIndex(const std::string& attr, const std::vector<IndexType>& idx)
+{
+ std::string indexString = attr;
+ std::vector<IndexType>::const_iterator i;
+ bool first = true;
+ for ( i = idx.begin(); i != idx.end(); i++ )
+ {
+ if (! first)
+ {
+ indexString += ",";
+ } else {
+ indexString += " ";
+ first = false;
+ }
+ if ( *i == Present ) {
+ indexString += "pres";
+ }
+ else if ( *i == Eq )
+ {
+ indexString += "eq";
+ }
+ else if ( *i == Sub )
+ {
+ indexString += "sub";
+ }
+ }
+ std::cout << "indexString: '" << indexString << "'" << std::endl;
+}
+
void OlcBdbDatabase::setDirectory( const std::string &dir )
{
this->setStringValue("olcDbDirectory", dir);
Modified: trunk/ldap-server/src/lib/backConfigTest.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.h?rev=48621&r1=48620&r2=48621&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/backConfigTest.h (original)
+++ trunk/ldap-server/src/lib/backConfigTest.h Fri Jun 27 15:58:49 2008
@@ -96,6 +96,7 @@
virtual std::map
participants (1)
-
rhafer@svn.opensuse.org