ClaireLytt opened a new pull request, #12297:
URL: https://github.com/apache/seatunnel/pull/12297
### Purpose of this pull request
This pull request adds a new SMB (Server Message Block) file connector for
SeaTunnel, supporting both Source and Sink capabilities. for #10753.
SMB is the standard protocol for Windows network file sharing (e.g.,
`\\192.168.1.100\shared`). This connector enables SeaTunnel to directly read
from and write to SMB/CIFS shared directories without manual file copying.
The implementation follows the existing file connector architecture (same
pattern as FTP/SFTP connectors), using the smbj library
(`com.hierynomus:smbj:0.13.0`) for SMB2/SMB3 protocol support. It bridges smbj
to Hadoop's `FileSystem` API, so all file formats (CSV, JSON, Parquet, ORC,
Excel, etc.) are automatically supported via `connector-file-base`.
**New module:** `connector-file-smb`
**Key files:**
- `SmbFileSystem.java` — Core Hadoop FileSystem implementation backed by smbj
- `SmbInputStream.java` — FSInputStream wrapper for smbj streams
- `SmbConf.java` — HadoopConf subclass building `smb://host:port` URI
- `SmbFileBaseOptions.java` — SMB-specific config options (host, port, user,
password, domain, share)
- Source/Sink factories, entry classes, catalog, and config classes
following the standard file connector pattern
### Does this PR introduce _any_ user-facing change?
Yes. Users can now configure SMB as a source or sink in SeaTunnel jobs.
**Source example:**
```hocon
source {
SmbFile {
host = "192.168.1.100"
port = 445
user = "seatunnel"
password = "password"
share = "data"
path = "/input"
file_format_type = "json"
}
}
```
**Sink example:**
```hocon
sink {
SmbFile {
host = "192.168.1.100"
port = 445
user = "seatunnel"
password = "password"
share = "data"
path = "/output"
file_format_type = "json"
}
}
```
Documentation added in both English and Chinese
(`docs/en/connectors/source/SmbFile.md`, `docs/en/connectors/sink/SmbFile.md`,
and their `zh` counterparts).
### How was this patch tested?
- 16 unit tests across 2 test classes, all passing:
- `SmbFileFactoryTest` (8 tests) — validates source/sink factory
identifiers, option rules, config validation (sync mode requires target path,
backup action requires backup path), and HadoopConf construction
- `SmbFileSystemTest` (8 tests) — validates initialization parameter
checking (missing host/user/share throws IOException), scheme, working
directory, append rejection, and port configuration
- Compilation verified with `mvn compile -pl :connector-file-smb`
- Spotless formatting applied and passing
### Check list
* [x] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [x] If you are contributing the connector code, please check that the
following files are updated:
1. [x] Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. [x] Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. [ ] Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. [ ] Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. [x] Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]