Repository: airavata Updated Branches: refs/heads/develop 9eede35ba -> a42ccd728
AIRAVATA-1792 Filter stats by username, app name, hostname Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/465f766e Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/465f766e Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/465f766e Branch: refs/heads/develop Commit: 465f766e3555f7287e4593ea67cd50b4312d0bbd Parents: 84f756d Author: Marcus Christie <[email protected]> Authored: Mon Dec 12 14:06:53 2016 -0500 Committer: Marcus Christie <[email protected]> Committed: Mon Dec 12 14:06:53 2016 -0500 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 5 +- .../java/org/apache/airavata/api/Airavata.java | 357 ++++++++++++++++++- .../resources/lib/Airavata/API/Airavata.php | 84 ++++- .../catalog/impl/ExperimentRegistry.java | 5 +- .../catalog/resources/WorkerResource.java | 37 +- .../airavata/registry/cpi/utils/Constants.java | 1 + .../service/handler/RegistryServerHandler.java | 11 +- .../airavata/registry/api/RegistryService.java | 357 ++++++++++++++++++- .../airavata-apis/airavata_api.thrift | 6 +- .../component-cpis/registry-api.thrift | 6 +- 10 files changed, 822 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index 10d2217..89be995 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -940,10 +940,11 @@ public class AiravataServerHandler implements Airavata.Iface { */ @Override @SecurityCheck - public ExperimentStatistics getExperimentStatistics(AuthzToken authzToken, String gatewayId, long fromTime, long toTime) + public ExperimentStatistics getExperimentStatistics(AuthzToken authzToken, String gatewayId, long fromTime, long toTime, + String userName, String applicationName, String resourceHostName) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { try { - return getRegistryServiceClient().getExperimentStatistics(gatewayId, fromTime, toTime); + return getRegistryServiceClient().getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); }catch (Exception e) { logger.error("Error while retrieving experiments", e); AiravataSystemException exception = new AiravataSystemException(); http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 78d2810..c997dfa 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -556,8 +556,11 @@ public class Airavata { * @param gatewayId * @param fromTime * @param toTime + * @param userName + * @param applicationName + * @param resourceHostName */ - public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** * @@ -3065,7 +3068,7 @@ public class Airavata { public void searchExperiments(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, String userName, Map<org.apache.airavata.model.experiment.ExperimentSearchFields,String> filters, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getExperimentsInProject(org.apache.airavata.model.security.AuthzToken authzToken, String projectId, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -4450,19 +4453,22 @@ public class Airavata { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "searchExperiments failed: unknown result"); } - public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException + public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException { - send_getExperimentStatistics(authzToken, gatewayId, fromTime, toTime); + send_getExperimentStatistics(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); return recv_getExperimentStatistics(); } - public void send_getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime) throws org.apache.thrift.TException + public void send_getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.thrift.TException { getExperimentStatistics_args args = new getExperimentStatistics_args(); args.setAuthzToken(authzToken); args.setGatewayId(gatewayId); args.setFromTime(fromTime); args.setToTime(toTime); + args.setUserName(userName); + args.setApplicationName(applicationName); + args.setResourceHostName(resourceHostName); sendBase("getExperimentStatistics", args); } @@ -10721,9 +10727,9 @@ public class Airavata { } } - public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getExperimentStatistics_call method_call = new getExperimentStatistics_call(authzToken, gatewayId, fromTime, toTime, resultHandler, this, ___protocolFactory, ___transport); + getExperimentStatistics_call method_call = new getExperimentStatistics_call(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -10733,12 +10739,18 @@ public class Airavata { private String gatewayId; private long fromTime; private long toTime; - public getExperimentStatistics_call(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String userName; + private String applicationName; + private String resourceHostName; + public getExperimentStatistics_call(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.authzToken = authzToken; this.gatewayId = gatewayId; this.fromTime = fromTime; this.toTime = toTime; + this.userName = userName; + this.applicationName = applicationName; + this.resourceHostName = resourceHostName; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { @@ -10748,6 +10760,9 @@ public class Airavata { args.setGatewayId(gatewayId); args.setFromTime(fromTime); args.setToTime(toTime); + args.setUserName(userName); + args.setApplicationName(applicationName); + args.setResourceHostName(resourceHostName); args.write(prot); prot.writeMessageEnd(); } @@ -17011,7 +17026,7 @@ public class Airavata { public getExperimentStatistics_result getResult(I iface, getExperimentStatistics_args args) throws org.apache.thrift.TException { getExperimentStatistics_result result = new getExperimentStatistics_result(); try { - result.success = iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime); + result.success = iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName); } catch (org.apache.airavata.model.error.InvalidRequestException ire) { result.ire = ire; } catch (org.apache.airavata.model.error.AiravataClientException ace) { @@ -23629,7 +23644,7 @@ public class Airavata { } public void start(I iface, getExperimentStatistics_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws TException { - iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime,resultHandler); + iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName,resultHandler); } } @@ -73751,6 +73766,9 @@ public class Airavata { private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField FROM_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("fromTime", org.apache.thrift.protocol.TType.I64, (short)3); private static final org.apache.thrift.protocol.TField TO_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("toTime", org.apache.thrift.protocol.TType.I64, (short)4); + private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)6); + private static final org.apache.thrift.protocol.TField RESOURCE_HOST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceHostName", org.apache.thrift.protocol.TType.STRING, (short)7); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -73762,13 +73780,19 @@ public class Airavata { public String gatewayId; // required public long fromTime; // required public long toTime; // required + public String userName; // required + public String applicationName; // required + public String resourceHostName; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { AUTHZ_TOKEN((short)1, "authzToken"), GATEWAY_ID((short)2, "gatewayId"), FROM_TIME((short)3, "fromTime"), - TO_TIME((short)4, "toTime"); + TO_TIME((short)4, "toTime"), + USER_NAME((short)5, "userName"), + APPLICATION_NAME((short)6, "applicationName"), + RESOURCE_HOST_NAME((short)7, "resourceHostName"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -73791,6 +73815,12 @@ public class Airavata { return FROM_TIME; case 4: // TO_TIME return TO_TIME; + case 5: // USER_NAME + return USER_NAME; + case 6: // APPLICATION_NAME + return APPLICATION_NAME; + case 7: // RESOURCE_HOST_NAME + return RESOURCE_HOST_NAME; default: return null; } @@ -73845,6 +73875,12 @@ public class Airavata { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.TO_TIME, new org.apache.thrift.meta_data.FieldMetaData("toTime", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("applicationName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.RESOURCE_HOST_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceHostName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getExperimentStatistics_args.class, metaDataMap); } @@ -73856,7 +73892,10 @@ public class Airavata { org.apache.airavata.model.security.AuthzToken authzToken, String gatewayId, long fromTime, - long toTime) + long toTime, + String userName, + String applicationName, + String resourceHostName) { this(); this.authzToken = authzToken; @@ -73865,6 +73904,9 @@ public class Airavata { setFromTimeIsSet(true); this.toTime = toTime; setToTimeIsSet(true); + this.userName = userName; + this.applicationName = applicationName; + this.resourceHostName = resourceHostName; } /** @@ -73880,6 +73922,15 @@ public class Airavata { } this.fromTime = other.fromTime; this.toTime = other.toTime; + if (other.isSetUserName()) { + this.userName = other.userName; + } + if (other.isSetApplicationName()) { + this.applicationName = other.applicationName; + } + if (other.isSetResourceHostName()) { + this.resourceHostName = other.resourceHostName; + } } public getExperimentStatistics_args deepCopy() { @@ -73894,6 +73945,9 @@ public class Airavata { this.fromTime = 0; setToTimeIsSet(false); this.toTime = 0; + this.userName = null; + this.applicationName = null; + this.resourceHostName = null; } public org.apache.airavata.model.security.AuthzToken getAuthzToken() { @@ -73990,6 +74044,78 @@ public class Airavata { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTIME_ISSET_ID, value); } + public String getUserName() { + return this.userName; + } + + public getExperimentStatistics_args setUserName(String userName) { + this.userName = userName; + return this; + } + + public void unsetUserName() { + this.userName = null; + } + + /** Returns true if field userName is set (has been assigned a value) and false otherwise */ + public boolean isSetUserName() { + return this.userName != null; + } + + public void setUserNameIsSet(boolean value) { + if (!value) { + this.userName = null; + } + } + + public String getApplicationName() { + return this.applicationName; + } + + public getExperimentStatistics_args setApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + public void unsetApplicationName() { + this.applicationName = null; + } + + /** Returns true if field applicationName is set (has been assigned a value) and false otherwise */ + public boolean isSetApplicationName() { + return this.applicationName != null; + } + + public void setApplicationNameIsSet(boolean value) { + if (!value) { + this.applicationName = null; + } + } + + public String getResourceHostName() { + return this.resourceHostName; + } + + public getExperimentStatistics_args setResourceHostName(String resourceHostName) { + this.resourceHostName = resourceHostName; + return this; + } + + public void unsetResourceHostName() { + this.resourceHostName = null; + } + + /** Returns true if field resourceHostName is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceHostName() { + return this.resourceHostName != null; + } + + public void setResourceHostNameIsSet(boolean value) { + if (!value) { + this.resourceHostName = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case AUTHZ_TOKEN: @@ -74024,6 +74150,30 @@ public class Airavata { } break; + case USER_NAME: + if (value == null) { + unsetUserName(); + } else { + setUserName((String)value); + } + break; + + case APPLICATION_NAME: + if (value == null) { + unsetApplicationName(); + } else { + setApplicationName((String)value); + } + break; + + case RESOURCE_HOST_NAME: + if (value == null) { + unsetResourceHostName(); + } else { + setResourceHostName((String)value); + } + break; + } } @@ -74041,6 +74191,15 @@ public class Airavata { case TO_TIME: return getToTime(); + case USER_NAME: + return getUserName(); + + case APPLICATION_NAME: + return getApplicationName(); + + case RESOURCE_HOST_NAME: + return getResourceHostName(); + } throw new IllegalStateException(); } @@ -74060,6 +74219,12 @@ public class Airavata { return isSetFromTime(); case TO_TIME: return isSetToTime(); + case USER_NAME: + return isSetUserName(); + case APPLICATION_NAME: + return isSetApplicationName(); + case RESOURCE_HOST_NAME: + return isSetResourceHostName(); } throw new IllegalStateException(); } @@ -74113,6 +74278,33 @@ public class Airavata { return false; } + boolean this_present_userName = true && this.isSetUserName(); + boolean that_present_userName = true && that.isSetUserName(); + if (this_present_userName || that_present_userName) { + if (!(this_present_userName && that_present_userName)) + return false; + if (!this.userName.equals(that.userName)) + return false; + } + + boolean this_present_applicationName = true && this.isSetApplicationName(); + boolean that_present_applicationName = true && that.isSetApplicationName(); + if (this_present_applicationName || that_present_applicationName) { + if (!(this_present_applicationName && that_present_applicationName)) + return false; + if (!this.applicationName.equals(that.applicationName)) + return false; + } + + boolean this_present_resourceHostName = true && this.isSetResourceHostName(); + boolean that_present_resourceHostName = true && that.isSetResourceHostName(); + if (this_present_resourceHostName || that_present_resourceHostName) { + if (!(this_present_resourceHostName && that_present_resourceHostName)) + return false; + if (!this.resourceHostName.equals(that.resourceHostName)) + return false; + } + return true; } @@ -74140,6 +74332,21 @@ public class Airavata { if (present_toTime) list.add(toTime); + boolean present_userName = true && (isSetUserName()); + list.add(present_userName); + if (present_userName) + list.add(userName); + + boolean present_applicationName = true && (isSetApplicationName()); + list.add(present_applicationName); + if (present_applicationName) + list.add(applicationName); + + boolean present_resourceHostName = true && (isSetResourceHostName()); + list.add(present_resourceHostName); + if (present_resourceHostName) + list.add(resourceHostName); + return list.hashCode(); } @@ -74191,6 +74398,36 @@ public class Airavata { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetApplicationName()).compareTo(other.isSetApplicationName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetApplicationName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationName, other.applicationName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetResourceHostName()).compareTo(other.isSetResourceHostName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceHostName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceHostName, other.resourceHostName); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -74234,6 +74471,30 @@ public class Airavata { sb.append("toTime:"); sb.append(this.toTime); first = false; + if (!first) sb.append(", "); + sb.append("userName:"); + if (this.userName == null) { + sb.append("null"); + } else { + sb.append(this.userName); + } + first = false; + if (!first) sb.append(", "); + sb.append("applicationName:"); + if (this.applicationName == null) { + sb.append("null"); + } else { + sb.append(this.applicationName); + } + first = false; + if (!first) sb.append(", "); + sb.append("resourceHostName:"); + if (this.resourceHostName == null) { + sb.append("null"); + } else { + sb.append(this.resourceHostName); + } + first = false; sb.append(")"); return sb.toString(); } @@ -74323,6 +74584,30 @@ public class Airavata { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 5: // USER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userName = iprot.readString(); + struct.setUserNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // APPLICATION_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // RESOURCE_HOST_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceHostName = iprot.readString(); + struct.setResourceHostNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -74360,6 +74645,21 @@ public class Airavata { oprot.writeFieldBegin(TO_TIME_FIELD_DESC); oprot.writeI64(struct.toTime); oprot.writeFieldEnd(); + if (struct.userName != null) { + oprot.writeFieldBegin(USER_NAME_FIELD_DESC); + oprot.writeString(struct.userName); + oprot.writeFieldEnd(); + } + if (struct.applicationName != null) { + oprot.writeFieldBegin(APPLICATION_NAME_FIELD_DESC); + oprot.writeString(struct.applicationName); + oprot.writeFieldEnd(); + } + if (struct.resourceHostName != null) { + oprot.writeFieldBegin(RESOURCE_HOST_NAME_FIELD_DESC); + oprot.writeString(struct.resourceHostName); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -74381,6 +74681,26 @@ public class Airavata { oprot.writeString(struct.gatewayId); oprot.writeI64(struct.fromTime); oprot.writeI64(struct.toTime); + BitSet optionals = new BitSet(); + if (struct.isSetUserName()) { + optionals.set(0); + } + if (struct.isSetApplicationName()) { + optionals.set(1); + } + if (struct.isSetResourceHostName()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetUserName()) { + oprot.writeString(struct.userName); + } + if (struct.isSetApplicationName()) { + oprot.writeString(struct.applicationName); + } + if (struct.isSetResourceHostName()) { + oprot.writeString(struct.resourceHostName); + } } @Override @@ -74395,6 +74715,19 @@ public class Airavata { struct.setFromTimeIsSet(true); struct.toTime = iprot.readI64(); struct.setToTimeIsSet(true); + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.userName = iprot.readString(); + struct.setUserNameIsSet(true); + } + if (incoming.get(1)) { + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + } + if (incoming.get(2)) { + struct.resourceHostName = iprot.readString(); + struct.setResourceHostNameIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index f235e48..cc90cc6 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -651,19 +651,23 @@ interface AiravataIf { * @param toTime * Ending data time. * + * TODO update docs * * * @param \Airavata\Model\Security\AuthzToken $authzToken * @param string $gatewayId * @param int $fromTime * @param int $toTime + * @param string $userName + * @param string $applicationName + * @param string $resourceHostName * @return \Airavata\Model\Experiment\ExperimentStatistics * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException * @throws \Airavata\API\Error\AuthorizationException */ - public function getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime); + public function getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime, $userName, $applicationName, $resourceHostName); /** * * Get All Experiments of the Project @@ -6013,19 +6017,22 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("searchExperiments failed: unknown result"); } - public function getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime) + public function getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime, $userName, $applicationName, $resourceHostName) { - $this->send_getExperimentStatistics($authzToken, $gatewayId, $fromTime, $toTime); + $this->send_getExperimentStatistics($authzToken, $gatewayId, $fromTime, $toTime, $userName, $applicationName, $resourceHostName); return $this->recv_getExperimentStatistics(); } - public function send_getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime) + public function send_getExperimentStatistics(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $fromTime, $toTime, $userName, $applicationName, $resourceHostName) { $args = new \Airavata\API\Airavata_getExperimentStatistics_args(); $args->authzToken = $authzToken; $args->gatewayId = $gatewayId; $args->fromTime = $fromTime; $args->toTime = $toTime; + $args->userName = $userName; + $args->applicationName = $applicationName; + $args->resourceHostName = $resourceHostName; $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { @@ -24221,6 +24228,18 @@ class Airavata_getExperimentStatistics_args { * @var int */ public $toTime = null; + /** + * @var string + */ + public $userName = null; + /** + * @var string + */ + public $applicationName = null; + /** + * @var string + */ + public $resourceHostName = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -24242,6 +24261,18 @@ class Airavata_getExperimentStatistics_args { 'var' => 'toTime', 'type' => TType::I64, ), + 5 => array( + 'var' => 'userName', + 'type' => TType::STRING, + ), + 6 => array( + 'var' => 'applicationName', + 'type' => TType::STRING, + ), + 7 => array( + 'var' => 'resourceHostName', + 'type' => TType::STRING, + ), ); } if (is_array($vals)) { @@ -24257,6 +24288,15 @@ class Airavata_getExperimentStatistics_args { if (isset($vals['toTime'])) { $this->toTime = $vals['toTime']; } + if (isset($vals['userName'])) { + $this->userName = $vals['userName']; + } + if (isset($vals['applicationName'])) { + $this->applicationName = $vals['applicationName']; + } + if (isset($vals['resourceHostName'])) { + $this->resourceHostName = $vals['resourceHostName']; + } } } @@ -24308,6 +24348,27 @@ class Airavata_getExperimentStatistics_args { $xfer += $input->skip($ftype); } break; + case 5: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->userName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->applicationName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->resourceHostName); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -24344,6 +24405,21 @@ class Airavata_getExperimentStatistics_args { $xfer += $output->writeI64($this->toTime); $xfer += $output->writeFieldEnd(); } + if ($this->userName !== null) { + $xfer += $output->writeFieldBegin('userName', TType::STRING, 5); + $xfer += $output->writeString($this->userName); + $xfer += $output->writeFieldEnd(); + } + if ($this->applicationName !== null) { + $xfer += $output->writeFieldBegin('applicationName', TType::STRING, 6); + $xfer += $output->writeString($this->applicationName); + $xfer += $output->writeFieldEnd(); + } + if ($this->resourceHostName !== null) { + $xfer += $output->writeFieldBegin('resourceHostName', TType::STRING, 7); + $xfer += $output->writeString($this->resourceHostName); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java index 9b8ab09..0301399 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java @@ -1444,7 +1444,10 @@ public class ExperimentRegistry { ExperimentStatisticsResource experimentStatisticsResource = workerResource.getExperimentStatistics( filters.get(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.FROM_DATE))), - new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))) + new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))), + filters.get(Constants.FieldConstants.ExperimentConstants.USER_NAME), + filters.get(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID), + filters.get(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID) ); experimentStatistics.setAllExperimentCount(experimentStatisticsResource.getAllExperimentCount()); http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java index 16f28e1..50ca874 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/WorkerResource.java @@ -37,6 +37,7 @@ import javax.persistence.EntityManager; import javax.persistence.Query; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -696,33 +697,33 @@ public class WorkerResource extends AbstractExpCatResource { * @return * @throws org.apache.airavata.registry.cpi.RegistryException */ - public ExperimentStatisticsResource getExperimentStatistics(String gatewayId, Timestamp fromTime, Timestamp toTime) throws RegistryException { + public ExperimentStatisticsResource getExperimentStatistics(String gatewayId, Timestamp fromTime, Timestamp toTime, String userName, String applicationName, String resourceHostName) throws RegistryException { ExperimentStatisticsResource experimentStatisticsResource = new ExperimentStatisticsResource(); - List<ExperimentSummaryResource> allExperiments = getExperimentStatisticsForState(null, gatewayId, fromTime, toTime); + List<ExperimentSummaryResource> allExperiments = getExperimentStatisticsForState(null, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); experimentStatisticsResource.setAllExperimentCount(allExperiments.size()); experimentStatisticsResource.setAllExperiments(allExperiments); - List<ExperimentSummaryResource> createdExperiments = getExperimentStatisticsForState(ExperimentState.CREATED, gatewayId, fromTime, toTime); - createdExperiments.addAll(getExperimentStatisticsForState(ExperimentState.VALIDATED, gatewayId, fromTime, toTime)); + List<ExperimentSummaryResource> createdExperiments = getExperimentStatisticsForState(ExperimentState.CREATED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); + createdExperiments.addAll(getExperimentStatisticsForState(ExperimentState.VALIDATED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName)); experimentStatisticsResource.setCreatedExperimentCount(createdExperiments.size()); experimentStatisticsResource.setCreatedExperiments(createdExperiments); - List<ExperimentSummaryResource> runningExperiments = getExperimentStatisticsForState(ExperimentState.EXECUTING, gatewayId, fromTime, toTime); - runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.SCHEDULED, gatewayId, fromTime, toTime)); - runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.LAUNCHED, gatewayId, fromTime, toTime)); + List<ExperimentSummaryResource> runningExperiments = getExperimentStatisticsForState(ExperimentState.EXECUTING, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); + runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.SCHEDULED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName)); + runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.LAUNCHED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName)); experimentStatisticsResource.setRunningExperimentCount(runningExperiments.size()); experimentStatisticsResource.setRunningExperiments(runningExperiments); - List<ExperimentSummaryResource> completedExperiments = getExperimentStatisticsForState(ExperimentState.COMPLETED, gatewayId, fromTime, toTime); + List<ExperimentSummaryResource> completedExperiments = getExperimentStatisticsForState(ExperimentState.COMPLETED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); experimentStatisticsResource.setCompletedExperimentCount(completedExperiments.size()); experimentStatisticsResource.setCompletedExperiments(completedExperiments); - List<ExperimentSummaryResource> failedExperiments = getExperimentStatisticsForState(ExperimentState.FAILED, gatewayId, fromTime, toTime); + List<ExperimentSummaryResource> failedExperiments = getExperimentStatisticsForState(ExperimentState.FAILED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); experimentStatisticsResource.setFailedExperimentCount(failedExperiments.size()); experimentStatisticsResource.setFailedExperiments(failedExperiments); - List<ExperimentSummaryResource> cancelledExperiments = getExperimentStatisticsForState(ExperimentState.CANCELED, gatewayId, fromTime, toTime); - cancelledExperiments.addAll(getExperimentStatisticsForState(ExperimentState.CANCELING, gatewayId, fromTime, toTime)); + List<ExperimentSummaryResource> cancelledExperiments = getExperimentStatisticsForState(ExperimentState.CANCELED, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); + cancelledExperiments.addAll(getExperimentStatisticsForState(ExperimentState.CANCELING, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName)); experimentStatisticsResource.setCancelledExperimentCount(cancelledExperiments.size()); experimentStatisticsResource.setCancelledExperiments(cancelledExperiments); @@ -730,21 +731,31 @@ public class WorkerResource extends AbstractExpCatResource { } private List<ExperimentSummaryResource> getExperimentStatisticsForState( - ExperimentState expState, String gatewayId, Timestamp fromTime, Timestamp toTime) throws RegistryException { + ExperimentState expState, String gatewayId, Timestamp fromTime, Timestamp toTime, + String userName, String applicationName, String resourceHostName) throws RegistryException { EntityManager em = null; List<ExperimentSummaryResource> result = new ArrayList(); try { + Map<String, Object> queryParameters = new HashMap<>(); String query = "SELECT e FROM ExperimentSummary e " + "WHERE "; if (expState != null) { query += "e.state='" + expState.toString() + "' AND "; } query += "e.creationTime > '" + fromTime + "' " + "AND e.creationTime <'" + toTime + "' AND "; - query += "e." + ExperimentConstants.GATEWAY_ID + "= '" + gatewayId + "' ORDER BY e.creationTime DESC"; + query += "e." + ExperimentConstants.GATEWAY_ID + "= '" + gatewayId + "' "; + if (userName != null) { + query += "AND e.userName = :userName "; + queryParameters.put("userName", userName); + } + query += "ORDER BY e.creationTime DESC"; em = ExpCatResourceUtils.getEntityManager(); em.getTransaction().begin(); Query q = em.createQuery(query); + for (String parameterName : queryParameters.keySet()) { + q.setParameter(parameterName, queryParameters.get(parameterName)); + } List resultList = q.getResultList(); for (Object o : resultList) { http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java index 581cdae..10bf408 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/Constants.java @@ -52,6 +52,7 @@ public class Constants { public static final String USER_CONFIGURATION_DATA = "userConfigurationData"; public static final String FROM_DATE = "fromDate"; public static final String TO_DATE = "toDate"; + public static final String RESOURCE_HOST_ID = "resourceHostId"; } public final class UserConfigurationDataConstants { http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java index 535b265..44a71a9 100644 --- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java +++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java @@ -385,7 +385,7 @@ public class RegistryServerHandler implements RegistryService.Iface { * @param toTime Ending data time. */ @Override - public ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime) throws RegistryServiceException, TException { + public ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws RegistryServiceException, TException { if (!isGatewayExistInternal(gatewayId)){ logger.error("Gateway does not exist.Please provide a valid gateway id..."); throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); @@ -395,6 +395,15 @@ public class RegistryServerHandler implements RegistryService.Iface { filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID, gatewayId); filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, fromTime+""); filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, toTime+""); + if (userName != null) { + filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName); + } + if (applicationName != null) { + filters.put(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID, applicationName); + } + if (resourceHostName != null) { + filters.put(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID, resourceHostName); + } List<Object> results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT_STATISTICS, filters); logger.debug("Airavata retrieved experiments for gateway id : " + gatewayId + " between : " + AiravataUtils.getTime(fromTime) + " and " + AiravataUtils.getTime(toTime)); http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java index 9c4ad05..e5d6d4f 100644 --- a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java +++ b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java @@ -376,8 +376,11 @@ public class RegistryService { * @param gatewayId * @param fromTime * @param toTime + * @param userName + * @param applicationName + * @param resourceHostName */ - public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; + public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; /** * @@ -2460,7 +2463,7 @@ public class RegistryService { public void searchExperiments(String gatewayId, String userName, List<String> accessibleExpIds, Map<org.apache.airavata.model.experiment.ExperimentSearchFields,String> filters, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getExperimentStatistics(String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getExperimentsInProject(String projectId, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -3292,18 +3295,21 @@ public class RegistryService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "searchExperiments failed: unknown result"); } - public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException + public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { - send_getExperimentStatistics(gatewayId, fromTime, toTime); + send_getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName); return recv_getExperimentStatistics(); } - public void send_getExperimentStatistics(String gatewayId, long fromTime, long toTime) throws org.apache.thrift.TException + public void send_getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName) throws org.apache.thrift.TException { getExperimentStatistics_args args = new getExperimentStatistics_args(); args.setGatewayId(gatewayId); args.setFromTime(fromTime); args.setToTime(toTime); + args.setUserName(userName); + args.setApplicationName(applicationName); + args.setResourceHostName(resourceHostName); sendBase("getExperimentStatistics", args); } @@ -7357,9 +7363,9 @@ public class RegistryService { } } - public void getExperimentStatistics(String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getExperimentStatistics_call method_call = new getExperimentStatistics_call(gatewayId, fromTime, toTime, resultHandler, this, ___protocolFactory, ___transport); + getExperimentStatistics_call method_call = new getExperimentStatistics_call(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -7368,11 +7374,17 @@ public class RegistryService { private String gatewayId; private long fromTime; private long toTime; - public getExperimentStatistics_call(String gatewayId, long fromTime, long toTime, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private String userName; + private String applicationName; + private String resourceHostName; + public getExperimentStatistics_call(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.gatewayId = gatewayId; this.fromTime = fromTime; this.toTime = toTime; + this.userName = userName; + this.applicationName = applicationName; + this.resourceHostName = resourceHostName; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { @@ -7381,6 +7393,9 @@ public class RegistryService { args.setGatewayId(gatewayId); args.setFromTime(fromTime); args.setToTime(toTime); + args.setUserName(userName); + args.setApplicationName(applicationName); + args.setResourceHostName(resourceHostName); args.write(prot); prot.writeMessageEnd(); } @@ -12322,7 +12337,7 @@ public class RegistryService { public getExperimentStatistics_result getResult(I iface, getExperimentStatistics_args args) throws org.apache.thrift.TException { getExperimentStatistics_result result = new getExperimentStatistics_result(); try { - result.success = iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime); + result.success = iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName); } catch (org.apache.airavata.registry.api.exception.RegistryServiceException rse) { result.rse = rse; } @@ -16769,7 +16784,7 @@ public class RegistryService { } public void start(I iface, getExperimentStatistics_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws TException { - iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime,resultHandler); + iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName,resultHandler); } } @@ -43336,6 +43351,9 @@ public class RegistryService { private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField FROM_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("fromTime", org.apache.thrift.protocol.TType.I64, (short)2); private static final org.apache.thrift.protocol.TField TO_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("toTime", org.apache.thrift.protocol.TType.I64, (short)3); + private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField RESOURCE_HOST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceHostName", org.apache.thrift.protocol.TType.STRING, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -43346,12 +43364,18 @@ public class RegistryService { public String gatewayId; // required public long fromTime; // required public long toTime; // required + public String userName; // required + public String applicationName; // required + public String resourceHostName; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { GATEWAY_ID((short)1, "gatewayId"), FROM_TIME((short)2, "fromTime"), - TO_TIME((short)3, "toTime"); + TO_TIME((short)3, "toTime"), + USER_NAME((short)4, "userName"), + APPLICATION_NAME((short)5, "applicationName"), + RESOURCE_HOST_NAME((short)6, "resourceHostName"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -43372,6 +43396,12 @@ public class RegistryService { return FROM_TIME; case 3: // TO_TIME return TO_TIME; + case 4: // USER_NAME + return USER_NAME; + case 5: // APPLICATION_NAME + return APPLICATION_NAME; + case 6: // RESOURCE_HOST_NAME + return RESOURCE_HOST_NAME; default: return null; } @@ -43424,6 +43454,12 @@ public class RegistryService { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.TO_TIME, new org.apache.thrift.meta_data.FieldMetaData("toTime", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("applicationName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.RESOURCE_HOST_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceHostName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getExperimentStatistics_args.class, metaDataMap); } @@ -43434,7 +43470,10 @@ public class RegistryService { public getExperimentStatistics_args( String gatewayId, long fromTime, - long toTime) + long toTime, + String userName, + String applicationName, + String resourceHostName) { this(); this.gatewayId = gatewayId; @@ -43442,6 +43481,9 @@ public class RegistryService { setFromTimeIsSet(true); this.toTime = toTime; setToTimeIsSet(true); + this.userName = userName; + this.applicationName = applicationName; + this.resourceHostName = resourceHostName; } /** @@ -43454,6 +43496,15 @@ public class RegistryService { } this.fromTime = other.fromTime; this.toTime = other.toTime; + if (other.isSetUserName()) { + this.userName = other.userName; + } + if (other.isSetApplicationName()) { + this.applicationName = other.applicationName; + } + if (other.isSetResourceHostName()) { + this.resourceHostName = other.resourceHostName; + } } public getExperimentStatistics_args deepCopy() { @@ -43467,6 +43518,9 @@ public class RegistryService { this.fromTime = 0; setToTimeIsSet(false); this.toTime = 0; + this.userName = null; + this.applicationName = null; + this.resourceHostName = null; } public String getGatewayId() { @@ -43539,6 +43593,78 @@ public class RegistryService { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTIME_ISSET_ID, value); } + public String getUserName() { + return this.userName; + } + + public getExperimentStatistics_args setUserName(String userName) { + this.userName = userName; + return this; + } + + public void unsetUserName() { + this.userName = null; + } + + /** Returns true if field userName is set (has been assigned a value) and false otherwise */ + public boolean isSetUserName() { + return this.userName != null; + } + + public void setUserNameIsSet(boolean value) { + if (!value) { + this.userName = null; + } + } + + public String getApplicationName() { + return this.applicationName; + } + + public getExperimentStatistics_args setApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + public void unsetApplicationName() { + this.applicationName = null; + } + + /** Returns true if field applicationName is set (has been assigned a value) and false otherwise */ + public boolean isSetApplicationName() { + return this.applicationName != null; + } + + public void setApplicationNameIsSet(boolean value) { + if (!value) { + this.applicationName = null; + } + } + + public String getResourceHostName() { + return this.resourceHostName; + } + + public getExperimentStatistics_args setResourceHostName(String resourceHostName) { + this.resourceHostName = resourceHostName; + return this; + } + + public void unsetResourceHostName() { + this.resourceHostName = null; + } + + /** Returns true if field resourceHostName is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceHostName() { + return this.resourceHostName != null; + } + + public void setResourceHostNameIsSet(boolean value) { + if (!value) { + this.resourceHostName = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case GATEWAY_ID: @@ -43565,6 +43691,30 @@ public class RegistryService { } break; + case USER_NAME: + if (value == null) { + unsetUserName(); + } else { + setUserName((String)value); + } + break; + + case APPLICATION_NAME: + if (value == null) { + unsetApplicationName(); + } else { + setApplicationName((String)value); + } + break; + + case RESOURCE_HOST_NAME: + if (value == null) { + unsetResourceHostName(); + } else { + setResourceHostName((String)value); + } + break; + } } @@ -43579,6 +43729,15 @@ public class RegistryService { case TO_TIME: return getToTime(); + case USER_NAME: + return getUserName(); + + case APPLICATION_NAME: + return getApplicationName(); + + case RESOURCE_HOST_NAME: + return getResourceHostName(); + } throw new IllegalStateException(); } @@ -43596,6 +43755,12 @@ public class RegistryService { return isSetFromTime(); case TO_TIME: return isSetToTime(); + case USER_NAME: + return isSetUserName(); + case APPLICATION_NAME: + return isSetApplicationName(); + case RESOURCE_HOST_NAME: + return isSetResourceHostName(); } throw new IllegalStateException(); } @@ -43640,6 +43805,33 @@ public class RegistryService { return false; } + boolean this_present_userName = true && this.isSetUserName(); + boolean that_present_userName = true && that.isSetUserName(); + if (this_present_userName || that_present_userName) { + if (!(this_present_userName && that_present_userName)) + return false; + if (!this.userName.equals(that.userName)) + return false; + } + + boolean this_present_applicationName = true && this.isSetApplicationName(); + boolean that_present_applicationName = true && that.isSetApplicationName(); + if (this_present_applicationName || that_present_applicationName) { + if (!(this_present_applicationName && that_present_applicationName)) + return false; + if (!this.applicationName.equals(that.applicationName)) + return false; + } + + boolean this_present_resourceHostName = true && this.isSetResourceHostName(); + boolean that_present_resourceHostName = true && that.isSetResourceHostName(); + if (this_present_resourceHostName || that_present_resourceHostName) { + if (!(this_present_resourceHostName && that_present_resourceHostName)) + return false; + if (!this.resourceHostName.equals(that.resourceHostName)) + return false; + } + return true; } @@ -43662,6 +43854,21 @@ public class RegistryService { if (present_toTime) list.add(toTime); + boolean present_userName = true && (isSetUserName()); + list.add(present_userName); + if (present_userName) + list.add(userName); + + boolean present_applicationName = true && (isSetApplicationName()); + list.add(present_applicationName); + if (present_applicationName) + list.add(applicationName); + + boolean present_resourceHostName = true && (isSetResourceHostName()); + list.add(present_resourceHostName); + if (present_resourceHostName) + list.add(resourceHostName); + return list.hashCode(); } @@ -43703,6 +43910,36 @@ public class RegistryService { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetApplicationName()).compareTo(other.isSetApplicationName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetApplicationName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationName, other.applicationName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetResourceHostName()).compareTo(other.isSetResourceHostName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceHostName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceHostName, other.resourceHostName); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -43738,6 +43975,30 @@ public class RegistryService { sb.append("toTime:"); sb.append(this.toTime); first = false; + if (!first) sb.append(", "); + sb.append("userName:"); + if (this.userName == null) { + sb.append("null"); + } else { + sb.append(this.userName); + } + first = false; + if (!first) sb.append(", "); + sb.append("applicationName:"); + if (this.applicationName == null) { + sb.append("null"); + } else { + sb.append(this.applicationName); + } + first = false; + if (!first) sb.append(", "); + sb.append("resourceHostName:"); + if (this.resourceHostName == null) { + sb.append("null"); + } else { + sb.append(this.resourceHostName); + } + first = false; sb.append(")"); return sb.toString(); } @@ -43812,6 +44073,30 @@ public class RegistryService { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 4: // USER_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userName = iprot.readString(); + struct.setUserNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // APPLICATION_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // RESOURCE_HOST_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceHostName = iprot.readString(); + struct.setResourceHostNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -43844,6 +44129,21 @@ public class RegistryService { oprot.writeFieldBegin(TO_TIME_FIELD_DESC); oprot.writeI64(struct.toTime); oprot.writeFieldEnd(); + if (struct.userName != null) { + oprot.writeFieldBegin(USER_NAME_FIELD_DESC); + oprot.writeString(struct.userName); + oprot.writeFieldEnd(); + } + if (struct.applicationName != null) { + oprot.writeFieldBegin(APPLICATION_NAME_FIELD_DESC); + oprot.writeString(struct.applicationName); + oprot.writeFieldEnd(); + } + if (struct.resourceHostName != null) { + oprot.writeFieldBegin(RESOURCE_HOST_NAME_FIELD_DESC); + oprot.writeString(struct.resourceHostName); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -43864,6 +44164,26 @@ public class RegistryService { oprot.writeString(struct.gatewayId); oprot.writeI64(struct.fromTime); oprot.writeI64(struct.toTime); + BitSet optionals = new BitSet(); + if (struct.isSetUserName()) { + optionals.set(0); + } + if (struct.isSetApplicationName()) { + optionals.set(1); + } + if (struct.isSetResourceHostName()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetUserName()) { + oprot.writeString(struct.userName); + } + if (struct.isSetApplicationName()) { + oprot.writeString(struct.applicationName); + } + if (struct.isSetResourceHostName()) { + oprot.writeString(struct.resourceHostName); + } } @Override @@ -43875,6 +44195,19 @@ public class RegistryService { struct.setFromTimeIsSet(true); struct.toTime = iprot.readI64(); struct.setToTimeIsSet(true); + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.userName = iprot.readString(); + struct.setUserNameIsSet(true); + } + if (incoming.get(1)) { + struct.applicationName = iprot.readString(); + struct.setApplicationNameIsSet(true); + } + if (incoming.get(2)) { + struct.resourceHostName = iprot.readString(); + struct.setResourceHostNameIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/thrift-interface-descriptions/airavata-apis/airavata_api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift index 36b6fda..70d10ff 100644 --- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift @@ -620,11 +620,15 @@ service Airavata { * @param toTime * Ending data time. * + * TODO update docs **/ experiment_model.ExperimentStatistics getExperimentStatistics(1: required security_model.AuthzToken authzToken, 2: required string gatewayId, 3: required i64 fromTime, - 4: required i64 toTime) + 4: required i64 toTime, + 5: string userName, + 6: string applicationName, + 7: string resourceHostName) throws (1: airavata_errors.InvalidRequestException ire, 2: airavata_errors.AiravataClientException ace, 3: airavata_errors.AiravataSystemException ase, http://git-wip-us.apache.org/repos/asf/airavata/blob/465f766e/thrift-interface-descriptions/component-cpis/registry-api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/component-cpis/registry-api.thrift b/thrift-interface-descriptions/component-cpis/registry-api.thrift index a6cc2e1..24cb0bf 100644 --- a/thrift-interface-descriptions/component-cpis/registry-api.thrift +++ b/thrift-interface-descriptions/component-cpis/registry-api.thrift @@ -347,11 +347,15 @@ service RegistryService { * * @param toTime * Ending data time. + * TODO update docs * **/ experiment_model.ExperimentStatistics getExperimentStatistics(1: required string gatewayId, 2: required i64 fromTime, - 3: required i64 toTime) + 3: required i64 toTime, + 4: string userName, + 5: string applicationName, + 6: string resourceHostName) throws (1: registry_api_errors.RegistryServiceException rse)
