|
25 | 25 | import org.springframework.integration.dsl.ComponentsRegistration;
|
26 | 26 | import org.springframework.integration.dsl.MessageHandlerSpec;
|
27 | 27 | import org.springframework.integration.expression.FunctionExpression;
|
| 28 | +import org.springframework.integration.file.FileNameGenerator; |
28 | 29 | import org.springframework.integration.file.filters.CompositeFileListFilter;
|
29 | 30 | import org.springframework.integration.file.filters.ExpressionFileListFilter;
|
30 | 31 | import org.springframework.integration.file.filters.FileListFilter;
|
@@ -313,8 +314,21 @@ public S localFilenameExpression(String localFilenameExpression) {
|
313 | 314 | * @param localFilenameFunction the {@link Function} to use.
|
314 | 315 | * @param <P> the expected payload type.
|
315 | 316 | * @return the Spec.
|
| 317 | + * @deprecated since 5.2 in favor of {@link #localFilenameFunction(Function)} |
316 | 318 | */
|
| 319 | + @Deprecated |
317 | 320 | public <P> S localFilename(Function<Message<P>, String> localFilenameFunction) {
|
| 321 | + return localFilenameFunction(localFilenameFunction); |
| 322 | + } |
| 323 | + |
| 324 | + /** |
| 325 | + * Specify a {@link Function} for local files renaming after downloading. |
| 326 | + * @param localFilenameFunction the {@link Function} to use. |
| 327 | + * @param <P> the expected payload type. |
| 328 | + * @return the Spec. |
| 329 | + * @since 5.2 |
| 330 | + */ |
| 331 | + public <P> S localFilenameFunction(Function<Message<P>, String> localFilenameFunction) { |
318 | 332 | return localFilenameExpression(new FunctionExpression<>(localFilenameFunction));
|
319 | 333 | }
|
320 | 334 |
|
@@ -351,6 +365,167 @@ public S fileExistsMode(FileExistsMode fileExistsMode) {
|
351 | 365 | return _this();
|
352 | 366 | }
|
353 | 367 |
|
| 368 | + /** |
| 369 | + * Determine whether the remote directory should automatically be created when |
| 370 | + * sending files to the remote system. |
| 371 | + * @param autoCreateDirectory true to create the directory. |
| 372 | + * @return the current Spec |
| 373 | + * @since 5.2 |
| 374 | + * @see AbstractRemoteFileOutboundGateway#setAutoCreateDirectory(boolean) |
| 375 | + */ |
| 376 | + public S autoCreateDirectory(boolean autoCreateDirectory) { |
| 377 | + this.target.setAutoCreateDirectory(autoCreateDirectory); |
| 378 | + return _this(); |
| 379 | + } |
| 380 | + |
| 381 | + /** |
| 382 | + * Set the remote directory expression used to determine the remote directory to which |
| 383 | + * files will be sent. |
| 384 | + * @param remoteDirectoryExpression the remote directory expression. |
| 385 | + * @return the current Spec |
| 386 | + * @since 5.2 |
| 387 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 388 | + */ |
| 389 | + public S remoteDirectoryExpression(String remoteDirectoryExpression) { |
| 390 | + return remoteDirectoryExpression(PARSER.parseExpression(remoteDirectoryExpression)); |
| 391 | + } |
| 392 | + |
| 393 | + /** |
| 394 | + * Specify a {@link Function} for remote directory. |
| 395 | + * @param remoteDirectoryFunction the {@link Function} to use. |
| 396 | + * @param <P> the expected payload type. |
| 397 | + * @return the Spec. |
| 398 | + * @since 5.2 |
| 399 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 400 | + * @see FunctionExpression |
| 401 | + */ |
| 402 | + public <P> S remoteDirectoryFunction(Function<Message<P>, String> remoteDirectoryFunction) { |
| 403 | + return remoteDirectoryExpression(new FunctionExpression<>(remoteDirectoryFunction)); |
| 404 | + } |
| 405 | + |
| 406 | + /** |
| 407 | + * Set the remote directory expression used to determine the remote directory to which |
| 408 | + * files will be sent. |
| 409 | + * @param remoteDirectoryExpression the remote directory expression. |
| 410 | + * @return the current Spec |
| 411 | + * @since 5.2 |
| 412 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 413 | + */ |
| 414 | + public S remoteDirectoryExpression(Expression remoteDirectoryExpression) { |
| 415 | + this.target.setRemoteDirectoryExpression(remoteDirectoryExpression); |
| 416 | + return _this(); |
| 417 | + } |
| 418 | + |
| 419 | + /** |
| 420 | + * Set a temporary remote directory expression; used when transferring files to the remote |
| 421 | + * system. |
| 422 | + * @param temporaryRemoteDirectoryExpression the temporary remote directory expression. |
| 423 | + * @return the current Spec |
| 424 | + * @since 5.2 |
| 425 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 426 | + */ |
| 427 | + public S temporaryRemoteDirectoryExpression(String temporaryRemoteDirectoryExpression) { |
| 428 | + return temporaryRemoteDirectoryExpression(PARSER.parseExpression(temporaryRemoteDirectoryExpression)); |
| 429 | + } |
| 430 | + |
| 431 | + /** |
| 432 | + * Set a temporary remote directory function; used when transferring files to the remote |
| 433 | + * system. |
| 434 | + * @param temporaryRemoteDirectoryFunction the file name expression. |
| 435 | + * @param <P> the expected payload type. |
| 436 | + * @return the current Spec |
| 437 | + * @since 5.2 |
| 438 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 439 | + */ |
| 440 | + public <P> S temporaryRemoteDirectoryFunction(Function<Message<P>, String> temporaryRemoteDirectoryFunction) { |
| 441 | + return temporaryRemoteDirectoryExpression(new FunctionExpression<>(temporaryRemoteDirectoryFunction)); |
| 442 | + } |
| 443 | + |
| 444 | + /** |
| 445 | + * Set a temporary remote directory expression; used when transferring files to the remote |
| 446 | + * system. |
| 447 | + * @param temporaryRemoteDirectoryExpression the temporary remote directory expression. |
| 448 | + * @return the current Spec |
| 449 | + * @since 5.2 |
| 450 | + * @see AbstractRemoteFileOutboundGateway#setRemoteDirectoryExpression |
| 451 | + */ |
| 452 | + public S temporaryRemoteDirectoryExpression(Expression temporaryRemoteDirectoryExpression) { |
| 453 | + this.target.setTemporaryRemoteDirectoryExpression(temporaryRemoteDirectoryExpression); |
| 454 | + return _this(); |
| 455 | + } |
| 456 | + |
| 457 | + /** |
| 458 | + * Set the file name expression to determine the full path to the remote file. |
| 459 | + * @param fileNameExpression the file name expression. |
| 460 | + * @return the current Spec |
| 461 | + * @since 5.2 |
| 462 | + * @see AbstractRemoteFileOutboundGateway#setFileNameExpression |
| 463 | + */ |
| 464 | + public S fileNameExpression(String fileNameExpression) { |
| 465 | + return fileNameExpression(PARSER.parseExpression(fileNameExpression)); |
| 466 | + } |
| 467 | + |
| 468 | + /** |
| 469 | + * Set the file name function to determine the full path to the remote file. |
| 470 | + * @param fileNameFunction the file name expression. |
| 471 | + * @param <P> the expected payload type. |
| 472 | + * @return the current Spec |
| 473 | + * @since 5.2 |
| 474 | + * @see AbstractRemoteFileOutboundGateway#setFileNameExpression |
| 475 | + */ |
| 476 | + public <P> S fileNameFunction(Function<Message<P>, String> fileNameFunction) { |
| 477 | + return fileNameExpression(new FunctionExpression<>(fileNameFunction)); |
| 478 | + } |
| 479 | + |
| 480 | + /** |
| 481 | + * Set the file name expression to determine the full path to the remote file. |
| 482 | + * @param fileNameExpression the file name expression. |
| 483 | + * @return the current Spec |
| 484 | + * @since 5.2 |
| 485 | + * @see AbstractRemoteFileOutboundGateway#setFileNameExpression |
| 486 | + */ |
| 487 | + public S fileNameExpression(Expression fileNameExpression) { |
| 488 | + this.target.setFileNameExpression(fileNameExpression); |
| 489 | + return _this(); |
| 490 | + } |
| 491 | + |
| 492 | + /** |
| 493 | + * Set whether a temporary file name is used when sending files to the remote system. |
| 494 | + * @param useTemporaryFileName true to use a temporary file name. |
| 495 | + * @return the current Spec |
| 496 | + * @since 5.2 |
| 497 | + * @see AbstractRemoteFileOutboundGateway#setUseTemporaryFileName |
| 498 | + */ |
| 499 | + public S useTemporaryFileName(boolean useTemporaryFileName) { |
| 500 | + this.target.setUseTemporaryFileName(useTemporaryFileName); |
| 501 | + return _this(); |
| 502 | + } |
| 503 | + |
| 504 | + /** |
| 505 | + * Set the file name generator used to generate the remote filename to be used when transferring |
| 506 | + * files to the remote system. |
| 507 | + * @param fileNameGenerator the file name generator. |
| 508 | + * @return the current Spec |
| 509 | + * @since 5.2 |
| 510 | + * @see AbstractRemoteFileOutboundGateway#setFileNameGenerator |
| 511 | + */ |
| 512 | + public S fileNameGenerator(FileNameGenerator fileNameGenerator) { |
| 513 | + this.target.setFileNameGenerator(fileNameGenerator); |
| 514 | + return _this(); |
| 515 | + } |
| 516 | + |
| 517 | + /** |
| 518 | + * Set the charset to use when converting String payloads to bytes as the content of the |
| 519 | + * remote file. Default {@code UTF-8}. |
| 520 | + * @param charset the charset. |
| 521 | + * @return the current Spec |
| 522 | + * @since 5.2 |
| 523 | + * @see AbstractRemoteFileOutboundGateway#setCharset |
| 524 | + */ |
| 525 | + public S charset(String charset) { |
| 526 | + this.target.setCharset(charset); |
| 527 | + return _this(); |
| 528 | + } |
354 | 529 |
|
355 | 530 | @Override
|
356 | 531 | public Map<Object, String> getComponentsToRegister() {
|
|
0 commit comments