use of diskCacheV111.vehicles.PnfsCommitUpload in project dcache by dCache.
the class XrootdTransferService method handleUploadDone.
private void handleUploadDone(NettyMover<XrootdProtocolInfo> mover) throws CacheException {
try {
EnumSet<CreateOption> options = EnumSet.noneOf(CreateOption.class);
if (mover.getProtocolInfo().isOverwriteAllowed()) {
options.add(CreateOption.OVERWRITE_EXISTING);
}
PnfsCommitUpload msg = new PnfsCommitUpload(mover.getSubject(), mover.getProtocolInfo().getRestriction(), FsPath.create(mover.getTransferPath()), FsPath.create(mover.getBillingPath()), options, EnumSet.of(PNFSID, SIZE, STORAGEINFO));
pnfsStub.sendAndWait(msg);
} catch (InterruptedException ex) {
throw new CacheException("Operation interrupted", ex);
} catch (NoRouteToCellException ex) {
throw new CacheException("Internal communication failure", ex);
}
}
use of diskCacheV111.vehicles.PnfsCommitUpload in project dcache by dCache.
the class Storage method putDone.
@Override
public void putDone(SRMUser user, String localTransferPath, URI surl, boolean overwrite) throws SRMException {
try {
Subject subject = asDcacheUser(user).getSubject();
Restriction restriction = asDcacheUser(user).getRestriction();
FsPath fullPath = getPath(surl);
checkNonBrokenUpload(localTransferPath);
EnumSet<CreateOption> options = EnumSet.noneOf(CreateOption.class);
if (overwrite) {
options.add(CreateOption.OVERWRITE_EXISTING);
}
PnfsCommitUpload msg = new PnfsCommitUpload(subject, restriction, FsPath.create(localTransferPath), fullPath, options, EnumSet.of(PNFSID, SIZE, STORAGEINFO));
msg = _pnfsStub.sendAndWait(msg);
DoorRequestInfoMessage infoMsg = new DoorRequestInfoMessage(getCellAddress());
infoMsg.setSubject(subject);
infoMsg.setBillingPath(fullPath.toString());
infoMsg.setTransferPath(localTransferPath);
infoMsg.setTransaction(CDC.getSession());
infoMsg.setPnfsId(msg.getFileAttributes().getPnfsId());
infoMsg.setResult(0, "");
infoMsg.setFileSize(msg.getFileAttributes().getSizeIfPresent().orElse(0L));
infoMsg.setStorageInfo(msg.getFileAttributes().getStorageInfo());
Origin origin = Subjects.getOrigin(subject);
if (origin != null) {
infoMsg.setClient(origin.getAddress().getHostAddress());
}
_billingStub.notify(infoMsg);
} catch (FileNotFoundCacheException e) {
throw new SRMInvalidPathException(e.getMessage(), e);
} catch (FileIsNewCacheException | FileCorruptedCacheException e) {
throw new SRMException(e.getMessage(), e);
} catch (PermissionDeniedCacheException e) {
throw new SRMAuthorizationException("Permission denied.", e);
} catch (FileExistsCacheException e) {
throw new SRMDuplicationException(surl + " exists.", e);
} catch (CacheException e) {
throw new SRMInternalErrorException(e.getMessage(), e);
} catch (InterruptedException e) {
throw new SRMInternalErrorException("Operation interrupted", e);
} catch (NoRouteToCellException e) {
throw new SRMInternalErrorException("Internal communication failure", e);
}
}
use of diskCacheV111.vehicles.PnfsCommitUpload in project dcache by dCache.
the class PnfsManagerV3 method commitUpload.
void commitUpload(PnfsCommitUpload message) {
try {
checkRestriction(message, UPLOAD);
FileAttributes attributes = _nameSpaceProvider.commitUpload(message.getSubject(), message.getUploadPath(), message.getPath(), message.getOptions(), message.getRequestedAttributes());
message.setFileAttributes(attributes);
message.setSucceeded();
} catch (CacheException e) {
message.setFailed(e.getRc(), e.getMessage());
} catch (RuntimeException e) {
LOGGER.error("Commit upload path failed", e);
message.setFailed(CacheException.UNEXPECTED_SYSTEM_EXCEPTION, e);
}
}
Aggregations