use of org.dcache.srm.v2_2.TFileStorageType in project dcache by dCache.
the class CopyRequestStorage method getContainerRequest.
@Override
protected CopyRequest getContainerRequest(Connection _con, long ID, Long NEXTJOBID, long CREATIONTIME, long LIFETIME, int STATE, SRMUser user, String SCHEDULERID, long SCHEDULER_TIMESTAMP, int NUMOFRETR, long LASTSTATETRANSITIONTIME, Long CREDENTIALID, int RETRYDELTATIME, boolean SHOULDUPDATERETRYDELTATIME, String DESCRIPTION, String CLIENTHOST, String STATUSCODE, ImmutableList<CopyFileRequest> fileRequests, ResultSet set, int next_index) throws SQLException {
Job.JobHistory[] jobHistoryArray = getJobHistory(ID, _con);
String STORAGETYPE = set.getString(next_index++);
String RETENTIONPOLICY = set.getString(next_index++);
String ACCESSLATENCY = set.getString(next_index++);
TFileStorageType storageType = STORAGETYPE == null || STORAGETYPE.equalsIgnoreCase("null") ? null : TFileStorageType.fromString(STORAGETYPE);
TRetentionPolicy retentionPolicy = RETENTIONPOLICY == null || RETENTIONPOLICY.equalsIgnoreCase("null") ? null : TRetentionPolicy.fromString(RETENTIONPOLICY);
TAccessLatency accessLatency = ACCESSLATENCY == null || ACCESSLATENCY.equalsIgnoreCase("null") ? null : TAccessLatency.fromString(ACCESSLATENCY);
return new CopyRequest(srmId, ID, NEXTJOBID, CREATIONTIME, LIFETIME, STATE, user, SCHEDULERID, SCHEDULER_TIMESTAMP, NUMOFRETR, LASTSTATETRANSITIONTIME, jobHistoryArray, CREDENTIALID, fileRequests, RETRYDELTATIME, SHOULDUPDATERETRYDELTATIME, DESCRIPTION, CLIENTHOST, STATUSCODE, storageType, retentionPolicy, accessLatency);
}
use of org.dcache.srm.v2_2.TFileStorageType in project dcache by dCache.
the class SRMLsClientV2 method printResults.
public static void printResults(StringBuffer sb, TMetaDataPathDetail[] ta, int depth, String depthPrefix, boolean longFormat) {
if (ta != null) {
for (int i = 0; i < ta.length; i++) {
TMetaDataPathDetail metaDataPathDetail = ta[i];
if (metaDataPathDetail != null) {
if (metaDataPathDetail.getStatus().getStatusCode() == TStatusCode.fromString(TStatusCode._SRM_INVALID_PATH)) {
sb.append(TStatusCode._SRM_INVALID_PATH).append(" ").append(depthPrefix).append(" File/directory ").append(i).append(" ").append(metaDataPathDetail.getPath()).append(" does not exist. \n");
} else {
sb.append(depthPrefix);
UnsignedLong size = metaDataPathDetail.getSize();
if (size != null) {
sb.append(" ").append(size.longValue());
}
sb.append(" ").append(metaDataPathDetail.getPath());
if (metaDataPathDetail.getType() == TFileType.DIRECTORY) {
sb.append("/");
}
if (metaDataPathDetail.getStatus().getStatusCode() != TStatusCode.SRM_SUCCESS) {
sb.append(" (").append(metaDataPathDetail.getStatus().getStatusCode()).append(",").append(metaDataPathDetail.getStatus().getExplanation()).append(")");
}
sb.append('\n');
if (longFormat) {
sb.append(" space token(s) :");
if (metaDataPathDetail.getArrayOfSpaceTokens() != null) {
for (int j = 0; j < metaDataPathDetail.getArrayOfSpaceTokens().getStringArray().length; j++) {
if (j == metaDataPathDetail.getArrayOfSpaceTokens().getStringArray().length - 1) {
sb.append(metaDataPathDetail.getArrayOfSpaceTokens().getStringArray()[j]);
} else {
sb.append(metaDataPathDetail.getArrayOfSpaceTokens().getStringArray()[j]).append(",");
}
}
} else {
sb.append("none found");
}
sb.append('\n');
TFileStorageType stortype = metaDataPathDetail.getFileStorageType();
if (stortype != null) {
sb.append(depthPrefix);
sb.append(" storage type:").append(stortype.getValue());
sb.append('\n');
} else {
sb.append(" type: null");
sb.append('\n');
}
TRetentionPolicyInfo rpi = metaDataPathDetail.getRetentionPolicyInfo();
if (rpi != null) {
TRetentionPolicy rt = rpi.getRetentionPolicy();
if (rt != null) {
sb.append(depthPrefix);
sb.append(" retention policy:").append(rt.getValue());
sb.append('\n');
} else {
sb.append(" retention policy: null");
sb.append('\n');
}
TAccessLatency al = rpi.getAccessLatency();
if (al != null) {
sb.append(depthPrefix);
sb.append(" access latency:").append(al.getValue());
sb.append('\n');
} else {
sb.append(" access latency: null");
sb.append('\n');
}
} else {
sb.append(" retentionpolicyinfo : null");
sb.append('\n');
}
TFileLocality locality = metaDataPathDetail.getFileLocality();
if (locality != null) {
sb.append(depthPrefix);
sb.append(" locality:").append(locality.getValue());
sb.append('\n');
} else {
sb.append(" locality: null");
sb.append('\n');
}
if (metaDataPathDetail.getCheckSumValue() != null) {
sb.append(depthPrefix).append(" - Checksum value: ").append(metaDataPathDetail.getCheckSumValue()).append('\n');
}
if (metaDataPathDetail.getCheckSumType() != null) {
sb.append(depthPrefix).append(" - Checksum type: ").append(metaDataPathDetail.getCheckSumType()).append('\n');
}
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
FieldPosition tfp = new FieldPosition(DateFormat.FULL);
if (metaDataPathDetail.getOwnerPermission() != null) {
TUserPermission up = metaDataPathDetail.getOwnerPermission();
sb.append(depthPrefix).append(" UserPermission:");
sb.append(" uid=").append(up.getUserID());
sb.append(" Permissions");
sb.append(up.getMode().getValue());
sb.append('\n');
}
if (metaDataPathDetail.getGroupPermission() != null) {
TGroupPermission gp = metaDataPathDetail.getGroupPermission();
sb.append(depthPrefix).append(" GroupPermission:");
sb.append(" gid=").append(gp.getGroupID());
sb.append(" Permissions");
sb.append(gp.getMode().getValue());
sb.append('\n');
}
if (metaDataPathDetail.getOtherPermission() != null) {
sb.append(depthPrefix).append(" WorldPermission: ");
sb.append(metaDataPathDetail.getOtherPermission().getValue());
sb.append('\n');
}
if (metaDataPathDetail.getCreatedAtTime() != null) {
Date tdate = metaDataPathDetail.getCreatedAtTime().getTime();
if (tdate != null) {
StringBuffer dsb = new StringBuffer();
df.format(tdate, dsb, tfp);
sb.append(depthPrefix).append("created at:").append(dsb);
sb.append('\n');
}
}
if (metaDataPathDetail.getLastModificationTime() != null) {
Date tdate = metaDataPathDetail.getLastModificationTime().getTime();
if (tdate != null) {
StringBuffer dsb = new StringBuffer();
df.format(tdate, dsb, tfp);
sb.append(depthPrefix);
sb.append("modified at:").append(dsb);
sb.append('\n');
}
}
if (metaDataPathDetail.getLifetimeAssigned() != null) {
sb.append(depthPrefix).append(" - Assigned lifetime (in seconds): ").append(metaDataPathDetail.getLifetimeAssigned()).append('\n');
}
if (metaDataPathDetail.getLifetimeLeft() != null) {
sb.append(depthPrefix).append(" - Lifetime left (in seconds): ").append(metaDataPathDetail.getLifetimeLeft()).append('\n');
}
sb.append(depthPrefix).append(" - Original SURL: ").append(metaDataPathDetail.getPath()).append('\n').append(" - Status: ").append(metaDataPathDetail.getStatus().getExplanation()).append('\n').append(" - Type: ").append(metaDataPathDetail.getType()).append('\n');
}
if (metaDataPathDetail.getArrayOfSubPaths() != null) {
TMetaDataPathDetail[] subpaths = metaDataPathDetail.getArrayOfSubPaths().getPathDetailArray();
if (subpaths == ta) {
sb.append(depthPrefix).append(" circular subpath reference !!!");
} else {
printResults(sb, subpaths, depth + 1, depthPrefix + " ", longFormat);
}
}
}
}
}
}
}
Aggregations