use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class CBalance method getListOfObjects.
private List<Metadata> getListOfObjects(String bucketName, String SrcDiskId, long size, long offset, String DstDiskId) {
List<Metadata> res;
List<Metadata> list;
// long offset = 0;
long numObjects = 100;
// long job_done = 0;
long size_counter = 0;
int ret;
res = new ArrayList();
ret = objm.startJob();
if (ret != 0)
return res;
do {
list = obmu.listObjects(bucketName, SrcDiskId, 1, offset, numObjects);
if (list == null)
return res;
if (list.isEmpty())
return res;
Iterator<Metadata> it = list.iterator();
while (it.hasNext()) {
totalChecked++;
Metadata mt = it.next();
if (mt.getSize() > size || mt.getSize() <= 0)
continue;
try {
if (!obmu.allowedToReplicate(bucketName, mt.getPrimaryDisk(), mt.getReplicaDisk(), DstDiskId))
continue;
} catch (ResourceNotFoundException ex) {
if (!obmu.allowedToReplicate(bucketName, mt.getPrimaryDisk(), null, DstDiskId))
continue;
}
size_counter = size_counter + mt.getSize();
res.add(mt);
if (size_counter > size)
return res;
}
offset = offset + numObjects;
} while (list.size() == numObjects);
return res;
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class GetAttr method getObjects.
void getObjects() {
Metadata mt;
try {
ObjManagerUtil obmu = new ObjManagerUtil();
if (!ObjectPath.isEmpty())
mt = obmu.getObjectWithPath(bucketName, ObjectPath);
else
mt = obmu.getObject(bucketName, objId);
displayMeta(mt);
} catch (ResourceNotFoundException ex) {
displayNothing();
} catch (Exception ex) {
Logger.getLogger(GetAttr.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class GetObjectMetadata method getObjects.
private int getObjects() {
Metadata mt1;
try {
ObjManagerUtil obmu = new ObjManagerUtil();
mt1 = obmu.getObjectWithPath(mt.getBucket(), mt.getPath());
message = mt1.toString();
return 1;
} catch (ResourceNotFoundException ex) {
message = displayNoInformation();
return 0;
} catch (Exception ex) {
message = dispalyError();
}
return -1;
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class S3Request method open.
protected Metadata open(String bucket, String object) throws GWException {
Metadata meta = null;
try {
setObjManager();
meta = objManager.open(bucket, object);
} catch (ResourceNotFoundException e) {
throw new GWException(GWErrorCode.NO_SUCH_KEY, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
return meta;
}
use of com.pspace.ifs.ksan.objmanager.ObjManagerException.ResourceNotFoundException in project ksan by infinistor.
the class S3Request method getSomeBucket.
protected Bucket getSomeBucket(String bucket) throws GWException {
checkBucket(bucket);
Bucket bucketInfo = null;
try {
setObjManager();
bucketInfo = objManager.getBucket(bucket);
if (bucketInfo != null) {
if (!bucketInfo.getAcl().startsWith(GWConstants.XML_VERSION)) {
bucketInfo.setAcl(GWUtils.makeOriginalXml(bucketInfo.getAcl(), s3Parameter));
}
}
} catch (ResourceNotFoundException e) {
throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
} finally {
try {
releaseObjManager();
} catch (Exception e) {
PrintStack.logging(logger, e);
throw new GWException(GWErrorCode.SERVER_ERROR, s3Parameter);
}
}
if (bucketInfo == null) {
logger.info(GWConstants.LOG_BUCKET_IS_NOT_EXIST, bucket);
throw new GWException(GWErrorCode.NO_SUCH_BUCKET, s3Parameter);
}
return bucketInfo;
}
Aggregations