Skip to main content link. Accesskey S
  • HCL Logo
  • HCL Notes and Domino wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL Forums and Blogs
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • API Documentation
Search
Community Articles > Lotus Domino > Domino admin > IBM Directory Change Analyzer
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

IBM Directory Change Analyzer

Learn how to configure and use the IBM Directory Change analyzer, which scans the Server Document and Configuration document in a Domino Directory, and reports what had changed, and who made the change, with timestamps.
Community articleIBM Directory Change Analyzer
Added by ~Sanjay Nonkrovitchoopsi | Edited by ~Lisa Brejipymanjip on July 24, 2013 | Version 4
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
Learn how to configure and use the IBM Directory Change analyzer, which scans the Server Document and Configuration document in a Domino Directory, and reports what had changed, and who made the change, with timestamps.
Tags: Domino server, Server changes, Server configuration
ShowTable of Contents
HideTable of Contents
  • 1 Introduction
  • 2 Understanding the Directory Change Analyzer
    • 2.1 Call Import Configuration Document
    • 2.2 Call Import Server Document
    • 2.3 Import Configuration Document
    • 2.4 Import Server Documents
    • 2.5 Compare Configuration Document
    • 2.6 Compare Server Documents
    • 2.7 Undo Changes
  • 3 Running the Directory Change Analyzer tool
    • 3.1 Pre-requisites:
    • 3.2 Step 1
    • 3.3 Step 2
    • 3.4 Step 3
  • 4 Conclusion
  • 5 FAQ'S
  • 6 About the Inventors

Introduction



The IBM Domino Directory, names.nsf, is one of the important databases for a Domino server, which contains the server's configuration information, and is responsible for all the server jobs that are running on the IBM Domino server.
It is important to understand how the data information is changed, and who performed the changes for audit purpose. By default, each document has a field called $Updates, where the server stores the last modification dates. However, we there is no mechanism to show what ( data ) was changed, or by whom.

To resolve this issue, you can use the IBM Directory Change Analyzer tool, which tracks all the changes to the server documents and server configuration documents. This tool, can identify which field was changed, and by whom , and display it in the UI along with the timestamps of the change.
This tool takes advantage of the existing feature “Configuration Collector”, which is part of IBM Domino Server6.0.3 and higher.

You can download the IBM Directory Change Analyzer tool from OpenNTF.org.

The configuration Collector feature generates the dxl file whenever the server document and server configuration document gets modified. The tool will import those .dxl files, and analyze them to give the necessary output.
The tool has also has the capability to restore any of the previous date changes, by over writing the current settings.

The tool has been developed as a plug-and-play type requiring no configuration. Simply provide it with the directory server name and run the desired agent.

Understanding the Directory Change Analyzer


The tool consists of the following 7 lotus script agents:
1) Call Import Configuration Document
2) Call Import Server Document
3) Import Configuration Document
4) Import Server Document
5) Compare Server Documents
6) Compare Configuration Documents
7) Undo Changes
The following sections discuss each one in more detail.

Call Import Configuration Document



The agent “Call Import Configuration Document” does 2 jobs:

1. Remove the old imported configuration documents, which were created when the agent last ran.


2. Call the Import Configuration Document agent, which will establish a connection with the target server, and import all the dxl files, which are for the configuration documents.

Here is an example of the Call Import Configuration Document script:

Sub Initialize
 	Dim s As New NotesSession
 	Dim curdb As NotesDatabase
 	Dim agent As NotesAgent
 	Dim configview As NotesView
 	Dim configdoc As NotesDocument,olddxldoc  As NotesDocument
 	Dim servername As String
 	Dim olddxldocview As NotesView
 	Dim olddxlviewentrycollection As NotesViewEntryCollection
 	Dim olddxlviewentry As NotesViewEntry
 	Set curdb = s.Currentdatabase
 	Set configview = curdb.getview("configuration view")
 	Set configdoc = configview.Getfirstdocument()
 		servername$ = configdoc.serverlist(0)
 	Set olddxldocview = curdb.getview("Imported server configuration Documents")
 	Set olddxldoc = olddxldocview.Getfirstdocument()
 	If not olddxldoc Is Nothing Then
 		MsgBox "We found imported documents from previous run, & hence attempting to remove those"
 		Set olddxlviewentrycollection = olddxldocview.Allentries
 		Set olddxlviewentry = olddxlviewentrycollection.Getfirstentry()
 		Do Until olddxlviewentry Is Nothing
 			Dim delolddoc As NotesDocument
 			Set delolddoc = olddxlviewentry.Document
 			Call delolddoc.remove(True)
 			Set olddxlviewentry = olddxlviewentrycollection.getnextentry(olddxlviewentry)
 		Loop
 		MsgBox " We removed your previous imported documents, and now we attempt to start the fresh import job"
 		End If 
 		Set agent = curdb.getagent("Import Configuration Documents")
 		Call agent.Runonserver(servername$)	
	End Sub


Call Import Server Document



The agent “ Call Import Server Document “ also does 2 jobs.

1. Remove the old imported server documents, which were created when the agent was last ran.
2. Call the Import Server Document agent, which will establish a connection with the target server, and import all the dxl files, which are for the server documents.

Here's an example of the Call Import Server Document Script:



Sub  Initialize
 	Dim s As New notessession
 	Dim curdb As NotesDatabase
 	Dim agent As NotesAgent
 	Dim configview As NotesView
 	Dim configdoc, olddxldoc As NotesDocument
 	Dim servername As String
 	Dim olddxldocview As NotesView
 	Dim olddxlviewentrycollection As NotesViewEntryCollection
 	Dim olddxlviewentry As NotesViewEntry
 	Set curdb = s.Currentdatabase
 	Set configview = curdb.getview("configuration view")
 	Set configdoc = configview.Getfirstdocument()
 	servername$ = configdoc.serverlist(0)
 	'Remove Previous documents
 	Set olddxldocview = curdb.getview("Imported Server Documents View")
 	Set olddxldoc = olddxldocview.Getfirstdocument()
 	If Not (olddxldoc Is Nothing) Then
 		MsgBox "We found imported documents from previous run, & hence attempting to remove those"
 		Set olddxlviewentrycollection = olddxldocview.Allentries
 		Set olddxlviewentry = olddxlviewentrycollection.Getfirstentry()
 		Do Until olddxlviewentry Is Nothing
 			Dim delolddoc As NotesDocument
 			Set delolddoc = olddxlviewentry.Document
 			Call delolddoc.remove(True)
 			Set olddxlviewentry = olddxlviewentrycollection.getnextentry(olddxlviewentry)
 		Loop
 		MsgBox " We removed your previous imported documents, and now we attempt to start the fresh import job"
 	End If
 	Set agent = curdb.getagent("Import Server Documents")
 	Call agent.Runonserver(servername$)
End  Sub




Import Configuration Document



The agent “Import Configuration Document” is used to Import all the dxl files, which are associated for server configuration document changes. It first checks whether the file is of dxl type. If not, it skips to the next file in the IBM Technical Folder. If it finds a dxl file, then it checks whether the dxl file is associated with the server configuration document changes, then it attempts to import the file to the database, else it skips to the next file. On successful completion of the document import, it goes to the next file in the IBM Technical folder, and does similar checks. Finally, it parses the dxl file to find information like <updatedby> and <modified>.

Here's an example of the Import Configuration Document script:


Sub Initialize
 	On Error GoTo Errhandler
 	Dim s As New NotesSession
 	Dim db As NotesDatabase
 	Dim dbdir As NotesDbDirectory
 	Dim doc As NotesDocument
 	Dim stream As NotesStream
 	Dim importer As NotesDXLImporter
 	Dim  Path As String, FName As String, newfilename As string
 	Dim AtPos As Integer, dotPos As Integer, filenum As Integer
 	Dim filename, text As String
 	Dim view As NotesView
 	Set db = s.Currentdatabase
 	Path = S.GetEnvironmentString("Directory", True) & "\" & "IBM_TECHNICAL_SUPPORT" & "\"
 	FName = Dir(Path, 0)
	Filename = path &  FName
 	Do While FName<> ""
 		If InStr (1, FName, "config") <> 0 Then
 			AtPos = InStr(FNAme, "@")	
 		    DotPos = InStr(FNAme, ".")
 		Set stream = s.CreateStream
 		'open the dxl file to be imported
 		    If Not stream.Open(path & Fname) Then
 			    MsgBox "Cannot open " & Path & Fname, , "Error"
 			Exit Sub
 		End If
 		'if the file is empty then inform the same to the user and exit
 		If stream.Bytes = 0 Then
 			MsgBox "File did not exist or was empty", , Path
 			Exit Sub
 		End If
 		REM Import DXL into current database
 		Set importer = s.CreateDXLImporter
 		importer.ReplaceDBProperties = False
 		importer.ReplicaRequiredForReplaceOrUpdate = False
		importer.DocumentImportOption = DXLIMPORTOPTION_UPDATE_ELSE_CREATE
 		'importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
 		'importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
 		Call importer.Import(stream, db)
 		Call stream.Close
 		    Set view = db.getview("Importinprogress")
 		    Set doc = view.Getfirstdocument()
 		    filenum% = FreeFile()
        
        newfilename$ = path & Fname
        Open  newfilename For Input As filenum%
        Do  While Not EOF(filenum%)
 	        'read each line of the file
 	        Line Input #filenum%, text$
 			    If InStr (1, text$, "<updatedby>") <> 0 Then
			    
				   doc.whoupdated = text$
 				   End If
 				If InStr ( 1, text$, "<modified>") <> 0 Then
				
				   doc.fldmodificationdate = text$
 				   End If
 			    Loop
 			    doc.fldimportstatus = "completed"
 			    Call doc.save( True, False)
 		    Close filenum%
 		    End If
 		    FName = Dir()
 	Loop
 	Exit Sub
	errHandler:
 	Print "Error ***" & Error & " occured on line ***" & CStr(Erl) & "*** with error number ***" & CStr(Err)  & "*** while attempting to importDxl"
 	MsgBox "Error ***" & Error & " occured on line ***" & CStr(Erl) & "*** with error number ***" & CStr(Err)  & "*** while attempting to importDxl"	
	End Sub


Import Server Documents



The agent “Import Server Documents” is used to import all dxl files that are associated with the server document changes.
It first checks, whether the file is of dxl type. If not, it skips to the next file in the IBM Technical Folder. If it is a dxl file type, it checks, whether the dxl file is for server configuration document or server document . If the dxl file is associated for the server document changes, then it attempts to import the file to the database. On successful completion of the document import, it goes to the next file in the IBM Technical folder, and does similar checks . Finally, it parses the dxl file to read find information like <updatedBy> and <modified>.

Here's an example of the Import Server Documents script:



Sub Initialize
 	On Error GoTo Errhandler
 	Dim s As New NotesSession
 	Dim db As NotesDatabase
 	Dim dbdir As NotesDbDirectory
 	Dim doc As NotesDocument
 	Dim stream As NotesStream
 	Dim importer As NotesDXLImporter
 	Dim  Path As String, FName As String, filename As String, Text As String, newfilename As String
 	Dim AtPos As Integer, dotPos As Integer, filenum As Integer
 	Dim view As NotesView
 	Set db = s.Currentdatabase
 	Path = S.GetEnvironmentString("Directory", True) & "\" & "IBM_TECHNICAL_SUPPORT" & "\"
 	FName = Dir(Path, 0)
	Filename = path &  FName
 	Do While FName<> ""
 		If InStr (1, FName, "serverdoc") <> 0 Then
 			AtPos = InStr(FNAme, "@")	
 			DotPos = InStr(FNAme, ".")
 			Set stream = s.CreateStream
 			'open the dxl file to be imported
 			If Not stream.Open(path & Fname) Then
 				MsgBox "Cannot open " & Path & Fname, , "Error"
 				Exit Sub
 			End If 
 			'if the file is empty then inform the same to the user and exit
 			If stream.Bytes = 0 Then
 				MsgBox "File did not exist or was empty", , Path
 				Exit Sub
 			End If
 			REM Import DXL into current database
 			Set importer = s.CreateDXLImporter
 			importer.ReplaceDBProperties = False
 			importer.ReplicaRequiredForReplaceOrUpdate = False
			importer.DocumentImportOption = DXLIMPORTOPTION_UPDATE_ELSE_CREATE
 			Call importer.Import(stream, db)
 			Call stream.Close
 			Set view = db.getview("importserverdocumentsinprogress")
 			Set doc = view.Getfirstdocument()
 			filenum% = FreeFile()
			
			newfilename$ = path & Fname
 			Open newFilename For Input As filenum%
 			Do While Not EOF(filenum%)
 				'read each line of the file
 				Line Input #filenum%, text$
 				If InStr (1, text$, "<updatedby>") <> 0 Then
					doc.whoupdated = text$
 				End If
 				If InStr ( 1, text$, "<modified>") <> 0 Then
					doc.fldmodificationdate = text$
 				End If
				
 			Loop
 			doc.fldimportstatus = "completed"
 			Call doc.save( True, False)
 			Close filenum%
 		End If
 		FName = Dir()
 	Loop
 	Exit Sub
errHandler:
 	Print "Error ***" & Error & " occured on line ***" & CStr(Erl) & "*** with error number ***" & CStr(Err)  & "*** while attempting to importDxl"	
End  Sub




Compare Configuration Document




The agent “Compare Configuration Document” compares any 2 selected imported documents field by field, and creates a document in the view “Configuration Document Changes”.

The new result document will have the following information:
  • Server Name
  • Comparison Results
  • Document1changedby
  • Document1lastmodificationdate
  • Document2Changedby
  • Document2LastModificationdate
  • Document1UniversalID
  • Document2UniversalID


  • For example, if you try to compare 2 imported configuration documents, then you can see a new document created on the “Configuration Document Changes” view.
    The agent can also do the fieldname mapping with the appropriate field labels. However, that feature depends upon the file called “configurationdocumentsfieldlabelmappings.txt”, that should exist on the notes client data directory under IBM_TECHNICAL_SUPPORT. If you
    do not have that file, then in the result document, you would only see the field name alone.

    Here's an example of the Compare Configuration Document script:


    Function CompareItems As Boolean
     	Dim s As New NotesSession
     	Dim curdb As NotesDatabase
     	Dim view As NotesView, resultview As NotesView
     	Dim doc As NotesDocument, doc1 As notesdocument
     	Dim collection As NotesDocumentCollection
     	Dim rtitem As NotesRichTextItem
     	Dim rtitem1 As NotesItem, doc1item As NotesItem
     	Dim doc1array As String,  array As String
     	Dim filename As String, path As String, FName As String, Text As String, fieldlabel As String, getcorrectfieldlabel As string
     	Dim filenum As Integer
     	Set curdb = s.currentdatabase
     	Dim resultdoc As NotesDocument
     	Set resultdoc = curDB.Createdocument()
     	resultdoc.form = "frmresult"
     	Set rtitem = resultdoc.Createrichtextitem("fldrtitem")
     	Set rtitem1 = New NotesItem(resultdoc, "fieldswithdifferences", "")
    	
     	Set view = curdb.getview("Imported Server Configuration Documents")
     	Set collection = curdb.Unprocesseddocuments
     	Set doc =  collection.getfirstdocument()
     	Set doc1 = collection.getnextdocument(doc)
     	array$ = doc.whoupdated(0)
     	resultdoc.document1changedby = StrRightBack(array, "<name>", 5, 1)
    	

     	doc1array$ = doc1.WHOUPDATED(0)
    	
     	resultdoc.document2changedby = StrRightBack(doc1array, "<name>", 5, 1)
    	
     	resultdoc.document1 = doc.fldmodificationdate(0)
     	resultdoc.document2 = doc1.fldmodificationdate (0)
    	resultdoc.universaliddoc1 = doc.Universalid
    	resultdoc.universaliddoc2 = doc1.universalid
     	resultdoc.Servername     =  doc.servername(0)
    	
     	ForAll x In doc.items
    		
     		If  x.name = "fldmodificationdate" Then
     			GoTo Nextitem
     		End If
     		If x.name = "WHOUPDATED" Then
     			GoTo NextItem
     		End If
     		If x.name = "fldimportstatus" Then
     			GoTo NextItem
     		End If
     		If x.name = "$Revisions" Then
     			GoTo NextItem
     		End If
     		If doc1.hasitem(x.name) Then
     			Set doc1item = doc1.Getfirstitem(x.name)
     			If x.text <> doc1item.text Then
    				
     				'Get the related field label for the field name we deal
     				filenum% = FreeFile()
     				Path = s.GetEnvironmentString("Directory", True) & "\" & "IBM_TECHNICAL_SUPPORT" & "\"
     				FName = Dir(Path, 0)
     				filename = Path &  "configurationdocumentsfieldlabelmappings.txt" 
    				
     				If Dir$(filename, 0) = "" Then
    					MsgBox "Field label mapping file doesn't exist on  " & path & " , hence we show only fieldnames in the output"
     					Call rtitem.appendtext("You have changed the field " & "'"  & "'" & "(" & x.name & ") " & "  " &  "from  " & " { " & x.text  & " } "& " " & "  to  " & " { " & doc1item.text & " } " )
     					resultdoc.caution("Caution *** : Please be advised, that we are not finding the file " &  "configurationdocumentsfieldlabelmappings.txt"  & "on your client IBM Techinical Folder. Hence, you see the results with the field names alone. Please refer the application documentation, and get the file on the right location")
     				else
     					Open Filename For Input As filenum%
     					Do While Not EOF(filenum%)
     						Line Input #filenum%, text$
     						If InStr (1, text$, x.name) <> 0 Then
     							'MsgBox TEXT$
     							getcorrectfieldlabel$ = ":" & x.name
     							'MsgBox getcorrectfieldlabel$
     							FieldLabel$ = StrLeftBack(text$, getcorrectfieldlabel$, 5, 1)
     						MsgBox FieldLabel$
    '						Call rtitem.appendtext("You have changed the field " & "'" & FieldLabel$ & "'" & "( & x.name ") " & "  " &  "from  " & " { " & x.text  & " } "& " " & "  to  " & " { " & doc1item.text & " } " )
                            Call  rtitem.appendtext("You have changed the field " & "'" & FieldLabel$ & "'" & "(" & x.name & ") " & "  " &  "from  " & " { " & x.text  & " } "& " " & "  to  " & " { " & doc1item.text & " } " )
     						Call rtitem.addnewline(1, True)	
     						Call rtitem1.appendtotextlist(x.name)			
     						GoTo nextitem	
     					End If
     				Loop
     				End if
     				'Set resultview = curdb.getview("ResultsUpdation")
     				'Call rtitem.appendtext("The field" & " " & FieldLabel$ & " "   & " " & "in doc1 has a value" & " " & x.text )
     				'Call rtitem.addnewline(1, True)
     				'Call rtitem.appendtext ("The field" & " " & FieldLabel$ & " "  & " " & "in doc2 has a value" & " " & doc1item.text)
    							
     			End If
     		End If
    		
    NextItem:
     	End ForAll
     	Call resultdoc.save ( True, False)
    End  Function 






    Compare Server Documents



    The agent “Compare Configuration Document” , will compare any 2 selected imported documents fields by field, and create a document in the view “Configuration Document Changes”.
    The new result document will have the following information:
  • Server Name
  • Comparison Results
  • Document1changedby
  • Document1lastmodificationdate
  • Document2Changedby
  • Document2LastModificationdate
  • Document1UniversalID
  • Document2UniversalID


  • The agent can do the field name mapping with the appropriate field labels. However, that feature depends upon the file called “fieldlabelmapping.txt” which should exist in the notes client data directory under IBM_TECHNICAL_SUPPORT. If you do not have that file, then in the result document, you will only see the field name alone.

    Below is an example of the Compare Server Documents script:




    Function CompareItems As Boolean
     	Dim s As New NotesSession
     	Dim curdb As NotesDatabase
     	Dim view As NotesView, resultview As NotesView
     	Dim doc As NotesDocument, doc1 As NotesDocument
     	Dim collection As NotesDocumentCollection
     	Dim rtitem As NotesRichTextItem
     	Dim rtitem1 As NotesItem, doc1item As NotesItem
     	Dim doc1array As string,  array As String
     	Dim filename As String, path As String, FName As String, Text As String, fieldlabel As String, getcorrectfieldlabel As String
     	Dim filenum As Integer
     	Set curdb = s.currentdatabase
     	Dim resultdoc As NotesDocument
     	Set resultdoc = curDB.Createdocument()
     	resultdoc.form = "frmresult"
     	Set rtitem = resultdoc.Createrichtextitem("fldrtitem")
     	Set rtitem1 = New NotesItem(resultdoc, "fieldswithdifferences", "")
    	
     	'Set view = curdb.getview("Imported Server Documents View")
     	'Set view = curdb.Getview("Imported server documents view")
     	Set collection = curdb.Unprocesseddocuments
     	Set doc =  collection.getfirstdocument()
     	Set doc1 = collection.getnextdocument(doc)
     	array$ = doc.whoupdated(0)
     	resultdoc.document1changedby = StrRightBack(array, "<name>", 5, 1)
    	

     	doc1array$ = doc1.WHOUPDATED(0)
    	
     	resultdoc.document2changedby = StrRightBack(doc1array, "<name>", 5, 1)
    	
     	resultdoc.document1 = doc.fldmodificationdate(0)
     	resultdoc.document2 = doc1.fldmodificationdate (0)
    	resultdoc.universaliddoc1 = doc.Universalid
    	resultdoc.universaliddoc2 = doc1.universalid
     	resultdoc.Servername     =  doc.servername(0)
    	
     	ForAll x In doc.items
     		If  x.name = "fldmodificationdate" Then
     		 GoTo Nextitem
     		End If
     		If x.name = "WHOUPDATED" Then
     			GoTo NextItem
     		End If
     		If x.name = "fldimportstatus" Then
     		GoTo NextItem
     		End If
     		If x.name = "$Revisions" Then
     			GoTo NextItem
     		End If
     		If doc1.hasitem(x.name) Then
     			Set doc1item = doc1.Getfirstitem(x.name)
     			If x.text <> doc1item.text Then
    				
     				'Get the related field label for the field name we deal
     				filenum% = FreeFile()
     				Path = s.GetEnvironmentString("Directory", True) & "\" & "IBM_TECHNICAL_SUPPORT" & "\"
     				FName = Dir(Path, 0)
     				filename = Path &  "fieldlabelmapping.txt"
     				If Dir$(filename, 0) = "" Then
    					MsgBox "Field label mapping file doesn't exist on  " & path & " , hence we show only fieldnames in the output"
     					Call rtitem.appendtext("You have changed the field " & "'"  & "'" & "(" & x.name & ") " & "  " &  "from  " & " { " & x.text  & " } "& " " & "  to  " & " { " & doc1item.text & " } " )
     					resultdoc.caution("Caution *** : Please be advised, that we are not finding the file " &  "fieldlabelmapping.txt"  & "on your client IBM Techinical Folder. Hence, you see the results with the field names alone. Please refer the application documentation, and get the file on the right location")
     				Else
    					
     				Open Filename For Input As filenum%
     				Do While Not EOF(filenum%)
     					Line Input #filenum%, text$
     					If InStr (1, text$, x.name) <> 0 Then
    						
     						getcorrectfieldlabel$ = ":" & x.name
    						
     						FieldLabel$ = StrLeftBack(text$, getcorrectfieldlabel$, 5, 1)
     						MsgBox fieldlabel$
    						
     						Call rtitem.appendtext("You have changed the field " & "'" & FieldLabel$ & "'" & "(" & x.name & ") " & "  " &  "from  " & " { " & x.text  & " } "& " " & "  to  " & " { " & doc1item.text & " } " )
     						Call rtitem.addnewline(1, True)	
     						Call rtitem1.appendtotextlist(x.name)			
     						GoTo nextitem	
     					End If
     				Loop
     				End if						
     			End If
     		End If
    		
    NextItem:
     	End ForAll
     	Call resultdoc.save ( True, False)
    End Function 




    Undo Changes



    The agent “Undo Changes” can restore the changes of any date by overwriting the current settings on the address book. The agent is available as a button on the comparison result document. The agent reads the field called “fieldwithdifferences” to understand which fields have changed . It reads those field's value alone, and restore those changes on the current address book.

    Below is an example of the Undo Changes script:




    Sub Click(Source As Button)
    	On Error Goto errorhandler
    	Dim S As New NotesSession
    	Dim curdb As notesdatabase
    	Dim uidoc As NotesUIDocument
    	Dim doc As NotesDocument
    	Dim view As notesview
    	Dim workspace As New NotesUIWorkspace
    	Dim nab As notesdatabase
    	Dim server As String
    	Set curdb = s.CurrentDatabase
    	server = curdb.Server
    	Set uidoc =  workspace.CurrentDocument
    	'find the fields which got modified 
    	Dim doc1 As notesdocument
    	Set doc1 = uidoc.Document
    	Dim item As notesitem
    	Set item = doc1.getfirstitem("fieldswithdifferences")
    	'For each field change, identify the original value 
    	Forall x In item.values
    		Dim uniddoc1 As String
    		uniddoc1$ = doc1.universaliddoc1(0)
    		'Now open the public address to copy the changes
    		Set nab = s.GetDatabase(server, "names.nsf")
    		
    		'decide whether the change has to be on server document or config document
    		If doc1.flddocumenttype(0) = "Server" Then
    			Dim publicnabdoc As NotesDocument
    			Dim publicnabview As NotesView
    			Set publicnabview = nab.GetView("Server\Servers")
    			Set publicnabdoc = publicnabview.Getfirstdocument()
    			
    			
    			If publicnabdoc.ServerName(0) = doc1.servername(0)  Then
    				Goto Modifyfields
    			Else
    NextDoc:				
    				Set publicnabdoc = publicnabview.GetNextDocument(publicnabdoc)
    				If publicnabdoc.ServerName(0) = servername Then
    					Goto Modifyfields
    				Else
    					Goto Nextdoc
    				End If
    				Goto Modifyfields
    			End If
    'Modify the fields value
    Modifyfields:			
    			'publicnabdoc.x = x.text
    			Dim fieldname As String
    			fieldname$ = x
    			Msgbox fieldname
    			Set doc = curdb.GetDocumentByUNID(uniddoc1)
    			Dim fieldvalue As Variant
    			fieldvalue = doc.getitemvalue(fieldname)
    			Msgbox fieldvalue
    			Call publicnabdoc.ReplaceItemValue(fieldname, fieldvalue)
    			
    			Call publicnabdoc.save(True, False)
    			Goto nextfield
    		Else
    			Set publicnabview = nab.GetView("Server\Configurations")
    			Set publicnabdoc = publicnabview.Getfirstdocument()
    			If publicnabdoc.ServerName(0) = servername Then
    				Goto Modifyconfigfields
    			Else
    				Set publicnabdoc = publicnabview.GetNextDocument(publicnabdoc)
    				If publicnabdoc.ServerName(0) = servername Then
    					Goto Modifyfields
    				Else
    					Goto Nextdoc
    				End If
    				Goto Modifyconfigfields
    			End If
    'Modify the fields value			
    Modifyconfigfields:			
    			Dim configfieldname As String
    			configfieldname$ = x
    			Msgbox configfieldname
    			Dim configdoc As notesdocument
    			Set configdoc = curdb.GetDocumentByUNID(uniddoc1)
    			Dim configfieldvalue As Variant
    			configfieldvalue = configdoc.GetItemValue(configfieldname)
    			
    			Call publicnabdoc.ReplaceItemValue(configfieldname, configfieldvalue)
    			Call publicnabdoc.save(True, False)
    			Goto nextfield
    			
    		End If
    NextField:		
    	End Forall
    	Exit Sub
    ErrorHandler:
    	Resume Next
    End Sub




    Running the Directory Change Analyzer tool



    Pre-requisites:



    1) Create a new database with the help of the template DirectoryChangeAnalyzer.ntf
    2) After creation of a new database, open the database and also pubnames.ntf database in the designer client. Copy all the forms and subforms from the pubnames.ntf to this application. This helps you to open the old server configuration documents from this application.
    3) Sign all the agents in this application, with your ID.
    4) If you have full administrator access , then you can work with the application directly. If not, you need to add your user ID in the server document in the field “Sign or run unrestricted methods and operations” . Save and close followed by a restart of the domino server.


    Step 1



    Deploy this database on the admin server, where you make changes on the server document. Open the database, and go to the view “Configuration View” (see figure 1).
    Locate the button called “Create Configuration Document”. As the name indicates, you use the button to create a configuration document with the information about your admin server. You should have only one configuration document, pointing to one directory server name.

    Figure 1


    Step 2




    Navigate to the view “Configuration Documents \ Imported Server ConfigurationDocuments” (See Figure 2).
    Locate the following two buttons, “Import Server Documents” and “Compare Server Documents”. As the name indicates, use the button “Import All Configuration Documents”, which starts the process to import the server documents on this database from the IBM Technical Folder.

    Figure 2


    Note:
    The Import All ConfigurationDocuments button is designed to delete any previously imported documents that the tool had imported on the previous run. If it finds any previous imported documents, it will automatically delete those documents, and inform you by showing a pop-up (see Figure 3). It also shows another pop-up, when it has cleared those documents, and proceeding to import the documents again (see Figure 4).

    Figure 3



    Figure 4



    On the successful completion of all process, the tool willhave imported all the configuration documents, that were available as dxl files in the IBM Technical Folder, (see figure 5).


    Figure 5


    In the view “Imported Server ConfigurationDocuments”, locate the button called “Compare Configuration Documents”. As the name implies, this button will compare any 2 imported configuration documents and identify the changes (differences), and create a document called Configuration Document Changes with the results. The result document has fields with information of comparison results, field names, which have the differences in the values, modification date, and who modified the documents. The sample output is shown below, (see figure 6).


    Figure 6



    Step 3



    Navigate to the view “ServerDocuments \ Imported Server Documents” . Locate the two buttons “Import Server Documents” and “Compare Server Documents”. As the name indicates, use the button “Import Server Documents”, which starts the process to import the server documents on this database from the IBM Technical Folder, (see Figure 7).

    Figure 7



    Note: The button “Import Server Document” deletes any imported documents from the previous run. If it finds any previously imported documents, it will automatically delete those documents, and inform you by showing a pop-up (see Figure 8). It also shows another pop-up when it had cleared those documents, and proceeding to import the documents again, (see Figure 9).

    Figure 8



    Figure 9






    On the successful completion of all process, the too will have imported all the server documents that were available as dxl files in the IBM Technical Folder, (see figure 10).

    Figure 10

    In the view “Imported Server Documents”, locate the button called “Compare Configuration Documents”. As the name implies, this button compares any 2 imported server document and identifies the changes (differences , and create a document called Server Document Changes with the results. The result documents has fields with information of comparison results, field labels & field names that have the differences in the values, modification date and who had modified the documents. The sample output is shown below, (see figure 11).

    Please be advised, if the fieldlabelmapping.txt is not present on IBM Technical folder, then only the field names are shown, (see figure 12).





    Figure 11



    Figure 12





    Conclusion


    This article provides the code for this tool and explains its architecture, so that you can deploy and configure the tool in your production environment and enjoy the full benefit of its automation. To download this tool, visit OpenNTF.org and search for Directory Change Analyzer.


    FAQ'S



    1. What access is required to run the agents on server?

    It is recommended to sign the agent and run it with an ID with Full Administration Access. If you are unable to obtain full administration access, enter the signer ID on the field “Sign or run unrestricted methods and operations” , and run the agent from the Signer ID.

    2. Where do I need to keep this database? Can I run it on locally or need to keep this database on server?

    The database should be deployed on a domino server, and not to be run from local.

    3. Does this DB work with a particular release or any release of Domino?

    The tool is designed to run on any version higher than IBM Domino Server 6.5 and 6.0.3. The tool depends on the “Configuration Collector” feature, and if that feature is available, the tool is expected to work correctly.

    4. What happens, if one deletes dxl files that got generated on the IBM_TECHNICAL_FOLDER ?

    As mentioned earlier, the tool depends on the “Configuration Collector” feature. That feature, would create dxl files on the IBM_TECHNICAL_FOLDER whenever the server and configuration document is updated. If the tool couldn't find any dxl files, then it will not import any documents.

    5. Can we open the old imported server / configuration documents on this application?

    By default, the application doesn't contain the forms or sub-forms that a server and configuration document inherits. However, you can do a design replace with the pubnames.ntf, so that they can get the forms added on the application. Similarly, you can copy and paste the forms and subforms on the pubnames.ntf to this application to open the old imported server / configuration documents on this application.

    Ensure that you select the following option, File ->Application ->Advanced tab : Enable the option for Allow more fields in database. This will ensure you do not encounter a problem while copying the forms/sub-forms from pubnames.ntf to this application.





    About the Inventors



    J Rajendran is an Advisory Software Engineer at IBM and based on Singapre. He is a member of the APAC Software Advisory Team ( APAC SWAT ) for Lotus Domino. He works on the customer escalations for the Lotus Domino issues and crit-sits. He has worked with IBM and Lotus products for more than 13 years. You can reach him at J.Rajendran@sg.ibm.com

    Ranjit S Rai is a Software Advisory Team Engineer at IBM's India Software Labs. He is a member of the APAC Software Advisory Team (APAC SWAT) for Lotus Domino. He works on the customer escalations for the Lotus Domino issues and crit-sits . He has worked with IBM and Lotus products for more than 10 years. You can reach him at ranjit.rai@in.ibm.com.

    Shankar Venkatachalam is a Software Engineer at IBM's India Software Labs. He works on crash, core, and performance issues for Notes/Domino servers and more recently has been working with the IBM SmartCloud Notes L3/Development team. You can reach him at svenkat7@in.ibm.com.

    • Actions Show Menu▼


    expanded Attachments (0)
    collapsed Attachments (0)
    Edit the article to add or modify attachments.
    expanded Versions (1)
    collapsed Versions (1)
    Version Comparison     
    VersionDateChanged by              Summary of changes
    This version (4)Jul 24, 2013, 8:10:40 PM~Lisa Brejipymanjip  
    expanded Comments (0)
    collapsed Comments (0)
    Copy and paste this wiki markup to link to this article from another article in this wiki.
    Go ElsewhereStay ConnectedAbout
    • HCL Software
    • HCL Digital Solutions community
    • HCL Software support
    • BlogsDigital Solutions blog
    • Community LinkHCL Software forums and blogs
    • About HCL Software
    • Privacy
    • Accessibility