本文整理汇总了Java中org.irods.jargon.core.exception.JargonException类的典型用法代码示例。如果您正苦于以下问题:Java JargonException类的具体用法?Java JargonException怎么用?Java JargonException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JargonException类属于org.irods.jargon.core.exception包,在下文中一共展示了JargonException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: mkdir
import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
try {
final IRODSFileSystemAO fs = session.getClient();
final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(folder.getAbsolute());
fs.mkdir(f, false);
}
catch(JargonException e) {
throw new IRODSExceptionMappingService().map("Cannot create folder {0}", e, folder);
}
return folder;
}
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:13,代码来源:IRODSDirectoryFeature.java
示例17: download
import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
@Override
public void download(final Path file, final Local local, final BandwidthThrottle throttle,
final StreamListener listener, final TransferStatus status,
final ConnectionCallback connectionCallback, final PasswordCallback passwordCallback) throws BackgroundException {
try {
final IRODSFileSystemAO fs = session.getClient();
final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
if(f.exists()) {
final TransferControlBlock block = DefaultTransferControlBlock.instance(StringUtils.EMPTY,
preferences.getInteger("connection.retry"));
final TransferOptions options = new DefaultTransferOptionsConfigurer().configure(new TransferOptions());
options.setUseParallelTransfer(session.getHost().getTransferType().equals(Host.TransferType.concurrent));
block.setTransferOptions(options);
final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory()
.getDataTransferOperations(fs.getIRODSAccount());
transfer.getOperation(f, new File(local.getAbsolute()),
new DefaultTransferStatusCallbackListener(status, listener, block),
block);
}
else {
throw new NotfoundException(file.getAbsolute());
}
}
catch(JargonException e) {
throw new IRODSExceptionMappingService().map("Download {0} failed", e, file);
}
}
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:28,代码来源:IRODSDownloadFeature.java
示例18: connect_to_content_storage
import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
public IRODSAccount connect_to_content_storage(String host, int port, String username, String password, String path, String zone, String demoResc)
throws JargonException {
logger.debug("Connecting to IRODS-Server[\n\tHost: " + host
+ "\tPort: " + port
+ "\tUsername: " + username
+ "\tPassword: " + password
+ "\tPath: " + path
+ "\tZone: " + zone
+ "\tResource: " + demoResc);
IRODSAccount account = new IRODSAccount(host, 1247, username, password, path, zone, demoResc);
return account;
}
开发者ID:isl,项目名称:LifeWatch_Greece,代码行数:13,代码来源:ContentStorageService.java
示例19: create_user_folder
import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
public void create_user_folder(IRODSAccount account, String sourceFilePath, String irodsPath,
String targetFileName, String userName, String datasetURI, String creationDate, String datasetName,
String datasetType)
throws JargonException {
logger.debug("Importing to IRODS-Server[\n\tiRODS account: " + account.toString()
+ "\tSourceFilePath: " + sourceFilePath
+ "\tiRODSPath: " + irodsPath
+ "\tTargetFileName: " + targetFileName
+ "\tUsername: " + userName
+ "\tDatasetURI: " + datasetURI
+ "\tDatasetName: " + datasetName
+ "\tCreationDate: " + creationDate);
IRODSFileSystem irodsFileSystem = IRODSFileSystem.instance();
DataTransferOperations dataTransferOperations = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(account);
File sourceFile = new File(sourceFilePath);
IRODSFileFactory irodsFileFactory = irodsFileSystem.getIRODSFileFactory(account);
//newFileName = "/tempZone/home/rods/"+newFileName;
String userFolderPath = irodsPath + "/" + userName + "/";
IRODSFile targetFileFolder = irodsFileFactory.instanceIRODSFile(userFolderPath);
targetFileFolder.mkdir();
String targetFilePath = userFolderPath + "/" + datasetName + "/";
IRODSFile targetFile = irodsFileFactory.instanceIRODSFile(targetFilePath);
targetFile.mkdir();
}
开发者ID:isl,项目名称:LifeWatch_Greece,代码行数:36,代码来源:ContentStorageService.java
示例20: search_datasets_by_username
import org.irods.jargon.core.exception.JargonException; //导入依赖的package包/类
public ArrayList<String> search_datasets_by_username(IRODSAccount account, String username) throws JargonException, JargonQueryException {
logger.debug("Searching datasets by username from IRODS-Server[\n\tiRODS account: " + account.toString()
+ "\tUsername: " + username);
IRODSFileSystem irodsFileSystem = IRODSFileSystem.instance();
DataTransferOperations dataTransferOperations = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(account);
//File targetFile = new File(targetFilePath);
IRODSFileFactory irodsFileFactory = irodsFileSystem.getIRODSFileFactory(account);
DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(account);
List<AVUQueryElement> avuQueryElements = new ArrayList<>();
avuQueryElements.add(AVUQueryElement.instanceForValueQuery(AVUQueryElement.AVUQueryPart.VALUE, AVUQueryOperatorEnum.EQUAL, username));
List<DataObject> dobject = dataObjectAO.findDomainByMetadataQuery(avuQueryElements);
ArrayList<String> results = new ArrayList();
for (DataObject actual : dobject) {
results.add(actual.getAbsolutePath());
}
for (String m : results) {
logger.info("Datasets Found:" + m);
}
return results;
}
开发者ID:isl,项目名称:LifeWatch_Greece,代码行数:28,代码来源:ContentStorageService.java
注:本文中的org.irods.jargon.core.exception.JargonException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论