本文整理汇总了Java中org.irods.jargon.core.pub.io.IRODSFile类的典型用法代码示例。如果您正苦于以下问题:Java IRODSFile类的具体用法?Java IRODSFile怎么用?Java IRODSFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRODSFile类属于org.irods.jargon.core.pub.io包,在下文中一共展示了IRODSFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: list
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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.pub.io.IRODSFile; //导入依赖的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: move
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例4: retrieveFile
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例5: retrieveDocumentForId
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例6: delete
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例7: find
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例8: mkdir
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例9: download
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例10: create_user_folder
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的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
示例11: getObject
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
public IrodsObject getObject(String irodsPath) throws IrodsException {
while (irodsPath.endsWith("/")) {
irodsPath = irodsPath.substring(0, irodsPath.length() - 1);
}
try {
IRODSFile irodsFile = irodsFileFactory.instanceIRODSFile(irodsPath);
return new JargonObject(this, irodsFile);
} catch (Exception ex) {
throw new IrodsException(ex);
}
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:12,代码来源:JargonConnection.java
示例12: getParentCollection
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
public JargonCollection getParentCollection() throws IrodsException {
IRODSFile p;
try {
if (irodsFile.getParent() == null || irodsFile.getParent().isEmpty()) {
return null;
}
p = conn.irodsFileFactory.instanceIRODSFile(irodsFile.getParent());
} catch (JargonException ex) {
throw new IrodsException(ex);
}
return new JargonCollection(conn, p);
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:13,代码来源:JargonCollection.java
示例13: listCollections
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
public Collection<IrodsCollection> listCollections() throws IrodsException {
List<IrodsCollection> l = new ArrayList<IrodsCollection>();
for (File f : irodsFile.listFiles()) {
if (f instanceof IRODSFile && f.isDirectory()) {
l.add(new JargonCollection(conn, (IRODSFile) f));
}
}
return l;
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:10,代码来源:JargonCollection.java
示例14: listFiles
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
public Collection<IrodsFile> listFiles() throws IrodsException {
List<IrodsFile> l = new ArrayList<IrodsFile>();
for (File f : irodsFile.listFiles()) {
if (f instanceof IRODSFile && f.isFile()) {
l.add(new JargonFile(conn, (IRODSFile) f));
}
}
return l;
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:10,代码来源:JargonCollection.java
示例15: upload
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
@Override
public Checksum upload(final Path file, final Local local, final BandwidthThrottle throttle,
final StreamListener listener, final TransferStatus status,
final ConnectionCallback callback) throws BackgroundException {
try {
final IRODSFileSystemAO fs = session.getClient();
final IRODSFile f = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute());
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.putOperation(new File(local.getAbsolute()), f, new DefaultTransferStatusCallbackListener(
status, listener, block
), block);
if(status.isComplete()) {
final DataObjectChecksumUtilitiesAO checksum = fs
.getIRODSAccessObjectFactory()
.getDataObjectChecksumUtilitiesAO(fs.getIRODSAccount());
final ChecksumValue value = checksum.computeChecksumOnDataObject(f);
final Checksum fingerprint = Checksum.parse(value.getChecksumStringValue());
if(null == fingerprint) {
log.warn(String.format("Unsupported checksum algorithm %s", value.getChecksumEncoding()));
}
else {
if(file.getType().contains(Path.Type.encrypted)) {
log.warn(String.format("Skip checksum verification for %s with client side encryption enabled", file));
}
else {
final Checksum expected = ChecksumComputeFactory.get(fingerprint.algorithm).compute(local.getInputStream(), status);
if(!expected.equals(fingerprint)) {
throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()),
MessageFormat.format("Mismatch between {0} hash {1} of uploaded data and ETag {2} returned by the server",
fingerprint.algorithm.toString(), expected, fingerprint.hash));
}
}
}
return fingerprint;
}
return null;
}
catch(JargonException e) {
throw new IRODSExceptionMappingService().map(e);
}
}
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:47,代码来源:IRODSUploadFeature.java
示例16: import_to_directory_recovery
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
public void import_to_directory_recovery(IRODSAccount account, String sourceFilePath, String irodsPath,
String targetFileName, String userName, String datasetURI, String creationDate, String datasetName,
String datasetType, String recoveryFolderName)
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 recoveryFolderPath = irodsPath + "/" + recoveryFolderName + "/";
IRODSFile targetFileFolder = irodsFileFactory.instanceIRODSFile(recoveryFolderPath);
targetFileFolder.mkdir();
String targetFilePath = recoveryFolderPath;// + "/" + datasetName + "/";
IRODSFile targetFile = irodsFileFactory.instanceIRODSFile(targetFilePath);
targetFile.mkdir();
// targetFilePath = irodsPath + targetFileName;
targetFilePath = targetFilePath + targetFileName;
targetFile = irodsFileFactory.instanceIRODSFile(targetFilePath);
DataTransferOperations dataTransferOperationsAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(account);
dataTransferOperationsAO.putOperation(sourceFile, targetFile, null, null);
DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(account);
dataObjectAO.findByAbsolutePath(targetFile.getAbsolutePath());
AvuData avuData = new AvuData();
avuData.setAttribute(USERNAME_LABEL);
avuData.setValue(userName);
AvuData avuData2 = new AvuData();
avuData2.setAttribute(DATASET_URI_LABEL);
avuData2.setValue(datasetURI);
AvuData avuData3 = new AvuData();
avuData3.setAttribute(CREATION_DATE_LABEL);
avuData3.setValue(creationDate);
AvuData avuData4 = new AvuData();
avuData4.setAttribute(DATASET_TITLE_LABEL);
avuData4.setValue(datasetName);
AvuData avuData5 = new AvuData();
avuData5.setAttribute(DATASET_TYPE_LABEL);
avuData5.setValue(datasetType);
dataObjectAO.addAVUMetadata(targetFile.getAbsolutePath(), avuData);
dataObjectAO.addAVUMetadata(targetFile.getAbsolutePath(), avuData2);
dataObjectAO.addAVUMetadata(targetFile.getAbsolutePath(), avuData3);
dataObjectAO.addAVUMetadata(targetFile.getAbsolutePath(), avuData4);
dataObjectAO.addAVUMetadata(targetFile.getAbsolutePath(), avuData5);
}
开发者ID:isl,项目名称:LifeWatch_Greece,代码行数:74,代码来源:ContentStorageService.java
示例17: JargonFile
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
JargonFile(JargonConnection conn, IRODSFile irodsFile) {
super(conn, irodsFile);
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:4,代码来源:JargonFile.java
示例18: JargonObject
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
JargonObject(JargonConnection conn, IRODSFile irodsFile) {
this.conn = conn;
this.irodsFile = irodsFile;
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:5,代码来源:JargonObject.java
示例19: JargonCollection
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
JargonCollection(JargonConnection conn, IRODSFile irodsFile) {
super(conn, irodsFile);
}
开发者ID:EUDAT-GEF,项目名称:IrodsLink,代码行数:4,代码来源:JargonCollection.java
示例20: retriveDataObjectForId
import org.irods.jargon.core.pub.io.IRODSFile; //导入依赖的package包/类
private Document retriveDataObjectForId(IRODSFile docFile) {
// TODO Auto-generated method stub
return null;
}
开发者ID:michael-conway,项目名称:jargon-modeshape,代码行数:5,代码来源:DocumentMapper.java
注:本文中的org.irods.jargon.core.pub.io.IRODSFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论