You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/11/20 07:37:25 UTC
[1/3] airavata git commit: Resolving registry-refactoring branch
compilation issues
Repository: airavata
Updated Branches:
refs/heads/registry-refactoring a39c443a0 -> 19b54a060
Resolving registry-refactoring branch compilation issues
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/dbc6ed16
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/dbc6ed16
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/dbc6ed16
Branch: refs/heads/registry-refactoring
Commit: dbc6ed161b22a893e35fba9b8d78fa65083dbd3b
Parents: a39c443
Author: Abhiit Karanjkar <ay...@indiana.edu>
Authored: Thu Nov 10 12:19:49 2016 -0500
Committer: Abhiit Karanjkar <ay...@indiana.edu>
Committed: Thu Nov 10 12:19:49 2016 -0500
----------------------------------------------------------------------
.../registry/core/impl/WorkflowCatalogImpl.java | 252 -------------------
modules/user-profile/pom.xml | 1 -
2 files changed, 253 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/dbc6ed16/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/impl/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/impl/WorkflowCatalogImpl.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/impl/WorkflowCatalogImpl.java
deleted file mode 100644
index e8456e9..0000000
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/impl/WorkflowCatalogImpl.java
+++ /dev/null
@@ -1,252 +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.registry.core.workflow.catalog.impl;
-
-import org.apache.airavata.model.WorkflowModel;
-import org.apache.airavata.model.application.io.InputDataObjectType;
-import org.apache.airavata.model.application.io.OutputDataObjectType;
-import org.apache.airavata.registry.core.workflow.catalog.resources.*;
-import org.apache.airavata.registry.core.workflow.catalog.utils.WorkflowCatalogThriftConversion;
-import org.apache.airavata.registry.core.workflow.catalog.utils.WorkflowCatalogUtils;
-import org.apache.airavata.registry.cpi.WorkflowCatalog;
-import org.apache.airavata.registry.cpi.WorkflowCatalogException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class WorkflowCatalogImpl implements WorkflowCatalog {
- private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogImpl.class);
-
- @Override
- public List<String> getAllWorkflows(String gatewayId) throws WorkflowCatalogException {
- List<String> workflowIds = new ArrayList<String>();
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.setGatewayId(gatewayId);
- workflowIds = resource.getAllIds();
- } catch (Exception e) {
- logger.error("Error while retrieving all the workflow template ids...", e);
- throw new WorkflowCatalogException(e);
- }
- return workflowIds;
- }
-
- @Override
- public WorkflowModel getWorkflow(String workflowTemplateId) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource wfResource = (WorkflowResource)resource.get(workflowTemplateId);
- return WorkflowCatalogThriftConversion.getWorkflow(wfResource);
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow...", e);
- throw new WorkflowCatalogException(e);
- }
- }
-
- @Override
- public void deleteWorkflow(String workflowTemplateId) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.remove(workflowTemplateId);
- } catch (Exception e) {
- logger.error("Error while deleting the workflow...", e);
- throw new WorkflowCatalogException(e);
- }
- }
-
- @Override
- public String registerWorkflow(WorkflowModel workflow, String gatewayId) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- resource.setWfTemplateId(WorkflowCatalogUtils.getID(workflow.getName()));
- resource.setWfName(workflow.getName());
- resource.setGraph(workflow.getGraph());
- resource.setGatewayId(gatewayId);
- if (workflow.getImage() != null){
- resource.setImage(new String(workflow.getImage()));
- }
- resource.save();
- workflow.setTemplateId(resource.getWfTemplateId());
- List<InputDataObjectType> workflowInputs = workflow.getWorkflowInputs();
- if (workflowInputs != null && workflowInputs.size() != 0){
- for (InputDataObjectType input : workflowInputs){
- WorkflowInputResource wfInputResource = new WorkflowInputResource();
- wfInputResource.setWorkflowResource(resource);
- wfInputResource.setInputKey(input.getName());
- wfInputResource.setInputVal(input.getValue());
- wfInputResource.setWfTemplateId(resource.getWfTemplateId());
- wfInputResource.setDataType(input.getType().toString());
- wfInputResource.setAppArgument(input.getApplicationArgument());
- wfInputResource.setStandardInput(input.isStandardInput());
- wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
- wfInputResource.setMetadata(input.getMetaData());
- wfInputResource.save();
- }
- }
- List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
- if (workflowOutputs != null && workflowOutputs.size() != 0){
- for (OutputDataObjectType output : workflowOutputs){
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- outputResource.setWorkflowResource(resource);
- outputResource.setOutputKey(output.getName());
- outputResource.setOutputVal(output.getValue());
- outputResource.setWfTemplateId(resource.getWfTemplateId());
- outputResource.setDataType(output.getType().toString());
- outputResource.setAppArgument(output.getApplicationArgument());
- outputResource.setDataNameLocation(output.getLocation());
- outputResource.setRequired(output.isIsRequired());
- outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- outputResource.setOutputStreaming(output.isOutputStreaming());
- outputResource.setDataMovement(output.isDataMovement());
- outputResource.save();
- }
- }
- return resource.getWfTemplateId();
- } catch (Exception e) {
- logger.error("Error while saving the workflow...", e);
- throw new WorkflowCatalogException(e);
- }
- }
-
- @Override
- public void updateWorkflow(String workflowTemplateId, WorkflowModel workflow) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource existingWF = (WorkflowResource)resource.get(workflowTemplateId);
- existingWF.setWfName(workflow.getName());
- existingWF.setGraph(workflow.getGraph());
- if (workflow.getImage() != null){
- existingWF.setImage(new String(workflow.getImage()));
- }
- existingWF.save();
- List<InputDataObjectType> existingwFInputs = workflow.getWorkflowInputs();
- if (existingwFInputs != null && existingwFInputs.size() != 0){
- for (InputDataObjectType input : existingwFInputs){
- WorkflowInputResource wfInputResource = new WorkflowInputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
- ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.INPUT_KEY,input.getName());
- WorkflowInputResource existingInput = (WorkflowInputResource)wfInputResource.get(ids);
- existingInput.setWorkflowResource(existingWF);
- existingInput.setInputKey(input.getName());
- existingInput.setInputVal(input.getValue());
- existingInput.setWfTemplateId(existingWF.getWfTemplateId());
- existingInput.setDataType(input.getType().toString());
- existingInput.setAppArgument(input.getApplicationArgument());
- existingInput.setStandardInput(input.isStandardInput());
- existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
- existingInput.setMetadata(input.getMetaData());
- existingInput.save();
- }
- }
- List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
- if (workflowOutputs != null && workflowOutputs.size() != 0){
- for (OutputDataObjectType output : workflowOutputs){
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.WF_TEMPLATE_ID,existingWF.getWfTemplateId());
- ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.OUTPUT_KEY,output.getName());
- WorkflowOutputResource existingOutput = (WorkflowOutputResource)outputResource.get(ids);
- existingOutput.setWorkflowResource(existingWF);
- existingOutput.setOutputKey(output.getName());
- existingOutput.setOutputVal(output.getValue());
- existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.setAppArgument(output.getApplicationArgument());
- existingOutput.setDataNameLocation(output.getLocation());
- existingOutput.setRequired(output.isIsRequired());
- existingOutput.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- existingOutput.setOutputStreaming(output.isOutputStreaming());
- existingOutput.setDataMovement(output.isDataMovement());
- existingOutput.save();
- }
- }
- } catch (Exception e) {
- logger.error("Error while updating the workflow...", e);
- throw new WorkflowCatalogException(e);
- }
- }
-
- @Override
- public String getWorkflowTemplateId(String workflowName) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- List<WorkflowCatalogResource> resourceList = resource.get(WorkflowCatAbstractResource.WorkflowConstants.WORKFLOW_NAME, workflowName);
- if (resourceList != null && !resourceList.isEmpty()){
- WorkflowResource wfResource = (WorkflowResource)resourceList.get(0);
- return wfResource.getWfTemplateId();
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow with the workflow name...", e);
- throw new WorkflowCatalogException(e);
- }
- return null;
- }
-
- @Override
- public boolean isWorkflowExistWithName(String workflowName) throws WorkflowCatalogException {
- try {
- WorkflowResource resource = new WorkflowResource();
- List<WorkflowCatalogResource> resourceList = resource.get(WorkflowCatAbstractResource.WorkflowConstants.WORKFLOW_NAME, workflowName);
- if (resourceList != null && !resourceList.isEmpty()){
- return true;
- }
- } catch (Exception e) {
- logger.error("Error while retrieving the workflow with the workflow name...", e);
- throw new WorkflowCatalogException(e);
- }
- return false;
- }
-
- @Override
- public void updateWorkflowOutputs(String workflowTemplateId, List<OutputDataObjectType> workflowOutputs) throws WorkflowCatalogException {
- WorkflowResource resource = new WorkflowResource();
- WorkflowResource existingWF = (WorkflowResource)resource.get(workflowTemplateId);
- if (workflowOutputs != null && workflowOutputs.size() != 0) {
- for (OutputDataObjectType output : workflowOutputs) {
- WorkflowOutputResource outputResource = new WorkflowOutputResource();
- Map<String, String> ids = new HashMap<String, String>();
- ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
- ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.OUTPUT_KEY, output.getName());
- WorkflowOutputResource existingOutput = (WorkflowOutputResource) outputResource.get(ids);
- existingOutput.setWorkflowResource(existingWF);
- existingOutput.setOutputKey(output.getName());
- existingOutput.setOutputVal(output.getValue());
- existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.setDataType(output.getType().toString());
- existingOutput.setAppArgument(output.getApplicationArgument());
- existingOutput.setDataNameLocation(output.getLocation());
- existingOutput.setRequired(output.isIsRequired());
- existingOutput.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
- existingOutput.setOutputStreaming(output.isOutputStreaming());
- existingOutput.setDataMovement(output.isDataMovement());
- existingOutput.save();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/dbc6ed16/modules/user-profile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/pom.xml b/modules/user-profile/pom.xml
index dc11a7c..7f60f9c 100644
--- a/modules/user-profile/pom.xml
+++ b/modules/user-profile/pom.xml
@@ -21,7 +21,6 @@
<artifactId>user-profile</artifactId>
<packaging>pom</packaging>
<modules>
- <module>user-profile-core</module>
<module>user-profile-stubs</module>
</modules>
[2/3] airavata git commit: User Profile CPI Server
Posted by sc...@apache.org.
User Profile CPI Server
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b10221a3
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b10221a3
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b10221a3
Branch: refs/heads/registry-refactoring
Commit: b10221a39280e56aae6b61e39b9a73224f3d0237
Parents: dbc6ed1
Author: Abhiit Karanjkar <ay...@indiana.edu>
Authored: Fri Nov 18 20:15:59 2016 -0500
Committer: Abhiit Karanjkar <ay...@indiana.edu>
Committed: Fri Nov 18 20:15:59 2016 -0500
----------------------------------------------------------------------
airavata-api/airavata-model-utils/pom.xml | 5 +
.../common/utils/ApplicationSettings.java | 8 +
.../apache/airavata/common/utils/IServer.java | 26 +--
.../airavata/common/utils/ServerSettings.java | 6 +
.../main/resources/airavata-server.properties | 8 +
.../core/repositories/AbstractRepository.java | 32 +++-
.../workspacecatalog/UserProfileRepository.java | 45 +++++
.../registry/core/utils/QueryConstants.java | 22 +++
modules/user-profile/.project | 17 ++
.../.settings/org.eclipse.core.resources.prefs | 2 +
.../.settings/org.eclipse.m2e.core.prefs | 4 +
modules/user-profile/pom.xml | 2 +
.../user-profile/user-profile-core/.classpath | 26 +++
modules/user-profile/user-profile-core/.project | 23 +++
.../.settings/org.eclipse.core.resources.prefs | 4 +
.../.settings/org.eclipse.jdt.core.prefs | 5 +
.../.settings/org.eclipse.m2e.core.prefs | 4 +
.../core/AbstractThriftDeserializer.java | 152 -----------------
.../core/AbstractThriftSerializer.java | 122 --------------
.../userprofile/core/ModelConversionHelper.java | 77 ---------
.../airavata/userprofile/core/MongoUtil.java | 59 -------
.../userprofile/core/UserProfileCPIImpl.java | 79 ---------
.../core/UserProfileCPIImplFactory.java | 43 -----
.../userprofile/core/UserProfileDao.java | 164 -------------------
.../core/UserProfileDeserializer.java | 64 --------
.../userprofile/core/UserProfileSerializer.java | 51 ------
.../core/UserProfileCPIImplTest.java | 68 --------
.../user-profile-service/.classpath | 26 +++
.../user-profile/user-profile-service/.project | 23 +++
.../.settings/org.eclipse.core.resources.prefs | 3 +
.../.settings/org.eclipse.jdt.core.prefs | 5 +
.../.settings/org.eclipse.m2e.core.prefs | 4 +
.../user-profile/user-profile-service/pom.xml | 27 +++
.../server/UserProfileHandler.java | 83 ++++++++++
.../server/UserProfileServer.java | 141 ++++++++++++++++
modules/user-profile/user-profile-stubs/pom.xml | 5 +
.../airavata/userprofile/crude/cpi/Test.java | 14 ++
.../component-cpis/user-profile-crud-cpi.thrift | 2 +-
38 files changed, 552 insertions(+), 899 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/airavata-api/airavata-model-utils/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-model-utils/pom.xml b/airavata-api/airavata-model-utils/pom.xml
index 87c457e..84d6592 100644
--- a/airavata-api/airavata-model-utils/pom.xml
+++ b/airavata-api/airavata-model-utils/pom.xml
@@ -36,6 +36,11 @@
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>0.17-SNAPSHOT</version>
+ </dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
index 9ce0786..db7e246 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
@@ -359,9 +359,17 @@ public class ApplicationSettings {
return getSetting("credential.store.server.host");
}
+ public static String getUserProfileServerHost() throws ApplicationSettingsException {
+ return getSetting(ServerSettings.USER_PROFILE_SERVER_HOST);
+ }
+
public static String getCredentialStoreServerPort() throws ApplicationSettingsException {
return getSetting("credential.store.server.port");
}
+
+ public static String getUserProfileServerPort() throws ApplicationSettingsException {
+ return getSetting(ServerSettings.USER_PROFILE_SERVER_PORT);
+ }
public static String getCredentialStoreNotifierEnabled() throws ApplicationSettingsException {
return getSetting("notifier.enabled");
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
----------------------------------------------------------------------
diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
index 867eb45..29159f9 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/IServer.java
@@ -25,20 +25,20 @@ import java.util.Calendar;
import java.util.Date;
public interface IServer {
- public enum ServerStatus{
- STOPING,
- STOPPED,
- STARTING,
- STARTED,
- FAILED;
- public void updateTime(){
- now=Calendar.getInstance().getTime();
+ public enum ServerStatus{
+ STOPING,
+ STOPPED,
+ STARTING,
+ STARTED,
+ FAILED;
+ public void updateTime(){
+ now=Calendar.getInstance().getTime();
+ }
+ private Date now;
+ public Date getTime(){
+ return now;
+ }
}
- private Date now;
- public Date getTime(){
- return now;
- }
- }
public String getName();
public String getVersion();
public void start() throws Exception;
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 bb11264..97a16f9 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
@@ -57,6 +57,12 @@ public class ServerSettings extends ApplicationSettings {
// Credential Store constants
public static final String CREDENTIAL_SERVER_HOST = "credential.store.server.host";
public static final String CREDENTIAL_SERVER_PORT = "credential.store.server.port";
+
+ //User Profile onstants
+
+ public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host";
+ public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port";
+
// Zookeeper + curator constants
public static final String EMBEDDED_ZK = "embedded.zk";
public static final String ZOOKEEPER_SERVER_CONNECTION = "zookeeper.server.connection";
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/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 2ce3701..704c6e5 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -194,6 +194,14 @@ credential.store.server.host=localhost
credential.store.server.port=8960
credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer
+
+###########################################################################
+# User Profile module Configuration
+###########################################################################
+user.profile.server.host=localhost
+user.profile.server.port=8961
+user_profile=com.apache.airavata.user.profile.server.UserProfileServer
+
# these properties used by credential store email notifications
email.server=smtp.googlemail.com
email.server.port=465
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
index bc3a9da..a83928d 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
@@ -26,8 +26,10 @@ import org.dozer.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.persistence.Query;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
public abstract class AbstractRepository<T, E, Id> {
private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
@@ -35,23 +37,23 @@ public abstract class AbstractRepository<T, E, Id> {
private Class<T> thriftGenericClass;
private Class<E> dbEntityGenericClass;
- public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass){
+ public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) {
this.thriftGenericClass = thriftGenericClass;
this.dbEntityGenericClass = dbEntityGenericClass;
}
- public T create(T t){
+ public T create(T t) {
return update(t);
}
- public T update(T t){
+ public T update(T t) {
Mapper mapper = ObjectMapperSingleton.getInstance();
E entity = mapper.map(t, dbEntityGenericClass);
E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
return mapper.map(persistedCopy, thriftGenericClass);
}
- public boolean delete(Id id){
+ public boolean delete(Id id) {
JPAUtils.execute(entityManager -> {
E entity = entityManager.find(dbEntityGenericClass, id);
entityManager.remove(entity);
@@ -60,14 +62,14 @@ public abstract class AbstractRepository<T, E, Id> {
return true;
}
- public T get(Id id){
+ public T get(Id id) {
E entity = JPAUtils.execute(entityManager -> entityManager
.find(dbEntityGenericClass, id));
Mapper mapper = ObjectMapperSingleton.getInstance();
return mapper.map(entity, thriftGenericClass);
}
- public List<T> select(String query, int limit, int offset){
+ public List<T> select(String query, int limit, int offset) {
List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset)
.setMaxResults(offset).getResultList());
Mapper mapper = ObjectMapperSingleton.getInstance();
@@ -75,4 +77,22 @@ public abstract class AbstractRepository<T, E, Id> {
resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
return gatewayList;
}
+
+ public List<T> select(String query, int limit, int offset, Map<String, Object> queryParams) {
+ List resultSet = (List) JPAUtils.execute(entityManager -> {
+ Query jpaQuery = entityManager.createQuery(query);
+
+ for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
+
+ jpaQuery.setParameter(entry.getKey(), entry.getValue());
+ }
+
+ return jpaQuery.setFirstResult(offset).setMaxResults(limit).getResultList();
+
+ });
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ List<T> gatewayList = new ArrayList<>();
+ resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+ return gatewayList;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
index f067370..7c5bd4b 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/workspacecatalog/UserProfileRepository.java
@@ -23,10 +23,13 @@ package org.apache.airavata.registry.core.repositories.workspacecatalog;
import org.apache.airavata.model.user.UserProfile;
import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.apache.airavata.registry.core.utils.QueryConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class UserProfileRepository extends AbstractRepository<UserProfile, UserProfileEntity, String> {
private final static Logger logger = LoggerFactory.getLogger(UserProfileRepository.class);
@@ -40,4 +43,46 @@ public class UserProfileRepository extends AbstractRepository<UserProfile, UserP
throw new UnsupportedOperationException("Due to performance overheads this method is not supported. Instead use" +
" UserProfileSummaryRepository");
}
+
+ public UserProfile getUserProfileByIdAndGateWay(String userId, String gatewayId) {
+
+ UserProfile userProfile = null;
+
+ Map<String, Object> queryParam = new HashMap<String, Object>();
+ queryParam.put(UserProfile._Fields.USER_ID.getFieldName(), userId);
+ queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+ List<UserProfile> resultList = select(QueryConstants.FIND_USER_PROFILE_BY_USER_ID, 0, 1, queryParam);
+
+ if (resultList != null && resultList.size() > 0)
+ userProfile = resultList.get(0);
+
+
+ return userProfile;
+ }
+
+ public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) {
+
+ Map<String, Object> queryParam = new HashMap<String, Object>();
+ queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+
+ List<UserProfile> resultList = select(QueryConstants.FIND_ALL_USER_PROFILES_BY_GATEWAY_ID, 0, 1, queryParam);
+
+ return resultList;
+ }
+
+ public UserProfile getUserProfileByNameAndGateWay(String name, String gatewayId) {
+
+ UserProfile userProfile = null;
+
+ Map<String, Object> queryParam = new HashMap<String, Object>();
+ queryParam.put(UserProfile._Fields.USER_NAME.getFieldName(), name);
+ queryParam.put(UserProfile._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+ List<UserProfile> resultList = select(QueryConstants.FIND_USER_PROFILE_BY_USER_NAME, 0, 1, queryParam);
+
+ if (resultList != null && resultList.size() > 0)
+ userProfile = resultList.get(0);
+
+
+ return userProfile;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
----------------------------------------------------------------------
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
new file mode 100644
index 0000000..171317e
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
@@ -0,0 +1,22 @@
+package org.apache.airavata.registry.core.utils;
+
+import org.apache.airavata.model.user.UserProfile;
+
+/**
+ * Created by abhij on 11/11/2016.
+ */
+public interface QueryConstants {
+
+
+
+ String FIND_USER_PROFILE_BY_USER_ID = "SELECT u FROM UserProfileEntity u " +
+ "where u.userId LIKE :" + UserProfile._Fields.USER_ID.getFieldName() + " " +
+ "AND u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+
+ String FIND_ALL_USER_PROFILES_BY_GATEWAY_ID = "SELECT u FROM UserProfileEntity u " +
+ "where u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+
+ String FIND_USER_PROFILE_BY_USER_NAME = "SELECT u FROM UserProfileEntity u " +
+ "where u.userId LIKE :" + UserProfile._Fields.USER_NAME.getFieldName() + " " +
+ "AND u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/.project b/modules/user-profile/.project
new file mode 100644
index 0000000..788ce56
--- /dev/null
+++ b/modules/user-profile/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>user-profile</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/modules/user-profile/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/pom.xml b/modules/user-profile/pom.xml
index 7f60f9c..37efc57 100644
--- a/modules/user-profile/pom.xml
+++ b/modules/user-profile/pom.xml
@@ -22,6 +22,8 @@
<packaging>pom</packaging>
<modules>
<module>user-profile-stubs</module>
+ <module>user-profile-service</module>
+
</modules>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.classpath
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.classpath b/modules/user-profile/user-profile-core/.classpath
new file mode 100644
index 0000000..af1430b
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.project b/modules/user-profile/user-profile-core/.project
new file mode 100644
index 0000000..e2dfe96
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>user-profile-core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/user-profile-core/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
deleted file mode 100644
index 83af52b..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftDeserializer.java
+++ /dev/null
@@ -1,152 +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.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.*;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.google.common.base.CaseFormat;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TException;
-import org.apache.thrift.TFieldIdEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * This abstract class represents a generic de-serializer for converting JSON to Thrift-based entities.
- *
- * @param <E> An implementation of the {@link org.apache.thrift.TFieldIdEnum} interface.
- * @param <T> An implementation of the {@link org.apache.thrift.TBase} interface.
- */
-public abstract class AbstractThriftDeserializer<E extends TFieldIdEnum, T extends TBase<T, E>> extends JsonDeserializer<T> {
-
- private static Logger log = LoggerFactory.getLogger(AbstractThriftDeserializer.class);
-
- @Override
- public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
- final T instance = newInstance();
- final ObjectMapper mapper = (ObjectMapper)jp.getCodec();
- final ObjectNode rootNode = (ObjectNode)mapper.readTree(jp);
- final Iterator<Map.Entry<String, JsonNode>> iterator = rootNode.fields();
-
- while(iterator.hasNext()) {
- final Map.Entry<String, JsonNode> currentField = iterator.next();
- try {
- /*
- * If the current node is not a null value, process it. Otherwise,
- * skip it. Jackson will treat the null as a 0 for primitive
- * number types, which in turn will make Thrift think the field
- * has been set. Also we ignore the MongoDB specific _id field
- */
- if(!currentField.getKey().equalsIgnoreCase("_id")
- && currentField.getValue().getNodeType() != JsonNodeType.NULL) {
- final E field = getField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_UNDERSCORE, currentField.getKey()));
- final JsonParser parser = currentField.getValue().traverse();
- parser.setCodec(mapper);
- final Object value = mapper.readValue(parser, generateValueType(instance, field));
- if(value != null) {
- log.debug(String.format("Field %s produced value %s of type %s.",
- currentField.getKey(), value, value.getClass().getName()));
- instance.setFieldValue(field, value);
- } else {
- log.debug("Field {} contains a null value. Skipping...", currentField.getKey());
- }
- } else {
- log.debug("Field {} contains a null value. Skipping...", currentField.getKey());
- }
- } catch (final NoSuchFieldException | IllegalArgumentException e) {
- log.error("Unable to de-serialize field '{}'.", currentField.getKey(), e);
- ctxt.mappingException(e.getMessage());
- }
- }
-
- try {
- // Validate that the instance contains all required fields.
- validate(instance);
- } catch (final TException e) {
- log.error(String.format("Unable to deserialize JSON '%s' to type '%s'.",
- jp.getValueAsString(), instance.getClass().getName(), e));
- ctxt.mappingException(e.getMessage());
- }
-
- return instance;
- }
-
- /**
- * Returns the {@code <E>} enumerated value that represents the target
- * field in the Thrift entity referenced in the JSON document.
- * @param fieldName The name of the Thrift entity target field.
- * @return The {@code <E>} enumerated value that represents the target
- * field in the Thrift entity referenced in the JSON document.
- */
- protected abstract E getField(String fieldName);
-
- /**
- * Creates a new instance of the Thrift entity class represented by this deserializer.
- * @return A new instance of the Thrift entity class represented by this deserializer.
- */
- protected abstract T newInstance();
-
- /**
- * Validates that the Thrift entity instance contains all required fields after deserialization.
- * @param instance A Thrift entity instance.
- * @throws org.apache.thrift.TException if unable to validate the instance.
- */
- protected abstract void validate(T instance) throws TException;
-
- /**
- * Generates a {@link JavaType} that matches the target Thrift field represented by the provided
- * {@code <E>} enumerated value. If the field's type includes generics, the generics will
- * be added to the generated {@link JavaType} to support proper conversion.
- * @param thriftInstance The Thrift-generated class instance that will be converted to/from JSON.
- * @param field A {@code <E>} enumerated value that represents a field in a Thrift-based entity.
- * @return The {@link JavaType} representation of the type associated with the field.
- * @throws NoSuchFieldException if unable to determine the field's type.
- * @throws SecurityException if unable to determine the field's type.
- */
- protected JavaType generateValueType(final T thriftInstance, final E field) throws NoSuchFieldException, SecurityException {
- final TypeFactory typeFactory = TypeFactory.defaultInstance();
-
- final Field declaredField = thriftInstance.getClass().getDeclaredField(field.getFieldName());
- if(declaredField.getType().equals(declaredField.getGenericType())) {
- log.debug("Generating JavaType for type '{}'.", declaredField.getType());
- return typeFactory.constructType(declaredField.getType());
- } else {
- final ParameterizedType type = (ParameterizedType)declaredField.getGenericType();
- final Class<?>[] parameterizedTypes = new Class<?>[type.getActualTypeArguments().length];
- for(int i=0; i<type.getActualTypeArguments().length; i++) {
- parameterizedTypes[i] = (Class<?>)type.getActualTypeArguments()[i];
- }
- log.debug("Generating JavaType for type '{}' with generics '{}'", declaredField.getType(), parameterizedTypes);
- return typeFactory.constructParametricType(declaredField.getType(), parameterizedTypes);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
deleted file mode 100644
index d9e19ab..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/AbstractThriftSerializer.java
+++ /dev/null
@@ -1,122 +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.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.google.common.base.CaseFormat;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TFieldIdEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * This abstract class represents a generic serializer for converting Thrift-based entities
- * to JSON.
- *
- * @param <E> An implementation of the {@link org.apache.thrift.TFieldIdEnum} interface.
- * @param <T> An implementation of the {@link org.apache.thrift.TBase} interface.
- */
-public abstract class AbstractThriftSerializer<E extends TFieldIdEnum, T extends TBase<T, E>>
- extends JsonSerializer<T> {
-
- private static final Logger log = LoggerFactory.getLogger(AbstractThriftSerializer.class);
-
- @Override
- public Class<T> handledType() {
- return getThriftClass();
- }
-
- @Override
- public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
- jgen.writeStartObject();
- for(final E field : getFieldValues()) {
- if(value.isSet(field)) {
- final Object fieldValue = value.getFieldValue(field);
- if(fieldValue != null) {
- log.debug("Adding field {} to the JSON string...",
- CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
- );
-
- jgen.writeFieldName(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName()));
- if(fieldValue instanceof Short) {
- jgen.writeNumber((Short)fieldValue);
- } else if(fieldValue instanceof Integer) {
- jgen.writeNumber((Integer)fieldValue);
- } else if(fieldValue instanceof Long) {
- jgen.writeNumber((Long)fieldValue);
- } else if(fieldValue instanceof Double) {
- jgen.writeNumber((Double)fieldValue);
- } else if(fieldValue instanceof Float) {
- jgen.writeNumber((Float)fieldValue);
- } else if(fieldValue instanceof Boolean) {
- jgen.writeBoolean((Boolean)fieldValue);
- } else if(fieldValue instanceof String) {
- jgen.writeString(fieldValue.toString());
- } else if(fieldValue instanceof Collection) {
- log.debug("Array opened for field {}.",
- CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
- );
- jgen.writeStartArray();
- for(final Object arrayObject : (Collection<?>)fieldValue) {
- jgen.writeObject(arrayObject);
- }
- jgen.writeEndArray();
- log.debug("Array closed for field {}.",
- CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
- );
- } else {
- jgen.writeObject(fieldValue);
- }
- } else {
- log.debug("Skipping converting field {} to JSON: value is null!",
- CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
- );
- }
- } else {
- log.debug("Skipping converting field {} to JSON: field has not been set!",
- CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE,field.getFieldName())
- );
- }
- }
- jgen.writeEndObject();
- }
-
- /**
- * Returns an array of {@code <E>} enumerated values that represent the fields present in the
- * Thrift class associated with this serializer.
- * @return The array of {@code <E>} enumerated values that represent the fields present in the
- * Thrift class.
- */
- protected abstract E[] getFieldValues();
-
- /**
- * Returns the {@code <T>} implementation class associated with this serializer.
- * @return The {@code <T>} implementation class
- */
- protected abstract Class<T> getThriftClass();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
deleted file mode 100644
index cae69a1..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/ModelConversionHelper.java
+++ /dev/null
@@ -1,77 +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.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.thrift.TBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-public class ModelConversionHelper {
- private final static Logger logger = LoggerFactory.getLogger(ModelConversionHelper.class);
- private ObjectMapper objectMapper;
-
- public ModelConversionHelper(){
- init();
- }
-
- /**
- * Private method to register the custom serializers and deserializers
- */
- private void init() {
- this.objectMapper = new ObjectMapper();
- SimpleModule module = new SimpleModule("UserProfileModule",
- new Version(1, 0, 0, null, null, null));
-
- module.addSerializer(UserProfile.class, new UserProfileSerializer());
- module.addDeserializer(UserProfile.class, new UserProfileDeserializer());
-
- objectMapper.registerModule(module);
- }
-
- /**
- * Method to serialize a thrift object to json
- * @param object
- * @return
- * @throws JsonProcessingException
- */
- public String serializeObject(TBase object) throws JsonProcessingException {
- String json = this.objectMapper.writeValueAsString(object);
- return json;
- }
-
- /**
- * Method to deserialize a json to the thrift object
- * @param clz
- * @param json
- * @return
- * @throws IOException
- */
- public TBase deserializeObject(Class<?> clz, String json) throws IOException {
- return (TBase)this.objectMapper.readValue(json, clz);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
deleted file mode 100644
index 3cd3598..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/MongoUtil.java
+++ /dev/null
@@ -1,59 +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.userprofile.core;
-
-import com.mongodb.DB;
-import com.mongodb.MongoClient;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MongoUtil {
- private final static Logger logger = LoggerFactory.getLogger(MongoUtil.class);
-
- private static MongoClient mongoClient = null;
- private static DB userProfileRegistry;
- public static String USER_PROFILE_REGISTRY_NAME = "user-profile-registry";
-
- public static MongoClient getMongoClient() throws ApplicationSettingsException {
- if (mongoClient == null) {
- String host = ServerSettings.getUserProfileMongodbHost();
- int port = ServerSettings.getUserProfileMongodbPort();
- mongoClient = new MongoClient(host, port);
- logger.debug("New Mongo Client created with [" + host + "] and ["
- + port + "]");
- }
- return mongoClient;
- }
-
- public static DB getUserProfileRegistry() throws ApplicationSettingsException {
- if (userProfileRegistry == null) {
- userProfileRegistry = getMongoClient().getDB(USER_PROFILE_REGISTRY_NAME);
- }
- return userProfileRegistry;
- }
-
- public static void dropUserProfileRegistry() throws ApplicationSettingsException {
- getMongoClient().dropDatabase(USER_PROFILE_REGISTRY_NAME);
- logger.debug("Dropped User Profile Registry");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
deleted file mode 100644
index 991f193..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImpl.java
+++ /dev/null
@@ -1,79 +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.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileCPI;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.UUID;
-
-public class UserProfileCPIImpl implements UserProfileCPI {
- private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImpl.class);
-
- private UserProfileDao userProfileDao;
-
- public UserProfileCPIImpl() throws UserProfileException {
- userProfileDao = new UserProfileDao();
- }
-
- @Override
- public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws UserProfileException {
- return userProfileDao.getAllUserProfilesInGateway(gatewayId);
- }
-
- @Override
- public String createUserProfile(UserProfile userProfile) throws UserProfileException {
- userProfile.setUserId(UUID.randomUUID().toString());
- // Setting user id to airavataInternalUserId. We don't distinguish these two at the moment.
- userProfile.setAiravataInternalUserId(userProfile.getUserId());
- userProfileDao.createUserProfile(userProfile);
- return userProfile.getUserId();
- }
-
- @Override
- public boolean updateUserProfile(UserProfile userProfile) throws UserProfileException {
- return userProfileDao.updateUserProfile(userProfile);
- }
-
- @Override
- public boolean deleteUserProfile(String userId) throws UserProfileException {
- return userProfileDao.deleteUserProfile(userId);
- }
-
- @Override
- public UserProfile getUserProfileFromUserId(String userId) throws UserProfileException {
- return userProfileDao.getUserProfileFromUserId(userId);
- }
-
- @Override
- public UserProfile getUserProfileFromUserName(String userName, String gatewayId) throws UserProfileException {
- return userProfileDao.getUserProfileFromUserName(userName, gatewayId);
- }
-
- @Override
- public boolean userProfileExists(String userName, String gatewayId) throws UserProfileException {
- return userProfileDao.userProfileExists(userName, gatewayId);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
deleted file mode 100644
index 532d382..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileCPIImplFactory.java
+++ /dev/null
@@ -1,43 +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.userprofile.core;
-
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileCPIImplFactory {
- private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImplFactory.class);
-
- private static UserProfileCPIImpl userProfileCPIImpl;
-
- public static UserProfileCPIImpl getRegistry() throws UserProfileException {
- try {
- if (userProfileCPIImpl == null) {
- userProfileCPIImpl = new UserProfileCPIImpl();
- }
- } catch (Exception e) {
- logger.error("Unable to create UserProfileCPIImpl instance", e);
- throw new UserProfileException(e);
- }
- return userProfileCPIImpl;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
deleted file mode 100644
index be3a78b..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDao.java
+++ /dev/null
@@ -1,164 +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.userprofile.core;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.mongodb.*;
-import com.mongodb.util.JSON;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class UserProfileDao {
- private final static Logger logger = LoggerFactory.getLogger(UserProfileDao.class);
-
- private static final String USER_PROFILE_COLLECTION_NAME = "user-profiles";
- private DBCollection collection;
- private ModelConversionHelper modelConversionHelper;
-
- private static final String USER_ID = "user_id";
- private static final String USER_NAME = "user_name";
- private static final String GATEWAY_ID = "gateway_id";
-
- public UserProfileDao() throws UserProfileException {
- try {
- collection = MongoUtil.getUserProfileRegistry().getCollection(USER_PROFILE_COLLECTION_NAME);
- } catch (ApplicationSettingsException e) {
- throw new UserProfileException(e);
- }
- modelConversionHelper = new ModelConversionHelper();
- //collection.dropIndexes();
- initIndexes();
- }
-
- /**
- * If indexes are already defined this will simply ignore them
- */
- private void initIndexes(){
- // UserID is the primary key
- collection.createIndex(new BasicDBObject(USER_ID, 1), new BasicDBObject("unique", true));
- // UserName and GatewayID combination is also makes a unique key
- collection.createIndex(new BasicDBObject(USER_NAME, 1).append(GATEWAY_ID, 1), new BasicDBObject("unique", true));
- }
-
- public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws UserProfileException {
- List<UserProfile> userList = new ArrayList();
- DBCursor cursor = collection.find();
- for(DBObject document: cursor){
- try {
- userList.add((UserProfile) modelConversionHelper.deserializeObject(
- UserProfile.class, document.toString()));
- } catch (IOException e) {
- throw new UserProfileException(e);
- }
- }
- return userList;
- }
-
- public boolean createUserProfile(UserProfile userProfile) throws UserProfileException{
- try {
- WriteResult result = collection.insert((DBObject) JSON.parse(
- modelConversionHelper.serializeObject(userProfile)));
- logger.debug("No of inserted results "+ result.getN());
- return true;
- } catch (JsonProcessingException e) {
- throw new UserProfileException(e);
- }
- }
-
- /**
- * The following operation replaces the document with item equal to
- * the given user id. The newly replaced document will only
- * contain the the _id field and the fields in the replacement document.
- * @param userProfile
- * @throws org.apache.airavata.registry.cpi.UserProfileException
- */
- public boolean updateUserProfile(UserProfile userProfile) throws UserProfileException{
- try {
- DBObject query = BasicDBObjectBuilder.start().add(
- USER_ID, userProfile.getUserId()).get();
- WriteResult result = collection.update(query, (DBObject) JSON.parse(
- modelConversionHelper.serializeObject(userProfile)));
- logger.debug("No of updated results "+ result.getN());
- return true;
- } catch (JsonProcessingException e) {
- throw new UserProfileException(e);
- }
- }
-
- public boolean deleteUserProfile(String userId) throws UserProfileException{
- DBObject query = BasicDBObjectBuilder.start().add(
- USER_ID, userId).get();
- WriteResult result = collection.remove(query);
- logger.debug("No of removed user profiles " + result.getN());
- return true;
- }
-
- public UserProfile getUserProfileFromUserId(String userId) throws UserProfileException{
- try {
- DBObject criteria = new BasicDBObject(USER_ID, userId);
- DBObject doc = collection.findOne(criteria);
- if(doc != null){
- String json = doc.toString();
- return (UserProfile)modelConversionHelper.deserializeObject(
- UserProfile.class, json);
- }
- } catch (IOException e) {
- throw new UserProfileException(e);
- }
- return null;
- }
-
- public UserProfile getUserProfileFromUserName(String userName, String gatewayId) throws UserProfileException{
- try {
- DBObject criteria = new BasicDBObject(USER_NAME, userName).append(GATEWAY_ID, gatewayId);
- DBObject doc = collection.findOne(criteria);
- if(doc != null){
- String json = doc.toString();
- return (UserProfile)modelConversionHelper.deserializeObject(
- UserProfile.class, json);
- }
- } catch (IOException e) {
- throw new UserProfileException(e);
- }
- return null;
- }
-
- public boolean userProfileExists(String userName, String gatewayId) throws UserProfileException{
- try {
- DBObject criteria = new BasicDBObject(USER_NAME, userName).append(GATEWAY_ID, gatewayId);
- DBObject doc = collection.findOne(criteria);
- if(doc != null){
- String json = doc.toString();
- return modelConversionHelper.deserializeObject(UserProfile.class, json) != null;
- }
- return false;
- } catch (IOException e) {
- throw new UserProfileException(e);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
deleted file mode 100644
index 4af0fc8..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileDeserializer.java
+++ /dev/null
@@ -1,64 +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.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileDeserializer extends AbstractThriftDeserializer<UserProfile._Fields, UserProfile>{
- private final static Logger logger = LoggerFactory.getLogger(UserProfileDeserializer.class);
-
- /**
- * Returns the {@code <E>} enumerated value that represents the target
- * field in the Thrift entity referenced in the JSON document.
- *
- * @param fieldName The name of the Thrift entity target field.
- * @return The {@code <E>} enumerated value that represents the target
- * field in the Thrift entity referenced in the JSON document.
- */
- @Override
- protected UserProfile._Fields getField(String fieldName) {
- return UserProfile._Fields.valueOf(fieldName);
- }
-
- /**
- * Creates a new instance of the Thrift entity class represented by this deserializer.
- *
- * @return A new instance of the Thrift entity class represented by this deserializer.
- */
- @Override
- protected UserProfile newInstance() {
- return new UserProfile();
- }
-
- /**
- * Validates that the Thrift entity instance contains all required fields after deserialization.
- *
- * @param instance A Thrift entity instance.
- * @throws TException if unable to validate the instance.
- */
- @Override
- protected void validate(UserProfile instance) throws TException {
- instance.validate();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
deleted file mode 100644
index 0f20906..0000000
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/userprofile/core/UserProfileSerializer.java
+++ /dev/null
@@ -1,51 +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.userprofile.core;
-
-import org.apache.airavata.model.user.UserProfile;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfileSerializer extends AbstractThriftSerializer<UserProfile._Fields, UserProfile> {
- private final static Logger logger = LoggerFactory.getLogger(UserProfileSerializer.class);
-
- /**
- * Returns an array of {@code <E>} enumerated values that represent the fields present in the
- * Thrift class associated with this serializer.
- *
- * @return The array of {@code <E>} enumerated values that represent the fields present in the
- * Thrift class.
- */
- @Override
- protected UserProfile._Fields[] getFieldValues() {
- return UserProfile._Fields.values();
- }
-
- /**
- * Returns the {@code <T>} implementation class associated with this serializer.
- *
- * @return The {@code <T>} implementation class
- */
- @Override
- protected Class<UserProfile> getThriftClass() {
- return null;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java b/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
deleted file mode 100644
index 737aa6b..0000000
--- a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/userprofile/core/UserProfileCPIImplTest.java
+++ /dev/null
@@ -1,68 +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.userprofile.core;
-
-import junit.framework.Assert;
-import org.apache.airavata.model.user.Status;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.userprofile.cpi.UserProfileException;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class UserProfileCPIImplTest {
- private final static Logger logger = LoggerFactory.getLogger(UserProfileCPIImplTest.class);
-
- /* @Test
- public void testUserProfileCPIImplementation(){
- UserProfile userProfile = new UserProfile();
- userProfile.setUserName("jsfsjdfsdg" + System.currentTimeMillis());
- userProfile.setGatewayId("seagrid");
- userProfile.setComments("vidfkj dfgndfkg dfkgndkjfng");
- userProfile.setCountry("USA");
- userProfile.setState(Status.ACTIVE);
-
- try {
- UserProfileCPIImpl userProfileCPIImpl = new UserProfileCPIImpl();
- String userId = userProfileCPIImpl.createUserProfile(userProfile);
- Assert.assertNotNull(userId);
- userProfile = userProfileCPIImpl.getUserProfileFromUserId(userId);
- Assert.assertNotNull(userProfile);
- Assert.assertTrue(userProfile.getCountry().equals("USA"));
- userProfile.setCountry("Sri Lanka");
- userProfileCPIImpl.updateUserProfile(userProfile);
- userProfile = userProfileCPIImpl.getUserProfileFromUserId(userId);
- Assert.assertTrue(userProfile.getCountry().equals("Sri Lanka"));
- userProfile = userProfileCPIImpl.getUserProfileFromUserName(userProfile.getUserName(),
- userProfile.getGatewayId());
- Assert.assertNotNull(userProfile);
- List<UserProfile> userProfileList = userProfileCPIImpl.getAllUserProfilesInGateway("seagrid");
- Assert.assertNotNull(userProfileList);
- userProfileCPIImpl.deleteUserProfile(userProfile.getUserId());
- Assert.assertNull(userProfileCPIImpl.getUserProfileFromUserId(userProfile.getUserId()));
- } catch (UserProfileException e) {
- e.printStackTrace();
- Assert.fail();
- }
- }*/
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.classpath
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.classpath b/modules/user-profile/user-profile-service/.classpath
new file mode 100644
index 0000000..af1430b
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.project
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.project b/modules/user-profile/user-profile-service/.project
new file mode 100644
index 0000000..15b1016
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>user-profile-cpi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..e9441bb
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding/<project>=UTF-8
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs b/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/modules/user-profile/user-profile-service/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/pom.xml b/modules/user-profile/user-profile-service/pom.xml
new file mode 100644
index 0000000..3e35699
--- /dev/null
+++ b/modules/user-profile/user-profile-service/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>user-profile-service</artifactId>
+ <version>0.17-SNAPSHOT</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>user-profile-stubs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
new file mode 100644
index 0000000..8f04204
--- /dev/null
+++ b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileHandler.java
@@ -0,0 +1,83 @@
+package com.apache.airavata.user.profile.server;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
+import org.apache.airavata.registry.core.repositories.workspacecatalog.UserProfileRepository;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.TException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Airavata on 11/11/2016.
+ */
+public class UserProfileHandler implements UserProfileCrudeService.Iface {
+
+ private UserProfileRepository userProfileRepository;
+
+ public UserProfileHandler() {
+
+ userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
+ }
+
+ public String addUserProfile(UserProfile userProfile) throws RegistryServiceException, TException {
+
+ userProfileRepository.create(userProfile);
+
+ if (null != userProfile)
+ return userProfile.getUserId();
+
+ return null;
+ }
+
+ public boolean updateUserProfile(UserProfile userProfile) throws RegistryServiceException, TException {
+
+ try {
+ userProfileRepository.update(userProfile);
+ } catch (Exception e) {
+
+ return false;
+ }
+
+ return true;
+ }
+
+ public UserProfile getUserProfileById(String userId, String gatewayId) throws RegistryServiceException, TException {
+
+
+ UserProfile userProfile = userProfileRepository.getUserProfileByIdAndGateWay(userId, gatewayId);
+
+ return userProfile;
+ }
+
+ public boolean deleteUserProfile(String userId) throws RegistryServiceException, TException {
+
+ boolean deleteResult = userProfileRepository.delete(userId);
+
+ return deleteResult;
+ }
+
+ public List<UserProfile> getAllUserProfilesInGateway(String gatewayId) throws RegistryServiceException, TException {
+
+ List<UserProfile> usersInGateway = userProfileRepository.getAllUserProfilesInGateway(gatewayId);
+ return usersInGateway;
+ }
+
+ public UserProfile getUserProfileByName(String userName, String gatewayId) throws RegistryServiceException, TException {
+
+ UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId);
+ return userProfile;
+ }
+
+ public boolean doesUserExist(String userName, String gatewayId) throws RegistryServiceException, TException {
+
+ UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId);
+
+ if(null != userProfile)
+ return true;
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
new file mode 100644
index 0000000..5fb2ac2
--- /dev/null
+++ b/modules/user-profile/user-profile-service/src/main/java/com.apache.airavata.user.profile/server/UserProfileServer.java
@@ -0,0 +1,141 @@
+package com.apache.airavata.user.profile.server;
+
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.userprofile.crude.cpi.UserProfileCrudeService;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetSocketAddress;
+import java.util.Date;
+
+/**
+ * Created by abhij on 11/11/2016.
+ */
+public class UserProfileServer implements IServer {
+
+ private final static Logger logger = LoggerFactory.getLogger(UserProfileServer.class);
+
+ private static final String SERVER_NAME = "User Profile Server";
+ private static final String SERVER_VERSION = "1.0";
+
+ private IServer.ServerStatus status;
+ private TServer server;
+
+ public UserProfileServer() {
+ setStatus(IServer.ServerStatus.STOPPED);
+ }
+
+ public void updateTime() {
+
+ }
+
+ public Date getTime() {
+ return null;
+ }
+
+ public String getName() {
+ return SERVER_NAME;
+ }
+
+ public String getVersion() {
+ return SERVER_VERSION;
+ }
+
+ public void start() throws Exception {
+
+
+ try {
+ setStatus(ServerStatus.STARTING);
+ final int serverPort = Integer.parseInt(ServerSettings.getUserProfileServerPort());
+ final String serverHost = ServerSettings.getUserProfileServerHost();
+ UserProfileCrudeService.Processor processor = new UserProfileCrudeService.Processor(new UserProfileHandler());
+
+ TServerTransport serverTransport;
+
+ if (serverHost == null) {
+ serverTransport = new TServerSocket(serverPort);
+ } else {
+ InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
+ serverTransport = new TServerSocket(inetSocketAddress);
+ }
+ TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+ options.minWorkerThreads = 30;
+ server = new TThreadPoolServer(options.processor(processor));
+
+ new Thread() {
+ public void run() {
+ server.serve();
+ setStatus(ServerStatus.STOPPED);
+ logger.info("Credential store Server Stopped.");
+ }
+ }.start();
+ new Thread() {
+ public void run() {
+ while (!server.isServing()) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ if (server.isServing()) {
+ setStatus(ServerStatus.STARTED);
+ logger.info("Starting Credential store Server on Port " + serverPort);
+ logger.info("Listening to Credential store clients ....");
+ }
+ }
+ }.start();
+ } catch (TTransportException e) {
+ setStatus(ServerStatus.FAILED);
+ throw new Exception("Error while starting the credential store service", e);
+ }
+ }
+
+ public void stop() throws Exception {
+
+ if (server!=null && server.isServing()){
+ setStatus(ServerStatus.STOPING);
+ server.stop();
+ }
+ }
+
+ public void restart() throws Exception {
+
+ stop();
+ start();
+ }
+
+ public void configure() throws Exception {
+
+ }
+
+ public ServerStatus getStatus() throws Exception {
+ return status; }
+
+ private void setStatus(IServer.ServerStatus stat){
+ status=stat;
+ status.updateTime();
+ }
+
+ public TServer getServer() {
+ return server;
+ }
+
+ public void setServer(TServer server) {
+ this.server = server;
+ }
+
+ public static void main(String[] args) {
+ try {
+ new UserProfileServer().start();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-stubs/pom.xml
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/pom.xml b/modules/user-profile/user-profile-stubs/pom.xml
index 80ac86f..3f9bce8 100644
--- a/modules/user-profile/user-profile-stubs/pom.xml
+++ b/modules/user-profile/user-profile-stubs/pom.xml
@@ -26,5 +26,10 @@
<artifactId>airavata-data-models</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>registry-refactoring</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
new file mode 100644
index 0000000..9914906
--- /dev/null
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/Test.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.userprofile.crude.cpi;
+
+import org.apache.airavata.model.user.UserProfile;
+
+/**
+ * Created by abhij on 11/17/2016.
+ */
+public class Test {
+
+ public static void main(String args[]) {
+
+ System.out.println();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b10221a3/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift b/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
index b3951d2..bea5ca7 100644
--- a/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
+++ b/thrift-interface-descriptions/component-cpis/user-profile-crud-cpi.thrift
@@ -45,7 +45,7 @@ service UserProfileCrudeService {
bool deleteUserProfile(1: required string userId)
throws (1:registry_api_errors.RegistryServiceException registryException);
- list<user_profile_model.UserProfile> getAllUserProfilesInGateway (1: required string gatewayId)
+ list<user_profile_model.UserProfile> getAllUserProfilesInGateway (1: required string gatewayId, 2: required i32 offset, 3: required i32 limit)
throws (1:registry_api_errors.RegistryServiceException registryException);
user_profile_model.UserProfile getUserProfileByName(1: required string userName, 2: required string gatewayId)
[3/3] airavata git commit: adding thrift generated files
Posted by sc...@apache.org.
adding thrift generated files
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/19b54a06
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/19b54a06
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/19b54a06
Branch: refs/heads/registry-refactoring
Commit: 19b54a0603caf893747191f2065a46a70fe12d44
Parents: b10221a
Author: scnakandala <su...@gmail.com>
Authored: Sun Nov 20 02:37:18 2016 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Sun Nov 20 02:37:18 2016 -0500
----------------------------------------------------------------------
.../store/cpi/CredentialStoreService.java | 2 +-
.../store/datamodel/CertificateCredential.java | 2 +-
.../store/datamodel/CommunityUser.java | 2 +-
.../store/datamodel/PasswordCredential.java | 2 +-
.../store/datamodel/SSHCredential.java | 2 +-
.../exception/CredentialStoreException.java | 2 +-
.../apache/airavata/gfac/cpi/GfacService.java | 2 +-
.../orchestrator/cpi/OrchestratorService.java | 2 +-
.../airavata/registry/api/RegistryService.java | 2 +-
.../api/exception/RegistryServiceException.java | 2 +-
.../api/exception/RegistryServiceException.java | 2 +-
.../crude/cpi/UserProfileCrudeService.java | 230 +++++++++++++++++--
12 files changed, 228 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
index 565e9c6..bb11845 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class CredentialStoreService {
public interface Iface {
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
index 77a85d4..690255e 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class CertificateCredential implements org.apache.thrift.TBase<CertificateCredential, CertificateCredential._Fields>, java.io.Serializable, Cloneable, Comparable<CertificateCredential> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CertificateCredential");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
index 457cad6..38b431e 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class CommunityUser implements org.apache.thrift.TBase<CommunityUser, CommunityUser._Fields>, java.io.Serializable, Cloneable, Comparable<CommunityUser> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CommunityUser");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
index c488315..3d6f747 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class PasswordCredential implements org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, java.io.Serializable, Cloneable, Comparable<PasswordCredential> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PasswordCredential");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
index 3e9de8d..677e399 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, SSHCredential._Fields>, java.io.Serializable, Cloneable, Comparable<SSHCredential> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHCredential");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
index 48ea94c..6687a30 100644
--- a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
+++ b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class CredentialStoreException extends TException implements org.apache.thrift.TBase<CredentialStoreException, CredentialStoreException._Fields>, java.io.Serializable, Cloneable, Comparable<CredentialStoreException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CredentialStoreException");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java
index 9483a20..5654207 100644
--- a/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java
+++ b/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class GfacService {
public interface Iface {
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java b/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
index fc8362e..09eadbd 100644
--- a/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
+++ b/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class OrchestratorService {
public interface Iface {
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
index 36420b7..10703d6 100644
--- a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
+++ b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class RegistryService {
public interface Iface {
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
index b7ed6b0..154ea74 100644
--- a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
+++ b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-08-09")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class RegistryServiceException extends TException implements org.apache.thrift.TBase<RegistryServiceException, RegistryServiceException._Fields>, java.io.Serializable, Cloneable, Comparable<RegistryServiceException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RegistryServiceException");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
index 206ffb8..154ea74 100644
--- a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class RegistryServiceException extends TException implements org.apache.thrift.TBase<RegistryServiceException, RegistryServiceException._Fields>, java.io.Serializable, Cloneable, Comparable<RegistryServiceException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RegistryServiceException");
http://git-wip-us.apache.org/repos/asf/airavata/blob/19b54a06/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
----------------------------------------------------------------------
diff --git a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
index afa0efd..60d084b 100644
--- a/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
+++ b/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/crude/cpi/UserProfileCrudeService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-11-18")
public class UserProfileCrudeService {
public interface Iface {
@@ -63,7 +63,7 @@ public class UserProfileCrudeService {
public boolean deleteUserProfile(String userId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
- public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
+ public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
public org.apache.airavata.model.user.UserProfile getUserProfileByName(String userName, String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
@@ -81,7 +81,7 @@ public class UserProfileCrudeService {
public void deleteUserProfile(String userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
- public void getAllUserProfilesInGateway(String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+ public void getAllUserProfilesInGateway(String gatewayId, int offset, int limit, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getUserProfileByName(String userName, String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -214,16 +214,18 @@ public class UserProfileCrudeService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteUserProfile failed: unknown result");
}
- public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException
+ public List<org.apache.airavata.model.user.UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException
{
- send_getAllUserProfilesInGateway(gatewayId);
+ send_getAllUserProfilesInGateway(gatewayId, offset, limit);
return recv_getAllUserProfilesInGateway();
}
- public void send_getAllUserProfilesInGateway(String gatewayId) throws org.apache.thrift.TException
+ public void send_getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws org.apache.thrift.TException
{
getAllUserProfilesInGateway_args args = new getAllUserProfilesInGateway_args();
args.setGatewayId(gatewayId);
+ args.setOffset(offset);
+ args.setLimit(limit);
sendBase("getAllUserProfilesInGateway", args);
}
@@ -443,24 +445,30 @@ public class UserProfileCrudeService {
}
}
- public void getAllUserProfilesInGateway(String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ public void getAllUserProfilesInGateway(String gatewayId, int offset, int limit, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
- getAllUserProfilesInGateway_call method_call = new getAllUserProfilesInGateway_call(gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+ getAllUserProfilesInGateway_call method_call = new getAllUserProfilesInGateway_call(gatewayId, offset, limit, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class getAllUserProfilesInGateway_call extends org.apache.thrift.async.TAsyncMethodCall {
private String gatewayId;
- public getAllUserProfilesInGateway_call(String gatewayId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ private int offset;
+ private int limit;
+ public getAllUserProfilesInGateway_call(String gatewayId, int offset, int limit, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.gatewayId = gatewayId;
+ this.offset = offset;
+ this.limit = limit;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllUserProfilesInGateway", org.apache.thrift.protocol.TMessageType.CALL, 0));
getAllUserProfilesInGateway_args args = new getAllUserProfilesInGateway_args();
args.setGatewayId(gatewayId);
+ args.setOffset(offset);
+ args.setLimit(limit);
args.write(prot);
prot.writeMessageEnd();
}
@@ -682,7 +690,7 @@ public class UserProfileCrudeService {
public getAllUserProfilesInGateway_result getResult(I iface, getAllUserProfilesInGateway_args args) throws org.apache.thrift.TException {
getAllUserProfilesInGateway_result result = new getAllUserProfilesInGateway_result();
try {
- result.success = iface.getAllUserProfilesInGateway(args.gatewayId);
+ result.success = iface.getAllUserProfilesInGateway(args.gatewayId, args.offset, args.limit);
} catch (org.apache.airavata.registry.api.exception.RegistryServiceException registryException) {
result.registryException = registryException;
}
@@ -1045,7 +1053,7 @@ public class UserProfileCrudeService {
}
public void start(I iface, getAllUserProfilesInGateway_args args, org.apache.thrift.async.AsyncMethodCallback<List<org.apache.airavata.model.user.UserProfile>> resultHandler) throws TException {
- iface.getAllUserProfilesInGateway(args.gatewayId,resultHandler);
+ iface.getAllUserProfilesInGateway(args.gatewayId, args.offset, args.limit,resultHandler);
}
}
@@ -4574,6 +4582,8 @@ public class UserProfileCrudeService {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllUserProfilesInGateway_args");
private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("offset", org.apache.thrift.protocol.TType.I32, (short)2);
+ private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I32, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -4582,10 +4592,14 @@ public class UserProfileCrudeService {
}
public String gatewayId; // required
+ public int offset; // required
+ public int limit; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- GATEWAY_ID((short)1, "gatewayId");
+ GATEWAY_ID((short)1, "gatewayId"),
+ OFFSET((short)2, "offset"),
+ LIMIT((short)3, "limit");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -4602,6 +4616,10 @@ public class UserProfileCrudeService {
switch(fieldId) {
case 1: // GATEWAY_ID
return GATEWAY_ID;
+ case 2: // OFFSET
+ return OFFSET;
+ case 3: // LIMIT
+ return LIMIT;
default:
return null;
}
@@ -4642,11 +4660,18 @@ public class UserProfileCrudeService {
}
// isset id assignments
+ private static final int __OFFSET_ISSET_ID = 0;
+ private static final int __LIMIT_ISSET_ID = 1;
+ private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllUserProfilesInGateway_args.class, metaDataMap);
}
@@ -4655,19 +4680,28 @@ public class UserProfileCrudeService {
}
public getAllUserProfilesInGateway_args(
- String gatewayId)
+ String gatewayId,
+ int offset,
+ int limit)
{
this();
this.gatewayId = gatewayId;
+ this.offset = offset;
+ setOffsetIsSet(true);
+ this.limit = limit;
+ setLimitIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public getAllUserProfilesInGateway_args(getAllUserProfilesInGateway_args other) {
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetGatewayId()) {
this.gatewayId = other.gatewayId;
}
+ this.offset = other.offset;
+ this.limit = other.limit;
}
public getAllUserProfilesInGateway_args deepCopy() {
@@ -4677,6 +4711,10 @@ public class UserProfileCrudeService {
@Override
public void clear() {
this.gatewayId = null;
+ setOffsetIsSet(false);
+ this.offset = 0;
+ setLimitIsSet(false);
+ this.limit = 0;
}
public String getGatewayId() {
@@ -4703,6 +4741,52 @@ public class UserProfileCrudeService {
}
}
+ public int getOffset() {
+ return this.offset;
+ }
+
+ public getAllUserProfilesInGateway_args setOffset(int offset) {
+ this.offset = offset;
+ setOffsetIsSet(true);
+ return this;
+ }
+
+ public void unsetOffset() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ /** Returns true if field offset is set (has been assigned a value) and false otherwise */
+ public boolean isSetOffset() {
+ return EncodingUtils.testBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ public void setOffsetIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OFFSET_ISSET_ID, value);
+ }
+
+ public int getLimit() {
+ return this.limit;
+ }
+
+ public getAllUserProfilesInGateway_args setLimit(int limit) {
+ this.limit = limit;
+ setLimitIsSet(true);
+ return this;
+ }
+
+ public void unsetLimit() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ /** Returns true if field limit is set (has been assigned a value) and false otherwise */
+ public boolean isSetLimit() {
+ return EncodingUtils.testBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ public void setLimitIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIMIT_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case GATEWAY_ID:
@@ -4713,6 +4797,22 @@ public class UserProfileCrudeService {
}
break;
+ case OFFSET:
+ if (value == null) {
+ unsetOffset();
+ } else {
+ setOffset((Integer)value);
+ }
+ break;
+
+ case LIMIT:
+ if (value == null) {
+ unsetLimit();
+ } else {
+ setLimit((Integer)value);
+ }
+ break;
+
}
}
@@ -4721,6 +4821,12 @@ public class UserProfileCrudeService {
case GATEWAY_ID:
return getGatewayId();
+ case OFFSET:
+ return getOffset();
+
+ case LIMIT:
+ return getLimit();
+
}
throw new IllegalStateException();
}
@@ -4734,6 +4840,10 @@ public class UserProfileCrudeService {
switch (field) {
case GATEWAY_ID:
return isSetGatewayId();
+ case OFFSET:
+ return isSetOffset();
+ case LIMIT:
+ return isSetLimit();
}
throw new IllegalStateException();
}
@@ -4760,6 +4870,24 @@ public class UserProfileCrudeService {
return false;
}
+ boolean this_present_offset = true;
+ boolean that_present_offset = true;
+ if (this_present_offset || that_present_offset) {
+ if (!(this_present_offset && that_present_offset))
+ return false;
+ if (this.offset != that.offset)
+ return false;
+ }
+
+ boolean this_present_limit = true;
+ boolean that_present_limit = true;
+ if (this_present_limit || that_present_limit) {
+ if (!(this_present_limit && that_present_limit))
+ return false;
+ if (this.limit != that.limit)
+ return false;
+ }
+
return true;
}
@@ -4772,6 +4900,16 @@ public class UserProfileCrudeService {
if (present_gatewayId)
list.add(gatewayId);
+ boolean present_offset = true;
+ list.add(present_offset);
+ if (present_offset)
+ list.add(offset);
+
+ boolean present_limit = true;
+ list.add(present_limit);
+ if (present_limit)
+ list.add(limit);
+
return list.hashCode();
}
@@ -4793,6 +4931,26 @@ public class UserProfileCrudeService {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetOffset()).compareTo(other.isSetOffset());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOffset()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset, other.offset);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetLimit()).compareTo(other.isSetLimit());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLimit()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.limit, other.limit);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -4820,6 +4978,14 @@ public class UserProfileCrudeService {
sb.append(this.gatewayId);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("offset:");
+ sb.append(this.offset);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("limit:");
+ sb.append(this.limit);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -4829,6 +4995,8 @@ public class UserProfileCrudeService {
if (gatewayId == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
}
+ // alas, we cannot check 'offset' because it's a primitive and you chose the non-beans generator.
+ // alas, we cannot check 'limit' because it's a primitive and you chose the non-beans generator.
// check for sub-struct validity
}
@@ -4842,6 +5010,8 @@ public class UserProfileCrudeService {
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
@@ -4874,6 +5044,22 @@ public class UserProfileCrudeService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 2: // OFFSET
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // LIMIT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -4882,6 +5068,12 @@ public class UserProfileCrudeService {
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
+ if (!struct.isSetOffset()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'offset' was not found in serialized data! Struct: " + toString());
+ }
+ if (!struct.isSetLimit()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'limit' was not found in serialized data! Struct: " + toString());
+ }
struct.validate();
}
@@ -4894,6 +5086,12 @@ public class UserProfileCrudeService {
oprot.writeString(struct.gatewayId);
oprot.writeFieldEnd();
}
+ oprot.writeFieldBegin(OFFSET_FIELD_DESC);
+ oprot.writeI32(struct.offset);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(LIMIT_FIELD_DESC);
+ oprot.writeI32(struct.limit);
+ oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -4912,6 +5110,8 @@ public class UserProfileCrudeService {
public void write(org.apache.thrift.protocol.TProtocol prot, getAllUserProfilesInGateway_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.gatewayId);
+ oprot.writeI32(struct.offset);
+ oprot.writeI32(struct.limit);
}
@Override
@@ -4919,6 +5119,10 @@ public class UserProfileCrudeService {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.gatewayId = iprot.readString();
struct.setGatewayIdIsSet(true);
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
}
}