removing old user profile
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/28709245 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/28709245 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/28709245 Branch: refs/heads/develop Commit: 28709245bb933dac13570c95cac276cd873d71ee Parents: 538135f Author: scnakandala <[email protected]> Authored: Tue May 2 13:44:56 2017 -0400 Committer: scnakandala <[email protected]> Committed: Tue May 2 13:44:56 2017 -0400 ---------------------------------------------------------------------- .../apache/airavata/common/utils/Constants.java | 1 - .../airavata/common/utils/ServerSettings.java | 2 +- .../main/resources/airavata-server.properties | 17 - modules/user-profile/pom.xml | 41 - modules/user-profile/user-profile-core/pom.xml | 152 - .../core/UserProfileRegistryException.java | 28 - .../core/entities/NSFDemographicsEntity.java | 94 - .../core/entities/UserProfileEntity.java | 247 - .../core/repositories/AbstractRepository.java | 98 - .../repositories/UserProfileRepository.java | 87 - .../user/registry/core/utils/Committer.java | 27 - .../user/registry/core/utils/JPAConstants.java | 33 - .../user/registry/core/utils/JPAUtils.java | 83 - .../core/utils/ObjectMapperSingleton.java | 39 - .../registry/core/utils/QueryConstants.java | 41 - .../user/registry/core/utils/Utils.java | 154 - .../src/main/resources/META-INF/persistence.xml | 33 - .../src/main/resources/user_profile_catalog.sql | 84 - .../repositories/WorkspaceRepositoryTest.java | 176 - .../user-profile/user-profile-service/pom.xml | 55 - .../user/profile/server/UserProfileServer.java | 157 - .../server/UserProfileServiceHandler.java | 139 - modules/user-profile/user-profile-stubs/pom.xml | 74 - .../userprofile/cpi/UserProfileService.java | 7523 ------------------ .../client/UserProfileServiceClientFactory.java | 42 - .../exception/UserProfileServiceException.java | 426 - .../cpi/user_profile_cpiConstants.java | 76 - pom.xml | 1 - 28 files changed, 1 insertion(+), 9929 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java ---------------------------------------------------------------------- diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java index eeb665e..38d0758 100644 --- a/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java +++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/Constants.java @@ -33,7 +33,6 @@ public final class Constants { public static final String IS_API_SECURED = "api.secured"; public static final String SECURITY_MANAGER_CLASS = "security.manager.class"; public static final String REMOTE_OAUTH_SERVER_URL = "remote.oauth.authorization.server"; - public static final String REMOTE_IDP_SERVICE_URL = "remote.idp.service.url"; public static final String IS_TLS_ENABLED = "TLS.enabled"; public static final String TLS_SERVER_PORT = "TLS.api.server.port"; public static final String KEYSTORE_PATH = "keystore.path"; http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/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 7537edb..e232e7b 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 @@ -336,7 +336,7 @@ public class ServerSettings extends ApplicationSettings { } public static String getRemoteIDPServiceUrl() throws ApplicationSettingsException { - return getSetting(Constants.REMOTE_IDP_SERVICE_URL); + return getSetting(ServerSettings.IAM_SERVER_URL); } http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/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 aa4a2f0..30518f1 100644 --- a/modules/configuration/server/src/main/resources/airavata-server.properties +++ b/modules/configuration/server/src/main/resources/airavata-server.properties @@ -326,9 +326,6 @@ authz.cache.enabled=true authz.cache.manager.class=org.apache.airavata.api.server.security.authzcache.DefaultAuthzCacheManager in.memory.cache.size=1000 -#### remote idp service url for KeyCloak based setup#### -remote.idp.service.url=https://iam.scigap.org/auth - # Kafka Logging related configuration isRunningOnAws=false kafka.broker.list=localhost:9092 @@ -336,20 +333,6 @@ kafka.topic.prefix=local enable.kafka.logging=false ########################################################################### -# User Profile module Configuration -########################################################################### -user.profile.server.host=localhost -user.profile.server.port=8961 -user_profile=org.apache.airavata.user.profile.server.UserProfileServer -user.profile.catalog.registry.jdbc.url=jdbc:derby:credential-store;create=true;user=airavata;password=airavata -user.profile.catalog.registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver -#user.profile.catalog.registry.jdbc.url=jdbc:mysql://localhost:3306/user_profile_catalog -#user.profile.catalog.registry.jdbc.driver=com.mysql.jdbc.Driver -user.profile.catalog.registry.jdbc.user=airavata -user.profile.catalog.registry.jdbc.password=airavata -user.profile.catalog.validationQuery=SELECT 1 - -########################################################################### # Profile Service Configuration ########################################################################### profile.service.server.host=localhost http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/pom.xml ---------------------------------------------------------------------- diff --git a/modules/user-profile/pom.xml b/modules/user-profile/pom.xml deleted file mode 100644 index f0ab64c..0000000 --- a/modules/user-profile/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?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> - <artifactId>airavata</artifactId> - <groupId>org.apache.airavata</groupId> - <version>0.17-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>user-profile</artifactId> - <packaging>pom</packaging> - <modules> - <module>user-profile-stubs</module> - <module>user-profile-service</module> - <module>user-profile-core</module> - </modules> - - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/pom.xml ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-core/pom.xml b/modules/user-profile/user-profile-core/pom.xml deleted file mode 100644 index 802c0ed..0000000 --- a/modules/user-profile/user-profile-core/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ -<?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> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index 056baea..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/UserProfileRegistryException.java +++ /dev/null @@ -1,28 +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.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); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index 00d7bda..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/NSFDemographicsEntity.java +++ /dev/null @@ -1,94 +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.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; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index 06b678e..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/entities/UserProfileEntity.java +++ /dev/null @@ -1,247 +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.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; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index f128086..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/AbstractRepository.java +++ /dev/null @@ -1,98 +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.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; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index ebf99e1..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/repositories/UserProfileRepository.java +++ /dev/null @@ -1,87 +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.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; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index 6c4549d..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Committer.java +++ /dev/null @@ -1,27 +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.user.registry.core.utils; - -@FunctionalInterface -public interface Committer<T, R> { - - R commit(T t); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAConstants.java ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAConstants.java b/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAConstants.java deleted file mode 100644 index 65b6135..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAConstants.java +++ /dev/null @@ -1,33 +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.user.registry.core.utils; -public class JPAConstants { - public static final String KEY_JDBC_URL = "user.profile.catalog.registry.jdbc.url"; - public static final String KEY_JDBC_USER = "user.profile.catalog.registry.jdbc.user"; - public static final String KEY_JDBC_PASSWORD = "user.profile.catalog.registry.jdbc.password"; - public static final String KEY_JDBC_DRIVER = "user.profile.catalog.registry.jdbc.driver"; - // TODO: is this needed? - public static final String KEY_DERBY_START_ENABLE = "user.profile.catalog.start.derby.server.mode"; - public static final String VALIDATION_QUERY = "user.profile.catalog.validationQuery"; - public static final String JPA_CACHE_SIZE = "user.profile.catalog.jpa.cache.size"; - public static final String ENABLE_CACHING = "user.profile.catalog.cache.enable"; -} http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index b8024fa..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/JPAUtils.java +++ /dev/null @@ -1,83 +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.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(); - } - } - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index f4d4d24..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/ObjectMapperSingleton.java +++ /dev/null @@ -1,39 +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.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; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index 73e3f78..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/QueryConstants.java +++ /dev/null @@ -1,41 +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.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/28709245/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java ---------------------------------------------------------------------- diff --git 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 deleted file mode 100644 index a534221..0000000 --- a/modules/user-profile/user-profile-core/src/main/java/org/apache/airavata/user/registry/core/utils/Utils.java +++ /dev/null @@ -1,154 +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.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; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-core/src/main/resources/META-INF/persistence.xml b/modules/user-profile/user-profile-core/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 12ae6cc..0000000 --- a/modules/user-profile/user-profile-core/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.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. - * -* --> -<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> - <persistence-unit name="user_profile_catalog"> - <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> - <class>org.apache.airavata.user.registry.core.entities.UserProfileEntity</class> - <class>org.apache.airavata.user.registry.core.entities.NSFDemographicsEntity</class> - <exclude-unlisted-classes>true</exclude-unlisted-classes> - <properties> - <property name="openjpa.jdbc.MappingDefaults" - value="ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade" /> - </properties> - </persistence-unit> -</persistence> http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/main/resources/user_profile_catalog.sql ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-core/src/main/resources/user_profile_catalog.sql b/modules/user-profile/user-profile-core/src/main/resources/user_profile_catalog.sql deleted file mode 100644 index 4653c45..0000000 --- a/modules/user-profile/user-profile-core/src/main/resources/user_profile_catalog.sql +++ /dev/null @@ -1,84 +0,0 @@ -CREATE TABLE IF NOT EXISTS USER_PROFILE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - USER_ID VARCHAR (255), - GATEWAY_ID VARCHAR (255), - USER_MODEL_VERSION VARCHAR (255), - USER_NAME VARCHAR (255), - ORCID_ID VARCHAR (255), - COUNTRY VARCHAR (255), - HOME_ORGANIZATION VARCHAR (255), - ORIGINATION_AFFILIATION VARCHAR (255), - CREATION_TIME BIGINT, - LAST_ACCESS_TIME BIGINT, - VALID_UNTIL BIGINT, - STATE VARCHAR (255), - COMMENTS TEXT, - GPG_KEY VARCHAR (8192), - TIME_ZONE VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID) -); - -CREATE TABLE IF NOT EXISTS USER_PROFILE_EMAIL ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - EMAIL VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, EMAIL), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS USER_PROFILE_PHONE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - PHONE VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, PHONE ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS USER_PROFILE_NATIONALITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - NATIONALITY VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, NATIONALITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS USER_PROFILE_LABELED_URI ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - LABELED_URI VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, LABELED_URI ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS NSF_DEMOGRAPHIC ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - GENDER VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS NSF_DEMOGRAPHIC_ETHNICITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - ETHNICITY VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, ETHNICITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS NSF_DEMOGRAPHIC_RACE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - RACE VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, RACE ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE IF NOT EXISTS NSF_DEMOGRAPHIC_DISABILITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255), - DISABILITY VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, DISABILITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('user_profile_catalog_version', '0.17'); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java b/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java deleted file mode 100644 index 67ba550..0000000 --- a/modules/user-profile/user-profile-core/src/test/java/org/apache/airavata/registry/core/repositories/WorkspaceRepositoryTest.java +++ /dev/null @@ -1,176 +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.repositories; - -public class WorkspaceRepositoryTest { -// private final static Logger logger = LoggerFactory.getLogger(WorkspaceRepositoryTest.class); -// -// private GatewayRepository gatewayRepository; -// private NotificationRepository notificationRepository; -// private UserProfileRepository userProfileRepository; -// private ProjectRepository projectRepository; -// private String gatewayId; -// private String notificationId; -// private String userId; -// private String projectId; -// -// private final String GATEWAY_DOMAIN = "test1.com"; -// private final String NOTIFY_MESSAGE = "NotifyMe"; -// private final String USER_COMMENT = "TestComment"; -// private final String PROJECT_DESCRIPTION = "Test Description"; -// -// -// @Before -// public void setupRepository() { -// -// gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.class); -// notificationRepository = new NotificationRepository(Notification.class, -// NotificationEntity.class); -// userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class); -// projectRepository = new ProjectRepository(Project.class, ProjectEntity.class); -// -// gatewayId = "test.com" + System.currentTimeMillis(); -// notificationId = UUID.randomUUID().toString(); -// userId = "testuser" + System.currentTimeMillis(); -// projectId = "project" + System.currentTimeMillis(); -// } -// -// @Test -// public void userProfileRepositoryTest() { -// -// /* -// * Creating Gateway required for UserProfile creation -// */ -// Gateway gateway = new Gateway(); -// gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE); -// gateway.setGatewayId(gatewayId); -// gateway.setDomain(GATEWAY_DOMAIN); -// gateway = gatewayRepository.create(gateway); -// Assert.assertTrue(!gateway.getGatewayId().isEmpty()); -// -// -// -// /* -// * UserProfile Instance creation -// */ -// UserProfile userProfile = new UserProfile(); -// userProfile.setAiravataInternalUserId(userId); -// userProfile.setGatewayId(gateway.getGatewayId()); -// -// /* -// * Workspace UserProfile Repository Insert Operation Test -// */ -// userProfile = userProfileRepository.create(userProfile); -// Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty()); -// -// /* -// * Workspace UserProfile Repository Update Operation Test -// */ -// userProfile.setComments(USER_COMMENT); -// userProfileRepository.update(userProfile); -// userProfile = userProfileRepository.get(userId); -// System.out.println(userProfile.getComments()); -// Assert.assertEquals(userProfile.getComments(), USER_COMMENT); -// -// /* -// * Workspace UserProfile Repository Select Operation Test -// */ -// userProfile = userProfileRepository.get(userId); -// Assert.assertNotNull(userProfile); -// -// /* -// * Workspace UserProfile Repository Delete Operation -// */ -// boolean deleteResult = userProfileRepository.delete(userId); -// Assert.assertTrue(deleteResult); -// deleteResult = gatewayRepository.delete(gatewayId); -// Assert.assertTrue(deleteResult); -// -// -// } -// -// @Test -// public void projectRepositoryTest() { -// -// /* -// * Creating Gateway required for UserProfile & Project creation -// */ -// Gateway gateway = new Gateway(); -// gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE); -// gateway.setGatewayId(gatewayId); -// gateway.setDomain(GATEWAY_DOMAIN); -// gateway = gatewayRepository.create(gateway); -// Assert.assertTrue(!gateway.getGatewayId().isEmpty()); -// -// /* -// * UserProfile Instance creation required for Project Creation -// */ -// UserProfile userProfile = new UserProfile(); -// userProfile.setAiravataInternalUserId(userId); -// userProfile.setGatewayId(gateway.getGatewayId()); -// userProfile = userProfileRepository.create(userProfile); -// Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty()); -// -// /* -// * Project Instance creation -// */ -// Project project = new Project(); -// project.setGatewayId(gatewayId); -// project.setOwner(userId); -// project.setProjectID(projectId); -// project.setGatewayIdIsSet(true); -// -// -// /* -// * Workspace Project Repository Insert Operation Test -// */ -// project = projectRepository.create(project); -// Assert.assertTrue(!project.getProjectID().isEmpty()); -// -// /* -// * Workspace Project Repository Update Operation Test -// */ -// project.setDescription(PROJECT_DESCRIPTION); -// projectRepository.update(project); -// project = projectRepository.get(projectId); -// Assert.assertEquals(project.getDescription(), PROJECT_DESCRIPTION); -// -// /* -// * Workspace Project Repository Select Operation Test -// */ -// project = projectRepository.get(projectId); -// Assert.assertNotNull(project); -// -// /* -// * Workspace Project Repository Delete Operation -// */ -// boolean deleteResult = projectRepository.delete(projectId); -// Assert.assertTrue(deleteResult); -// -// deleteResult = userProfileRepository.delete(userId); -// Assert.assertTrue(deleteResult); -// -// deleteResult = gatewayRepository.delete(gatewayId); -// Assert.assertTrue(deleteResult); -// -// -// } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/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 deleted file mode 100644 index 9481ad6..0000000 --- a/modules/user-profile/user-profile-service/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?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-service</artifactId> - <name>Airavata user profile service</name> - <description>Module to expose a user profile registry as a thrift service</description> - - <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> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>user-profile-core</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServer.java ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServer.java b/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServer.java deleted file mode 100644 index 3e09044..0000000 --- a/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServer.java +++ /dev/null @@ -1,157 +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.user.profile.server; - -import org.apache.airavata.common.utils.IServer; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.userprofile.cpi.UserProfileService; -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; - -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(); - UserProfileService.Processor processor = new UserProfileService.Processor(new UserProfileServiceHandler()); - - 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("User Profile 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 User Profile Server on Port " + serverPort); - logger.info("Listening to User Profile server clients ...."); - } - } - }.start(); - } catch (TTransportException e) { - setStatus(ServerStatus.FAILED); - throw new Exception("Error while starting the User Profile 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/28709245/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServiceHandler.java ---------------------------------------------------------------------- diff --git a/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServiceHandler.java b/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServiceHandler.java deleted file mode 100644 index f6e7c43..0000000 --- a/modules/user-profile/user-profile-service/src/main/java/org/apache/airavata/user/profile/server/UserProfileServiceHandler.java +++ /dev/null @@ -1,139 +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.user.profile.server; - -import org.apache.airavata.model.user.UserProfile; -import org.apache.airavata.user.registry.core.entities.UserProfileEntity; -import org.apache.airavata.user.registry.core.repositories.UserProfileRepository; -import org.apache.airavata.userprofile.cpi.UserProfileService; -import org.apache.airavata.userprofile.cpi.exception.UserProfileServiceException; -import org.apache.thrift.TException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.util.List; - -public class UserProfileServiceHandler implements UserProfileService.Iface { - - private final static Logger logger = LoggerFactory.getLogger(UserProfileServiceHandler.class); - - private UserProfileRepository userProfileRepository; - - public UserProfileServiceHandler() { - - userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class); - } - - public String addUserProfile(UserProfile userProfile) throws UserProfileServiceException{ - try{ - userProfileRepository.create(userProfile); - if (null != userProfile) - return userProfile.getUserId(); - return null; - } catch (Exception e){ - logger.error("Error while creating user profile", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while creating user profile. More info : " + e.getMessage()); - throw exception; - } - } - - public boolean updateUserProfile(UserProfile userProfile) throws UserProfileServiceException, TException { - try { - if(userProfileRepository.update(userProfile) != null) - return true; - return false; - } catch (Exception e) { - logger.error("Error while Updating user profile", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while Updating user profile. More info : " + e.getMessage()); - throw exception; - } - } - - public UserProfile getUserProfileById(String userId, String gatewayId) throws UserProfileServiceException { - try{ - UserProfile userProfile = userProfileRepository.getUserProfileByIdAndGateWay(userId, gatewayId); - if(userProfile != null) - return userProfile; - return null; - } catch (Exception e) { - logger.error("Error retrieving user profile by ID", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error retrieving user profile by ID. More info : " + e.getMessage()); - throw exception; - } - } - - // FIXME: shouldn't deleteUserProfile require the gatewayId as well? - public boolean deleteUserProfile(String userId) throws UserProfileServiceException { - try{ - boolean deleteResult = userProfileRepository.delete(userId); - return deleteResult; - } catch (Exception e) { - logger.error("Error while deleting user profile", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while deleting user profile. More info : " + e.getMessage()); - throw exception; - } - } - - public List<UserProfile> getAllUserProfilesInGateway(String gatewayId, int offset, int limit) throws UserProfileServiceException { - try{ - List<UserProfile> usersInGateway = userProfileRepository.getAllUserProfilesInGateway(gatewayId, offset, limit); - if(usersInGateway != null) - return usersInGateway; - return null; - } catch (Exception e) { - logger.error("Error while retrieving user profile List", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while retrieving user profile List. More info : " + e.getMessage()); - throw exception; - } - } - - - public UserProfile getUserProfileByName(String userName, String gatewayId) throws UserProfileServiceException { - try{ - UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId); - if(userProfile != null) - return userProfile; - return null; - } catch (Exception e) { - logger.error("Error while retrieving user profile", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while retrieving user profile. More info : " + e.getMessage()); - throw exception; - } - } - - public boolean doesUserExist(String userName, String gatewayId) throws UserProfileServiceException, TException { - try{ - UserProfile userProfile = userProfileRepository.getUserProfileByNameAndGateWay(userName, gatewayId); - if (null != userProfile) - return true; - return false; - } catch (Exception e) { - logger.error("Error while finding user profile", e); - UserProfileServiceException exception = new UserProfileServiceException(); - exception.setMessage("Error while finding user profile. More info : " + e.getMessage()); - throw exception; - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/28709245/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 deleted file mode 100644 index c17b285..0000000 --- a/modules/user-profile/user-profile-stubs/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?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-stubs</artifactId> - <name>Airavata user profile service stubs</name> - <description>thrift generated user profile service stubs</description> - - <dependencies> - <dependency> - <groupId>org.apache.airavata</groupId> - <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> - - <build> - <plugins> - <plugin> - <groupId>com.google.code.maven-replacer-plugin</groupId> - <artifactId>replacer</artifactId> - <version>${maven.replacer.plugin.version}</version> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>replace</goal> - </goals> - </execution> - </executions> - <configuration> - <includes> - <include>${basedir}/src/main/java/org/apache/airavata/**/*.java</include> - </includes> - <token>, date = ".*"</token> - <value> </value> - </configuration> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file
