use of org.dcache.srm.v2_2.SrmGetSpaceMetaDataResponse in project dcache by dCache.
the class AxisSrmFileSystem method getSpaceMetaData.
@Nonnull
@Override
public TMetaDataSpace[] getSpaceMetaData(String... spaceTokens) throws RemoteException, SRMException {
checkArgument(spaceTokens.length > 0);
SrmGetSpaceMetaDataResponse response = srm.srmGetSpaceMetaData(new SrmGetSpaceMetaDataRequest(null, new ArrayOfString(spaceTokens)));
TMetaDataSpace[] spaceDataArray = response.getArrayOfSpaceDetails().getSpaceDataArray();
if (spaceDataArray == null || spaceDataArray.length == 0) {
checkSuccess(response.getReturnStatus(), TStatusCode.SRM_SUCCESS, TStatusCode.SRM_PARTIAL_SUCCESS);
throw new SrmProtocolException("Server reply lacks space meta data.");
} else {
checkSuccess(response.getReturnStatus(), TStatusCode.SRM_SUCCESS, TStatusCode.SRM_PARTIAL_SUCCESS, TStatusCode.SRM_FAILURE);
}
return spaceDataArray;
}
use of org.dcache.srm.v2_2.SrmGetSpaceMetaDataResponse in project dcache by dCache.
the class SrmGetSpaceMetaData method srmGetSpaceMetaData.
private SrmGetSpaceMetaDataResponse srmGetSpaceMetaData() throws SRMException {
String[] spaceTokens = request.getArrayOfSpaceTokens().getStringArray();
if (spaceTokens == null || spaceTokens.length == 0) {
throw new SRMInvalidRequestException("arrayOfSpaceToken is empty");
}
TMetaDataSpace[] array = storage.srmGetSpaceMetaData(user, spaceTokens);
return new SrmGetSpaceMetaDataResponse(getSummaryReturnStatus(array), new ArrayOfTMetaDataSpace(array));
}
use of org.dcache.srm.v2_2.SrmGetSpaceMetaDataResponse in project dcache by dCache.
the class SRMGetSpaceMetaDataClientV2 method start.
@Override
public void start() throws Exception {
checkCredentialValid();
try {
String[] tokens = configuration.getSpaceTokensList();
SrmGetSpaceMetaDataRequest request = new SrmGetSpaceMetaDataRequest();
request.setArrayOfSpaceTokens(new ArrayOfString(tokens));
SrmGetSpaceMetaDataResponse response = srm.srmGetSpaceMetaData(request);
if (response == null) {
throw new IOException(" null SrmGetSpaceMetaDataResponse");
}
TReturnStatus rs = response.getReturnStatus();
if (rs == null) {
throw new IOException(" null TReturnStatus ");
}
if (RequestStatusTool.isFailedRequestStatus(rs)) {
throw new IOException("SrmGetSpaceMetaData failed, unexpected or failed return status : " + rs.getStatusCode() + " explanation=" + rs.getExplanation());
}
TMetaDataSpace[] spaceMetaDatas = response.getArrayOfSpaceDetails().getSpaceDataArray();
for (TMetaDataSpace spaceMetaData : spaceMetaDatas) {
System.out.println("Space Reservation with token=" + spaceMetaData.getSpaceToken());
if (spaceMetaData.getStatus().getStatusCode() != TStatusCode.SRM_SUCCESS) {
System.out.println("\t StatusCode=" + spaceMetaData.getStatus().getStatusCode() + " explanation=" + spaceMetaData.getStatus().getExplanation());
continue;
}
System.out.println("\t owner:" + spaceMetaData.getOwner());
System.out.println("\t totalSize:" + spaceMetaData.getTotalSize());
System.out.println("\t guaranteedSize:" + spaceMetaData.getGuaranteedSize());
System.out.println("\t unusedSize:" + spaceMetaData.getUnusedSize());
System.out.println("\tlifetimeAssigned:" + spaceMetaData.getLifetimeAssigned());
System.out.println("\t lifetimeLeft:" + spaceMetaData.getLifetimeLeft());
TRetentionPolicyInfo policyInfo = spaceMetaData.getRetentionPolicyInfo();
if (policyInfo != null) {
System.out.println("\t accessLatency:" + policyInfo.getAccessLatency());
System.out.println("\t retentionPolicy:" + policyInfo.getRetentionPolicy());
}
}
} catch (Exception e) {
throw e;
}
}
use of org.dcache.srm.v2_2.SrmGetSpaceMetaDataResponse in project dcache by dCache.
the class SrmGetSpaceMetaData method getFailedResponse.
public static final SrmGetSpaceMetaDataResponse getFailedResponse(String text, TStatusCode statusCode) {
SrmGetSpaceMetaDataResponse response = new SrmGetSpaceMetaDataResponse();
response.setReturnStatus(new TReturnStatus(statusCode, text));
return response;
}
Aggregations