Page 1 sur 1
Talon de réplication

Publié:
14 Avr 2014 à 13:35
par Bizous78
Bonjour,
Est-il possible (en lotuscript) de créer juste un talon de réplication d'une application?
Mon problème est qu'en utilisant db.CreateReplica, la réplication ne se fait pas en arrière plan.
Je cherche un moyen pour activer la réplication en second-plan....
J'ai essayé la solution suivante:
Set rep = db.ReplicationInfo
rep.disabled=false
Call rep.save()
'Create a new replica
Set replica = db.CreateReplica( "", "mail02\tsesame.nsf" )
mais un message d'erreur m'indiquer que cette base ne peut pas être répliqué (logique).
@+
Re: Talon de réplication

Publié:
14 Avr 2014 à 13:58
par Michael DELIQUE
salut
c'est faisable en API, mais j'ai pas le code. sinon j'utilise cett function qui passe par l'adminP
- Code : Tout sélectionner
Public Function Admin_ReplicaCreate(wlstParam List As String) As String
Dim AdminP As NotesAdministrationProcess
Dim nmServer As NotesName
Dim nbCopyACL As Boolean
Dim nbCreateFTIndex As Boolean
On Error GoTo CatchError
Admin_ReplicaCreate = ""
If IsEmpty(wlstParam) = True Then
Error 9999,"wlstParam is Empty"
Exit Function
End If
If session Is Nothing Or DB Is Nothing Then
Set session = New NotesSession
Set DB = Session.CurrentDatabase
End If
If IsElement(wlstParam("ADMINISTRATIONPROCESSSERVER")) = False Then
Error 9999,"ADMINISTRATIONPROCESSSERVER value is not defined"
Exit Function
End If
If Trim(wlstParam("ADMINISTRATIONPROCESSSERVER")) = "" Then
Error 9999,"ADMINISTRATIONPROCESSSERVER value is Empty"
Exit Function
End If
Set nmServer = New NotesName(Trim(wlstParam("ADMINISTRATIONPROCESSSERVER")))
wlstParam("ADMINISTRATIONPROCESSSERVER") = nmServer.Canonical
Set nmServer = Nothing
If IsElement(wlstParam("SOURCESERVER")) = False Then
wlstParam("SOURCESERVER") = ""
End If
If Trim(wlstParam("SOURCESERVER")) = "" Then
wlstParam("SOURCESERVER") = DB.Server
End If
Set nmServer = New NotesName(Trim(wlstParam("SOURCESERVER")))
wlstParam("SOURCESERVER") = nmServer.Canonical
Set nmServer = Nothing
If IsElement(wlstParam("SOURCEDBFILE")) = False Then
Error 9999,"SOURCEDBFILE value is not defined"
Exit Function
End If
If Trim(wlstParam("SOURCEDBFILE")) = "" Then
Error 9999,"SOURCEDBFILE value is Empty"
Exit Function
End If
If IsElement(wlstParam("DESTSERVER")) = False Then
wlstParam("DESTSERVER") = ""
End If
If Trim(wlstParam("DESTSERVER")) = "" Then
wlstParam("DESTSERVER") = DB.Server
End If
Set nmServer = New NotesName(Trim(wlstParam("DESTSERVER")))
wlstParam("DESTSERVER") = nmServer.Canonical
Set nmServer = Nothing
If IsElement(wlstParam("DESTDBFILE")) = False Then
wlstParam("DESTDBFILE") = ""
End If
If Trim(wlstParam("DESTDBFILE")) = "" Then
wlstParam("DESTDBFILE") = Trim(wlstParam("SOURCEDBFILE"))
End If
If UCase(Trim(wlstParam("SOURCESERVER"))) = UCase(Trim(wlstParam("DESTSERVER"))) Then
If UCase(Trim(wlstParam("SOURCEDBFILE"))) = UCase(Trim(wlstParam("DESTDBFILE"))) Then
Error 9999,"You try to replicate database on itself, source and destination are identical"
Exit Function
End If
End If
nbCopyACL = True
If IsElement(wlstParam("COPYACL")) = True Then
Select Case UCase(Trim(wlstParam("COPYACL")))
Case "YES","Y","TRUE","T","1",CStr(True),"","DEFAULT","D"
nbCopyACL = True
Case "NO","N","FALSE","F","0",CStr(False)
nbCopyACL = False
Case Else
Error 9999,"COPYACL wrong value : "+wlstParam("COPYACL")
Exit Function
End Select
End If
nbCreateFTIndex = False
If IsElement(wlstParam("CREATEFTINDEX")) = True Then
Select Case UCase(Trim(wlstParam("CREATEFTINDEX")))
Case "YES","Y","TRUE","T","1",CStr(True)
nbCreateFTIndex = True
Case "NO","N","FALSE","F","0",CStr(False),"","DEFAULT","D"
nbCreateFTIndex = False
Case Else
Error 9999,"CREATEFTINDEX wrong value : "+wlstParam("CREATEFTINDEX")
Exit Function
End Select
End If
Set nmServer = New NotesName(Trim(wlstParam("ADMINISTRATIONPROCESSSERVER")))
Set AdminP = Session.Createadministrationprocess(nmServer.Canonical)
If AdminP Is Nothing Then
Error 9999,"AdminP is Nothing, Administration Process Server : "+nmServer.Abbreviated
Exit Function
End If
Set nmServer = Nothing
Admin_ReplicaCreate = AdminP.Createreplica(wlstParam("SOURCESERVER"), Trim(wlstParam("SOURCEDBFILE")), wlstParam("DESTSERVER"), Trim(wlstParam("DESTDBFILE")), nbCopyACL, nbCreateFTIndex)
Set AdminP = Nothing
%REM
Liste des paramètres
lstParam("ADMINISTRATIONPROCESSSERVER") = ""
lstParam("SOURCESERVER") = ""
lstParam("SOURCEDBFILE") = ""
lstParam("DESTSERVER") = ""
lstParam("DESTDBFILE") = ""
lstParam("COPYACL") = ""
lstParam("CREATEFTINDEX") = ""
%END REM
Exit Function
CatchError:
MsgBox "("+Structure_Log+" : "+Cstr(GetThreadInfo (1))+" Call by "+Cstr(GetThreadInfo(10))+")"+Chr(10)+"Error " + CStr(Err) + " : "+Chr(10) + CStr(Error)+". "+Chr(10)+"Line # "+Cstr(Erl),16," ERROR !"
Admin_ReplicaCreate = "ERROR : " + CStr(Error)+" ("+ CStr(Err) + ")"
Exit Function
End Function
Re: Talon de réplication

Publié:
14 Avr 2014 à 14:21
par Bizous78
J'ai oublié un "détail" important..... l'application est une boîte mail à répliquer en local sur le poste de l'utilisateur

Re: Talon de réplication

Publié:
14 Avr 2014 à 14:46
par Michael DELIQUE
Bon, mais c'est bien parceque c'est toi... hein
essais ça
- Code : Tout sélectionner
Public Function DBCreateStubReplica(wDBSource As NotesDatabase, wServerTarget As String) As Boolean
Dim DBReplica As NotesDatabase
Dim ReplicationSource As NotesReplication
Dim ReplicationTarget As NotesReplication
On Error GoTo CatchError
DBCreateStubReplica = False
If Session Is Nothing Then
Set Session = New NotesSession
End If
If wDBSource Is Nothing Then
Error 9999,"WDBSource is Noting"
Exit Function
End If
rem Disable replication, only create a database stub
Set ReplicationSource = wDBSource.ReplicationInfo
If ReplicationSource Is Nothing Then
Error 9999,"ReplicationSource is Nothing"
Exit Function
End If
ReplicationSource.disabled = True
Call ReplicationSource.save()
rem Create a new replica
Set DBReplica = wDBSource.CreateReplica(Trim(wServerTarget), wDBSource.Filepath ) ' Get handle to the new replica's replicationinfo
If DBReplica Is Nothing Then
Error 9999,"Database 'DBReplica' is Nothing"
Exit Function
End If
Set ReplicationTarget = DBReplica.replicationinfo
If ReplicationTarget Is Nothing Then
Error 9999,"ReplicationTarget is Nothing"
Exit Function
End If
rem turn the replication flags back on
ReplicationSource.disabled = False
Call ReplicationSource.save()
Set ReplicationSource = Nothing
ReplicationTarget.disabled = False
Call ReplicationTarget.save()
Set ReplicationTarget = Nothing
DBCreateStubReplica = PingReplique(wServerTarget,wDBSource.Replicaid)
Set DBReplica = Nothing
Exit Function
CatchError:
MsgBox "("+Structure_Log+" : "+Cstr(GetThreadInfo (1))+" Call by "+Cstr(GetThreadInfo(10))+")"+Chr(10)+"Error " + CStr(Err) + " : "+Chr(10) + CStr(Error)+". "+Chr(10)+"Line # "+Cstr(Erl),16," ERROR !"
DBCreateStubReplica = False
Exit Function
End Function
- Code : Tout sélectionner
Public Function PingReplique(wServer As String, wRepliqueID As String) As Boolean
REM détermine is une base est déjà répliqué
Dim DBTarget As NotesDatabase
On Error GoTo CatchError
PingReplique = False
If Trim(wRepliqueID) = "" Then
Exit Function
End If
Set DBTarget = New NotesDatabase( "", "" )
PingReplique = DBTarget.OpenByReplicaID( Trim(wServer), Trim(wRepliqueID))
Set DBTarget = Nothing
Exit Function
CatchError:
MsgBox "("+Structure_Log+" : "+Cstr(GetThreadInfo (1))+" Call by "+Cstr(GetThreadInfo(10))+")"+Chr(10)+"Error " + CStr(Err) + " : "+Chr(10) + CStr(Error)+". "+Chr(10)+"Line # "+Cstr(Erl),16," ERROR !"
PingReplique = False
Exit Function
End Function
Re: Talon de réplication

Publié:
14 Avr 2014 à 15:03
par Bizous78
J'ai essayé cette solution avant de venir demander de l'aide

Mais j'ai le message d'erreur suivant: "Réplication de cette base non autorisée"
Je me demande si l'astuce de désactiver la réplication pour ne pas répliquer les documents fonctionne encore en version 8.5.3....
Re: Talon de réplication

Publié:
14 Avr 2014 à 15:05
par Michael DELIQUE
oui... je l'ai utilisé en 8.5.3.
sinon tu as la socution de créeerune base vide et de lui changer son id de replique
Re: Talon de réplication

Publié:
14 Avr 2014 à 15:11
par Bizous78
Si je change un id de réplique, est-ce que la bal sera affiché dans le réplication? j'ai un doute
Re: Talon de réplication

Publié:
14 Avr 2014 à 15:12
par Michael DELIQUE
yaka essayer

Re: Talon de réplication

Publié:
14 Avr 2014 à 16:15
par Bizous78
Je viens de faire le test.
Après avoir créer la base et modifier l'id de réplication, il faut ajouter la base au workspace et redémarrer le client pour mettre à jour le réplicateur et l'afficher.
Re: Talon de réplication

Publié:
14 Avr 2014 à 16:20
par Michael DELIQUE
cool, ça marche