当前位置: 首页>>代码示例>>Java>>正文


Java JargonException类代码示例

本文整理汇总了Java中org.irods.jargon.core.exception.JargonException的典型用法代码示例。如果您正苦于以下问题:Java JargonException类的具体用法?Java JargonException怎么用?Java JargonException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JargonException类属于org.irods.jargon.core.exception包,在下文中一共展示了JargonException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: list

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
    try {
        final AttributedList<Path> children = new AttributedList<Path>();
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(directory.getAbsolute());
        if(!f.exists()) {
            throw new NotfoundException(directory.getAbsolute());
        }
        for(File file : fs.getListInDirWithFileFilter(f, TrueFileFilter.TRUE)) {
            final String normalized = PathNormalizer.normalize(file.getAbsolutePath(), true);
            if(StringUtils.equals(normalized, directory.getAbsolute())) {
                continue;
            }
            final PathAttributes attributes = new PathAttributes();
            final ObjStat stats = fs.getObjStat(file.getAbsolutePath());
            attributes.setModificationDate(stats.getModifiedAt().getTime());
            attributes.setCreationDate(stats.getCreatedAt().getTime());
            attributes.setSize(stats.getObjSize());
            attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(stats.getChecksum()))));
            attributes.setOwner(stats.getOwnerName());
            attributes.setGroup(stats.getOwnerZone());
            children.add(new Path(directory, PathNormalizer.name(normalized),
                    file.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file),
                    attributes));
            listener.chunk(directory, children);
        }
        return children;
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Listing directory {0} failed", e, directory);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:34,代码来源:IRODSListService.java

示例2: find

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public PathAttributes find(final Path file) throws BackgroundException {
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
        if(!f.exists()) {
            throw new NotfoundException(file.getAbsolute());
        }
        final PathAttributes attributes = new PathAttributes();
        final ObjStat stats = fs.getObjStat(f.getAbsolutePath());
        attributes.setModificationDate(stats.getModifiedAt().getTime());
        attributes.setCreationDate(stats.getCreatedAt().getTime());
        attributes.setSize(stats.getObjSize());
        attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(stats.getChecksum()))));
        attributes.setOwner(stats.getOwnerName());
        attributes.setGroup(stats.getOwnerZone());
        return attributes;
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Failure to read attributes of {0}", e, file);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:23,代码来源:IRODSAttributesFinderFeature.java

示例3: login

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public void login(final HostPasswordStore keychain, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException {
    try {
        final IRODSAccount account = client.getIRODSAccount();
        final Credentials credentials = host.getCredentials();
        account.setUserName(credentials.getUsername());
        account.setPassword(credentials.getPassword());
        final AuthResponse response = client.getIRODSAccessObjectFactory().authenticateIRODSAccount(account);
        if(log.isDebugEnabled()) {
            log.debug(String.format("Connected to %s", response.getStartupResponse()));
        }
        if(!response.isSuccessful()) {
            throw new LoginFailureException(MessageFormat.format(LocaleFactory.localizedString(
                    "Login {0} with username and password", "Credentials"), BookmarkNameProvider.toString(host)));
        }
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map(e);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:21,代码来源:IRODSSession.java

示例4: map

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public BackgroundException map(final JargonException e) {
    final StringBuilder buffer = new StringBuilder();
    this.append(buffer, e.getMessage());
    if(e instanceof CatNoAccessException) {
        return new AccessDeniedException(buffer.toString(), e);
    }
    if(e instanceof FileNotFoundException) {
        return new NotfoundException(buffer.toString(), e);
    }
    if(e instanceof DataNotFoundException) {
        return new NotfoundException(buffer.toString(), e);
    }
    if(e instanceof AuthenticationException) {
        return new LoginFailureException(buffer.toString(), e);
    }
    if(e instanceof InvalidUserException) {
        return new LoginFailureException(buffer.toString(), e);
    }
    if(e instanceof InvalidGroupException) {
        return new LoginFailureException(buffer.toString(), e);
    }
    return this.wrap(e, buffer);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:25,代码来源:IRODSExceptionMappingService.java

示例5: move

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException {
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
        if(!s.exists()) {
            throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute()));
        }
        if(status.isExists()) {
            delete.delete(Collections.singletonList(renamed), connectionCallback, callback);
        }
        final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute());
        s.renameTo(d);
        return renamed;
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:20,代码来源:IRODSMoveFeature.java

示例6: retrieveFile

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
protected void retrieveFile(String remoteFileName, String localDirPath) 
		throws ReplicationServiceException {
	try {
		if(overrideJargonProperties!=null) {
			irodsFileSystem.getIrodsSession().setJargonProperties(overrideJargonProperties);
		}		
		File localFile = new File(localDirPath);

		IRODSFileFactory irodsFileFactory = irodsFileSystem .getIRODSFileFactory(irodsAccount);

		IRODSFile remoteFile = irodsFileFactory.instanceIRODSFile(remoteFileName);

		DataTransferOperations dataTransferOperations = irodsFileSystem
				.getIRODSAccessObjectFactory()
				.getDataTransferOperations(irodsAccount);

		dataTransferOperations.getOperation(remoteFile.getAbsolutePath(), localFile.getAbsolutePath(), "", null, null);    	
	} catch (JargonException e) {
		throw new ReplicationServiceException(e);
	}
}
 
开发者ID:EUDAT-B2SAFE,项目名称:B2SAFE-repository-package,代码行数:22,代码来源:ReplicationServiceIrodsGenericImpl.java

示例7: getMetadataOfDataObject

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
protected Map<String, AVUMetaData> getMetadataOfDataObject(String dataObjectAbsolutePath) 
		throws ReplicationServiceException {

	try {
		Map<String, AVUMetaData> eudatMetadata = new HashMap<String, AVUMetaData>();
		DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount);

		List<MetaDataAndDomainData> listMetaData = dataObjectAO.findMetadataValuesForDataObject(dataObjectAbsolutePath);
		for (MetaDataAndDomainData temp : listMetaData) {
			eudatMetadata.put(temp.getAvuAttribute(), new AVUMetaData(temp.getAvuAttribute(),temp.getAvuValue(),temp.getAvuUnit()));
		}

		return eudatMetadata;
	} catch (JargonException e) {
		throw new ReplicationServiceException(e);
	}

}
 
开发者ID:EUDAT-B2SAFE,项目名称:B2SAFE-repository-package,代码行数:19,代码来源:ReplicationServiceIrodsGenericImpl.java

示例8: DocumentMapper

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
/**
 * Default constuctor
 * 
 * @param connectorContext
 *            {@link ConnectorContext} with access and environmental
 *            information
 */
DocumentMapper(ConnectorContext connectorContext) {
	if (connectorContext == null) {
		throw new IllegalArgumentException("null connectorContext");
	}
	this.connectorContext = null;
	// FIXME: auth shim here until I understand the pluggable auth for
	// modeshape
	try {
		irodsAccount = IRODSAccount.instance("localhost", 1247, "test1",
				"test", "", "test1", "test1-resc");
	} catch (JargonException je) {
		throw new JargonRuntimeException("exception getting irods account",
				je);
	}
}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:23,代码来源:DocumentMapper.java

示例9: retrieveDocumentForId

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
Document retrieveDocumentForId(final String id)
		throws FileNotFoundException, JargonException {
	log.info("retrieveDocumentForId()");
	if (id == null || id.isEmpty()) {
		throw new IllegalArgumentException("null or empty id");
	}

	log.info("id:{}", id);

	log.info("get irodsFileFactory...");
	IRODSFile docFile = connectorContext.getIrodsAccessObjectFactory()
			.getIRODSFileFactory(irodsAccount).instanceIRODSFile(id);

	if (!docFile.exists()) {
		throw new FileNotFoundException("file not found");
	}

	if (docFile.isDirectory()) {
		return retriveCollectionForId(docFile);
	} else {
		return retriveDataObjectForId(docFile);
	}

}
 
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:25,代码来源:DocumentMapper.java

示例10: delete

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
    final List<Path> deleted = new ArrayList<Path>();
    for(Path file : files) {
        boolean skip = false;
        for(Path d : deleted) {
            if(file.isChild(d)) {
                skip = true;
                break;
            }
        }
        if(skip) {
            continue;
        }
        deleted.add(file);
        callback.delete(file);
        try {
            final IRODSFile f = session.getClient().getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
            if(!f.exists()) {
                throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute()));
            }
            if(f.isFile()) {
                session.getClient().fileDeleteForce(f);
            }
            else if(f.isDirectory()) {
                session.getClient().directoryDeleteForce(f);
            }
        }
        catch(JargonException e) {
            throw new IRODSExceptionMappingService().map("Cannot delete {0}", e, file);
        }
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:34,代码来源:IRODSDeleteFeature.java

示例11: statusCallback

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public FileStatusCallbackResponse statusCallback(final org.irods.jargon.core.transfer.TransferStatus t) throws JargonException {
    if(log.isDebugEnabled()) {
        log.debug(String.format("Progress with %s", t));
    }
    final long bytes = t.getBytesTransfered() - status.getOffset();
    status.progress(bytes);
    switch(t.getTransferType()) {
        case GET:
            listener.recv(bytes);
            break;
        case PUT:
            listener.sent(bytes);
            break;
    }
    if(status.isCanceled()) {
        if(log.isDebugEnabled()) {
            log.debug(String.format("Set canceled for block %s", block));
        }
        block.setCancelled(true);
        return FileStatusCallbackResponse.SKIP;
    }
    else {
        if(!t.isIntraFileStatusReport()) {
            if(t.getTotalFilesTransferredSoFar() == t.getTotalFilesToTransfer()) {
                status.setComplete();
            }
        }
    }
    return FileStatusCallbackResponse.CONTINUE;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:32,代码来源:DefaultTransferStatusCallbackListener.java

示例12: touch

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final int descriptor = fs.createFile(file.getAbsolute(),
                DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE);
        fs.fileClose(descriptor, false);
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file);
    }
    return file;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:14,代码来源:IRODSTouchFeature.java

示例13: find

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public boolean find(final Path file) throws BackgroundException {
    if(file.isRoot()) {
        return true;
    }
    try {
        final IRODSFileSystemAO fs = session.getClient();
        final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
        return fs.isFileExists(f);
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map("Failure to read attributes of {0}", e, file);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:IRODSFindFeature.java

示例14: logout

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
protected void logout() throws BackgroundException {
    try {
        client.getIRODSSession().closeSession();
    }
    catch(JargonException e) {
        throw new IRODSExceptionMappingService().map(e);
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:10,代码来源:IRODSSession.java

示例15: toURI

import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public URI toURI(final boolean includePassword) throws JargonException {
    try {
        return new URI(String.format("irods://%s.%s%[email protected]%s:%d%s",
                this.getUserName(),
                this.getZone(),
                includePassword ? String.format(":%s", this.getPassword()) : StringUtils.EMPTY,
                this.getHost(),
                this.getPort(),
                URIEncoder.encode(this.getHomeDirectory())));
    }
    catch(URISyntaxException e) {
        throw new JargonException(e.getMessage());
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:16,代码来源:IRODSSession.java


注:本文中的org.irods.jargon.core.exception.JargonException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。