本文整理汇总了Java中org.apache.camel.component.file.GenericFile.bindToExchange方法的典型用法代码示例。如果您正苦于以下问题:Java GenericFile.bindToExchange方法的具体用法?Java GenericFile.bindToExchange怎么用?Java GenericFile.bindToExchange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.component.file.GenericFile
的用法示例。
在下文中一共展示了GenericFile.bindToExchange方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: begin
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public boolean begin(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
// must invoke super
boolean result = super.begin(operations, endpoint, exchange, file);
if (!result) {
return false;
}
// okay we got the file then execute the begin renamer
if (beginRenamer != null) {
GenericFile<T> newName = beginRenamer.renameFile(exchange, file);
GenericFile<T> to = renameFile(operations, file, newName);
if (to != null) {
to.bindToExchange(exchange);
}
}
return true;
}
示例2: rollback
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public void rollback(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
try {
deleteLocalWorkFile(exchange);
operations.releaseRetreivedFileResources(exchange);
// moved the failed file if specifying the moveFailed option
if (failureRenamer != null) {
// create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
Exchange copy = exchange.copy();
file.bindToExchange(copy);
// must preserve message id
copy.getIn().setMessageId(exchange.getIn().getMessageId());
copy.setExchangeId(exchange.getExchangeId());
GenericFile<T> newName = failureRenamer.renameFile(copy, file);
renameFile(operations, file, newName);
}
} finally {
// must release lock last
if (exclusiveReadLockStrategy != null) {
exclusiveReadLockStrategy.releaseExclusiveReadLockOnRollback(operations, file, exchange);
}
}
}
示例3: begin
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public boolean begin(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
// must invoke super
boolean result = super.begin(operations, endpoint, exchange, file);
if (!result) {
return false;
}
// okay we got the file then execute the begin renamer
if (beginRenamer != null) {
GenericFile<T> newName = beginRenamer.renameFile(exchange, file);
GenericFile<T> to = renameFile(operations, file, newName);
if (to != null) {
to.bindToExchange(exchange);
}
}
return true;
}
示例4: rollback
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public void rollback(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
try {
operations.releaseRetreivedFileResources(exchange);
if (failureRenamer != null) {
// create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
Exchange copy = exchange.copy();
file.bindToExchange(copy);
// must preserve message id
copy.getIn().setMessageId(exchange.getIn().getMessageId());
copy.setExchangeId(exchange.getExchangeId());
GenericFile<T> newName = failureRenamer.renameFile(copy, file);
renameFile(operations, file, newName);
}
} finally {
if (exclusiveReadLockStrategy != null) {
exclusiveReadLockStrategy.releaseExclusiveReadLockOnRollback(operations, file, exchange);
}
deleteLocalWorkFile(exchange);
}
}
示例5: commit
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public void commit(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
try {
if (commitRenamer != null) {
// create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
Exchange copy = exchange.copy();
file.bindToExchange(copy);
// must preserve message id
copy.getIn().setMessageId(exchange.getIn().getMessageId());
copy.setExchangeId(exchange.getExchangeId());
GenericFile<T> newName = commitRenamer.renameFile(copy, file);
renameFile(operations, file, newName);
}
} finally {
// must invoke super
super.commit(operations, endpoint, exchange, file);
}
}
示例6: createExchange
import org.apache.camel.component.file.GenericFile; //导入方法依赖的package包/类
@Override
public Exchange createExchange(GenericFile<T> file) {
Exchange answer = super.createExchange();
if (file != null) {
file.bindToExchange(answer);
}
return answer;
}