use of org.dcache.pool.movers.MoverFactory in project dcache by dCache.
the class PoolV4 method createMover.
// //////////////////////////////////////////////////////////////
//
// The io File Part
//
//
public Mover<?> createMover(CellMessage envelop, PoolIoFileMessage message) throws CacheException {
CellPath source = envelop.getSourcePath().revert();
FileAttributes attributes = message.getFileAttributes();
PnfsId pnfsId = attributes.getPnfsId();
ProtocolInfo pi = message.getProtocolInfo();
MoverFactory moverFactory = _transferServices.getMoverFactory(pi);
ReplicaDescriptor handle;
try {
if (message instanceof PoolAcceptFileMessage) {
OptionalLong maximumSize = ((PoolAcceptFileMessage) message).getMaximumSize();
List<StickyRecord> stickyRecords = _replicaStatePolicy.getStickyRecords(attributes);
ReplicaState targetState = _replicaStatePolicy.getTargetState(attributes);
handle = _repository.createEntry(attributes, ReplicaState.FROM_CLIENT, targetState, stickyRecords, moverFactory.getChannelCreateOptions(), maximumSize);
} else {
Set<? extends OpenOption> openFlags = message.isPool2Pool() ? EnumSet.of(Repository.OpenFlags.NOATIME) : EnumSet.noneOf(Repository.OpenFlags.class);
handle = _repository.openEntry(pnfsId, openFlags);
}
} catch (FileNotInCacheException e) {
throw new FileNotInCacheException("File " + pnfsId + " does not exist in " + _poolName, e);
} catch (FileInCacheException e) {
throw new FileInCacheException("File " + pnfsId + " already exists in " + _poolName, e);
}
try {
return moverFactory.createMover(handle, message, source);
} catch (Throwable t) {
handle.close();
throw t;
}
}
Aggregations