You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/04/28 15:23:30 UTC
[49/50] [abbrv] airavata git commit: Merge branch 'master' into
develop
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-api-server/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/application/io/InputDataObjectType.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/messaging/event/MessageType.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/user/NSFDemographics.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/user/UserProfile.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/GatewayEntity.java
----------------------------------------------------------------------
diff --cc airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/GatewayEntity.java
index 3b1e370,0000000..8d9a25d
mode 100644,000000..100644
--- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/GatewayEntity.java
+++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/tenant/entities/GatewayEntity.java
@@@ -1,254 -1,0 +1,254 @@@
- /*
++/**
+ *
+ * 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.service.profile.commons.tenant.entities;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Entity
+@Table(name = "GATEWAY")
+public class GatewayEntity {
+ private final static Logger logger = LoggerFactory.getLogger(GatewayEntity.class);
+ private String gatewayId;
+ private String gatewayName;
+ private String domain;
+ private String emailAddress;
+ private String gatewayApprovalStatus;
+ private String gatewayAcronym;
+ private String gatewayUrl;
+ private String gatewayPublicAbstract;
+ private String reviewProposalDescription;
+ private String gatewayAdminFirstName;
+ private String getGatewayAdminLastName;
+ private String gatewayAdminEmail;
+ private String identityServerUserName;
+ private String identityServerPasswordToken;
+ private String declinedReason;
+ private String oauthClientId;
+ private String getOauthClientSecret;
+ private long requestCreationTime;
+ private String requesterUsername;
+
+ @Id
+ @Column(name = "GATEWAY_ID")
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ @Column(name = "GATEWAY_NAME")
+ public String getGatewayName() {
+ return gatewayName;
+ }
+
+ public void setGatewayName(String gatewayName) {
+ this.gatewayName = gatewayName;
+ }
+
+ @Column(name = "GATEWAY_DOMAIN")
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+ @Column(name = "EMAIL_ADDRESS")
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ @Column(name = "GATEWAY_APPROVAL_STATUS")
+ public String getGatewayApprovalStatus() {
+ return gatewayApprovalStatus;
+ }
+
+ public void setGatewayApprovalStatus(String gatewayApprovalStatus) {
+ this.gatewayApprovalStatus = gatewayApprovalStatus;
+ }
+
+ @Column(name = "GATEWAY_ACRONYM")
+ public String getGatewayAcronym() {
+ return gatewayAcronym;
+ }
+
+ public void setGatewayAcronym(String gatewayAcronym) {
+ this.gatewayAcronym = gatewayAcronym;
+ }
+
+ @Column(name = "GATEWAY_URL")
+ public String getGatewayUrl() {
+ return gatewayUrl;
+ }
+
+ public void setGatewayUrl(String gatewayUrl) {
+ this.gatewayUrl = gatewayUrl;
+ }
+
+ @Column(name = "GATEWAY_PUBLIC_ABSTRACT")
+ public String getGatewayPublicAbstract() {
+ return gatewayPublicAbstract;
+ }
+
+ public void setGatewayPublicAbstract(String gatewayPublicAbstract) {
+ this.gatewayPublicAbstract = gatewayPublicAbstract;
+ }
+
+ @Column(name = "GATEWAY_REVIEW_PROPOSAL_DESCRIPTION")
+ public String getReviewProposalDescription() {
+ return reviewProposalDescription;
+ }
+
+ public void setReviewProposalDescription(String reviewProposalDescription) {
+ this.reviewProposalDescription = reviewProposalDescription;
+ }
+
+ @Column(name = "GATEWAY_ADMIN_FIRST_NAME")
+ public String getGatewayAdminFirstName() {
+ return gatewayAdminFirstName;
+ }
+
+ public void setGatewayAdminFirstName(String gatewayAdminFirstName) {
+ this.gatewayAdminFirstName = gatewayAdminFirstName;
+ }
+
+ @Column(name = "GATEWAY_ADMIN_LAST_NAME")
+ public String getGetGatewayAdminLastName() {
+ return getGatewayAdminLastName;
+ }
+
+ public void setGetGatewayAdminLastName(String getGatewayAdminLastName) {
+ this.getGatewayAdminLastName = getGatewayAdminLastName;
+ }
+
+ @Column(name = "GATEWAY_ADMIN_EMAIL")
+ public String getGatewayAdminEmail() {
+ return gatewayAdminEmail;
+ }
+
+ public void setGatewayAdminEmail(String gatewayAdminEmail) {
+ this.gatewayAdminEmail = gatewayAdminEmail;
+ }
+
+ @Column(name = "IDENTITY_SERVER_USERNAME")
+ public String getIdentityServerUserName() {
+ return identityServerUserName;
+ }
+
+ public void setIdentityServerUserName(String identityServerUserName) {
+ this.identityServerUserName = identityServerUserName;
+ }
+
+ @Column(name = "IDENTITY_SERVER_PASSWORD_TOKEN")
+ public String getIdentityServerPasswordToken() {
+ return identityServerPasswordToken;
+ }
+
+ public void setIdentityServerPasswordToken(String identityServerPasswordToken) {
+ this.identityServerPasswordToken = identityServerPasswordToken;
+ }
+
+ @Column(name = "REQUESTER_USERNAME")
+ public String getRequesterUsername() {
+ return requesterUsername;
+ }
+
+ public void setRequesterUsername(String requesterUsername) {
+ this.requesterUsername = requesterUsername;
+ }
+
+ @Column(name = "DECLINED_REASON")
+ public String getDeclinedReason() {
+ return declinedReason;
+ }
+
+ public void setDeclinedReason(String declinedReason) {
+ this.declinedReason = declinedReason;
+ }
+
+ @Column(name = "OAUTH_CLIENT_ID")
+ public String getOauthClientId() {
+ return oauthClientId;
+ }
+
+ public void setOauthClientId(String oauthClientId) {
+ this.oauthClientId = oauthClientId;
+ }
+
+ @Column(name = "REQUEST_CREATION_TIME")
+ public long getRequestCreationTime() {
+ return requestCreationTime;
+ }
+
+ public void setRequestCreationTime(long requestCreationTime) {
+ this.requestCreationTime = requestCreationTime;
+ }
+
+ @Column(name = "OAUTH_CLIENT_SECRET")
+ public String getGetOauthClientSecret() {
+ return getOauthClientSecret;
+ }
+
+ public void setGetOauthClientSecret(String oauthClientSecret) {
+ this.getOauthClientSecret = oauthClientSecret;
+ }
+
+ @PrePersist
+ void createdAt() {
+ this.requestCreationTime = new Date().getTime();
+ }
+
+ @Override
+ public String toString() {
+ return "GatewayEntity{" +
+ "gatewayId='" + gatewayId + '\'' +
+ ", gatewayName='" + gatewayName + '\'' +
+ ", domain='" + domain + '\'' +
+ ", emailAddress='" + emailAddress + '\'' +
+ ", gatewayApprovalStatus='" + gatewayApprovalStatus + '\'' +
+ ", gatewayAcronym='" + gatewayAcronym + '\'' +
+ ", gatewayUrl='" + gatewayUrl + '\'' +
+ ", gatewayPublicAbstract='" + gatewayPublicAbstract + '\'' +
+ ", reviewProposalDescription='" + reviewProposalDescription + '\'' +
+ ", gatewayAdminFirstName='" + gatewayAdminFirstName + '\'' +
+ ", getGatewayAdminLastName='" + getGatewayAdminLastName + '\'' +
+ ", gatewayAdminEmail='" + gatewayAdminEmail + '\'' +
+ ", identityServerUserName='" + identityServerUserName + '\'' +
+ ", identityServerPasswordToken='" + identityServerPasswordToken + '\'' +
+ ", declinedReason='" + declinedReason + '\'' +
+ ", oauthClientId='" + oauthClientId + '\'' +
+ ", getOauthClientSecret='" + getOauthClientSecret + '\'' +
+ ", requestCreationTime=" + requestCreationTime +
+ ", requesterUsername='" + requesterUsername + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java
----------------------------------------------------------------------
diff --cc airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java
index 2548991,0000000..f911b42
mode 100644,000000..100644
--- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java
+++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java
@@@ -1,39 -1,0 +1,39 @@@
- /*
++/**
+ *
+ * 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.service.profile.commons.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+ private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+ private static ObjectMapperSingleton instance;
+
+ private ObjectMapperSingleton(){}
+
+ public static ObjectMapperSingleton getInstance(){
+ if(instance == null)
+ instance = new ObjectMapperSingleton();
+ return instance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
----------------------------------------------------------------------
diff --cc airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
index 1a7677c,0000000..2584262
mode 100644,000000..100644
--- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
+++ b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/exceptions/UserProfileRegistryException.java
@@@ -1,28 -1,0 +1,28 @@@
- /*
++/**
+ *
+ * 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.service.profile.user.core.exceptions;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProfileRegistryException extends Exception {
+ private final static Logger logger = LoggerFactory.getLogger(UserProfileRegistryException.class);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/interceptor/SecurityModule.java
----------------------------------------------------------------------
diff --cc airavata-services/services-security/src/main/java/org/apache/airavata/service/security/interceptor/SecurityModule.java
index 7ec56b9,0000000..1651402
mode 100644,000000..100644
--- a/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/interceptor/SecurityModule.java
+++ b/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/interceptor/SecurityModule.java
@@@ -1,43 -1,0 +1,43 @@@
- /*
++/**
+ *
+ * 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.service.security.interceptor;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.matcher.Matchers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This does the plumbing work of integrating the interceptor with Guice framework for the methods to be
+ * intercepted upon their invocation.
+ */
+public class SecurityModule extends AbstractModule {
+ private final static Logger logger = LoggerFactory.getLogger(SecurityModule.class);
+
+ public void configure(){
+ logger.info("Security module reached...");
+ SecurityInterceptor interceptor = new SecurityInterceptor();
+ //requestInjection(interceptor);
+
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(SecurityCheck.class), interceptor);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/dev-tools/ansible/inventories/develop/group_vars/all.yml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/dev-tools/ansible/inventories/testing-0.17/group_vars/all/vars.yml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/dev-tools/ansible/roles/api-orch/defaults/main.yml
----------------------------------------------------------------------
diff --cc dev-tools/ansible/roles/api-orch/defaults/main.yml
index a9f655c,c7dd3a9..d10db39
--- a/dev-tools/ansible/roles/api-orch/defaults/main.yml
+++ b/dev-tools/ansible/roles/api-orch/defaults/main.yml
@@@ -1,2 -1,22 +1,24 @@@
+ #
+ #
+ # 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.
+ #
+
api_orch_server_names: "api-orch"
+ api_orch_log_dir: "../logs"
++
+remote_idp_service_url: "https://iam.scigap.org/auth"
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/dev-tools/ansible/roles/java/tasks/main.yml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/commons/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/utils/Constants.java
----------------------------------------------------------------------
diff --cc modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/utils/Constants.java
index 05aba6e,0000000..e2db407
mode 100644,000000..100644
--- a/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/utils/Constants.java
+++ b/modules/db-event-manager/src/main/java/org/apache/airavata/db/event/manager/utils/Constants.java
@@@ -1,33 -1,0 +1,33 @@@
- /*
++/**
+ *
+ * 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.db.event.manager.utils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Ajinkya on 3/1/17.
+ */
+public class Constants {
+
+ public static final String DB_EVENT_MGR_ZK_PATH = "db-event-mgr";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/gfac/gfac-client/src/main/java/org/apache/airavata/gfac/cpi/GfacService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/messaging/core/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/MessagingFactory.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/Publisher.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQPublisher.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/orchestrator/orchestrator-client/src/main/java/org/apache/airavata/orchestrator/cpi/OrchestratorService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-core/src/test/java/org/apache/airavata/replica/catalog/ReplicaCatalogTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-service/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
----------------------------------------------------------------------
diff --cc modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
index 04bcdd4,0cf40e7..d5f027c
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
@@@ -16,11 -16,9 +16,10 @@@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
- */
+ */
package org.apache.airavata.registry.api.service;
+import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.utils.IServer;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.registry.api.RegistryService;
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/util/Constants.java
----------------------------------------------------------------------
diff --cc modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/util/Constants.java
index 973b2d5,eeb6a81..93ddc1d
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/util/Constants.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/util/Constants.java
@@@ -16,16 -16,9 +16,14 @@@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
*/
-
package org.apache.airavata.registry.api.service.util;
+import org.apache.airavata.common.utils.DBEventService;
+
+import java.util.ArrayList;
+import java.util.List;
+
public class Constants {
public static final String REGISTRY_SERVER_PORT = "regserver.server.port";
public static final String REGISTRY_SERVER_HOST = "regserver.server.host";
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/util/DatabaseCreator.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/exception/RegistryServiceException.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-server/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/UserGroupRepository.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
----------------------------------------------------------------------
diff --cc modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
index 7b707f1,c728c00..0cca07a
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
@@@ -16,17 -16,12 +16,16 @@@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
- */
+ */
package org.apache.airavata.sharing.registry.server;
+import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.utils.IServer;
import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.sharing.registry.messaging.SharingServiceDBEventMessagingFactory;
+import org.apache.airavata.sharing.registry.models.SharingRegistryException;
import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.airavata.sharing.registry.utils.Constants;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-stubs/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/client/SharingRegistryServiceClientFactory.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/SharingRegistryService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-service-docs/api-docs/index.html
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-service-docs/api-docs/sharing_cpi.html
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/sharing-registry/thrift_models/thrift-gen.sh
----------------------------------------------------------------------
diff --cc modules/sharing-registry/thrift_models/thrift-gen.sh
index b4fb872,34b0934..a096eb1
--- a/modules/sharing-registry/thrift_models/thrift-gen.sh
+++ b/modules/sharing-registry/thrift_models/thrift-gen.sh
@@@ -1,6 -1,26 +1,26 @@@
#!/usr/bin/env bash
+ #
+ #
+ # 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.
+ #
+
-thrift --gen java sharing_models.thrift
+thrift --gen java:generated_annotations=undated sharing_models.thrift
cd gen-java
rm -r ../../sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/*
cp -r org/apache/airavata/sharing/registry/models/ ../../sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile-migration/src/main/java/org/apache/airavata/UserProfileAiravataThriftClient.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/pom.xml
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/pom.xml
index 3e49f86,0000000..802c0ed
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/pom.xml
+++ b/modules/user-profile/user-profile-core/pom.xml
@@@ -1,131 -1,0 +1,152 @@@
+<?xml version="1.0" encoding="UTF-8"?>
++<!--
++
++
++ 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.
++
++-->
+<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">
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata</artifactId>
+ <version>0.17-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>user-profile-core</artifactId>
+
+ <properties>
+ <derby.version>10.11.1.1</derby.version>
+ <surefire.version>2.18.1</surefire.version>
+ <skipTests>false</skipTests>
+ <mysql.connector.version>5.1.34</mysql.connector.version>
+ <openjpa.version>2.2.0</openjpa.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-data-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.dozer</groupId>
+ <artifactId>dozer</artifactId>
+ <version>5.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>${openjpa.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbynet</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-maven-plugin</artifactId>
+ <version>2.2.0</version>
+ <configuration>
+ <includes>**/entities/*.class</includes>
+ <excludes>**/entities/XML*.class</excludes>
+ <addDefaultConstructor>true</addDefaultConstructor>
+ <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>enhancer</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>${openjpa.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <inherited>true</inherited>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <!--<skipTests>${skipTests}</skipTests>-->
+ <skipTests>true</skipTests>
+ <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java
index db6c391,0000000..056baea
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java
@@@ -1,28 -1,0 +1,28 @@@
- /*
++/**
+ *
+ * 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.user.registry.core;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProfileRegistryException extends Exception {
+ private final static Logger logger = LoggerFactory.getLogger(UserProfileRegistryException.class);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java
index ccb4625,0000000..00d7bda
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java
@@@ -1,94 -1,0 +1,94 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.entities;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity
+@Table(name = "NSF_DEMOGRAPHIC")
+public class NSFDemographicsEntity {
+ private String airavataInternalUserId;
+ private String gender;
+ private List<String> ethnicities;
+ private List<String> races;
+ private List<String> disabilities;
+ private UserProfileEntity userProfile;
+
+ @Id
+ @Column(name = "AIRAVATA_INTERNAL_USER_ID")
+ public String getAiravataInternalUserId() {
+ return airavataInternalUserId;
+ }
+
+ public void setAiravataInternalUserId(String userId) {
+ this.airavataInternalUserId = userId;
+ }
+
+ @Column(name = "GENDER")
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ @ElementCollection
+ @CollectionTable(name="NSF_DEMOGRAPHIC_ETHNICITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getEthnicities() {
+ return ethnicities;
+ }
+
+ public void setEthnicities(List<String> ethnicities) {
+ this.ethnicities = ethnicities;
+ }
+
+ @ElementCollection
+ @CollectionTable(name="NSF_DEMOGRAPHIC_RACE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getRaces() {
+ return races;
+ }
+
+ public void setRaces(List<String> races) {
+ this.races = races;
+ }
+
+ @ElementCollection
+ @CollectionTable(name="NSF_DEMOGRAPHIC_DISABILITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getDisabilities() {
+ return disabilities;
+ }
+
+ public void setDisabilities(List<String> disabilities) {
+ this.disabilities = disabilities;
+ }
+
+ @OneToOne(targetEntity = UserProfileEntity.class, cascade = CascadeType.ALL)
+ @PrimaryKeyJoinColumn(name = "AIRAVATA_INTERNAL_USER_ID", referencedColumnName = "AIRAVATA_INTERNAL_USER_ID")
+ public UserProfileEntity getUserProfile() {
+ return userProfile;
+ }
+
+ public void setUserProfile(UserProfileEntity userProfile) {
+ this.userProfile = userProfile;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java
index 81bf18e,0000000..06b678e
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java
@@@ -1,247 -1,0 +1,247 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.entities;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Entity
+@Table(name="USER_PROFILE")
+public class UserProfileEntity {
+ private String airavataInternalUserId;
+ private String userId;
+ private String gatewayId;
+ private String userModelVersion;
+ private String userName;
+ private String orcidId;
+ private String country;
+ private String homeOrganization;
+ private String orginationAffiliation;
+ private long creationTime;
+ private long lastAccessTime;
+ private long validUntil;
+ private String state;
+ private String comments;
+ private List<String> labeledURI;
+ private String gpgKey;
+ private String timeZone;
+
+ private List<String> nationality;
+ private List<String> emails;
+ private List<String> phones;
+ private NSFDemographicsEntity nsfDemographics;
+
+ @Id
+ @Column(name = "AIRAVATA_INTERNAL_USER_ID")
+ public String getAiravataInternalUserId() {
+ return airavataInternalUserId;
+ }
+
+ public void setAiravataInternalUserId(String id) {
+ this.airavataInternalUserId = id;
+ }
+
+ @Column(name = "USER_ID")
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Column(name = "GATEWAY_ID")
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ @Column(name = "USER_MODEL_VERSION")
+ public String getUserModelVersion() {
+ return userModelVersion;
+ }
+
+ public void setUserModelVersion(String userModelVersion) {
+ this.userModelVersion = userModelVersion;
+ }
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @CollectionTable(name="USER_PROFILE_EMAIL", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getEmails() {
+ return emails;
+ }
+
+ public void setEmails(List<String> emails) {
+ this.emails = emails;
+ }
+
+ @Column(name = "USER_NAME")
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Column(name = "ORCID_ID")
+ public String getOrcidId() {
+ return orcidId;
+ }
+
+ public void setOrcidId(String orcidId) {
+ this.orcidId = orcidId;
+ }
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @CollectionTable(name="USER_PROFILE_PHONE", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getPhones() {
+ return phones;
+ }
+
+ public void setPhones(List<String> phones) {
+ this.phones = phones;
+ }
+
+ @Column(name = "COUNTRY")
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @CollectionTable(name="USER_PROFILE_NATIONALITY", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getNationality() {
+ return nationality;
+ }
+
+ public void setNationality(List<String> nationality) {
+ this.nationality = nationality;
+ }
+
+ @Column(name = "HOME_ORGANIZATION")
+ public String getHomeOrganization() {
+ return homeOrganization;
+ }
+
+ public void setHomeOrganization(String homeOrganization) {
+ this.homeOrganization = homeOrganization;
+ }
+
+ @Column(name = "ORIGINATION_AFFILIATION")
+ public String getOrginationAffiliation() {
+ return orginationAffiliation;
+ }
+
+ public void setOrginationAffiliation(String orginationAffiliation) {
+ this.orginationAffiliation = orginationAffiliation;
+ }
+
+ @Column(name="CREATION_TIME")
+ public long getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(long creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ @Column(name = "LAST_ACCESS_TIME")
+ public long getLastAccessTime() {
+ return lastAccessTime;
+ }
+
+ public void setLastAccessTime(long lastAccessTime) {
+ this.lastAccessTime = lastAccessTime;
+ }
+
+ @Column(name = "VALID_UNTIL")
+ public long getValidUntil() {
+ return validUntil;
+ }
+
+ public void setValidUntil(long validUntil) {
+ this.validUntil = validUntil;
+ }
+
+ @Column(name = "STATE")
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ @Lob
+ @Column(name = "COMMENTS")
+ public String getComments() {
+ return comments;
+ }
+
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @CollectionTable(name="USER_PROFILE_LABELED_URI", joinColumns = @JoinColumn(name="AIRAVATA_INTERNAL_USER_ID"))
+ public List<String> getLabeledURI() {
+ return labeledURI;
+ }
+
+ public void setLabeledURI(List<String> labeledURI) {
+ this.labeledURI = labeledURI;
+ }
+
+ @Lob
+ @Column(name = "GPG_KEY")
+ public String getGpgKey() {
+ return gpgKey;
+ }
+
+ public void setGpgKey(String gpgKey) {
+ this.gpgKey = gpgKey;
+ }
+
+ @Column(name = "TIME_ZONE")
+ public String getTimeZone() {
+ return timeZone;
+ }
+
+ public void setTimeZone(String timeZone) {
+ this.timeZone = timeZone;
+ }
+
+ @OneToOne(targetEntity = NSFDemographicsEntity.class, cascade = CascadeType.ALL, mappedBy = "userProfile", fetch = FetchType.EAGER)
+ public NSFDemographicsEntity getNsfDemographics() {
+ return nsfDemographics;
+ }
+
+ public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) {
+ this.nsfDemographics = nsfDemographics;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java
index f61aa3b,0000000..f128086
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java
@@@ -1,98 -1,0 +1,98 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.repositories;
+
+import org.apache.airavata.user.registry.core.utils.JPAUtils;
+import org.apache.airavata.user.registry.core.utils.ObjectMapperSingleton;
+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);
+
+ private Class<T> thriftGenericClass;
+ private Class<E> dbEntityGenericClass;
+
+ public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) {
+ this.thriftGenericClass = thriftGenericClass;
+ this.dbEntityGenericClass = dbEntityGenericClass;
+ }
+
+ public T create(T t) {
+ return update(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) {
+ JPAUtils.execute(entityManager -> {
+ E entity = entityManager.find(dbEntityGenericClass, id);
+ entityManager.remove(entity);
+ return entity;
+ });
+ return true;
+ }
+
+ 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) {
+ List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset)
+ .setMaxResults(offset).getResultList());
+ Mapper mapper = ObjectMapperSingleton.getInstance();
+ List<T> gatewayList = new ArrayList<>();
+ 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java
index eee5963,0000000..ebf99e1
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java
@@@ -1,87 -1,0 +1,87 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.repositories;
+
+import org.apache.airavata.model.user.UserProfile;
+import org.apache.airavata.user.registry.core.entities.UserProfileEntity;
+import org.apache.airavata.user.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);
+
+ public UserProfileRepository(Class<UserProfile> thriftGenericClass, Class<UserProfileEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+
+ @Override
+ public List<UserProfile> select(String query, int offset, int limit) {
+ 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, 1, 0, queryParam);
+
+ if (resultList != null && resultList.size() > 0)
+ userProfile = resultList.get(0);
+
+
+ return userProfile;
+ }
+
+ public List<UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) {
+
+ 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, limit, offset, 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java
index fe96ca9,0000000..6c4549d
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java
@@@ -1,27 -1,0 +1,27 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.utils;
+
+@FunctionalInterface
+public interface Committer<T, R> {
+
+ R commit(T t);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java
index 2961524,0000000..b8024fa
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java
@@@ -1,83 -1,0 +1,83 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JPAUtils {
+ private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
+ private static final String PERSISTENCE_UNIT_NAME = "user_profile_catalog";
+ @PersistenceUnit(unitName = "user_profile_catalog")
+ protected static EntityManagerFactory factory;
+ @PersistenceContext(unitName = "user_profile_catalog")
+ private static EntityManager entityManager;
+
+ public static EntityManager getEntityManager(){
+
+ if (factory == null) {
+ //FIXME
+ String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" +
+ Utils.getJDBCURL() + "?autoReconnect=true," +
+ "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() +
+ ",validationQuery=" + Utils.getValidationQuery();
+ logger.info(connectionProperties);
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+ properties.put("openjpa.ConnectionProperties", connectionProperties);
+ properties.put("openjpa.DynamicEnhancementAgent", "true");
+ properties.put("openjpa.RuntimeUnenhancedClasses", "warn");
+ properties.put("openjpa.RemoteCommitProvider", "sjvm");
+ properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+ properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.jdbc.QuerySQLCache", "false");
+ properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," +
+ " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
+ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+ }
+
+ entityManager = factory.createEntityManager();
+ return entityManager;
+ }
+
+ public static <R> R execute(Committer<EntityManager, R> committer){
+ EntityManager entityManager = JPAUtils.getEntityManager();
+ try {
+ entityManager.getTransaction().begin();
+ R r = committer.commit(entityManager);
+ entityManager.getTransaction().commit();
+ return r;
+ }finally {
+ if (entityManager != null && entityManager.isOpen()) {
+ if (entityManager.getTransaction().isActive()) {
+ entityManager.getTransaction().rollback();
+ }
+ entityManager.close();
+ }
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java
index e7324eb,0000000..f4d4d24
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java
@@@ -1,39 -1,0 +1,39 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.utils;
+
+import org.dozer.DozerBeanMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMapperSingleton extends DozerBeanMapper{
+ private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
+
+ private static ObjectMapperSingleton instance;
+
+ private ObjectMapperSingleton(){}
+
+ public static ObjectMapperSingleton getInstance(){
+ if(instance == null)
+ instance = new ObjectMapperSingleton();
+ return instance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java
index 773dc3f,0000000..73e3f78
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java
@@@ -1,22 -1,0 +1,41 @@@
++/**
++ *
++ * 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.user.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/7a779933/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java
----------------------------------------------------------------------
diff --cc modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java
index b349c8d,0000000..a534221
mode 100644,000000..100644
--- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java
+++ b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java
@@@ -1,155 -1,0 +1,154 @@@
- /*
++/**
+ *
+ * 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.user.registry.core.utils;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URI;
+
+
+public class Utils {
+ private final static Logger logger = LoggerFactory.getLogger(Utils.class);
+
+ public static String getJDBCFullURL(){
+ String jdbcUrl = getJDBCURL();
+ String jdbcUser = getJDBCUser();
+ String jdbcPassword = getJDBCPassword();
+ jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+ return jdbcUrl;
+ }
+
+ public static String getJDBCURL(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getHost(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getHost();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static int getPort(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getPort();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return -1;
+ }
+ }
+
+ public static int getJPACacheSize (){
+ try {
+ String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
+ return Integer.parseInt(cache);
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ return -1;
+ }
+ }
+
+ public static String isCachingEnabled (){
+ try {
+ return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
+ }catch (Exception e){
+ logger.error(e.getMessage(), e);
+ return "true";
+ }
+ }
+
+ public static String getDBType(){
+ try{
+ String jdbcURL = getJDBCURL();
+ String cleanURI = jdbcURL.substring(5);
+ URI uri = URI.create(cleanURI);
+ return uri.getScheme();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static boolean isDerbyStartEnabled(){
+ try {
+ String s = ServerSettings.getSetting(JPAConstants.KEY_DERBY_START_ENABLE);
+ if("true".equals(s)){
+ return true;
+ }
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return false;
+ }
+ return false;
+ }
+
+ public static String getJDBCUser(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getValidationQuery(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static String getJDBCPassword(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+
+ }
+
+ public static String getJDBCDriver(){
+ try {
+ return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
+ } catch (ApplicationSettingsException e) {
+ logger.error(e.getMessage(), e);
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-service/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServiceHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/modules/user-profile/user-profile-stubs/src/main/java/org/apache/airavata/userprofile/cpi/client/UserProfileServiceClientFactory.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/thrift-interface-descriptions/component-cpis/generate-cpi-stubs.sh
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/7a779933/thrift-interface-descriptions/generate-thrift-stubs.sh
----------------------------------------------------------------------