making sharing enabling configurable

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

Branch: refs/heads/lahiru/AIRAVATA-2065
Commit: ae5461264baa2e7e0f6bfc6c83e18fa55238c8ad
Parents: 729a15f
Author: scnakandala <supun.nakand...@gmail.com>
Authored: Wed Sep 7 15:00:13 2016 -0400
Committer: scnakandala <supun.nakand...@gmail.com>
Committed: Wed Sep 7 15:00:13 2016 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |  74 ++--
 .../client/samples/RegisterSampleData.java      | 422 -------------------
 .../client/samples/SampleEchoExperiment.java    | 200 +++++++++
 .../airavata/common/utils/ServerSettings.java   |   5 +
 .../main/resources/airavata-server.properties   |   1 +
 .../service/handler/RegistryServerHandler.java  |  11 +-
 6 files changed, 253 insertions(+), 460 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
 
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 83eb771..74c4eb3 100644
--- 
a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ 
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -523,7 +523,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
         try {
             RegistryService.Client regClient = getRegistryServiceClient();
             Project existingProject = regClient.getProject(projectId);
-            
if(!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(existingProject.getOwner())
+            if(ServerSettings.isEnableSharing() && 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(existingProject.getOwner())
                     || 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(existingProject.getGatewayId())){
                 try {
                     
if(!hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -553,7 +553,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
         try {
             RegistryService.Client regClient = getRegistryServiceClient();
             Project existingProject = regClient.getProject(projectId);
-            
if(!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(existingProject.getOwner())
+            if(ServerSettings.isEnableSharing() && 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(existingProject.getOwner())
                     || 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(existingProject.getGatewayId())){
                 try {
                     
if(!hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -598,7 +598,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             
if(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(project.getOwner())
                     && 
authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(project.getGatewayId())){
                 return project;
-            }else{
+            }else if (ServerSettings.isEnableSharing()){
                 try {
                     
if(hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
                                     
+"@"+authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID),
@@ -610,7 +610,8 @@ public class AiravataServerHandler implements 
Airavata.Iface {
                 } catch (Exception e) {
                     throw new AuthorizationException("User does not have 
permission to access this resource");
                 }
-            }
+            }else
+                return null;
         } catch (ApplicationSettingsException | RegistryServiceException e) {
             logger.error("Error while retrieving the project", e);
             ProjectNotFoundException exception = new 
ProjectNotFoundException();
@@ -676,7 +677,9 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             String> filters, int limit, int offset) throws 
InvalidRequestException, AiravataClientException, AiravataSystemException, 
AuthorizationException, TException {
         try {
             List<String> accessibleProjIds  = new ArrayList<>();
-            
accessibleProjIds.addAll(getAllAccessibleResourcesForUser(userName+"@"+gatewayId,
 ResourceType.PROJECT, ResourcePermissionType.READ));
+
+            if(ServerSettings.isEnableSharing())
+                
accessibleProjIds.addAll(getAllAccessibleResourcesForUser(userName+"@"+gatewayId,
 ResourceType.PROJECT, ResourcePermissionType.READ));
 
             return getRegistryServiceClient().searchProjects(gatewayId, 
userName, accessibleProjIds, filters, limit, offset);
         }catch (Exception e) {
@@ -711,7 +714,8 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, 
AiravataSystemException, AuthorizationException, TException {
         try {
             List<String> accessibleExpIds = new ArrayList<>();
-            accessibleExpIds.addAll(getAllAccessibleResourcesForUser(userName 
+ "@" + gatewayId, ResourceType.EXPERIMENT, ResourcePermissionType.READ));
+            if(ServerSettings.isEnableSharing())
+                
accessibleExpIds.addAll(getAllAccessibleResourcesForUser(userName + "@" + 
gatewayId, ResourceType.EXPERIMENT, ResourcePermissionType.READ));
             return getRegistryServiceClient().searchExperiments(gatewayId, 
userName, accessibleExpIds, filters, limit, offset);
         }catch (Exception e) {
             logger.error("Error while retrieving experiments", e);
@@ -770,7 +774,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             RegistryService.Client regClient  = getRegistryServiceClient();
             Project project = regClient.getProject(projectId);
 
-            
if(!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(project.getOwner())
+            if(ServerSettings.isEnableSharing() && 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(project.getOwner())
                     || 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(project.getGatewayId())){
                 try {
                     
if(!hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -849,13 +853,17 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             AiravataClientException, AiravataSystemException, 
AuthorizationException, TException {
         try {
             String experimentId = 
getRegistryServiceClient().createExperiment(gatewayId, experiment);
-            GroupManagerCPI groupManager = 
GroupManagerFactory.getGroupManager();
             Resource expResource = new Resource(experimentId, 
org.apache.airavata.grouper.resource.ResourceType.EXPERIMENT);
             
expResource.setOwnerId(experiment.getUserName()+"@"+experiment.getGatewayId());
             expResource.setParentResourceId(experiment.getProjectId());
             expResource.setName(experiment.getExperimentName());
             expResource.setDescription(experiment.getDescription());
-            groupManager.createResource(expResource);
+
+            if(ServerSettings.isEnableSharing()) {
+                GroupManagerCPI groupManager = 
GroupManagerFactory.getGroupManager();
+                groupManager.createResource(expResource);
+            }
+
             ExperimentStatusChangeEvent event = new 
ExperimentStatusChangeEvent(ExperimentState.CREATED,
                     experimentId,
                     gatewayId);
@@ -894,7 +902,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             RegistryService.Client regClient  = getRegistryServiceClient();
             ExperimentModel experimentModel = 
regClient.getExperiment(experimentId);
 
-            
if(!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
+            if(ServerSettings.isEnableSharing() && 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
                     || 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(experimentModel.getGatewayId())){
                 try {
                     if(! 
hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -950,6 +958,24 @@ public class AiravataServerHandler implements 
Airavata.Iface {
         ExperimentModel experimentModel = null;
         try {
             experimentModel = 
getRegistryServiceClient().getExperiment(airavataExperimentId);
+            
if(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
+                    && 
authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(experimentModel.getGatewayId())){
+                return experimentModel;
+            }else if(ServerSettings.isEnableSharing()){
+                try {
+                    
if(hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
+                                    
+"@"+authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID),
+                            experimentModel.getExperimentId(), 
ResourceType.EXPERIMENT, ResourcePermissionType.READ)){
+                        return experimentModel;
+                    }else {
+                        throw new AuthorizationException("User does not have 
permission to access this resource");
+                    }
+                } catch (Exception e) {
+                    throw new AuthorizationException("User does not have 
permission to access this resource");
+                }
+            }else{
+                return null;
+            }
         } catch (ApplicationSettingsException e) {
             logger.error("Error while getting the experiment", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -957,22 +983,6 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             exception.setMessage("Error while getting the experiment. More 
info : " + e.getMessage());
             throw exception;
         }
-        
if(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
-                && 
authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(experimentModel.getGatewayId())){
-            return experimentModel;
-        }else{
-            try {
-                
if(hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
-                                
+"@"+authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID),
-                        experimentModel.getExperimentId(), 
ResourceType.EXPERIMENT, ResourcePermissionType.READ)){
-                    return experimentModel;
-                }else {
-                    throw new AuthorizationException("User does not have 
permission to access this resource");
-                }
-            } catch (Exception e) {
-                throw new AuthorizationException("User does not have 
permission to access this resource");
-            }
-        }
     }
 
     /**
@@ -1045,7 +1055,7 @@ public class AiravataServerHandler implements 
Airavata.Iface {
         try {
             RegistryService.Client regClient = getRegistryServiceClient();
             ExperimentModel experimentModel = 
regClient.getExperiment(airavataExperimentId);
-            
if(!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
+            if(ServerSettings.isEnableSharing() && 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME).equals(experimentModel.getUserName())
                 || 
!authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.GATEWAY_ID).equals(experimentModel.getGatewayId())){
                 try {
                     if(! 
hasPermission(authzToken.getClaimsMap().get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -1381,10 +1391,14 @@ public class AiravataServerHandler implements 
Airavata.Iface {
             String expId = regClient.createExperiment(gatewayId, 
existingExperiment);
 
             String projectId = existingExperiment.getProjectId();
-            if(!isResourceExistsInGrouper(projectId, ResourceType.PROJECT)){
-                initializeResourceWithGrouper(projectId, ResourceType.PROJECT);
+
+            if(ServerSettings.isEnableSharing()){
+                if(!isResourceExistsInGrouper(projectId, 
ResourceType.PROJECT)){
+                    initializeResourceWithGrouper(projectId, 
ResourceType.PROJECT);
+                }
+                initializeResourceWithGrouper(expId, ResourceType.EXPERIMENT);
             }
-            initializeResourceWithGrouper(expId, ResourceType.EXPERIMENT);
+
             return expId;
         } catch (Exception e) {
             logger.error(existingExperimentID, "Error while cloning the 
experiment with existing configuration...", e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java
 
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java
deleted file mode 100644
index c737695..0000000
--- 
a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- *
- * 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.client.samples;
-
-import org.apache.airavata.api.Airavata;
-import org.apache.airavata.api.client.AiravataClientFactory;
-import org.apache.airavata.client.tools.RegisterSampleApplicationsUtils;
-import 
org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
-import 
org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
-import 
org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission;
-import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
-import 
org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType;
-import 
org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import 
org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
-import org.apache.airavata.model.application.io.DataType;
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.model.data.movement.DataMovementInterface;
-import org.apache.airavata.model.data.movement.DataMovementProtocol;
-import org.apache.airavata.model.error.AiravataClientException;
-import org.apache.airavata.model.parallelism.ApplicationParallelismType;
-import org.apache.airavata.model.security.AuthzToken;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.thrift.TException;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class RegisterSampleData {
-
-    private static final String THRIFT_SERVER_HOST = "127.0.0.1";
-    private static final int THRIFT_SERVER_PORT = 8930;
-
-    private Airavata.Client airavataClient;
-    private String localhost_ip = "127.0.0.1";
-    private String localhostId ;
-    private String echoModuleId;
-    private String addModuleId;
-    private String multiplyModuleId;
-    private String subtractModuleId;
-    private String sampleScriptDir;
-    private String monteXModuleId;
-    private String gaussianModuleId;
-
-    private String gatewayId;
-
-    public static void main(String[] args) throws AiravataClientException, 
TException {
-        RegisterSampleData registerSampleData = new RegisterSampleData();
-        registerSampleData.init();
-        registerSampleData.register();
-    }
-
-    public void init() {
-        String airavataHome = System.getenv("AIRAVATA_HOME");
-        if (airavataHome == null) {
-            sampleScriptDir = new File("").getAbsolutePath() +
-                    
"/modules/distribution/server/src/main/resources/samples/scripts";
-        } else {
-            sampleScriptDir = airavataHome + "/samples/scripts";
-        }
-        System.out.println(sampleScriptDir);
-    }
-
-    public void register() throws AiravataClientException, TException {
-        airavataClient = 
AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, 
THRIFT_SERVER_PORT);
-        gatewayId = registerGateway();
-        registerLocalhost();
-        registerGatewayProfile();
-        registerApplicationModules();
-        registerApplicationDeployments();
-        registerApplicationInterfaces();
-    }
-
-    private String registerGateway() throws TException {
-        Gateway gateway = new Gateway();
-        gateway.setGatewayName("Sample");
-        gateway.setGatewayId("sample");
-        return airavataClient.addGateway(new AuthzToken(""), gateway);
-    }
-
-    private void registerGatewayProfile() throws TException {
-        ComputeResourcePreference localhostResourcePreference = 
RegisterSampleApplicationsUtils.
-                createComputeResourcePreference(localhostId, "Sample", false, 
null, null, null, sampleScriptDir + "/..");
-        GatewayResourceProfile gatewayResourceProfile = new 
GatewayResourceProfile();
-        gatewayResourceProfile.setGatewayID(gatewayId);
-        
gatewayResourceProfile.addToComputeResourcePreferences(localhostResourcePreference);
-        airavataClient.registerGatewayResourceProfile(new AuthzToken(""), 
gatewayResourceProfile);
-    }
-
-    private void registerLocalhost() {
-        try {
-            System.out.println("\n #### Registering Localhost Computational 
Resource #### \n");
-
-            ComputeResourceDescription computeResourceDescription = 
RegisterSampleApplicationsUtils.
-                    createComputeResourceDescription("localhost", "LocalHost", 
null, null);
-            DataMovementInterface dataMovementInterface = new 
DataMovementInterface("localhost_data_movement_interface", 
DataMovementProtocol.LOCAL, 1);
-            
computeResourceDescription.addToDataMovementInterfaces(dataMovementInterface);
-            JobSubmissionInterface jobSubmissionInterface = new 
JobSubmissionInterface("localhost_job_submission_interface", 
JobSubmissionProtocol.LOCAL, 1);
-            
computeResourceDescription.addToJobSubmissionInterfaces(jobSubmissionInterface);
-
-            localhostId = airavataClient.registerComputeResource(new 
AuthzToken(""), computeResourceDescription);
-            ResourceJobManager resourceJobManager = 
RegisterSampleApplicationsUtils.
-                    createResourceJobManager(ResourceJobManagerType.FORK, 
null, null, null);
-            LOCALSubmission submission = new LOCALSubmission();
-            submission.setResourceJobManager(resourceJobManager);
-            String localSubmission = 
airavataClient.addLocalSubmissionDetails(new AuthzToken(""), localhostId, 1, 
submission);
-//            if (!localSubmission) throw new AiravataClientException();
-            System.out.println(localSubmission);
-            System.out.println("LocalHost Resource Id is " + localhostId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void registerApplicationInterfaces() {
-        registerAddApplicationInterface();
-        registerSubtractApplicationInterface();
-        registerMultiplyApplicationInterface();
-        registerEchoInterface();
-        registerTinkerMonteInterface();
-        registerGaussianInterface();
-    }
-
-    private void registerGaussianInterface() {
-        try {
-            System.out.println("#### Registering Gaussian Application 
Interface ####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(gaussianModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("MainInputFile", null,
-                    DataType.URI, null, 1,true,true, false, "Gaussian main 
input file", null);
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("gaussian.out",
-                    "", DataType.URI, true,true, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String addApplicationInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Gaussian",
 "Gaussian application",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Gaussian Application Interface Id " + 
addApplicationInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void registerTinkerMonteInterface() {
-        try {
-            System.out.println("#### Registering Tinker Monte Application 
Interface ####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(monteXModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("xyzf", "O16.xyz",
-                    DataType.STRING, null, 1, true,true, false, "Tinker monte 
input_1", null);
-            InputDataObjectType input2 = 
RegisterSampleApplicationsUtils.createAppInput("keyf", "O16.key",
-                    DataType.STRING, "-k", 2, true,true, false, "Tinker monte 
input_2", null);
-            InputDataObjectType input3 = 
RegisterSampleApplicationsUtils.createAppInput("stps", "20000",
-                    DataType.STRING, null, 3, true,true, false, "Tinker monte 
input_3", null);
-            InputDataObjectType input4 = 
RegisterSampleApplicationsUtils.createAppInput("Ctc", "C",
-                    DataType.STRING, null, 4, true,true, false, "Tinker monte 
input_4", null);
-            InputDataObjectType input5 = 
RegisterSampleApplicationsUtils.createAppInput("stpsZ", "3.0",
-                    DataType.STRING, null, 5, true,true, false, "Tinker monte 
input_5", null);
-            InputDataObjectType input6 = 
RegisterSampleApplicationsUtils.createAppInput("temp", "298",
-                    DataType.STRING, null, 6, true,true, false, "Tinker monte 
input_6", null);
-            InputDataObjectType input7 = 
RegisterSampleApplicationsUtils.createAppInput("Rconv", "0.01",
-                    DataType.STRING, null, 7, true,true, false, "Tinker monte 
input_7", null);
-
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-            applicationInputs.add(input2);
-            applicationInputs.add(input3);
-            applicationInputs.add(input4);
-            applicationInputs.add(input5);
-            applicationInputs.add(input6);
-            applicationInputs.add(input7);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Diskoutputfile_with_dir",
-                    "", DataType.URI, true,false, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String addApplicationInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Tinker_Monte",
 "Monte application",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Monte Application Interface Id " + 
addApplicationInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private void registerApplicationDeployments() throws TException {
-        System.out.println("#### Registering Application Deployments on 
Localhost ####");
-        //Register Echo
-        String echoAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, 
localhostId,
-                        sampleScriptDir + "/echo.sh", 
ApplicationParallelismType.SERIAL, "Echo application description",
-                        null, null, null));
-        System.out.println("Successfully registered Echo application on 
localhost, application Id = " + echoAppDeployId);
-
-        //Register Add application
-        String addAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(addModuleId, 
localhostId,
-                        sampleScriptDir + "/add.sh", 
ApplicationParallelismType.SERIAL, "Add application description",
-                        null, null, null));
-        System.out.println("Successfully registered Add application on 
localhost, application Id = " + addAppDeployId);
-
-        //Register Multiply application
-        String multiplyAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(multiplyModuleId, 
localhostId,
-                        sampleScriptDir + "/multiply.sh", 
ApplicationParallelismType.SERIAL, "Multiply application description",
-                        null, null, null));
-        System.out.println("Successfully registered Multiply application on 
localhost, application Id = " + multiplyAppDeployId);
-
-        //Register Subtract application
-        String subtractAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(subtractModuleId, 
localhostId,
-                        sampleScriptDir + "/subtract.sh", 
ApplicationParallelismType.SERIAL, "Subtract application description ",
-                        null, null, null));
-        System.out.println("Successfully registered Subtract application on 
localhost, application Id = " + subtractAppDeployId);
-
-        //Register Tinker monte application
-        String tinkerMonteAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(monteXModuleId, 
localhostId,
-                        sampleScriptDir + "/monte.x", 
ApplicationParallelismType.SERIAL, "Grid chem tinker monte application 
description ",
-                        null, null, null));
-        System.out.println("Successfully registered tinker monte application 
on localhost, application Id = " + tinkerMonteAppDeployId);
-
-        //Register Tinker monte application
-        String gaussianAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
-                
RegisterSampleApplicationsUtils.createApplicationDeployment(gaussianModuleId, 
localhostId,
-                        sampleScriptDir + "/gaussian.sh", 
ApplicationParallelismType.SERIAL, "Grid chem Gaussian application description 
",
-                        null, null, null));
-        System.out.println("Successfully registered Gaussian application on 
localhost, application Id = " + gaussianAppDeployId);
-    }
-
-    private void registerApplicationModules() throws TException {
-        //Register Echo
-        echoModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Echo", "1.0", "Echo application description"));
-        //Register Echo
-        addModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Add", "1.0", "Add application description"));
-        //Register Echo
-        multiplyModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Multiply", "1.0", "Multiply application 
description"));
-        //Register Echo
-        subtractModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Subtract", "1.0", "Subtract application 
description"));
-        //Register Monte
-        monteXModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Tinker Monte", "1.0", "Grid chem tinker monte 
application description"));
-
-        // Register gaussian application
-        gaussianModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
-                RegisterSampleApplicationsUtils.createApplicationModule(
-                        "Gaussian", "1.0", "Grid Chem Gaussian application 
description"));
-
-    }
-
-
-    public void registerEchoInterface() {
-        try {
-            System.out.println("#### Registering Echo Interface ####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(echoModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("Input_to_Echo", "Hello World",
-                    DataType.STRING, null, 1, true,true, false, "A test string 
to Echo", null);
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output",
-                    "", DataType.STRING, true, false, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String echoInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Echo", 
"Echo application description",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Echo Application Interface Id " + 
echoInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void registerAddApplicationInterface() {
-        try {
-            System.out.println("#### Registering Add Application Interface 
####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(addModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("x", "2",
-                    DataType.STRING, null, 1, true,true, false, "Add operation 
input_1", null);
-            InputDataObjectType input2 = 
RegisterSampleApplicationsUtils.createAppInput("y", "3",
-                    DataType.STRING, null, 2, true,true, false, "Add operation 
input_2", null);
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-            applicationInputs.add(input2);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Result",
-                    "0", DataType.STRING, true,false, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String addApplicationInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Add", 
"Add two numbers",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Add Application Interface Id " + 
addApplicationInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void registerMultiplyApplicationInterface() {
-        try {
-            System.out.println("#### Registering Multiply Application 
Interface ####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(multiplyModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("x", "4",
-                    DataType.STRING, null, 1,true,true, false, "Multiply 
operation input_1", null);
-            InputDataObjectType input2 = 
RegisterSampleApplicationsUtils.createAppInput("y", "5",
-                    DataType.STRING, null, 2, true,true, false, "Multiply 
operation input_2", null);
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-            applicationInputs.add(input2);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Result",
-                    "0", DataType.STRING,true,false, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String multiplyApplicationInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Multiply",
 "Multiply two numbers",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Multiply Application Interface Id " + 
multiplyApplicationInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void registerSubtractApplicationInterface() {
-        try {
-            System.out.println("#### Registering Subtract Application 
Interface ####");
-
-            List<String> appModules = new ArrayList<String>();
-            appModules.add(subtractModuleId);
-
-            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("x", "6",
-                    DataType.STRING, null, 1,true,true, false, "Subtract 
operation input_1", null);
-            InputDataObjectType input2 = 
RegisterSampleApplicationsUtils.createAppInput("y", "7",
-                    DataType.STRING, null, 2,true,true, false, "Subtract 
operation input_2", null);
-
-            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
-            applicationInputs.add(input1);
-            applicationInputs.add(input2);
-
-            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Result",
-                    "0", DataType.STRING, true,false, null);
-
-            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
-            applicationOutputs.add(output1);
-
-            String subtractApplicationInterfaceId = 
airavataClient.registerApplicationInterface(new AuthzToken(""), gatewayId,
-                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Subtract",
 "Subtract two numbers",
-                            appModules, applicationInputs, 
applicationOutputs));
-            System.out.println("Subtract Application Interface Id " + 
subtractApplicationInterfaceId);
-
-        } catch (TException e) {
-            e.printStackTrace();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/SampleEchoExperiment.java
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/SampleEchoExperiment.java
 
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/SampleEchoExperiment.java
new file mode 100644
index 0000000..3a706ea
--- /dev/null
+++ 
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/SampleEchoExperiment.java
@@ -0,0 +1,200 @@
+/*
+ *
+ * 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.client.samples;
+
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.client.AiravataClientFactory;
+import org.apache.airavata.client.tools.RegisterSampleApplicationsUtils;
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import 
org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import 
org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.application.io.DataType;
+import org.apache.airavata.model.application.io.InputDataObjectType;
+import org.apache.airavata.model.application.io.OutputDataObjectType;
+import org.apache.airavata.model.data.movement.DataMovementInterface;
+import org.apache.airavata.model.data.movement.DataMovementProtocol;
+import org.apache.airavata.model.error.AiravataClientException;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.model.experiment.UserConfigurationDataModel;
+import org.apache.airavata.model.parallelism.ApplicationParallelismType;
+import 
org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
+import org.apache.airavata.model.security.AuthzToken;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.GatewayApprovalStatus;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.thrift.TException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SampleEchoExperiment {
+
+    private static final String THRIFT_SERVER_HOST = "127.0.0.1";
+    private static final int THRIFT_SERVER_PORT = 8930;
+
+    private Airavata.Client airavataClient;
+    private String localhostId ;
+    private String echoModuleId;
+    private String echoInterfaceId;
+    private String echoExperimentId;
+
+    private String gatewayId = "default";
+    private String userId = "default-user";
+
+    public static void main(String[] args) throws AiravataClientException, 
TException {
+        SampleEchoExperiment sampleEchoExperiment = new SampleEchoExperiment();
+        sampleEchoExperiment.register();
+    }
+
+    public void register() throws TException {
+        airavataClient = 
AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, 
THRIFT_SERVER_PORT);
+        gatewayId = registerGateway();
+        registerLocalhost();
+        registerGatewayProfile();
+        registerEchoModule();
+        registerEchoDeployment();
+        registerEchoInterface();
+        createEchoExperiment();
+    }
+
+    private String registerGateway() throws TException {
+        Gateway gateway = new Gateway();
+        gateway.setGatewayName(gatewayId);
+        gateway.setGatewayId(gatewayId);
+        gateway.setGatewayApprovalStatus(GatewayApprovalStatus.APPROVED);
+        return airavataClient.addGateway(new AuthzToken(""), gateway);
+    }
+
+
+    private void registerLocalhost() {
+        try {
+            System.out.println("\n #### Registering Localhost Computational 
Resource #### \n");
+
+            ComputeResourceDescription computeResourceDescription = 
RegisterSampleApplicationsUtils.
+                    createComputeResourceDescription("localhost", "LocalHost", 
null, null);
+            DataMovementInterface dataMovementInterface = new 
DataMovementInterface("localhost_data_movement_interface", 
DataMovementProtocol.LOCAL, 1);
+            
computeResourceDescription.addToDataMovementInterfaces(dataMovementInterface);
+            JobSubmissionInterface jobSubmissionInterface = new 
JobSubmissionInterface("localhost_job_submission_interface", 
JobSubmissionProtocol.LOCAL, 1);
+            
computeResourceDescription.addToJobSubmissionInterfaces(jobSubmissionInterface);
+
+            localhostId = airavataClient.registerComputeResource(new 
AuthzToken(""), computeResourceDescription);
+            ResourceJobManager resourceJobManager = 
RegisterSampleApplicationsUtils.
+                    createResourceJobManager(ResourceJobManagerType.FORK, 
null, null, null);
+            LOCALSubmission submission = new LOCALSubmission();
+            submission.setResourceJobManager(resourceJobManager);
+            String localSubmission = 
airavataClient.addLocalSubmissionDetails(new AuthzToken(""), localhostId, 1, 
submission);
+            System.out.println(localSubmission);
+            System.out.println("LocalHost Resource Id is " + localhostId);
+        } catch (TException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void registerGatewayProfile() throws TException {
+        GatewayResourceProfile gatewayResourceProfile = new 
GatewayResourceProfile();
+        ComputeResourcePreference localhostResourcePreference = 
RegisterSampleApplicationsUtils.
+                createComputeResourcePreference(localhostId, gatewayId, false, 
null, null, null, "/tmp");
+        gatewayResourceProfile.setGatewayID(gatewayId);
+        
gatewayResourceProfile.addToComputeResourcePreferences(localhostResourcePreference);
+        airavataClient.registerGatewayResourceProfile(new AuthzToken(""), 
gatewayResourceProfile);
+    }
+
+
+    private void registerEchoModule() throws TException {
+        //Register Echo
+        echoModuleId = airavataClient.registerApplicationModule(new 
AuthzToken(""), gatewayId,
+                RegisterSampleApplicationsUtils.createApplicationModule(
+                        "Echo", "1.0", "Echo application description"));
+    }
+
+    private void registerEchoDeployment() throws TException {
+        System.out.println("#### Registering Application Deployments on 
Localhost ####");
+        //Register Echo
+        String echoAppDeployId = 
airavataClient.registerApplicationDeployment(new AuthzToken(""), gatewayId,
+                
RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, 
localhostId, "/bin/echo",
+                        ApplicationParallelismType.SERIAL, "Echo application 
description",
+                        null, null, null));
+        System.out.println("Successfully registered Echo application on 
localhost, application Id = " + echoAppDeployId);
+    }
+
+    private void registerEchoInterface() {
+        try {
+            System.out.println("#### Registering Echo Interface ####");
+
+            List<String> appModules = new ArrayList<String>();
+            appModules.add(echoModuleId);
+
+            InputDataObjectType input1 = 
RegisterSampleApplicationsUtils.createAppInput("Input_to_Echo", "Hello World",
+                    DataType.STRING, null, 1, true,true, false, "A test string 
to Echo", null);
+
+            List<InputDataObjectType> applicationInputs = new 
ArrayList<InputDataObjectType>();
+            applicationInputs.add(input1);
+
+            OutputDataObjectType output1 = 
RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output",
+                    "", DataType.STRING, true, false, null);
+
+            List<OutputDataObjectType> applicationOutputs = new 
ArrayList<OutputDataObjectType>();
+            applicationOutputs.add(output1);
+
+            echoInterfaceId = airavataClient.registerApplicationInterface(new 
AuthzToken(""), gatewayId,
+                    
RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Echo", 
"Echo application description",
+                            appModules, applicationInputs, 
applicationOutputs));
+            System.out.println("Echo Application Interface Id " + 
echoInterfaceId);
+
+        } catch (TException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void createEchoExperiment() throws TException {
+        Project project = new Project();
+        project.setName("default-project");
+        project.setOwner(userId);
+        String projectId = airavataClient.createProject(new AuthzToken(""), 
gatewayId, project);
+
+        ExperimentModel experimentModel = new ExperimentModel();
+        experimentModel.setExperimentName("dummy-echo-experiment");
+        experimentModel.setProjectId(projectId);
+        experimentModel.setUserName(userId);
+        experimentModel.setGatewayId(gatewayId);
+        experimentModel.setExecutionId(echoInterfaceId);
+
+        UserConfigurationDataModel userConfigurationDataModel = new 
UserConfigurationDataModel();
+        ComputationalResourceSchedulingModel 
computationalResourceSchedulingModel = new 
ComputationalResourceSchedulingModel();
+        computationalResourceSchedulingModel.setNodeCount(1);
+        computationalResourceSchedulingModel.setTotalCPUCount(1);
+        computationalResourceSchedulingModel.setTotalPhysicalMemory(512);
+        computationalResourceSchedulingModel.setResourceHostId(localhostId);
+        
userConfigurationDataModel.setComputationalResourceScheduling(computationalResourceSchedulingModel);
+
+        experimentModel.setUserConfigurationData(userConfigurationDataModel);
+
+        List<InputDataObjectType> experimentInputs = new ArrayList<>();
+        
experimentInputs.add(RegisterSampleApplicationsUtils.createAppInput("Input_to_Echo",
 "Hello World",
+                DataType.STRING, null, 1, true,true, false, "A test string to 
Echo", null));
+        experimentModel.setExperimentInputs(experimentInputs);
+        
experimentModel.setExperimentOutputs(airavataClient.getApplicationOutputs(new 
AuthzToken(""), echoInterfaceId));
+
+        echoExperimentId = airavataClient.createExperiment(new AuthzToken(""), 
gatewayId, experimentModel);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
----------------------------------------------------------------------
diff --git 
a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
 
b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
index 985daad..bb11264 100644
--- 
a/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
+++ 
b/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
@@ -35,6 +35,7 @@ public class ServerSettings extends ApplicationSettings {
     private static final String DEFAULT_USER = "default.registry.user";
     private static final String DEFAULT_USER_PASSWORD = 
"default.registry.password";
     private static final String DEFAULT_USER_GATEWAY = 
"default.registry.gateway";
+    private static final String ENABLE_SHARING = "enable.sharing";
 
     public static final String IP = "ip";
 
@@ -400,4 +401,8 @@ public class ServerSettings extends ApplicationSettings {
     public static String getLocalDataLocation() {
         return System.getProperty("java.io.tmpdir");
     }
+
+    public static Boolean isEnableSharing() throws 
ApplicationSettingsException {
+        return Boolean.parseBoolean(getSetting(ENABLE_SHARING));
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git 
a/modules/configuration/server/src/main/resources/airavata-server.properties 
b/modules/configuration/server/src/main/resources/airavata-server.properties
index 0dad713..2ce3701 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -43,6 +43,7 @@ validationQuery=SELECT 1 from CONFIGURATION
 cache.enable=true
 jpa.cache.size=5000
 
#jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
+enable.sharing=true
 
 # Properties for default user mode
 default.registry.user=admin

http://git-wip-us.apache.org/repos/asf/airavata/blob/ae546126/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
 
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index 076208d..30c518f 100644
--- 
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ 
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -21,6 +21,7 @@
 package org.apache.airavata.registry.api.service.handler;
 
 import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.WorkflowModel;
 import 
org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
@@ -3291,10 +3292,7 @@ public class RegistryServerHandler implements 
RegistryService.Iface {
                 }
             }
 
-            if(accessibleExpIds.size() == 0)
-                return new ArrayList<>();
-
-            if(accessibleExpIds.size() == 0){
+            if(accessibleExpIds.size() == 0 && 
!ServerSettings.isEnableSharing()){
                 
if(!regFilters.containsKey(AbstractExpCatResource.ExperimentConstants.USER_NAME)){
                     
regFilters.put(AbstractExpCatResource.ExperimentConstants.USER_NAME, userName);
                 }
@@ -3361,10 +3359,7 @@ public class RegistryServerHandler implements 
RegistryService.Iface {
                 }
             }
 
-            if(accessibleProjIds.size() == 0)
-                return new ArrayList<>();
-
-            if(accessibleProjIds.size() == 0){
+            if(accessibleProjIds.size() == 0 && 
!ServerSettings.isEnableSharing()){
                 
if(!regFilters.containsKey(AbstractExpCatResource.ProjectConstants.USERNAME)){
                     
regFilters.put(AbstractExpCatResource.ProjectConstants.USERNAME, userName);
                 }

Reply via email to