# XINA Import

XINA Import is a utility for importing XINA API actions as JSON files. This application is distributed as a Java jar file and requires Java 21 or greater to run. The recommended OpenJDK build is available [here](https://learn.microsoft.com/en-us/java/openjdk/download).

### Latest Version


#### XINA Import 13.3.0

[Download](https://smce-xina.s3.amazonaws.com/dist/13.3.0/xina-import.jar)

Windows
```
 java -jar "path to xina_import.jar" ^
      [additional arguments...]
```

MacOS, Linux
```
 java -jar "path to xina_import.jar" \
      [additional arguments...]
```

| Argument | Info | Default |
|-|-|-|
| `-host <hostname>` | the XINA Tunnel host | `"localhost"` |
| `-post <port>` | the XINA Tunnel port | `41746` |
| `-okmove <path>` | if set, move files to path to after successful import | none (files are not moved) |
| `-oktrash` | if set, move files to OS trash after successful import | `false` |
| `-okdelete` | if set, permanently delete files after successful import | `false` |
| `-ermove <path>` | if set, move files to path to after failed import | none (errors stop import) |
| `-dir <path>` | path to directory containing files to import | |
| `-watch <path>` | path to directory to watch for files to import | |
| `-recursive` | if true in `dir` or `watch` mode, searches directory recursively for JSON files | `false` |

XINA Import has three modes of operation:

#### File List

JSON files can be listed explicitly. They will be imported in the specified order.

```
 java -jar "path to xina_import.jar" \
      "path to JSON file" \
      "path to JSON file"...
```

#### Directory

If the `-dir` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphanumeric order.

**Note**: the directory is now queried after each imported file, so at one of `-okmove`, `-oktrash`, or `-okdelete` must be specified in this mode, or the same file would be imported repeatedly in an infinite loop.

```
 java -jar "path to xina_import.jar" \
      -dir "path to directory" \
      -okmove "path to different directory"
```

#### Watch

If the `-watch` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphanumeric order. Once complete, the directory is watched for any new JSON files, which are imported as they become available. As with directory mode, a `-ok*` argument is required to prevent the same file from being imported repeatedly.

```
 java -jar "path to xina_import.jar" \
      -watch "path to directory" \
      -okmove "path to different directory"
```

### Previous Versions

#### XINA Import 10.1.0

[Download](https://smce-xina.s3.amazonaws.com/dist/import/10.1.0/xina_import.jar)

Windows
```
 java -jar "path to xina_import.jar" ^
      [additional arguments...]
```

MacOS, Linux
```
 java -jar "path to xina_import.jar" \
      [additional arguments...]
```

| Argument | Info | Default |
|-|-|-|
| `-host <hostname>` | the XINA Tunnel host | `"localhost"` |
| `-post <port>` | the XINA Tunnel port | `41746` |
| `-okmove <path>` | if set, move files to path to after successful import | none (files are not moved) |
| `-oktrash` | if set, move files to OS trash after successful import | `false` |
| `-okdelete` | if set, permanently delete files after successful import | `false` |
| `-ermove` | if set, move files to path to after failed import | none (errors stop import) |
| `-dir <path>` | path to directory containing files to import | |
| `-watch <path>` | path to directory to watch for files to import | |
| `-recursive` | if true in `dir` or `watch` mode, searches directory recursively for JSON files | `false` |

XINA Import has three modes of operation:

#### File List

JSON files can be listed explicitly. They will be imported in the specified order.

```
 java -jar "path to xina_import.jar" \
      "path to JSON file" \
      "path to JSON file"...
```

#### Directory

If the `-dir` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphanumeric order.

**Note**: the directory is now queried after each imported file, so at one of `-okmove`, `-oktrash`, or `-okdelete` must be specified in this mode, or the same file would be imported repeatedly in an infinite loop.

```
 java -jar "path to xina_import.jar" \
      -dir "path to directory" \
      -okmove "path to different directory"
```

#### Watch

If the `-watch` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphanumeric order. Once complete, the directory is watched for any new JSON files, which are imported as they become available. As with directory mode, a `-ok*` argument is required to prevent the same file from being imported repeatedly.

```
 java -jar "path to xina_import.jar" \
      -watch "path to directory" \
      -okmove "path to different directory"
```

#### XINA Import 9.2.0

[Download](https://smce-xina.s3.amazonaws.com/dist/import/xina_import_9.2.0.zip)

### Usage

Windows
```
 java -Dlog4j.configurationFile="path to log4j2.xml" ^
      -jar "path to xina_import.jar" ^
      [additional arguments...]
```

MacOS, Linux
```
 java -Dlog4j.configurationFile="path to log4j2.xml" \
      -jar "path to xina_import.jar" \
      [additional arguments...]
```

| Argument | Info | Default |
|-|-|-|
| `-host <hostname>` | the XINA Tunnel host | `"localhost"` |
| `-post <port>` | the XINA Tunnel port | `41746` |
| `-movejson <path>` | directory to move JSON files to after import | none (files are not moved) |
| `-movefile <path>` | directory to move other files to after import | none (files are not moved)  |
| `-deljson` | if set, permanently delete JSON files after import | `false` |
| `-delfile` | if set, permanently delete other files after import | `false` |
| `-dir <path>` | path to directory containing files to import | |
| `-watch <path>` | path to directory to watch for files to import | |
| `-recursive` | if true in `dir` or `watch` mode, searches directory recursively for JSON files | `false` |

XINA Import has three modes of operation:

#### File List

JSON files can be listed explicitly. They will be imported in the specified order.

```
 java -jar "path to xina_import.jar" \
      "path to JSON file" \
      "path to JSON file"...
```

#### Directory

If the `-dir` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphabetical order. It is recommended to include `-movejson` or `-deljson` to track progress, in case the import is interrupted.

```
 java -jar "path to xina_import.jar" \
      -dir "path to directory" \
      -movejson "path to different directory"
```

#### Watch

If the `-watch` argument is used, XINA Import will attempt to import all `*.json` files in the specified directory in alphabetical order. Once complete, the directory is watched for any new JSON files, which are imported as they become available. It is required to include `-movejson` or `-deljson`, as otherwise files would be continuously re-imported.

```
 java -jar "path to xina_import.jar" \
      -watch "path to directory" \
      -movejson "path to different directory"
```