airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject git commit: Adding validation funcation to thrift service - AIRAVATA-1200
Date Tue, 13 May 2014 14:23:15 GMT
Repository: airavata
Updated Branches:
  refs/heads/master c18a52faa -> 6328beae7


Adding validation funcation to thrift service - AIRAVATA-1200


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6328beae
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6328beae
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6328beae

Branch: refs/heads/master
Commit: 6328beae7e0b9e05c2dc5a3d7f0e68895435e1c9
Parents: c18a52f
Author: Suresh Marru <smarru@apache.org>
Authored: Tue May 13 10:23:10 2014 -0400
Committer: Suresh Marru <smarru@apache.org>
Committed: Tue May 13 10:23:10 2014 -0400

----------------------------------------------------------------------
 .../orchestrator/cpi/OrchestratorService.java   | 857 +++++++++++++++++++
 .../orchestrator.cpi.service.thrift             |  20 +-
 2 files changed, 875 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6328beae/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
index dd08ca6..92cf63f 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
@@ -71,6 +71,30 @@ import org.slf4j.LoggerFactory;
      */
     public boolean launchExperiment(String experimentId) throws org.apache.thrift.TException;
 
+    /**
+     *  *
+     *  * Validate funcations which can verify if the experiment is ready to be launced.
+     *  *
+     *  * @param experimentID
+     *  * @return sucess/failure
+     *  *
+     * *
+     * 
+     * @param experimentId
+     */
+    public boolean validateExperiment(String experimentId) throws org.apache.thrift.TException;
+
+    /**
+     *  *
+     *  * Terminate the running experiment.
+     *  *
+     *  * @param experimentID
+     *  * @return sucess/failure
+     *  *
+     * *
+     * 
+     * @param experimentId
+     */
     public boolean terminateExperiment(String experimentId) throws org.apache.thrift.TException;
 
   }
@@ -81,6 +105,8 @@ import org.slf4j.LoggerFactory;
 
     public void launchExperiment(String experimentId, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws org.apache.thrift.TException;
 
+    public void validateExperiment(String experimentId, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws org.apache.thrift.TException;
+
     public void terminateExperiment(String experimentId, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws org.apache.thrift.TException;
 
   }
@@ -150,6 +176,29 @@ import org.slf4j.LoggerFactory;
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT,
"launchExperiment failed: unknown result");
     }
 
+    public boolean validateExperiment(String experimentId) throws org.apache.thrift.TException
+    {
+      send_validateExperiment(experimentId);
+      return recv_validateExperiment();
+    }
+
+    public void send_validateExperiment(String experimentId) throws org.apache.thrift.TException
+    {
+      validateExperiment_args args = new validateExperiment_args();
+      args.setExperimentId(experimentId);
+      sendBase("validateExperiment", args);
+    }
+
+    public boolean recv_validateExperiment() throws org.apache.thrift.TException
+    {
+      validateExperiment_result result = new validateExperiment_result();
+      receiveBase(result, "validateExperiment");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT,
"validateExperiment failed: unknown result");
+    }
+
     public boolean terminateExperiment(String experimentId) throws org.apache.thrift.TException
     {
       send_terminateExperiment(experimentId);
@@ -252,6 +301,38 @@ import org.slf4j.LoggerFactory;
       }
     }
 
+    public void validateExperiment(String experimentId, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      validateExperiment_call method_call = new validateExperiment_call(experimentId, resultHandler,
this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class validateExperiment_call extends org.apache.thrift.async.TAsyncMethodCall
{
+      private String experimentId;
+      public validateExperiment_call(String experimentId, 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.experimentId = experimentId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException
{
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("validateExperiment",
org.apache.thrift.protocol.TMessageType.CALL, 0));
+        validateExperiment_args args = new validateExperiment_args();
+        args.setExperimentId(experimentId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public boolean getResult() throws org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_validateExperiment();
+      }
+    }
+
     public void terminateExperiment(String experimentId, org.apache.thrift.async.AsyncMethodCallback
resultHandler) throws org.apache.thrift.TException {
       checkReady();
       terminateExperiment_call method_call = new terminateExperiment_call(experimentId, resultHandler,
this, ___protocolFactory, ___transport);
@@ -299,6 +380,7 @@ import org.slf4j.LoggerFactory;
     private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I,
? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I,
? extends  org.apache.thrift.TBase>> processMap) {
       processMap.put("getOrchestratorCPIVersion", new getOrchestratorCPIVersion());
       processMap.put("launchExperiment", new launchExperiment());
+      processMap.put("validateExperiment", new validateExperiment());
       processMap.put("terminateExperiment", new terminateExperiment());
       return processMap;
     }
@@ -344,6 +426,27 @@ import org.slf4j.LoggerFactory;
       }
     }
 
+    public static class validateExperiment<I extends Iface> extends org.apache.thrift.ProcessFunction<I,
validateExperiment_args> {
+      public validateExperiment() {
+        super("validateExperiment");
+      }
+
+      public validateExperiment_args getEmptyArgsInstance() {
+        return new validateExperiment_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public validateExperiment_result getResult(I iface, validateExperiment_args args) throws
org.apache.thrift.TException {
+        validateExperiment_result result = new validateExperiment_result();
+        result.success = iface.validateExperiment(args.experimentId);
+        result.setSuccessIsSet(true);
+        return result;
+      }
+    }
+
     public static class terminateExperiment<I extends Iface> extends org.apache.thrift.ProcessFunction<I,
terminateExperiment_args> {
       public terminateExperiment() {
         super("terminateExperiment");
@@ -380,6 +483,7 @@ import org.slf4j.LoggerFactory;
     private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I,
? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I,
? extends  org.apache.thrift.TBase, ?>> processMap) {
       processMap.put("getOrchestratorCPIVersion", new getOrchestratorCPIVersion());
       processMap.put("launchExperiment", new launchExperiment());
+      processMap.put("validateExperiment", new validateExperiment());
       processMap.put("terminateExperiment", new terminateExperiment());
       return processMap;
     }
@@ -487,6 +591,58 @@ import org.slf4j.LoggerFactory;
       }
     }
 
+    public static class validateExperiment<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I,
validateExperiment_args, Boolean> {
+      public validateExperiment() {
+        super("validateExperiment");
+      }
+
+      public validateExperiment_args getEmptyArgsInstance() {
+        return new validateExperiment_args();
+      }
+
+      public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb,
final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Boolean>() { 
+          public void onComplete(Boolean o) {
+            validateExperiment_result result = new validateExperiment_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            validateExperiment_result result = new validateExperiment_result();
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR,
e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, validateExperiment_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean>
resultHandler) throws TException {
+        iface.validateExperiment(args.experimentId,resultHandler);
+      }
+    }
+
     public static class terminateExperiment<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I,
terminateExperiment_args, Boolean> {
       public terminateExperiment() {
         super("terminateExperiment");
@@ -1842,6 +1998,707 @@ import org.slf4j.LoggerFactory;
 
   }
 
+  public static class validateExperiment_args implements org.apache.thrift.TBase<validateExperiment_args,
validateExperiment_args._Fields>, java.io.Serializable, Cloneable, Comparable<validateExperiment_args>
  {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("validateExperiment_args");
+
+    private static final org.apache.thrift.protocol.TField EXPERIMENT_ID_FIELD_DESC = new
org.apache.thrift.protocol.TField("experimentId", org.apache.thrift.protocol.TType.STRING,
(short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes
= new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new validateExperiment_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new validateExperiment_argsTupleSchemeFactory());
+    }
+
+    public String experimentId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum
{
+      EXPERIMENT_ID((short)1, "experimentId");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // EXPERIMENT_ID
+            return EXPERIMENT_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't
exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields,
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.EXPERIMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("experimentId",
org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(validateExperiment_args.class,
metaDataMap);
+    }
+
+    public validateExperiment_args() {
+    }
+
+    public validateExperiment_args(
+      String experimentId)
+    {
+      this();
+      this.experimentId = experimentId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public validateExperiment_args(validateExperiment_args other) {
+      if (other.isSetExperimentId()) {
+        this.experimentId = other.experimentId;
+      }
+    }
+
+    public validateExperiment_args deepCopy() {
+      return new validateExperiment_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.experimentId = null;
+    }
+
+    public String getExperimentId() {
+      return this.experimentId;
+    }
+
+    public validateExperiment_args setExperimentId(String experimentId) {
+      this.experimentId = experimentId;
+      return this;
+    }
+
+    public void unsetExperimentId() {
+      this.experimentId = null;
+    }
+
+    /** Returns true if field experimentId is set (has been assigned a value) and false otherwise
*/
+    public boolean isSetExperimentId() {
+      return this.experimentId != null;
+    }
+
+    public void setExperimentIdIsSet(boolean value) {
+      if (!value) {
+        this.experimentId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case EXPERIMENT_ID:
+        if (value == null) {
+          unsetExperimentId();
+        } else {
+          setExperimentId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case EXPERIMENT_ID:
+        return getExperimentId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value)
and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case EXPERIMENT_ID:
+        return isSetExperimentId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof validateExperiment_args)
+        return this.equals((validateExperiment_args)that);
+      return false;
+    }
+
+    public boolean equals(validateExperiment_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_experimentId = true && this.isSetExperimentId();
+      boolean that_present_experimentId = true && that.isSetExperimentId();
+      if (this_present_experimentId || that_present_experimentId) {
+        if (!(this_present_experimentId && that_present_experimentId))
+          return false;
+        if (!this.experimentId.equals(that.experimentId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(validateExperiment_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetExperimentId()).compareTo(other.isSetExperimentId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetExperimentId()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.experimentId, other.experimentId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException
{
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException
{
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("validateExperiment_args(");
+      boolean first = true;
+
+      sb.append("experimentId:");
+      if (this.experimentId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.experimentId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (experimentId == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'experimentId'
was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException
{
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class validateExperiment_argsStandardSchemeFactory implements SchemeFactory
{
+      public validateExperiment_argsStandardScheme getScheme() {
+        return new validateExperiment_argsStandardScheme();
+      }
+    }
+
+    private static class validateExperiment_argsStandardScheme extends StandardScheme<validateExperiment_args>
{
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, validateExperiment_args
struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // EXPERIMENT_ID
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.experimentId = iprot.readString();
+                struct.setExperimentIdIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate
method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, validateExperiment_args
struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.experimentId != null) {
+          oprot.writeFieldBegin(EXPERIMENT_ID_FIELD_DESC);
+          oprot.writeString(struct.experimentId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class validateExperiment_argsTupleSchemeFactory implements SchemeFactory
{
+      public validateExperiment_argsTupleScheme getScheme() {
+        return new validateExperiment_argsTupleScheme();
+      }
+    }
+
+    private static class validateExperiment_argsTupleScheme extends TupleScheme<validateExperiment_args>
{
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, validateExperiment_args
struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        oprot.writeString(struct.experimentId);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, validateExperiment_args
struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        struct.experimentId = iprot.readString();
+        struct.setExperimentIdIsSet(true);
+      }
+    }
+
+  }
+
+  public static class validateExperiment_result implements org.apache.thrift.TBase<validateExperiment_result,
validateExperiment_result._Fields>, java.io.Serializable, Cloneable, Comparable<validateExperiment_result>
  {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("validateExperiment_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success",
org.apache.thrift.protocol.TType.BOOL, (short)0);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes
= new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new validateExperiment_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new validateExperiment_resultTupleSchemeFactory());
+    }
+
+    public boolean success; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
+    @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum
{
+      SUCCESS((short)0, "success");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't
exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    private static final int __SUCCESS_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields,
org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(validateExperiment_result.class,
metaDataMap);
+    }
+
+    public validateExperiment_result() {
+    }
+
+    public validateExperiment_result(
+      boolean success)
+    {
+      this();
+      this.success = success;
+      setSuccessIsSet(true);
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public validateExperiment_result(validateExperiment_result other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.success = other.success;
+    }
+
+    public validateExperiment_result deepCopy() {
+      return new validateExperiment_result(this);
+    }
+
+    @Override
+    public void clear() {
+      setSuccessIsSet(false);
+      this.success = false;
+    }
+
+    public boolean isSuccess() {
+      return this.success;
+    }
+
+    public validateExperiment_result setSuccess(boolean success) {
+      this.success = success;
+      setSuccessIsSet(true);
+      return this;
+    }
+
+    public void unsetSuccess() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise
*/
+    public boolean isSetSuccess() {
+      return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((Boolean)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return Boolean.valueOf(isSuccess());
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value)
and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof validateExperiment_result)
+        return this.equals((validateExperiment_result)that);
+      return false;
+    }
+
+    public boolean equals(validateExperiment_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true;
+      boolean that_present_success = true;
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (this.success != that.success)
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    @Override
+    public int compareTo(validateExperiment_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException
{
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException
{
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("validateExperiment_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      sb.append(this.success);
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException
{
+      try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky,
and doesn't call the default constructor.
+        __isset_bitfield = 0;
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class validateExperiment_resultStandardSchemeFactory implements SchemeFactory
{
+      public validateExperiment_resultStandardScheme getScheme() {
+        return new validateExperiment_resultStandardScheme();
+      }
+    }
+
+    private static class validateExperiment_resultStandardScheme extends StandardScheme<validateExperiment_result>
{
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, validateExperiment_result
struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+                struct.success = iprot.readBool();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate
method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, validateExperiment_result
struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.isSetSuccess()) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeBool(struct.success);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class validateExperiment_resultTupleSchemeFactory implements SchemeFactory
{
+      public validateExperiment_resultTupleScheme getScheme() {
+        return new validateExperiment_resultTupleScheme();
+      }
+    }
+
+    private static class validateExperiment_resultTupleScheme extends TupleScheme<validateExperiment_result>
{
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, validateExperiment_result
struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetSuccess()) {
+          oprot.writeBool(struct.success);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, validateExperiment_result
struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = iprot.readBool();
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
   public static class terminateExperiment_args implements org.apache.thrift.TBase<terminateExperiment_args,
terminateExperiment_args._Fields>, java.io.Serializable, Cloneable, Comparable<terminateExperiment_args>
  {
     private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("terminateExperiment_args");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6328beae/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
b/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
index 6dc452e..68b3b56 100644
--- a/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
+++ b/modules/orchestrator/orchestrator-thrift-descriptions/orchestrator.cpi.service.thrift
@@ -43,7 +43,23 @@ service OrchestratorService {
     **/
   bool launchExperiment (1: required string experimentId),
 
-  bool terminateExperiment (1: required string experimentId),
-
+    /**
+     *
+     * Validate funcations which can verify if the experiment is ready to be launced.
+     *
+     * @param experimentID
+     * @return sucess/failure
+     *
+    **/
   bool validateExperiment(1: required string experimentId)
+
+    /**
+     *
+     * Terminate the running experiment.
+     *
+     * @param experimentID
+     * @return sucess/failure
+     *
+    **/
+  bool terminateExperiment (1: required string experimentId)
 }
\ No newline at end of file


Mime
View raw message