org.apache.cayenne.access

## Class DataPort

- java.lang.Object
- - org.apache.cayenne.access.DataPort

- Deprecated.
  since 4.0

      @Deprecated
      public class DataPort
      extends Object

  An engine to port data between two DataNodes. These nodes can potentially connect to databases from different vendors. The only assumption is that all of the DbEntities (tables) being ported are present in both source and destination databases and are adequately described by Cayenne mapping.

  DataPort implements a Cayenne-based algorithm to read data from source DataNode and write to destination DataNode. It uses DataPortDelegate interface to externalize various things, such as determining what entities to port (include/exclude from port based on some criteria), logging the progress of port operation, qualifying the queries, etc.

  Since:
    1.2: Prior to 1.2 DataPort classes were a part of cayenne-examples package.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `cleaningDestination` Deprecated.
    `protected DataPortDelegate` | `delegate` Deprecated.
    `protected DataNode` | `destinationNode` Deprecated.
    `protected Collection` | `entities` Deprecated.
    `static int` | `INSERT_BATCH_SIZE` Deprecated.
    `protected int` | `insertBatchSize` Deprecated.
    `protected DataNode` | `sourceNode` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataPort()` Deprecated.
    `DataPort(DataPortDelegate delegate)` Deprecated. Creates a new DataPort instance, setting its delegate.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute()` Deprecated. Runs DataPort.
    `DataPortDelegate` | `getDelegate()` Deprecated. Returns previously initialized DataPortDelegate object.
    `DataNode` | `getDestinationNode()` Deprecated.
    `Collection` | `getEntities()` Deprecated.
    `int` | `getInsertBatchSize()` Deprecated.
    `DataNode` | `getSourceNode()` Deprecated.
    `boolean` | `isCleaningDestination()` Deprecated. Returns true if a DataPort was configured to delete all data from the destination tables.
    `protected void` | `processDelete(List entities)` Deprecated. Cleans up destination tables data.
    `protected void` | `processInsert(List entities)` Deprecated. Reads source data from source, saving it to destination.
    `void` | `setCleaningDestination(boolean cleaningDestination)` Deprecated. Defines whether DataPort should delete all data from destination tables before doing the port.
    `void` | `setDelegate(DataPortDelegate delegate)` Deprecated.
    `void` | `setDestinationNode(DataNode destinationNode)` Deprecated. Sets the DataNode serving as a destination of the ported data.
    `void` | `setEntities(Collection entities)` Deprecated. Sets the initial list of entities to process.
    `void` | `setInsertBatchSize(int insertBatchSize)` Deprecated. Sets a parameter used for tuning insert batches.
    `void` | `setSourceNode(DataNode sourceNode)` Deprecated. Sets the DataNode serving as a source of the ported data.

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

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

- - ### Field Detail

    - #### INSERT_BATCH_SIZE

          public static final int INSERT_BATCH_SIZE

      Deprecated.
      See Also:
        Constant Field Values

    - #### sourceNode

          protected DataNode sourceNode

      Deprecated.

    - #### destinationNode

          protected DataNode destinationNode

      Deprecated.

    - #### entities

          protected Collection entities

      Deprecated.

    - #### cleaningDestination

          protected boolean cleaningDestination

      Deprecated.

    - #### delegate

          protected DataPortDelegate delegate

      Deprecated.

    - #### insertBatchSize

          protected int insertBatchSize

      Deprecated.

  - ### Constructor Detail

    - #### DataPort

          public DataPort()

      Deprecated.

    - #### DataPort

          public DataPort(DataPortDelegate delegate)

      Deprecated.
      Creates a new DataPort instance, setting its delegate.

  - ### Method Detail

    - #### execute

          public void execute()
                       throws CayenneException

      Deprecated.
      Runs DataPort. The instance must be fully configured by the time this method is invoked, having its delegate, source and destinatio nodes, and a list of entities set up.
      Throws:
        `CayenneException`

    - #### processDelete

          protected void processDelete(List entities)

      Deprecated.
      Cleans up destination tables data.

    - #### processInsert

          protected void processInsert(List entities)
                                throws CayenneException

      Deprecated.
      Reads source data from source, saving it to destination.
      Throws:
        `CayenneException`

    - #### getEntities

          public Collection getEntities()

      Deprecated.

    - #### getSourceNode

          public DataNode getSourceNode()

      Deprecated.

    - #### getDestinationNode

          public DataNode getDestinationNode()

      Deprecated.

    - #### setEntities

          public void setEntities(Collection entities)

      Deprecated.
      Sets the initial list of entities to process. This list can be later modified by the delegate.

    - #### setSourceNode

          public void setSourceNode(DataNode sourceNode)

      Deprecated.
      Sets the DataNode serving as a source of the ported data.

    - #### setDestinationNode

          public void setDestinationNode(DataNode destinationNode)

      Deprecated.
      Sets the DataNode serving as a destination of the ported data.

    - #### getDelegate

          public DataPortDelegate getDelegate()

      Deprecated.
      Returns previously initialized DataPortDelegate object.

    - #### setDelegate

          public void setDelegate(DataPortDelegate delegate)

      Deprecated.

    - #### isCleaningDestination

          public boolean isCleaningDestination()

      Deprecated.
      Returns true if a DataPort was configured to delete all data from the destination tables.

    - #### setCleaningDestination

          public void setCleaningDestination(boolean cleaningDestination)

      Deprecated.
      Defines whether DataPort should delete all data from destination tables before doing the port.

    - #### getInsertBatchSize

          public int getInsertBatchSize()

      Deprecated.

    - #### setInsertBatchSize

          public void setInsertBatchSize(int insertBatchSize)

      Deprecated.
      Sets a parameter used for tuning insert batches. If set to a value greater than zero, DataPort will commit every N rows. If set to value less or equal to zero, DataPort will commit only once at the end of the insert.

Copyright © 2001–2023 Apache Cayenne. All rights reserved.