You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2015/06/02 14:01:24 UTC

[5/8] airavata git commit: updated the master to 0.16 Airavata, and merged the branch sprint1

updated the master to 0.16 Airavata, and merged the branch sprint1


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

Branch: refs/heads/master
Commit: 0c1ff519a03da0ae2125469eaedcd11009a8e6b4
Parents: b67b532 b62a56a
Author: Hasini Gunasinghe <ha...@gmail.com>
Authored: Tue Jun 2 14:23:26 2015 +0530
Committer: Hasini Gunasinghe <ha...@gmail.com>
Committed: Tue Jun 2 14:23:26 2015 +0530

----------------------------------------------------------------------
 airavata-api/airavata-api-server/pom.xml        |  20 +
 .../server/handler/AiravataServerHandler.java   |  29 +-
 .../security/AiravataSecurityManager.java       |  27 +
 .../DefaultAiravataSecurityManager.java         |  55 ++
 .../api/server/security/DefaultOAuthClient.java | 124 +++++
 .../api/server/security/Properties.java         |  27 +
 .../api/server/security/SecurityException.java  |  11 +
 .../server/security/SecurityManagerFactory.java |  32 ++
 .../java/org/apache/airavata/api/Airavata.java  | 258 ++++++++-
 .../client/samples/CreateLaunchBES.java         |   2 +-
 .../client/samples/CreateLaunchExperiment.java  |   4 +-
 .../samples/CreateLaunchExperimentUS3.java      |   2 +-
 .../samples/TestCreateLaunchExperiment.java     |   3 +-
 .../tools/RegisterOGCEUS3Application.java       |   2 +-
 .../tools/RegisterSampleApplications.java       |   2 +-
 .../client/tools/RegisterUS3Application.java    |   2 +-
 .../airavata/model/security/AuthzToken.java     | 553 +++++++++++++++++++
 .../airavataAPI.thrift                          |   6 +-
 .../airavataDataModel.thrift                    |   1 +
 .../securityModel.thrift                        |  35 ++
 .../apache/airavata/common/utils/Constants.java |   5 +
 .../airavata/common/utils/ServerSettings.java   |  15 +
 .../main/resources/airavata-server.properties   |   8 +
 .../apache/airavata/integration/BaseCaseIT.java |   2 +-
 .../WorkflowIntegrationTestBase.java            |   2 +
 pom.xml                                         |   1 +
 samples/java-client/experiment/pom.xml          |   2 +-
 samples/java-client/pom.xml                     |   7 +-
 samples/java-client/secure-client/pom.xml       | 110 ++++
 .../sample/AiravataSecurityException.java       |  31 ++
 .../sample/OAuthAppRegisteringClient.java       | 109 ++++
 .../sample/OAuthTokenRetrievalClient.java       |  87 +++
 .../airavata/secure/sample/Properties.java      |  42 ++
 .../airavata/secure/sample/SecureClient.java    | 152 +++++
 34 files changed, 1733 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-api-server/pom.xml
----------------------------------------------------------------------
diff --cc airavata-api/airavata-api-server/pom.xml
index e91f3fb,b4af842..64b436b
--- a/airavata-api/airavata-api-server/pom.xml
+++ b/airavata-api/airavata-api-server/pom.xml
@@@ -82,10 -82,25 +82,30 @@@
              <version>${org.slf4j.version}</version>
          </dependency>
          <dependency>
 +            <groupId>org.apache.curator</groupId>
 +            <artifactId>curator-framework</artifactId>
 +            <version>${curator.version}</version>
 +        </dependency>
++        <dependency>
+             <groupId>org.wso2.carbon</groupId>
+             <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
+             <version>4.2.3</version>
+         </dependency>
+         <dependency>
+             <groupId>org.apache.axis2.wso2</groupId>
+             <artifactId>axis2</artifactId>
+             <version>1.6.1.wso2v4</version>
+         </dependency>
+         <dependency>
+             <groupId>org.apache.httpcomponents</groupId>
+             <artifactId>httpclient</artifactId>
+             <version>4.4</version>
+         </dependency>
+         <dependency>
+             <groupId>org.wso2.carbon</groupId>
+             <artifactId>org.wso2.carbon.utils</artifactId>
+             <version>4.2.0</version>
+         </dependency>
      </dependencies>
  
  </project>

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/security/DefaultOAuthClient.java
----------------------------------------------------------------------
diff --cc airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/security/DefaultOAuthClient.java
index 0000000,d85f2bc..3f2e32f
mode 000000,100644..100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/security/DefaultOAuthClient.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/security/DefaultOAuthClient.java
@@@ -1,0 -1,124 +1,124 @@@
+ /*
+  *
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *   http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing,
+  * software distributed under the License is distributed on an
+  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
+  *
+  */
+ package org.apache.airavata.api.server.security;
+ 
+ import org.apache.axis2.AxisFault;
+ import org.apache.axis2.context.ConfigurationContext;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+ import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub;
+ import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO;
+ import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken;
+ import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO;
+ import org.wso2.carbon.utils.CarbonUtils;
+ 
+ import javax.net.ssl.*;
+ import java.rmi.RemoteException;
+ 
+ /**
+  * This is the default OAuth Client that talks to WSO2 IS's OAuth Authentication Server
+  * to get the OAuth token validated.
+  */
+ public class DefaultOAuthClient {
+     private OAuth2TokenValidationServiceStub stub;
+     private final static Logger logger = LoggerFactory.getLogger(DefaultOAuthClient.class);
+     public static final String BEARER_TOKEN_TYPE = "bearer";
+ 
+     /**
+      * OAuth2TokenValidationService Admin Service Client
+      *
+      * @param auhorizationServerURL
+      * @param username
+      * @param password
+      * @param configCtx
+      * @throws Exception
+      */
+     public DefaultOAuthClient(String auhorizationServerURL, String username, String password,
+                               ConfigurationContext configCtx) throws Exception {
+         String serviceURL = auhorizationServerURL + "OAuth2TokenValidationService";
+         try {
+             stub = new OAuth2TokenValidationServiceStub(configCtx, serviceURL);
+             CarbonUtils.setBasicAccessSecurityHeaders(username, password, true, stub._getServiceClient());
+         } catch (AxisFault e) {
+             logger.error("Error initializing OAuth2 Client");
+             throw new Exception("Error initializing OAuth Client", e);
+         }
 -
++        //TODO:Import the WSO2 IS cert into Airavata trust store.
+         try {
+             // Get SSL context
+             SSLContext sc = SSLContext.getInstance("SSL");
+ 
+             // Create empty HostnameVerifier
+             HostnameVerifier hv = new HostnameVerifier() {
+                 public boolean verify(String urlHostName, SSLSession session) {
+                     return true;
+                 }
+             };
+             HttpsURLConnection.setDefaultHostnameVerifier(hv);
+ 
+             // Create a trust manager that does not validate certificate chains
+             TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
+                 public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+                     return null;
+                 }
+ 
+                 public void checkClientTrusted(java.security.cert.X509Certificate[] certs,
+                                                String authType) {
+                 }
+ 
+                 public void checkServerTrusted(java.security.cert.X509Certificate[] certs,
+                                                String authType) {
+                 }
+             }};
+ 
+             sc.init(null, trustAllCerts, new java.security.SecureRandom());
+             SSLContext.setDefault(sc);
+         } catch (Exception e) {
+             e.printStackTrace();
+             //ignore
+         }
+     }
+ 
+     /**
+      * Validates the OAuth 2.0 access token
+      *
+      * @param accessToken
+      * @return
+      * @throws Exception
+      */
+     public OAuth2TokenValidationResponseDTO validateAccessToken(String accessToken)
+             throws Exception {
+         OAuth2TokenValidationRequestDTO oauthReq = new OAuth2TokenValidationRequestDTO();
+         OAuth2TokenValidationRequestDTO_OAuth2AccessToken token =
+                 new OAuth2TokenValidationRequestDTO_OAuth2AccessToken();
+         token.setIdentifier(accessToken);
+         token.setTokenType(BEARER_TOKEN_TYPE);
+         oauthReq.setAccessToken(token);
+         try {
+             return stub.validate(oauthReq);
+         } catch (RemoteException e) {
+             logger.error("Error while validating OAuth2 request");
+             throw new Exception("Error while validating OAuth2 request", e);
+         }
+     }
+ 
+ 
+ }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
----------------------------------------------------------------------
diff --cc airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
index 7ffa368,6e70510..44b9230
--- 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
@@@ -23723,1018 -23688,9 +23890,1075 @@@ import org.slf4j.LoggerFactory
        case ASE:
          return getAse();
  
 -      case AE:
 -        return getAe();
 -
++      case AE:
++        return getAe();
++
 +      }
 +      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();
 +      case IRE:
 +        return isSetIre();
 +      case ACE:
 +        return isSetAce();
 +      case ASE:
 +        return isSetAse();
++      case AE:
++        return isSetAe();
 +      }
 +      throw new IllegalStateException();
 +    }
 +
 +    @Override
 +    public boolean equals(Object that) {
 +      if (that == null)
 +        return false;
 +      if (that instanceof getAPIVersion_result)
 +        return this.equals((getAPIVersion_result)that);
 +      return false;
 +    }
 +
 +    public boolean equals(getAPIVersion_result that) {
 +      if (that == null)
 +        return false;
 +
 +      boolean this_present_success = true && this.isSetSuccess();
 +      boolean that_present_success = true && that.isSetSuccess();
 +      if (this_present_success || that_present_success) {
 +        if (!(this_present_success && that_present_success))
 +          return false;
 +        if (!this.success.equals(that.success))
 +          return false;
 +      }
 +
 +      boolean this_present_ire = true && this.isSetIre();
 +      boolean that_present_ire = true && that.isSetIre();
 +      if (this_present_ire || that_present_ire) {
 +        if (!(this_present_ire && that_present_ire))
 +          return false;
 +        if (!this.ire.equals(that.ire))
 +          return false;
 +      }
 +
 +      boolean this_present_ace = true && this.isSetAce();
 +      boolean that_present_ace = true && that.isSetAce();
 +      if (this_present_ace || that_present_ace) {
 +        if (!(this_present_ace && that_present_ace))
 +          return false;
 +        if (!this.ace.equals(that.ace))
 +          return false;
 +      }
 +
 +      boolean this_present_ase = true && this.isSetAse();
 +      boolean that_present_ase = true && that.isSetAse();
 +      if (this_present_ase || that_present_ase) {
 +        if (!(this_present_ase && that_present_ase))
 +          return false;
 +        if (!this.ase.equals(that.ase))
 +          return false;
 +      }
 +
++      boolean this_present_ae = true && this.isSetAe();
++      boolean that_present_ae = true && that.isSetAe();
++      if (this_present_ae || that_present_ae) {
++        if (!(this_present_ae && that_present_ae))
++          return false;
++        if (!this.ae.equals(that.ae))
++          return false;
++      }
++
 +      return true;
 +    }
 +
 +    @Override
 +    public int hashCode() {
 +      return 0;
 +    }
 +
 +    @Override
 +    public int compareTo(getAPIVersion_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;
 +        }
 +      }
 +      lastComparison = Boolean.valueOf(isSetIre()).compareTo(other.isSetIre());
 +      if (lastComparison != 0) {
 +        return lastComparison;
 +      }
 +      if (isSetIre()) {
 +        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ire, other.ire);
 +        if (lastComparison != 0) {
 +          return lastComparison;
 +        }
 +      }
 +      lastComparison = Boolean.valueOf(isSetAce()).compareTo(other.isSetAce());
 +      if (lastComparison != 0) {
 +        return lastComparison;
 +      }
 +      if (isSetAce()) {
 +        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ace, other.ace);
 +        if (lastComparison != 0) {
 +          return lastComparison;
 +        }
 +      }
 +      lastComparison = Boolean.valueOf(isSetAse()).compareTo(other.isSetAse());
 +      if (lastComparison != 0) {
 +        return lastComparison;
 +      }
 +      if (isSetAse()) {
 +        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ase, other.ase);
 +        if (lastComparison != 0) {
 +          return lastComparison;
 +        }
 +      }
++      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
++      if (lastComparison != 0) {
++        return lastComparison;
++      }
++      if (isSetAe()) {
++        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
++        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("getAPIVersion_result(");
 +      boolean first = true;
 +
 +      sb.append("success:");
 +      if (this.success == null) {
 +        sb.append("null");
 +      } else {
 +        sb.append(this.success);
 +      }
 +      first = false;
 +      if (!first) sb.append(", ");
 +      sb.append("ire:");
 +      if (this.ire == null) {
 +        sb.append("null");
 +      } else {
 +        sb.append(this.ire);
 +      }
 +      first = false;
 +      if (!first) sb.append(", ");
 +      sb.append("ace:");
 +      if (this.ace == null) {
 +        sb.append("null");
 +      } else {
 +        sb.append(this.ace);
 +      }
 +      first = false;
 +      if (!first) sb.append(", ");
 +      sb.append("ase:");
 +      if (this.ase == null) {
 +        sb.append("null");
 +      } else {
 +        sb.append(this.ase);
 +      }
 +      first = false;
++      if (!first) sb.append(", ");
++      sb.append("ae:");
++      if (this.ae == null) {
++        sb.append("null");
++      } else {
++        sb.append(this.ae);
++      }
++      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 {
 +        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 getAPIVersion_resultStandardSchemeFactory implements SchemeFactory {
 +      public getAPIVersion_resultStandardScheme getScheme() {
 +        return new getAPIVersion_resultStandardScheme();
 +      }
 +    }
 +
 +    private static class getAPIVersion_resultStandardScheme extends StandardScheme<getAPIVersion_result> {
 +
 +      public void read(org.apache.thrift.protocol.TProtocol iprot, getAPIVersion_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.STRING) {
 +                struct.success = iprot.readString();
 +                struct.setSuccessIsSet(true);
 +              } else { 
 +                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
 +              }
 +              break;
 +            case 1: // IRE
 +              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
 +                struct.ire = new org.apache.airavata.model.error.InvalidRequestException();
 +                struct.ire.read(iprot);
 +                struct.setIreIsSet(true);
 +              } else { 
 +                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
 +              }
 +              break;
 +            case 2: // ACE
 +              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
 +                struct.ace = new org.apache.airavata.model.error.AiravataClientException();
 +                struct.ace.read(iprot);
 +                struct.setAceIsSet(true);
 +              } else { 
 +                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
 +              }
 +              break;
 +            case 3: // ASE
 +              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
 +                struct.ase = new org.apache.airavata.model.error.AiravataSystemException();
 +                struct.ase.read(iprot);
 +                struct.setAseIsSet(true);
 +              } else { 
 +                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
 +              }
 +              break;
++            case 4: // AE
++              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
++                struct.ae = new org.apache.airavata.model.error.AuthorizationException();
++                struct.ae.read(iprot);
++                struct.setAeIsSet(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, getAPIVersion_result struct) throws org.apache.thrift.TException {
 +        struct.validate();
 +
 +        oprot.writeStructBegin(STRUCT_DESC);
 +        if (struct.success != null) {
 +          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
 +          oprot.writeString(struct.success);
 +          oprot.writeFieldEnd();
 +        }
 +        if (struct.ire != null) {
 +          oprot.writeFieldBegin(IRE_FIELD_DESC);
 +          struct.ire.write(oprot);
 +          oprot.writeFieldEnd();
 +        }
 +        if (struct.ace != null) {
 +          oprot.writeFieldBegin(ACE_FIELD_DESC);
 +          struct.ace.write(oprot);
 +          oprot.writeFieldEnd();
 +        }
 +        if (struct.ase != null) {
 +          oprot.writeFieldBegin(ASE_FIELD_DESC);
 +          struct.ase.write(oprot);
 +          oprot.writeFieldEnd();
 +        }
++        if (struct.ae != null) {
++          oprot.writeFieldBegin(AE_FIELD_DESC);
++          struct.ae.write(oprot);
++          oprot.writeFieldEnd();
++        }
 +        oprot.writeFieldStop();
 +        oprot.writeStructEnd();
 +      }
 +
 +    }
 +
 +    private static class getAPIVersion_resultTupleSchemeFactory implements SchemeFactory {
 +      public getAPIVersion_resultTupleScheme getScheme() {
 +        return new getAPIVersion_resultTupleScheme();
 +      }
 +    }
 +
 +    private static class getAPIVersion_resultTupleScheme extends TupleScheme<getAPIVersion_result> {
 +
 +      @Override
 +      public void write(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_result struct) throws org.apache.thrift.TException {
 +        TTupleProtocol oprot = (TTupleProtocol) prot;
 +        BitSet optionals = new BitSet();
 +        if (struct.isSetSuccess()) {
 +          optionals.set(0);
 +        }
 +        if (struct.isSetIre()) {
 +          optionals.set(1);
 +        }
 +        if (struct.isSetAce()) {
 +          optionals.set(2);
 +        }
 +        if (struct.isSetAse()) {
 +          optionals.set(3);
 +        }
-         oprot.writeBitSet(optionals, 4);
++        if (struct.isSetAe()) {
++          optionals.set(4);
++        }
++        oprot.writeBitSet(optionals, 5);
 +        if (struct.isSetSuccess()) {
 +          oprot.writeString(struct.success);
 +        }
 +        if (struct.isSetIre()) {
 +          struct.ire.write(oprot);
 +        }
 +        if (struct.isSetAce()) {
 +          struct.ace.write(oprot);
 +        }
 +        if (struct.isSetAse()) {
 +          struct.ase.write(oprot);
 +        }
++        if (struct.isSetAe()) {
++          struct.ae.write(oprot);
++        }
 +      }
 +
 +      @Override
 +      public void read(org.apache.thrift.protocol.TProtocol prot, getAPIVersion_result struct) throws org.apache.thrift.TException {
 +        TTupleProtocol iprot = (TTupleProtocol) prot;
-         BitSet incoming = iprot.readBitSet(4);
++        BitSet incoming = iprot.readBitSet(5);
 +        if (incoming.get(0)) {
 +          struct.success = iprot.readString();
 +          struct.setSuccessIsSet(true);
 +        }
 +        if (incoming.get(1)) {
 +          struct.ire = new org.apache.airavata.model.error.InvalidRequestException();
 +          struct.ire.read(iprot);
 +          struct.setIreIsSet(true);
 +        }
 +        if (incoming.get(2)) {
 +          struct.ace = new org.apache.airavata.model.error.AiravataClientException();
 +          struct.ace.read(iprot);
 +          struct.setAceIsSet(true);
 +        }
 +        if (incoming.get(3)) {
 +          struct.ase = new org.apache.airavata.model.error.AiravataSystemException();
 +          struct.ase.read(iprot);
 +          struct.setAseIsSet(true);
 +        }
++        if (incoming.get(4)) {
++          struct.ae = new org.apache.airavata.model.error.AuthorizationException();
++          struct.ae.read(iprot);
++          struct.setAeIsSet(true);
++        }
 +      }
 +    }
 +
 +  }
 +
 +  public static class addGateway_args implements org.apache.thrift.TBase<addGateway_args, addGateway_args._Fields>, java.io.Serializable, Cloneable, Comparable<addGateway_args>   {
 +    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addGateway_args");
 +
 +    private static final org.apache.thrift.protocol.TField GATEWAY_FIELD_DESC = new org.apache.thrift.protocol.TField("gateway", org.apache.thrift.protocol.TType.STRUCT, (short)1);
 +
 +    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
 +    static {
 +      schemes.put(StandardScheme.class, new addGateway_argsStandardSchemeFactory());
 +      schemes.put(TupleScheme.class, new addGateway_argsTupleSchemeFactory());
 +    }
 +
 +    public org.apache.airavata.model.workspace.Gateway gateway; // 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 {
 +      GATEWAY((short)1, "gateway");
 +
 +      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: // GATEWAY
 +            return GATEWAY;
 +          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.GATEWAY, new org.apache.thrift.meta_data.FieldMetaData("gateway", org.apache.thrift.TFieldRequirementType.REQUIRED, 
 +          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.workspace.Gateway.class)));
 +      metaDataMap = Collections.unmodifiableMap(tmpMap);
 +      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(addGateway_args.class, metaDataMap);
 +    }
 +
 +    public addGateway_args() {
 +    }
 +
 +    public addGateway_args(
 +      org.apache.airavata.model.workspace.Gateway gateway)
 +    {
 +      this();
 +      this.gateway = gateway;
 +    }
 +
 +    /**
 +     * Performs a deep copy on <i>other</i>.
 +     */
 +    public addGateway_args(addGateway_args other) {
 +      if (other.isSetGateway()) {
 +        this.gateway = new org.apache.airavata.model.workspace.Gateway(other.gateway);
 +      }
 +    }
 +
 +    public addGateway_args deepCopy() {
 +      return new addGateway_args(this);
 +    }
 +
 +    @Override
 +    public void clear() {
 +      this.gateway = null;
 +    }
 +
 +    public org.apache.airavata.model.workspace.Gateway getGateway() {
 +      return this.gateway;
 +    }
 +
 +    public addGateway_args setGateway(org.apache.airavata.model.workspace.Gateway gateway) {
 +      this.gateway = gateway;
 +      return this;
 +    }
 +
 +    public void unsetGateway() {
 +      this.gateway = null;
 +    }
 +
 +    /** Returns true if field gateway is set (has been assigned a value) and false otherwise */
 +    public boolean isSetGateway() {
 +      return this.gateway != null;
 +    }
 +
 +    public void setGatewayIsSet(boolean value) {
 +      if (!value) {
 +        this.gateway = null;
 +      }
 +    }
 +
 +    public void setFieldValue(_Fields field, Object value) {
 +      switch (field) {
 +      case GATEWAY:
 +        if (value == null) {
 +          unsetGateway();
 +        } else {
 +          setGateway((org.apache.airavata.model.workspace.Gateway)value);
 +        }
 +        break;
 +
 +      }
 +    }
 +
 +    public Object getFieldValue(_Fields field) {
 +      switch (field) {
 +      case GATEWAY:
 +        return getGateway();
 +
 +      }
 +      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 GATEWAY:
 +        return isSetGateway();
 +      }
 +      throw new IllegalStateException();
 +    }
 +
 +    @Override
 +    public boolean equals(Object that) {
 +      if (that == null)
 +        return false;
 +      if (that instanceof addGateway_args)
 +        return this.equals((addGateway_args)that);
 +      return false;
 +    }
 +
 +    public boolean equals(addGateway_args that) {
 +      if (that == null)
 +        return false;
 +
 +      boolean this_present_gateway = true && this.isSetGateway();
 +      boolean that_present_gateway = true && that.isSetGateway();
 +      if (this_present_gateway || that_present_gateway) {
 +        if (!(this_present_gateway && that_present_gateway))
 +          return false;
 +        if (!this.gateway.equals(that.gateway))
 +          return false;
 +      }
 +
 +      return true;
 +    }
 +
 +    @Override
 +    public int hashCode() {
 +      return 0;
 +    }
 +
 +    @Override
 +    public int compareTo(addGateway_args other) {
 +      if (!getClass().equals(other.getClass())) {
 +        return getClass().getName().compareTo(other.getClass().getName());
 +      }
 +
 +      int lastComparison = 0;
 +
 +      lastComparison = Boolean.valueOf(isSetGateway()).compareTo(other.isSetGateway());
 +      if (lastComparison != 0) {
 +        return lastComparison;
 +      }
 +      if (isSetGateway()) {
 +        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gateway, other.gateway);
 +        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("addGateway_args(");
 +      boolean first = true;
 +
 +      sb.append("gateway:");
 +      if (this.gateway == null) {
 +        sb.append("null");
 +      } else {
 +        sb.append(this.gateway);
 +      }
 +      first = false;
 +      sb.append(")");
 +      return sb.toString();
 +    }
 +
 +    public void validate() throws org.apache.thrift.TException {
 +      // check for required fields
 +      if (gateway == null) {
 +        throw new org.apache.thrift.protocol.TProtocolException("Required field 'gateway' was not present! Struct: " + toString());
 +      }
 +      // check for sub-struct validity
 +      if (gateway != null) {
 +        gateway.validate();
 +      }
 +    }
 +
 +    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 addGateway_argsStandardSchemeFactory implements SchemeFactory {
 +      public addGateway_argsStandardScheme getScheme() {
 +        return new addGateway_argsStandardScheme();
 +      }
 +    }
 +
 +    private static class addGateway_argsStandardScheme extends StandardScheme<addGateway_args> {
 +
 +      public void read(org.apache.thrift.protocol.TProtocol iprot, addGateway_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: // GATEWAY
 +              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
 +                struct.gateway = new org.apache.airavata.model.workspace.Gateway();
 +                struct.gateway.read(iprot);
 +                struct.setGatewayIsSet(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, addGateway_args struct) throws org.apache.thrift.TException {
 +        struct.validate();
 +
 +        oprot.writeStructBegin(STRUCT_DESC);
 +        if (struct.gateway != null) {
 +          oprot.writeFieldBegin(GATEWAY_FIELD_DESC);
 +          struct.gateway.write(oprot);
 +          oprot.writeFieldEnd();
 +        }
 +        oprot.writeFieldStop();
 +        oprot.writeStructEnd();
 +      }
 +
 +    }
 +
 +    private static class addGateway_argsTupleSchemeFactory implements SchemeFactory {
 +      public addGateway_argsTupleScheme getScheme() {
 +        return new addGateway_argsTupleScheme();
 +      }
 +    }
 +
 +    private static class addGateway_argsTupleScheme extends TupleScheme<addGateway_args> {
 +
 +      @Override
 +      public void write(org.apache.thrift.protocol.TProtocol prot, addGateway_args struct) throws org.apache.thrift.TException {
 +        TTupleProtocol oprot = (TTupleProtocol) prot;
 +        struct.gateway.write(oprot);
 +      }
 +
 +      @Override
 +      public void read(org.apache.thrift.protocol.TProtocol prot, addGateway_args struct) throws org.apache.thrift.TException {
 +        TTupleProtocol iprot = (TTupleProtocol) prot;
 +        struct.gateway = new org.apache.airavata.model.workspace.Gateway();
 +        struct.gateway.read(iprot);
 +        struct.setGatewayIsSet(true);
 +      }
 +    }
 +
 +  }
 +
 +  public static class addGateway_result implements org.apache.thrift.TBase<addGateway_result, addGateway_result._Fields>, java.io.Serializable, Cloneable, Comparable<addGateway_result>   {
 +    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("addGateway_result");
 +
 +    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
 +    private static final org.apache.thrift.protocol.TField IRE_FIELD_DESC = new org.apache.thrift.protocol.TField("ire", org.apache.thrift.protocol.TType.STRUCT, (short)1);
 +    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)2);
 +    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)3);
 +
 +    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
 +    static {
 +      schemes.put(StandardScheme.class, new addGateway_resultStandardSchemeFactory());
 +      schemes.put(TupleScheme.class, new addGateway_resultTupleSchemeFactory());
 +    }
 +
 +    public String success; // required
 +    public org.apache.airavata.model.error.InvalidRequestException ire; // required
 +    public org.apache.airavata.model.error.AiravataClientException ace; // required
 +    public org.apache.airavata.model.error.AiravataSystemException ase; // 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"),
 +      IRE((short)1, "ire"),
 +      ACE((short)2, "ace"),
 +      ASE((short)3, "ase");
 +
 +      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;
 +          case 1: // IRE
 +            return IRE;
 +          case 2: // ACE
 +            return ACE;
 +          case 3: // ASE
 +            return ASE;
 +          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.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.STRING)));
 +      tmpMap.put(_Fields.IRE, new org.apache.thrift.meta_data.FieldMetaData("ire", org.apache.thrift.TFieldRequirementType.DEFAULT, 
 +          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
 +      tmpMap.put(_Fields.ACE, new org.apache.thrift.meta_data.FieldMetaData("ace", org.apache.thrift.TFieldRequirementType.DEFAULT, 
 +          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
 +      tmpMap.put(_Fields.ASE, new org.apache.thrift.meta_data.FieldMetaData("ase", 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(addGateway_result.class, metaDataMap);
 +    }
 +
 +    public addGateway_result() {
 +    }
 +
 +    public addGateway_result(
 +      String success,
 +      org.apache.airavata.model.error.InvalidRequestException ire,
 +      org.apache.airavata.model.error.AiravataClientException ace,
 +      org.apache.airavata.model.error.AiravataSystemException ase)
 +    {
 +      this();
 +      this.success = success;
 +      this.ire = ire;
 +      this.ace = ace;
 +      this.ase = ase;
 +    }
 +
 +    /**
 +     * Performs a deep copy on <i>other</i>.
 +     */
 +    public addGateway_result(addGateway_result other) {
 +      if (other.isSetSuccess()) {
 +        this.success = other.success;
 +      }
 +      if (other.isSetIre()) {
 +        this.ire = new org.apache.airavata.model.error.InvalidRequestException(other.ire);
 +      }
 +      if (other.isSetAce()) {
 +        this.ace = new org.apache.airavata.model.error.AiravataClientException(other.ace);
 +      }
 +      if (other.isSetAse()) {
 +        this.ase = new org.apache.airavata.model.error.AiravataSystemException(other.ase);
 +      }
 +    }
 +
 +    public addGateway_result deepCopy() {
 +      return new addGateway_result(this);
 +    }
 +
 +    @Override
 +    public void clear() {
 +      this.success = null;
 +      this.ire = null;
 +      this.ace = null;
 +      this.ase = null;
 +    }
 +
 +    public String getSuccess() {
 +      return this.success;
 +    }
 +
 +    public addGateway_result setSuccess(String success) {
 +      this.success = success;
 +      return this;
 +    }
 +
 +    public void unsetSuccess() {
 +      this.success = null;
 +    }
 +
 +    /** Returns true if field success is set (has been assigned a value) and false otherwise */
 +    public boolean isSetSuccess() {
 +      return this.success != null;
 +    }
 +
 +    public void setSuccessIsSet(boolean value) {
 +      if (!value) {
 +        this.success = null;
 +      }
 +    }
 +
 +    public org.apache.airavata.model.error.InvalidRequestException getIre() {
 +      return this.ire;
 +    }
 +
 +    public addGateway_result setIre(org.apache.airavata.model.error.InvalidRequestException ire) {
 +      this.ire = ire;
 +      return this;
 +    }
 +
 +    public void unsetIre() {
 +      this.ire = null;
 +    }
 +
 +    /** Returns true if field ire is set (has been assigned a value) and false otherwise */
 +    public boolean isSetIre() {
 +      return this.ire != null;
 +    }
 +
 +    public void setIreIsSet(boolean value) {
 +      if (!value) {
 +        this.ire = null;
 +      }
 +    }
 +
 +    public org.apache.airavata.model.error.AiravataClientException getAce() {
 +      return this.ace;
 +    }
 +
 +    public addGateway_result setAce(org.apache.airavata.model.error.AiravataClientException ace) {
 +      this.ace = ace;
 +      return this;
 +    }
 +
 +    public void unsetAce() {
 +      this.ace = null;
 +    }
 +
 +    /** Returns true if field ace is set (has been assigned a value) and false otherwise */
 +    public boolean isSetAce() {
 +      return this.ace != null;
 +    }
 +
 +    public void setAceIsSet(boolean value) {
 +      if (!value) {
 +        this.ace = null;
 +      }
 +    }
 +
 +    public org.apache.airavata.model.error.AiravataSystemException getAse() {
 +      return this.ase;
 +    }
 +
 +    public addGateway_result setAse(org.apache.airavata.model.error.AiravataSystemException ase) {
 +      this.ase = ase;
 +      return this;
 +    }
 +
 +    public void unsetAse() {
 +      this.ase = null;
 +    }
 +
 +    /** Returns true if field ase is set (has been assigned a value) and false otherwise */
 +    public boolean isSetAse() {
 +      return this.ase != null;
 +    }
 +
 +    public void setAseIsSet(boolean value) {
 +      if (!value) {
 +        this.ase = null;
 +      }
 +    }
 +
 +    public void setFieldValue(_Fields field, Object value) {
 +      switch (field) {
 +      case SUCCESS:
 +        if (value == null) {
 +          unsetSuccess();
 +        } else {
 +          setSuccess((String)value);
 +        }
 +        break;
 +
 +      case IRE:
 +        if (value == null) {
 +          unsetIre();
 +        } else {
 +          setIre((org.apache.airavata.model.error.InvalidRequestException)value);
 +        }
 +        break;
 +
 +      case ACE:
 +        if (value == null) {
 +          unsetAce();
 +        } else {
 +          setAce((org.apache.airavata.model.error.AiravataClientException)value);
 +        }
 +        break;
 +
 +      case ASE:
 +        if (value == null) {
 +          unsetAse();
 +        } else {
 +          setAse((org.apache.airavata.model.error.AiravataSystemException)value);
 +        }
 +        break;
 +
 +      }
 +    }
 +
 +    public Object getFieldValue(_Fields field) {
 +      switch (field) {
 +      case SUCCESS:
 +        return getSuccess();
 +
 +      case IRE:
 +        return getIre();
 +
 +      case ACE:
 +        return getAce();
 +
 +      case ASE:
 +        return getAse();
 +
        }
        throw new IllegalStateException();
      }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --cc airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index cd2fc7a,b78bd3d..794d826
--- 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
@@@ -80,9 -86,17 +80,9 @@@ public class CreateLaunchExperiment 
  
      public static void main(String[] args) throws Exception {
          airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
-         System.out.println("API version is " + airavataClient.getAPIVersion());
+         System.out.println("API version is " + airavataClient.getAPIVersion(null));
 -        Experiment experiment = airavataClient.getExperiment("echotest_fcc7127d-73e9-4e43-bc07-07399a7c5efc");
 -        long creationTime = experiment.getCreationTime();
 -        Date date = new Date(creationTime);
 -        DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 -        String dateFormatted = formatter.format(date);
 -        System.out.println(dateFormatted);
 -//        createGateway();
 -//        getGateway("testGatewayId");
  //        registerApplications(); // run this only the first time
--//        createAndLaunchExp();
++        createAndLaunchExp();
      }
  
      private static String fsdResourceId;

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/airavata-api/thrift-interface-descriptions/airavataAPI.thrift
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --cc modules/configuration/server/src/main/resources/airavata-server.properties
index 56a8bd1,baf4cd1..8bdc004
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@@ -279,3 -274,11 +279,11 @@@ gfac-experiments=/gfac-experiment
  gfac-server-name=gfac-node0
  orchestrator-server-name=orch-node0
  airavata-server-name=api-node0
+ 
+ ########################################################################
+ ## API Security Configuration
+ ########################################################################
+ api.secured=true
+ remote.oauth.authorization.server=https://localhost:9443/services/
+ admin.user.name=admin
 -admin.password=admin
++admin.password=admin

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthAppRegisteringClient.java
----------------------------------------------------------------------
diff --cc samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthAppRegisteringClient.java
index 0000000,f547e0d..5113c02
mode 000000,100644..100644
--- a/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthAppRegisteringClient.java
+++ b/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthAppRegisteringClient.java
@@@ -1,0 -1,109 +1,109 @@@
+ /*
+  *
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *   http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing,
+  * software distributed under the License is distributed on an
+  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
+  *
+  */
+ package org.apache.airavata.secure.sample;
+ 
+ import org.apache.axis2.AxisFault;
+ import org.apache.axis2.context.ConfigurationContext;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+ import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException;
+ import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub;
+ import org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO;
+ import org.wso2.carbon.utils.CarbonUtils;
+ 
+ import javax.net.ssl.*;
+ import java.rmi.RemoteException;
+ 
+ public class OAuthAppRegisteringClient {
+     private OAuthAdminServiceStub stub;
+     private final static Logger logger = LoggerFactory.getLogger(OAuthAppRegisteringClient.class);
+ 
+     public OAuthAppRegisteringClient(String auhorizationServerURL, String username, String password,
+                                      ConfigurationContext configCtx) throws Exception {
+         String serviceURL = auhorizationServerURL + "OAuthAdminService";
+         try {
+             stub = new OAuthAdminServiceStub(configCtx, serviceURL);
+             CarbonUtils.setBasicAccessSecurityHeaders(username, password, true, stub._getServiceClient());
+         } catch (AxisFault e) {
+             logger.error("Error initializing OAuth2 Client");
+             throw new Exception("Error initializing OAuth Client", e);
+         }
 -        //TODO:enable proper SSL handshake
++        //TODO:enable proper SSL handshake with WSO2 IS.
+         try {
+             // Get SSL context
+             SSLContext sc = SSLContext.getInstance("SSL");
+ 
+             // Create empty HostnameVerifier
+             HostnameVerifier hv = new HostnameVerifier() {
+                 public boolean verify(String urlHostName, SSLSession session) {
+                     return true;
+                 }
+             };
+             HttpsURLConnection.setDefaultHostnameVerifier(hv);
+ 
+             // Create a trust manager that does not validate certificate chains
+             TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
+                 public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+                     return null;
+                 }
+ 
+                 public void checkClientTrusted(java.security.cert.X509Certificate[] certs,
+                                                String authType) {
+                 }
+ 
+                 public void checkServerTrusted(java.security.cert.X509Certificate[] certs,
+                                                String authType) {
+                 }
+             }};
+ 
+             sc.init(null, trustAllCerts, new java.security.SecureRandom());
+             SSLContext.setDefault(sc);
+         } catch (Exception e) {
+             e.printStackTrace();
+         }
+ 
+     }
+ 
+     public OAuthConsumerAppDTO registerApplication(String appName, String consumerId, String consumerSecret)
+             throws AiravataSecurityException {
+ 
+         try {
+             OAuthConsumerAppDTO consumerAppDTO = new OAuthConsumerAppDTO();
+             consumerAppDTO.setApplicationName(appName);
+             // consumer key and secret is set by the application.
+             consumerAppDTO.setOauthConsumerKey(consumerId);
+             consumerAppDTO.setOauthConsumerSecret(consumerSecret);
+             //consumerAppDTO.setUsername(adminUserName);
+             stub.registerOAuthApplicationData(consumerAppDTO);
+             // After registration application is retrieve
 -            return stub.getOAuthApplicationDataByAppName(Properties.appName);
++            return stub.getOAuthApplicationDataByAppName(appName);
+         } catch (AxisFault axisFault) {
+             axisFault.printStackTrace();
+             throw new AiravataSecurityException("Error in registering the OAuth application.");
+         } catch (RemoteException e) {
+             e.printStackTrace();
+             throw new AiravataSecurityException("Error in registering the OAuth application.");
+         } catch (OAuthAdminServiceException e) {
+             e.printStackTrace();
+             throw new AiravataSecurityException("Error in registering the OAuth application.");
+         }
+     }
+ }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0c1ff519/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthTokenRetrievalClient.java
----------------------------------------------------------------------
diff --cc samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthTokenRetrievalClient.java
index 0000000,10ac3db..7204e53
mode 000000,100644..100644
--- a/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthTokenRetrievalClient.java
+++ b/samples/java-client/secure-client/src/main/java/org/apache/airavata/secure/sample/OAuthTokenRetrievalClient.java
@@@ -1,0 -1,87 +1,87 @@@
+ package org.apache.airavata.secure.sample;
+ 
+ import org.apache.commons.codec.binary.Base64;
+ import org.apache.http.HttpResponse;
+ import org.apache.http.NameValuePair;
+ import org.apache.http.client.ClientProtocolException;
+ import org.apache.http.client.HttpClient;
+ import org.apache.http.client.entity.UrlEncodedFormEntity;
+ import org.apache.http.client.methods.HttpPost;
+ import org.apache.http.conn.scheme.Scheme;
+ import org.apache.http.impl.client.DefaultHttpClient;
+ import org.apache.http.message.BasicNameValuePair;
+ import org.json.simple.JSONObject;
+ import org.json.simple.parser.JSONParser;
+ import org.json.simple.parser.ParseException;
+ 
+ import javax.net.ssl.SSLContext;
+ import java.io.BufferedReader;
+ import java.io.IOException;
+ import java.io.InputStreamReader;
+ import java.io.UnsupportedEncodingException;
+ import java.security.NoSuchAlgorithmException;
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+ public class OAuthTokenRetrievalClient {
+ 
+     public String retrieveAccessToken(String consumerId, String consumerSecret, String userName, String password)
+             throws SecurityException {
+ 
+         HttpPost postMethod = null;
+         try {
 -            //TODO:handle SSL handshake properly.
++            //TODO:handle SSL handshake with WSO2 IS properly.
+             org.apache.http.conn.ssl.SSLSocketFactory sf = new org.apache.http.conn.ssl.SSLSocketFactory(
+                     SSLContext.getDefault());
+             sf.setHostnameVerifier(org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+             Scheme httpsScheme = new Scheme("https", sf, Properties.authzServerPort);
+             HttpClient httpClient = new DefaultHttpClient();
+             httpClient.getConnectionManager().getSchemeRegistry().register(httpsScheme);
+ 
+             postMethod = new HttpPost(Properties.oauthTokenEndPointURL);
+             //build the HTTP request with relevant params for resource owner credential grant type
+             String authInfo = consumerId + ":" + consumerSecret;
+             String authHeader = new String(Base64.encodeBase64(authInfo.getBytes()));
+ 
+             postMethod.setHeader("Content-Type", "application/x-www-form-urlencoded");
+             postMethod.setHeader("Authorization", "Basic " + authHeader);
+ 
+             List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
+             urlParameters.add(new BasicNameValuePair("grant_type", "password"));
+             urlParameters.add(new BasicNameValuePair("username", userName));
+             urlParameters.add(new BasicNameValuePair("password", password));
+ 
+             postMethod.setEntity(new UrlEncodedFormEntity(urlParameters));
+ 
+             HttpResponse response = httpClient.execute(postMethod);
+ 
+             BufferedReader rd = new BufferedReader(
+                     new InputStreamReader(response.getEntity().getContent()));
+ 
+             StringBuilder result = new StringBuilder();
+             String line = "";
+             while ((line = rd.readLine()) != null) {
+                 result.append(line);
+             }
+ 
+             JSONParser parser = new JSONParser();
+             JSONObject jsonObject = (JSONObject) parser.parse(result.toString());
+             return (String) jsonObject.get("access_token");
+         } catch (ClientProtocolException e) {
+             throw new SecurityException(e.getMessage());
+         } catch (UnsupportedEncodingException e) {
+             throw new SecurityException(e.getMessage());
+         } catch (IOException e) {
+             throw new SecurityException(e.getMessage());
+         } catch (NoSuchAlgorithmException e) {
+             throw new SecurityException(e.getMessage());
+         } catch (ParseException e) {
+             throw new SecurityException(e.getMessage());
+         } finally {
+             if (postMethod != null) {
+                 postMethod.releaseConnection();
+             }
+         }
+     }
+ 
+ }