Repository: airavata Updated Branches: refs/heads/develop 2768cf159 -> cdce06d96
AIRAVATA-2190 Add newExperimentProjectId to cloneExperiment Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a36adaf9 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a36adaf9 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a36adaf9 Branch: refs/heads/develop Commit: a36adaf96f492c0dd5038236772df7d19b7e2668 Parents: 4cafd7a Author: Marcus Christie <[email protected]> Authored: Fri Nov 4 10:30:55 2016 -0400 Committer: Marcus Christie <[email protected]> Committed: Fri Nov 4 10:30:55 2016 -0400 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 14 +- .../java/org/apache/airavata/api/Airavata.java | 270 +++++++++++++++++-- .../resources/lib/Airavata/API/Airavata.php | 65 ++++- .../client/samples/CreateLaunchExperiment.java | 2 +- .../airavata-apis/airavata_api.thrift | 9 +- 5 files changed, 331 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/a36adaf9/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 d02b8c8..8bcae6a 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 @@ -1568,9 +1568,9 @@ public class AiravataServerHandler implements Airavata.Iface { */ @Override @SecurityCheck - public String cloneExperiment(AuthzToken authzToken, String existingExperimentID, String newExperiementName) + public String cloneExperiment(AuthzToken authzToken, String existingExperimentID, String newExperiementName, String newExperimentProjectId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, - AuthorizationException, TException { + AuthorizationException, ProjectNotFoundException, TException { try { RegistryService.Client regClient = getRegistryServiceClient(); ExperimentModel existingExperiment = regClient.getExperiment(existingExperimentID); @@ -1578,6 +1578,16 @@ public class AiravataServerHandler implements Airavata.Iface { logger.error(existingExperimentID, "Error while cloning experiment {}, experiment doesn't exist.", existingExperimentID); throw new ExperimentNotFoundException("Requested experiment id " + existingExperimentID + " does not exist in the system.."); } + if (newExperimentProjectId != null) { + + Project project = regClient.getProject(newExperimentProjectId); + if (project == null){ + logger.error("Error while cloning experiment {}, project {} doesn't exist.", existingExperimentID, newExperimentProjectId); + throw new ProjectNotFoundException("Requested project id " + newExperimentProjectId + " does not exist in the system.."); + } + // TODO: make sure user has write access to the project as well + existingExperiment.setProjectId(project.getProjectID()); + } String gatewayId = existingExperiment.getGatewayId(); existingExperiment.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime()); http://git-wip-us.apache.org/repos/asf/airavata/blob/a36adaf9/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 4da92ac..76cd150 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 @@ -1003,6 +1003,9 @@ public class Airavata { * Once an experiment is cloned, to disambiguate, the users are suggested to provide new metadata. This will again require * the basic experiment metadata like the name and description, intended user, the gateway identifier and if the experiment * should be shared public by default. + * @param newExperimentProjectId + * The project in which to create the cloned experiment. This is optional and if null the experiment will be created + * in the same project as the existing experiment. * * @return * The server-side generated.airavata.registry.core.experiment.globally unique identifier (Experiment ID) for the newly cloned experiment. @@ -1034,8 +1037,9 @@ public class Airavata { * @param authzToken * @param existingExperimentID * @param newExperimentName + * @param newExperimentProjectId */ - public String cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + public String cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.airavata.model.error.ProjectNotFoundException, org.apache.thrift.TException; /** * @@ -3020,7 +3024,7 @@ public class Airavata { public void getJobDetails(org.apache.airavata.model.security.AuthzToken authzToken, String airavataExperimentId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void terminateExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String airavataExperimentId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -5025,22 +5029,23 @@ public class Airavata { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getJobDetails failed: unknown result"); } - public String cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException + public String cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.airavata.model.error.ProjectNotFoundException, org.apache.thrift.TException { - send_cloneExperiment(authzToken, existingExperimentID, newExperimentName); + send_cloneExperiment(authzToken, existingExperimentID, newExperimentName, newExperimentProjectId); return recv_cloneExperiment(); } - public void send_cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName) throws org.apache.thrift.TException + public void send_cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId) throws org.apache.thrift.TException { cloneExperiment_args args = new cloneExperiment_args(); args.setAuthzToken(authzToken); args.setExistingExperimentID(existingExperimentID); args.setNewExperimentName(newExperimentName); + args.setNewExperimentProjectId(newExperimentProjectId); sendBase("cloneExperiment", args); } - public String recv_cloneExperiment() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException + public String recv_cloneExperiment() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.airavata.model.error.ProjectNotFoundException, org.apache.thrift.TException { cloneExperiment_result result = new cloneExperiment_result(); receiveBase(result, "cloneExperiment"); @@ -5062,6 +5067,9 @@ public class Airavata { if (result.ae != null) { throw result.ae; } + if (result.pnfe != null) { + throw result.pnfe; + } throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "cloneExperiment failed: unknown result"); } @@ -11213,9 +11221,9 @@ public class Airavata { } } - public void cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void cloneExperiment(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - cloneExperiment_call method_call = new cloneExperiment_call(authzToken, existingExperimentID, newExperimentName, resultHandler, this, ___protocolFactory, ___transport); + cloneExperiment_call method_call = new cloneExperiment_call(authzToken, existingExperimentID, newExperimentName, newExperimentProjectId, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -11224,11 +11232,13 @@ public class Airavata { private org.apache.airavata.model.security.AuthzToken authzToken; private String existingExperimentID; private String newExperimentName; - public cloneExperiment_call(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, 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 newExperimentProjectId; + public cloneExperiment_call(org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId, 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.existingExperimentID = existingExperimentID; this.newExperimentName = newExperimentName; + this.newExperimentProjectId = newExperimentProjectId; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { @@ -11237,11 +11247,12 @@ public class Airavata { args.setAuthzToken(authzToken); args.setExistingExperimentID(existingExperimentID); args.setNewExperimentName(newExperimentName); + args.setNewExperimentProjectId(newExperimentProjectId); args.write(prot); prot.writeMessageEnd(); } - public String getResult() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException { + public String getResult() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.ExperimentNotFoundException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.airavata.model.error.ProjectNotFoundException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } @@ -17309,7 +17320,7 @@ public class Airavata { public cloneExperiment_result getResult(I iface, cloneExperiment_args args) throws org.apache.thrift.TException { cloneExperiment_result result = new cloneExperiment_result(); try { - result.success = iface.cloneExperiment(args.authzToken, args.existingExperimentID, args.newExperimentName); + result.success = iface.cloneExperiment(args.authzToken, args.existingExperimentID, args.newExperimentName, args.newExperimentProjectId); } catch (org.apache.airavata.model.error.InvalidRequestException ire) { result.ire = ire; } catch (org.apache.airavata.model.error.ExperimentNotFoundException enf) { @@ -17320,6 +17331,8 @@ public class Airavata { result.ase = ase; } catch (org.apache.airavata.model.error.AuthorizationException ae) { result.ae = ae; + } catch (org.apache.airavata.model.error.ProjectNotFoundException pnfe) { + result.pnfe = pnfe; } return result; } @@ -24603,6 +24616,11 @@ public class Airavata { result.setAeIsSet(true); msg = result; } + else if (e instanceof org.apache.airavata.model.error.ProjectNotFoundException) { + result.pnfe = (org.apache.airavata.model.error.ProjectNotFoundException) e; + result.setPnfeIsSet(true); + msg = result; + } else { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; @@ -24624,7 +24642,7 @@ public class Airavata { } public void start(I iface, cloneExperiment_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException { - iface.cloneExperiment(args.authzToken, args.existingExperimentID, args.newExperimentName,resultHandler); + iface.cloneExperiment(args.authzToken, args.existingExperimentID, args.newExperimentName, args.newExperimentProjectId,resultHandler); } } @@ -97289,6 +97307,7 @@ public class Airavata { private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.protocol.TField EXISTING_EXPERIMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("existingExperimentID", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField NEW_EXPERIMENT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("newExperimentName", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField NEW_EXPERIMENT_PROJECT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("newExperimentProjectId", org.apache.thrift.protocol.TType.STRING, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -97299,12 +97318,14 @@ public class Airavata { public org.apache.airavata.model.security.AuthzToken authzToken; // required public String existingExperimentID; // required public String newExperimentName; // required + public String newExperimentProjectId; // 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"), EXISTING_EXPERIMENT_ID((short)2, "existingExperimentID"), - NEW_EXPERIMENT_NAME((short)3, "newExperimentName"); + NEW_EXPERIMENT_NAME((short)3, "newExperimentName"), + NEW_EXPERIMENT_PROJECT_ID((short)4, "newExperimentProjectId"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -97325,6 +97346,8 @@ public class Airavata { return EXISTING_EXPERIMENT_ID; case 3: // NEW_EXPERIMENT_NAME return NEW_EXPERIMENT_NAME; + case 4: // NEW_EXPERIMENT_PROJECT_ID + return NEW_EXPERIMENT_PROJECT_ID; default: return null; } @@ -97374,6 +97397,8 @@ public class Airavata { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.NEW_EXPERIMENT_NAME, new org.apache.thrift.meta_data.FieldMetaData("newExperimentName", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.NEW_EXPERIMENT_PROJECT_ID, new org.apache.thrift.meta_data.FieldMetaData("newExperimentProjectId", 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(cloneExperiment_args.class, metaDataMap); } @@ -97384,12 +97409,14 @@ public class Airavata { public cloneExperiment_args( org.apache.airavata.model.security.AuthzToken authzToken, String existingExperimentID, - String newExperimentName) + String newExperimentName, + String newExperimentProjectId) { this(); this.authzToken = authzToken; this.existingExperimentID = existingExperimentID; this.newExperimentName = newExperimentName; + this.newExperimentProjectId = newExperimentProjectId; } /** @@ -97405,6 +97432,9 @@ public class Airavata { if (other.isSetNewExperimentName()) { this.newExperimentName = other.newExperimentName; } + if (other.isSetNewExperimentProjectId()) { + this.newExperimentProjectId = other.newExperimentProjectId; + } } public cloneExperiment_args deepCopy() { @@ -97416,6 +97446,7 @@ public class Airavata { this.authzToken = null; this.existingExperimentID = null; this.newExperimentName = null; + this.newExperimentProjectId = null; } public org.apache.airavata.model.security.AuthzToken getAuthzToken() { @@ -97490,6 +97521,30 @@ public class Airavata { } } + public String getNewExperimentProjectId() { + return this.newExperimentProjectId; + } + + public cloneExperiment_args setNewExperimentProjectId(String newExperimentProjectId) { + this.newExperimentProjectId = newExperimentProjectId; + return this; + } + + public void unsetNewExperimentProjectId() { + this.newExperimentProjectId = null; + } + + /** Returns true if field newExperimentProjectId is set (has been assigned a value) and false otherwise */ + public boolean isSetNewExperimentProjectId() { + return this.newExperimentProjectId != null; + } + + public void setNewExperimentProjectIdIsSet(boolean value) { + if (!value) { + this.newExperimentProjectId = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case AUTHZ_TOKEN: @@ -97516,6 +97571,14 @@ public class Airavata { } break; + case NEW_EXPERIMENT_PROJECT_ID: + if (value == null) { + unsetNewExperimentProjectId(); + } else { + setNewExperimentProjectId((String)value); + } + break; + } } @@ -97530,6 +97593,9 @@ public class Airavata { case NEW_EXPERIMENT_NAME: return getNewExperimentName(); + case NEW_EXPERIMENT_PROJECT_ID: + return getNewExperimentProjectId(); + } throw new IllegalStateException(); } @@ -97547,6 +97613,8 @@ public class Airavata { return isSetExistingExperimentID(); case NEW_EXPERIMENT_NAME: return isSetNewExperimentName(); + case NEW_EXPERIMENT_PROJECT_ID: + return isSetNewExperimentProjectId(); } throw new IllegalStateException(); } @@ -97591,6 +97659,15 @@ public class Airavata { return false; } + boolean this_present_newExperimentProjectId = true && this.isSetNewExperimentProjectId(); + boolean that_present_newExperimentProjectId = true && that.isSetNewExperimentProjectId(); + if (this_present_newExperimentProjectId || that_present_newExperimentProjectId) { + if (!(this_present_newExperimentProjectId && that_present_newExperimentProjectId)) + return false; + if (!this.newExperimentProjectId.equals(that.newExperimentProjectId)) + return false; + } + return true; } @@ -97613,6 +97690,11 @@ public class Airavata { if (present_newExperimentName) list.add(newExperimentName); + boolean present_newExperimentProjectId = true && (isSetNewExperimentProjectId()); + list.add(present_newExperimentProjectId); + if (present_newExperimentProjectId) + list.add(newExperimentProjectId); + return list.hashCode(); } @@ -97654,6 +97736,16 @@ public class Airavata { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetNewExperimentProjectId()).compareTo(other.isSetNewExperimentProjectId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNewExperimentProjectId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newExperimentProjectId, other.newExperimentProjectId); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -97697,6 +97789,14 @@ public class Airavata { sb.append(this.newExperimentName); } first = false; + if (!first) sb.append(", "); + sb.append("newExperimentProjectId:"); + if (this.newExperimentProjectId == null) { + sb.append("null"); + } else { + sb.append(this.newExperimentProjectId); + } + first = false; sb.append(")"); return sb.toString(); } @@ -97771,6 +97871,14 @@ public class Airavata { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 4: // NEW_EXPERIMENT_PROJECT_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.newExperimentProjectId = iprot.readString(); + struct.setNewExperimentProjectIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -97801,6 +97909,11 @@ public class Airavata { oprot.writeString(struct.newExperimentName); oprot.writeFieldEnd(); } + if (struct.newExperimentProjectId != null) { + oprot.writeFieldBegin(NEW_EXPERIMENT_PROJECT_ID_FIELD_DESC); + oprot.writeString(struct.newExperimentProjectId); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -97826,13 +97939,19 @@ public class Airavata { if (struct.isSetNewExperimentName()) { optionals.set(1); } - oprot.writeBitSet(optionals, 2); + if (struct.isSetNewExperimentProjectId()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); if (struct.isSetExistingExperimentID()) { oprot.writeString(struct.existingExperimentID); } if (struct.isSetNewExperimentName()) { oprot.writeString(struct.newExperimentName); } + if (struct.isSetNewExperimentProjectId()) { + oprot.writeString(struct.newExperimentProjectId); + } } @Override @@ -97841,7 +97960,7 @@ public class Airavata { struct.authzToken = new org.apache.airavata.model.security.AuthzToken(); struct.authzToken.read(iprot); struct.setAuthzTokenIsSet(true); - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.existingExperimentID = iprot.readString(); struct.setExistingExperimentIDIsSet(true); @@ -97850,6 +97969,10 @@ public class Airavata { struct.newExperimentName = iprot.readString(); struct.setNewExperimentNameIsSet(true); } + if (incoming.get(2)) { + struct.newExperimentProjectId = iprot.readString(); + struct.setNewExperimentProjectIdIsSet(true); + } } } @@ -97864,6 +97987,7 @@ public class Airavata { private static final org.apache.thrift.protocol.TField ACE_FIELD_DESC = new org.apache.thrift.protocol.TField("ace", org.apache.thrift.protocol.TType.STRUCT, (short)3); private static final org.apache.thrift.protocol.TField ASE_FIELD_DESC = new org.apache.thrift.protocol.TField("ase", org.apache.thrift.protocol.TType.STRUCT, (short)4); private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)5); + private static final org.apache.thrift.protocol.TField PNFE_FIELD_DESC = new org.apache.thrift.protocol.TField("pnfe", org.apache.thrift.protocol.TType.STRUCT, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -97877,6 +98001,7 @@ public class Airavata { public org.apache.airavata.model.error.AiravataClientException ace; // required public org.apache.airavata.model.error.AiravataSystemException ase; // required public org.apache.airavata.model.error.AuthorizationException ae; // required + public org.apache.airavata.model.error.ProjectNotFoundException pnfe; // 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 { @@ -97885,7 +98010,8 @@ public class Airavata { ENF((short)2, "enf"), ACE((short)3, "ace"), ASE((short)4, "ase"), - AE((short)5, "ae"); + AE((short)5, "ae"), + PNFE((short)6, "pnfe"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -97912,6 +98038,8 @@ public class Airavata { return ASE; case 5: // AE return AE; + case 6: // PNFE + return PNFE; default: return null; } @@ -97967,6 +98095,8 @@ public class Airavata { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + tmpMap.put(_Fields.PNFE, new org.apache.thrift.meta_data.FieldMetaData("pnfe", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(cloneExperiment_result.class, metaDataMap); } @@ -97980,7 +98110,8 @@ public class Airavata { org.apache.airavata.model.error.ExperimentNotFoundException enf, org.apache.airavata.model.error.AiravataClientException ace, org.apache.airavata.model.error.AiravataSystemException ase, - org.apache.airavata.model.error.AuthorizationException ae) + org.apache.airavata.model.error.AuthorizationException ae, + org.apache.airavata.model.error.ProjectNotFoundException pnfe) { this(); this.success = success; @@ -97989,6 +98120,7 @@ public class Airavata { this.ace = ace; this.ase = ase; this.ae = ae; + this.pnfe = pnfe; } /** @@ -98013,6 +98145,9 @@ public class Airavata { if (other.isSetAe()) { this.ae = new org.apache.airavata.model.error.AuthorizationException(other.ae); } + if (other.isSetPnfe()) { + this.pnfe = new org.apache.airavata.model.error.ProjectNotFoundException(other.pnfe); + } } public cloneExperiment_result deepCopy() { @@ -98027,6 +98162,7 @@ public class Airavata { this.ace = null; this.ase = null; this.ae = null; + this.pnfe = null; } public String getSuccess() { @@ -98173,6 +98309,30 @@ public class Airavata { } } + public org.apache.airavata.model.error.ProjectNotFoundException getPnfe() { + return this.pnfe; + } + + public cloneExperiment_result setPnfe(org.apache.airavata.model.error.ProjectNotFoundException pnfe) { + this.pnfe = pnfe; + return this; + } + + public void unsetPnfe() { + this.pnfe = null; + } + + /** Returns true if field pnfe is set (has been assigned a value) and false otherwise */ + public boolean isSetPnfe() { + return this.pnfe != null; + } + + public void setPnfeIsSet(boolean value) { + if (!value) { + this.pnfe = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: @@ -98223,6 +98383,14 @@ public class Airavata { } break; + case PNFE: + if (value == null) { + unsetPnfe(); + } else { + setPnfe((org.apache.airavata.model.error.ProjectNotFoundException)value); + } + break; + } } @@ -98246,6 +98414,9 @@ public class Airavata { case AE: return getAe(); + case PNFE: + return getPnfe(); + } throw new IllegalStateException(); } @@ -98269,6 +98440,8 @@ public class Airavata { return isSetAse(); case AE: return isSetAe(); + case PNFE: + return isSetPnfe(); } throw new IllegalStateException(); } @@ -98340,6 +98513,15 @@ public class Airavata { return false; } + boolean this_present_pnfe = true && this.isSetPnfe(); + boolean that_present_pnfe = true && that.isSetPnfe(); + if (this_present_pnfe || that_present_pnfe) { + if (!(this_present_pnfe && that_present_pnfe)) + return false; + if (!this.pnfe.equals(that.pnfe)) + return false; + } + return true; } @@ -98377,6 +98559,11 @@ public class Airavata { if (present_ae) list.add(ae); + boolean present_pnfe = true && (isSetPnfe()); + list.add(present_pnfe); + if (present_pnfe) + list.add(pnfe); + return list.hashCode(); } @@ -98448,6 +98635,16 @@ public class Airavata { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetPnfe()).compareTo(other.isSetPnfe()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPnfe()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pnfe, other.pnfe); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -98515,6 +98712,14 @@ public class Airavata { sb.append(this.ae); } first = false; + if (!first) sb.append(", "); + sb.append("pnfe:"); + if (this.pnfe == null) { + sb.append("null"); + } else { + sb.append(this.pnfe); + } + first = false; sb.append(")"); return sb.toString(); } @@ -98611,6 +98816,15 @@ public class Airavata { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 6: // PNFE + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.pnfe = new org.apache.airavata.model.error.ProjectNotFoundException(); + struct.pnfe.read(iprot); + struct.setPnfeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -98656,6 +98870,11 @@ public class Airavata { struct.ae.write(oprot); oprot.writeFieldEnd(); } + if (struct.pnfe != null) { + oprot.writeFieldBegin(PNFE_FIELD_DESC); + struct.pnfe.write(oprot); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -98692,7 +98911,10 @@ public class Airavata { if (struct.isSetAe()) { optionals.set(5); } - oprot.writeBitSet(optionals, 6); + if (struct.isSetPnfe()) { + optionals.set(6); + } + oprot.writeBitSet(optionals, 7); if (struct.isSetSuccess()) { oprot.writeString(struct.success); } @@ -98711,12 +98933,15 @@ public class Airavata { if (struct.isSetAe()) { struct.ae.write(oprot); } + if (struct.isSetPnfe()) { + struct.pnfe.write(oprot); + } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, cloneExperiment_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(6); + BitSet incoming = iprot.readBitSet(7); if (incoming.get(0)) { struct.success = iprot.readString(); struct.setSuccessIsSet(true); @@ -98746,6 +98971,11 @@ public class Airavata { struct.ae.read(iprot); struct.setAeIsSet(true); } + if (incoming.get(6)) { + struct.pnfe = new org.apache.airavata.model.error.ProjectNotFoundException(); + struct.pnfe.read(iprot); + struct.setPnfeIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/a36adaf9/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 7d5325a..5739ce5 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 @@ -1225,6 +1225,9 @@ interface AiravataIf { * Once an experiment is cloned, to disambiguate, the users are suggested to provide new metadata. This will again require * the basic experiment metadata like the name and description, intended user, the gateway identifier and if the experiment * should be shared public by default. + * @param newExperimentProjectId + * The project in which to create the cloned experiment. This is optional and if null the experiment will be created + * in the same project as the existing experiment. * * @return * The server-side generated.airavata.registry.core.experiment.globally unique identifier (Experiment ID) for the newly cloned experiment. @@ -1256,14 +1259,16 @@ interface AiravataIf { * @param \Airavata\Model\Security\AuthzToken $authzToken * @param string $existingExperimentID * @param string $newExperimentName + * @param string $newExperimentProjectId * @return string * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\ExperimentNotFoundException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException * @throws \Airavata\API\Error\AuthorizationException + * @throws \Airavata\API\Error\ProjectNotFoundException */ - public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName); + public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId); /** * * Terminate a running Experiment. @@ -7066,18 +7071,19 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("getJobDetails failed: unknown result"); } - public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName) + public function cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId) { - $this->send_cloneExperiment($authzToken, $existingExperimentID, $newExperimentName); + $this->send_cloneExperiment($authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId); return $this->recv_cloneExperiment(); } - public function send_cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName) + public function send_cloneExperiment(\Airavata\Model\Security\AuthzToken $authzToken, $existingExperimentID, $newExperimentName, $newExperimentProjectId) { $args = new \Airavata\API\Airavata_cloneExperiment_args(); $args->authzToken = $authzToken; $args->existingExperimentID = $existingExperimentID; $args->newExperimentName = $newExperimentName; + $args->newExperimentProjectId = $newExperimentProjectId; $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { @@ -7131,6 +7137,9 @@ class AiravataClient implements \Airavata\API\AiravataIf { if ($result->ae !== null) { throw $result->ae; } + if ($result->pnfe !== null) { + throw $result->pnfe; + } throw new \Exception("cloneExperiment failed: unknown result"); } @@ -29465,6 +29474,10 @@ class Airavata_cloneExperiment_args { * @var string */ public $newExperimentName = null; + /** + * @var string + */ + public $newExperimentProjectId = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -29482,6 +29495,10 @@ class Airavata_cloneExperiment_args { 'var' => 'newExperimentName', 'type' => TType::STRING, ), + 4 => array( + 'var' => 'newExperimentProjectId', + 'type' => TType::STRING, + ), ); } if (is_array($vals)) { @@ -29494,6 +29511,9 @@ class Airavata_cloneExperiment_args { if (isset($vals['newExperimentName'])) { $this->newExperimentName = $vals['newExperimentName']; } + if (isset($vals['newExperimentProjectId'])) { + $this->newExperimentProjectId = $vals['newExperimentProjectId']; + } } } @@ -29538,6 +29558,13 @@ class Airavata_cloneExperiment_args { $xfer += $input->skip($ftype); } break; + case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->newExperimentProjectId); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -29569,6 +29596,11 @@ class Airavata_cloneExperiment_args { $xfer += $output->writeString($this->newExperimentName); $xfer += $output->writeFieldEnd(); } + if ($this->newExperimentProjectId !== null) { + $xfer += $output->writeFieldBegin('newExperimentProjectId', TType::STRING, 4); + $xfer += $output->writeString($this->newExperimentProjectId); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; @@ -29603,6 +29635,10 @@ class Airavata_cloneExperiment_result { * @var \Airavata\API\Error\AuthorizationException */ public $ae = null; + /** + * @var \Airavata\API\Error\ProjectNotFoundException + */ + public $pnfe = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -29636,6 +29672,11 @@ class Airavata_cloneExperiment_result { 'type' => TType::STRUCT, 'class' => '\Airavata\API\Error\AuthorizationException', ), + 6 => array( + 'var' => 'pnfe', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\ProjectNotFoundException', + ), ); } if (is_array($vals)) { @@ -29657,6 +29698,9 @@ class Airavata_cloneExperiment_result { if (isset($vals['ae'])) { $this->ae = $vals['ae']; } + if (isset($vals['pnfe'])) { + $this->pnfe = $vals['pnfe']; + } } } @@ -29726,6 +29770,14 @@ class Airavata_cloneExperiment_result { $xfer += $input->skip($ftype); } break; + case 6: + if ($ftype == TType::STRUCT) { + $this->pnfe = new \Airavata\API\Error\ProjectNotFoundException(); + $xfer += $this->pnfe->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -29769,6 +29821,11 @@ class Airavata_cloneExperiment_result { $xfer += $this->ae->write($output); $xfer += $output->writeFieldEnd(); } + if ($this->pnfe !== null) { + $xfer += $output->writeFieldBegin('pnfe', TType::STRUCT, 6); + $xfer += $this->pnfe->write($output); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/airavata/blob/a36adaf9/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index aff662b..83c485e 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -866,7 +866,7 @@ public class CreateLaunchExperiment { public static String cloneExperiment(Airavata.Client client, String expId) throws TException { try { - return client.cloneExperiment(new AuthzToken(""), expId, "cloneExperiment1"); + return client.cloneExperiment(new AuthzToken(""), expId, "cloneExperiment1", null); } catch (TException e) { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); http://git-wip-us.apache.org/repos/asf/airavata/blob/a36adaf9/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 e9f9993..0dfaa8f 100644 --- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift @@ -1112,6 +1112,9 @@ service Airavata { * Once an experiment is cloned, to disambiguate, the users are suggested to provide new metadata. This will again require * the basic experiment metadata like the name and description, intended user, the gateway identifier and if the experiment * should be shared public by default. + * @param newExperimentProjectId + * The project in which to create the cloned experiment. This is optional and if null the experiment will be created + * in the same project as the existing experiment. * * @return * The server-side generated.airavata.registry.core.experiment.globally unique identifier (Experiment ID) for the newly cloned experiment. @@ -1142,12 +1145,14 @@ service Airavata { */ string cloneExperiment(1: required security_model.AuthzToken authzToken, 2: string existingExperimentID, - 3: string newExperimentName) + 3: string newExperimentName, + 4: string newExperimentProjectId) throws (1: airavata_errors.InvalidRequestException ire, 2: airavata_errors.ExperimentNotFoundException enf, 3: airavata_errors.AiravataClientException ace, 4: airavata_errors.AiravataSystemException ase, - 5: airavata_errors.AuthorizationException ae) + 5: airavata_errors.AuthorizationException ae, + 6: airavata_errors.ProjectNotFoundException pnfe) /** *
