You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2019/09/03 13:43:36 UTC
[airavata-custos] 41/45: code refactoring
This is an automated email from the ASF dual-hosted git repository.
smarru pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit fc0891017df4b9f75bc4798c46a897c5f353c6e3
Author: Aarushi <aa...@gmail.com>
AuthorDate: Mon Sep 2 20:14:07 2019 -0400
code refactoring
---
.../custos/authentication/handler/CustosAuthenticationHandler.java | 2 +-
custos-client/pom.xml | 6 ------
...onServiceClientFactory.java => AuthenticationServiceClient.java} | 2 +-
.../custos/commons/exceptions/ServiceConnectionException.java | 3 +++
.../{CustosAPIServerStarted.java => CustosAPIServerStarter.java} | 2 +-
.../service/sample/CustosAuthenticationServiceSample.java | 4 ++--
6 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
index 8706071..8a7de8c 100644
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
@@ -20,7 +20,7 @@ public class CustosAuthenticationHandler implements CustosAuthenticationService.
CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
boolean isAuth = securityManager.isUserAuthenticated(authzToken);
if (isAuth) {
- logger.info("User " + authzToken.getClaimsMap().get(Constants.USER_NAME) + " in gateway " + authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + " is authenticated");
+ logger.info("User" + authzToken.getClaimsMap().get(Constants.USER_NAME) + "in gateway" + authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + "is authenticated");
return isAuth;
}
else{
diff --git a/custos-client/pom.xml b/custos-client/pom.xml
index 58f34c4..7c241a8 100644
--- a/custos-client/pom.xml
+++ b/custos-client/pom.xml
@@ -30,12 +30,6 @@
<artifactId>tenant-profile-service</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>custos-sharing-registry-stubs</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
diff --git a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
similarity index 95%
rename from custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java
rename to custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
index 734e55e..4fc0444 100644
--- a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java
+++ b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
@@ -8,7 +8,7 @@ import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
-public class AuthenticationServiceClientFactory {
+public class AuthenticationServiceClient {
public static CustosAuthenticationService.Client createAuthenticationServiceClient(String serverHost, int serverPort) throws CustosAuthenticationServiceException {
try {
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/exceptions/ServiceConnectionException.java b/custos-commons/src/main/java/org/apache/custos/commons/exceptions/ServiceConnectionException.java
index bdfaf29..06e0314 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/exceptions/ServiceConnectionException.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/exceptions/ServiceConnectionException.java
@@ -1,4 +1,7 @@
package org.apache.custos.commons.exceptions;
+/*
+This exception is thrown when client fails to make the Http call
+*/
public class ServiceConnectionException extends RuntimeException {
diff --git a/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java b/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarter.java
similarity index 93%
rename from ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java
rename to ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarter.java
index 81dd02b..9edcdef 100644
--- a/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java
+++ b/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarter.java
@@ -3,7 +3,7 @@ package org.apache.custos.server.start;
import org.apache.custos.authentication.server.CustosAuthenticationServer;
import org.apache.custos.profile.server.ProfileServiceServer;
-public class CustosAPIServerStarted {
+public class CustosAPIServerStarter {
public static void main(String args[]) throws Exception {
CustosAuthenticationServer custosAuthenticationServer = new CustosAuthenticationServer();
ProfileServiceServer custosProfileServer = new ProfileServiceServer();
diff --git a/ide-integration/samples/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java b/ide-integration/samples/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java
index 4fb0be0..5403862 100644
--- a/ide-integration/samples/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java
+++ b/ide-integration/samples/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java
@@ -1,7 +1,7 @@
package org.apache.custos.authentication.service.sample;
import org.apache.custos.authentication.cpi.CustosAuthenticationService;
-import org.apache.custos.client.authentication.service.AuthenticationServiceClientFactory;
+import org.apache.custos.client.authentication.service.AuthenticationServiceClient;
import org.apache.custos.commons.model.security.AuthzToken;
import org.apache.custos.commons.utils.Constants;
import org.apache.custos.commons.utils.ServerSettings;
@@ -24,7 +24,7 @@ public class CustosAuthenticationServiceSample {
try {
String serverHost = ServerSettings.getAuthenticationServerHost();
int serverPort = Integer.parseInt(ServerSettings.getAuthenticationServerPort());
- CustosAuthenticationService.Client client = AuthenticationServiceClientFactory.createAuthenticationServiceClient(serverHost, serverPort);
+ CustosAuthenticationService.Client client = AuthenticationServiceClient.createAuthenticationServiceClient(serverHost, serverPort);
testUserAuthentication(client);
}catch (Exception e){
log.error("Error setting up the authentication server");