Package com.orchestranetworks.service.extensions

# Class ReplicationUnit

java.lang.Object
com.orchestranetworks.service.extensions.ReplicationUnit

public abstract class ReplicationUnit extends Object
A replication unit is defined by the data model.

See Also:
  - Replicating data to relational tables

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReplicationUnit()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract RefreshPolicy`
  `getRefreshPolicy()`
  Returns the `RefreshPolicy` of this replication unit.
  `abstract ReplicaTable`
  `getReplicaTable(SchemaNode aTableNode)`
  Returns the replica of the specified table node.
  `abstract Iterator<ReplicaTable>`
  `getReplicaTables()`
  Returns the table replicas defined by this replication unit.
  `abstract ReplicationUnitKey`
  `getReplicationUnitKey()`
  Returns the key of this replication unit.
  `static final List<ReplicationUnit>`
  `getReplicationUnitsForTable(SchemaNode aTableNode, Repository aRepository)`
  Returns all the replication units involving the specified table in the context of a repository.
  `static ReplicationUnit`
  `newReplicationUnit(ReplicationUnitKey aUnitKey, Adaptation aDataSet)`
  Returns the replication unit for the specified dataset and unit name.
  `abstract void`
  `performRefresh(ProcedureContext aContext)`
  Refreshes the tables included by this replication unit.
  `abstract ProcedureResult`
  `performRefresh(Session aSession)`
  Refreshes the tables included by this replication unit.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ReplicationUnit

    public ReplicationUnit()

- ## Method Details

  - ### newReplicationUnit

    public static ReplicationUnit newReplicationUnit(ReplicationUnitKey aUnitKey, Adaptation aDataSet)
    Returns the replication unit for the specified dataset and unit name.
    Parameters:
      `aUnitKey` - identifies the replication unit, namely the table(s) to be replicated in the specified dataset.
      `aDataSet` - dataset for which at least one table will be replicated.
    Throws:
      `IllegalArgumentException` - if one argument is `null`, if the specified replication unit is not defined by the data model, if its refresh is not `onDemand`, or if the dataset does not match the replication unit definition.
    See Also:
      - Replication refresh policy

  - ### getReplicationUnitsForTable

    public static final List<ReplicationUnit> getReplicationUnitsForTable(SchemaNode aTableNode, Repository aRepository)
    Returns all the replication units involving the specified table in the context of a repository.

    Returns an empty list if this method is called before the resolution of the replications units defined in the data model containing the specified node, or if this data model does not define a replication unit for the specified table node.

    Throws:
      `IllegalArgumentException` - if the specified node is `null`, or if it is not a table node.
      `IllegalArgumentException` - if the specified repository is `null`.
    Since:
      5.8.0

  - ### performRefresh

    public abstract ProcedureResult performRefresh(Session aSession)
    Refreshes the tables included by this replication unit. This method cannot be invoked from a running procedure.
    Parameters:
      `aSession` - authenticated session allowed to perform the replication.
    Returns:
      the result of the execution; specifically, the success of the refresh must be checked using this object.
    Throws:
      `IllegalArgumentException` - if the specified table is not included by any replication units with the refresh policy `onDemand`.
    See Also:
      - Replication refresh policy

  - ### performRefresh

    public abstract void performRefresh(ProcedureContext aContext) throws OperationException
    Refreshes the tables included by this replication unit.

    Caution: If the procedure context specifies a commit threshold, intermediate commits can be performed outside the execution of this method. However, the replication operations performed by this method are not taken into account by the threshold (and no commits will take place during the replication itself).

    Parameters:
      `aContext` - context of the procedure currently running.
    Throws:
      `IllegalArgumentException` - if the specified context is `null`, or is not running on the same dataspace as the current dataset.
      `IllegalStateException` - if this method is not invoked from a still running procedure.
      `OperationException` - thrown if operation cannot complete, or if executed on the D3 replica delivery dataspace.
    See Also:
      - Replication refresh policy

  - ### getReplicationUnitKey

    public abstract ReplicationUnitKey getReplicationUnitKey()
    Returns the key of this replication unit.
    Since:
      5.8.0
    See Also:
      - `ReplicationUnitKey`

  - ### getReplicaTables

    public abstract Iterator<ReplicaTable> getReplicaTables()
    Returns the table replicas defined by this replication unit. Returns an empty iterator if this replication unit does not define table replicas.
    Since:
      5.8.0

  - ### getReplicaTable

    public abstract ReplicaTable getReplicaTable(SchemaNode aTableNode)
    Returns the replica of the specified table node.

    Returns `null` if the current replication unit does not define a replica for the specified table node.

    Throws:
      `IllegalArgumentException` - if the specified node is `null`, or if it is not a table node.
    Since:
      5.8.0

  - ### getRefreshPolicy

    public abstract RefreshPolicy getRefreshPolicy()
    Returns the `RefreshPolicy` of this replication unit.
    Since:
      5.8.0