com.esri.arcgis.geodatabasedistributed
Class ReplicationAgent

java.lang.Object
  extended by com.esri.arcgis.geodatabasedistributed.ReplicationAgent
All Implemented Interfaces:
IReplicationAgent, IReplicationAgentCancelControl, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class ReplicationAgent
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IReplicationAgent, IReplicationAgentCancelControl

A class used to perform replica operations.

Remarks

The ReplicatonAgent coClass is a software component that can be used to implement replication commands and agents (services). The fundamental unit of replication is a replica pair consisting of a parent replica and a child replica. A ReplicationAgent works with a pair of GeoDataServers. It can be used to create and synchronize replicas within the two GeoDataServers. The ReplicaAgrent also allows you to perform data extration.

If both GeoDataServers are can't be accessed on the same network they are considered disconnected. In this environment, you can perform replication operations by exporting, transporting and importing files. The GeoDataServer class has methods to support these operations.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Constructor Summary
ReplicationAgent()
          Constructs a ReplicationAgent using ArcGIS Engine.
ReplicationAgent(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ReplicationAgent theReplicationAgent = (ReplicationAgent) obj;
 
Method Summary
 void addIFeatureProgressListener(IFeatureProgress theListener)
          addIFeatureProgressListener.
 void createReplica(String versionName, IGeoDataServer srcGDS, IGeoDataServer destGDS, String replicaName, IGPReplicaDescription desc, IGPReplicaOptions repOptions)
          Creates a replica pair in the workspaces bound to the input geodataservers.
 boolean equals(Object o)
          Compare this object with another
 void extractData(String versionName, IGeoDataServer srcGDS, IGeoDataServer destGDS, IGPReplicaDescription desc)
          Extracts data from the source geodata server into the destination geodata server.
static String getClsid()
          getClsid.
 int hashCode()
          the hashcode for this object
 void removeIFeatureProgressListener(IFeatureProgress theListener)
          removeIFeatureProgressListener.
 void setCancelTrackerByRef(ITrackCancel rhs1)
          The cancel tracker to inspect for user cancellations.
 boolean synchronizeReplica(IGeoDataServer gds1, IGeoDataServer gds2, IGPReplica rep1, IGPReplica rep2, int pol, int dir, boolean columnLevel)
          Synchronizes a replica pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

ReplicationAgent

public ReplicationAgent()
                 throws IOException,
                        UnknownHostException
Constructs a ReplicationAgent using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

ReplicationAgent

public ReplicationAgent(Object obj)
                 throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ReplicationAgent theReplicationAgent = (ReplicationAgent) obj;

Construct a ReplicationAgent using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to ReplicationAgent.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

addIFeatureProgressListener

public void addIFeatureProgressListener(IFeatureProgress theListener)
                                 throws IOException
addIFeatureProgressListener. Listen to events generated by this class.

Parameters:
theListener - An object that implements the com.esri.arcgis.geodatabase.IFeatureProgress interface.
Throws:
IOException - If there are communications problems.

removeIFeatureProgressListener

public void removeIFeatureProgressListener(IFeatureProgress theListener)
                                    throws IOException
removeIFeatureProgressListener. Stop listening to events generated by this class.

Parameters:
theListener - An object that implements the com.esri.arcgis.geodatabase.IFeatureProgress interface.
Throws:
IOException - If there are communications problems.

createReplica

public void createReplica(String versionName,
                          IGeoDataServer srcGDS,
                          IGeoDataServer destGDS,
                          String replicaName,
                          IGPReplicaDescription desc,
                          IGPReplicaOptions repOptions)
                   throws IOException,
                          AutomationException
Creates a replica pair in the workspaces bound to the input geodataservers.

Remarks

The IReplicationAgent::CreateReplica method is used to create replicas in a connected environment. This method may be used to create check-out replicas, two way replicas, or one way replicas. To create replicas in a disconnected environement please see the IGeodataserver::CreateReplica method for more information

This method requires two input geodataserver objects,a srcGDS and a destGDS. The replicas will be created in the geodatabases represented by the input geodataserver objects. The srcGDS will host the parent replica, and the destGDS will host the child replica in the replica pair. See the GeoDataServer coclass for more information. The ReplicaName is a string that uniquely identifies the replica.

The versionName is the version on the geodatabase represented by the srcGDS from which the replica will be created.

The desc parameter defines the data which will be replicated. See the GPReplicaDescription coclass for more information.

The replicaOptions parameter defines replica options such as the replica access type. See the GPReplicaOptions coclass for more information.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
createReplica in interface IReplicationAgent
Parameters:
versionName - The versionName (in)
srcGDS - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
destGDS - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
replicaName - The replicaName (in)
desc - A reference to a com.esri.arcgis.geodatabase.IGPReplicaDescription (in)
repOptions - A reference to a com.esri.arcgis.geodatabase.IGPReplicaOptions (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

synchronizeReplica

public boolean synchronizeReplica(IGeoDataServer gds1,
                                  IGeoDataServer gds2,
                                  IGPReplica rep1,
                                  IGPReplica rep2,
                                  int pol,
                                  int dir,
                                  boolean columnLevel)
                           throws IOException,
                                  AutomationException
Synchronizes a replica pair.

Remarks

The SynchronizeReplica method provides a way to synchronize changes between a replica pair in a connected environment. This method may be used with check-out replicas, two way replicas, or one way replicas. If you are using replication in a disconnected environment, where the replicas are not on the same network, you must use the IGeoDataServer interface to synchronize changes. Please see the GeoDataServer coclass for more information.

The SynchronizeReplica method requires two input geodataserver objects, gds1 and gds2. One geodataserver must reference the geodatabase with the parent replica and the other the geodatabase with the child replica. The order is not important. For example, if gds1 references the child, gds2 would reference the parent or vice versa.

The rep1 and rep2 parameters take GPReplica objects for the parent and child replicas. See the GPReplica coclass for more information. These parameters must be consistent with the ordering of the geodataserver objects passed in for gds1 and gds2. For example, if gds1 refers to the geodatabase with the parent replica then rep1 must reference the parent replica. The gds2 and rep2 parameters in the same way must then refer to the child replica.

During synchronization, changes are first applied to a synchronization version. For 2 way and 1 way replicas, this version is always reconciled and posted with the replica version. For check-out replicas, you can choose whether or not to reconcile and post. The pol parameter takes an esriReplicationAgentReconilePolicy enumeration value to determine how conflicts will be handled during reconcile. See the esriReplicationAgentReconcilePolicy enumeration for more information. The following describes the meaning of each enumeration:

esriRADetectConflicts -If conflicts occur, the reconcile process is aborted and you must reconcile and post manually after sycnhronization is completed.

esriRAResolveConflictsInFavorOfReplica1 - Automatically reconcile in favor of rep1 if conflicts arrise.

esriRAResolveConflictsInFavorOfReplica2 - Automatically reconcile in favor of rep2 if conflicts arrise.

esriRAResolveConflictsNone - This enumeration has meaning for check-out replicas only. It indicates that a the synchronization version should not be reconciled and post with the replica version during synchronization

The dir parameter takes an esriReplicaSynchronizeDirection enumeration value to define the direction to synchronize the changes. See esriReplicaSynchronizeDirection for more information.

If synchronizing in both directions, the reconcile policy set with the pol parameter will apply to both synchronizations. Therefore you must set the pol parameter to either resolve conflicts in favor of rep1 or resolve in favor of rep2. An error occurs if you specify any other policy when synchronizing in both directions.


Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
synchronizeReplica in interface IReplicationAgent
Parameters:
gds1 - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
gds2 - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
rep1 - A reference to a com.esri.arcgis.geodatabase.IGPReplica (in)
rep2 - A reference to a com.esri.arcgis.geodatabase.IGPReplica (in)
pol - A com.esri.arcgis.geodatabasedistributed.esriReplicationAgentReconcilePolicy constant (in)
dir - A com.esri.arcgis.geodatabasedistributed.esriReplicaSynchronizeDirection constant (in)
columnLevel - The columnLevel (in)
Returns:
The conflictsDetected
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

extractData

public void extractData(String versionName,
                        IGeoDataServer srcGDS,
                        IGeoDataServer destGDS,
                        IGPReplicaDescription desc)
                 throws IOException,
                        AutomationException
Extracts data from the source geodata server into the destination geodata server.

Description

The IReplicationAgent::ExtractData method is used to copy data between geodatabases applying filters to determine the rows to copy.

This method requires two input geodataserver objects, a srcGDS and a destGDS. The srcGDS references the geodatabase that originally contains the data while the destGDS references the geodatabase where the data will be copied.

The desc parameter defines the data which will be extracted. See the GPReplicaDescription coclass for more information.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
extractData in interface IReplicationAgent
Parameters:
versionName - The versionName (in)
srcGDS - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
destGDS - A reference to a com.esri.arcgis.geodatabasedistributed.IGeoDataServer (in)
desc - A reference to a com.esri.arcgis.geodatabase.IGPReplicaDescription (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCancelTrackerByRef

public void setCancelTrackerByRef(ITrackCancel rhs1)
                           throws IOException,
                                  AutomationException
The cancel tracker to inspect for user cancellations.

Remarks

The putref_CancelTracker method inspects for user cancellations.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setCancelTrackerByRef in interface IReplicationAgentCancelControl
Parameters:
rhs1 - A reference to a com.esri.arcgis.system.ITrackCancel (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.