You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by an...@apache.org on 2017/05/02 16:49:18 UTC
[03/23] airavata git commit: adding boiler plate code for iam admin
services
adding boiler plate code for iam admin services
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/65bb9867
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/65bb9867
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/65bb9867
Branch: refs/heads/develop
Commit: 65bb9867213615891957906c414a4a4f08c26c64
Parents: 2923dd2
Author: Anuj Bhandar <bh...@gmail.com>
Authored: Sun Apr 23 23:29:58 2017 -0400
Committer: Anuj Bhandar <bh...@gmail.com>
Committed: Sun Apr 23 23:29:58 2017 -0400
----------------------------------------------------------------------
.../iam-admin-services-core/pom.xml | 19 +
airavata-services/profile-service/pom.xml | 1 +
.../handlers/IamAdminServicesHandler.java | 54 +
.../profile/server/ProfileServiceServer.java | 5 +
.../admin/services/cpi/IamAdminServices.java | 2424 ++++++++++++++++++
.../exception/IamAdminServicesException.java | 407 +++
.../cpi/iam_admin_services_cpiConstants.java | 59 +
.../iam-admin-services-cpi.thrift | 47 +
.../iam_admin_services_cpi_errors.thrift | 32 +
.../profile-service/profile-service-cpi.thrift | 1 +
10 files changed, 3049 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/65bb9867/airavata-services/profile-service/iam-admin-services-core/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/iam-admin-services-core/pom.xml b/airavata-services/profile-service/iam-admin-services-core/pom.xml
new file mode 100644
index 0000000..be7e409
--- /dev/null
+++ b/airavata-services/profile-service/iam-admin-services-core/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>profile-service</artifactId>
+ <version>0.17-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+
+ <artifactId>iam-admin-services-core</artifactId>
+ <name>Profile User Core</name>
+
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/65bb9867/airavata-services/profile-service/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/pom.xml b/airavata-services/profile-service/pom.xml
index 043f266..72609da 100644
--- a/airavata-services/profile-service/pom.xml
+++ b/airavata-services/profile-service/pom.xml
@@ -33,6 +33,7 @@
<module>profile-tenant-core</module>
<module>profile-service-server</module>
<module>profile-service-client-sdks</module>
+ <module>iam-admin-services-core</module>
</modules>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/65bb9867/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
new file mode 100644
index 0000000..113bf3f
--- /dev/null
+++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.handlers;
+
+import org.apache.airavata.model.error.AuthorizationException;
+import org.apache.airavata.model.security.AuthzToken;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.iam_admin_services_cpiConstants;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class IamAdminServicesHandler implements IamAdminServices.Iface {
+
+ private final static Logger logger = LoggerFactory.getLogger(IamAdminServicesHandler.class);
+
+
+ @Override
+ public String getAPIVersion(AuthzToken authzToken) throws IamAdminServicesException, AuthorizationException {
+ try {
+ return iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_VERSION;
+ } catch (Exception ex) {
+ logger.error("Error getting API version, reason: " + ex.getMessage(), ex);
+ IamAdminServicesException exception = new IamAdminServicesException();
+ exception.setMessage("Error getting API version, reason: " + ex.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ public String setUpGateway(AuthzToken authzToken, Gateway gateway) throws IamAdminServicesException, AuthorizationException {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/65bb9867/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/server/ProfileServiceServer.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/server/ProfileServiceServer.java b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/server/ProfileServiceServer.java
index c21006b..96d6f83 100644
--- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/server/ProfileServiceServer.java
+++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/server/ProfileServiceServer.java
@@ -23,6 +23,9 @@ package org.apache.airavata.service.profile.server;
import org.apache.airavata.common.utils.IServer;
import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.service.profile.handlers.IamAdminServicesHandler;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.iam_admin_services_cpiConstants;
import org.apache.airavata.service.profile.tenant.cpi.profile_tenant_cpiConstants;
import org.apache.airavata.service.profile.handlers.TenantProfileServiceHandler;
import org.apache.airavata.service.profile.handlers.UserProfileServiceHandler;
@@ -84,11 +87,13 @@ public class ProfileServiceServer implements IServer {
// create multiple processors for each profile-service
UserProfileService.Processor userProfileProcessor = new UserProfileService.Processor(new UserProfileServiceHandler());
TenantProfileService.Processor teneantProfileProcessor = new TenantProfileService.Processor(new TenantProfileServiceHandler());
+ IamAdminServices.Processor iamAdminServicesProcessor = new IamAdminServices.Processor(new IamAdminServicesHandler());
// create a multiplexed processor
TMultiplexedProcessor profileServiceProcessor = new TMultiplexedProcessor();
profileServiceProcessor.registerProcessor(profile_user_cpiConstants.USER_PROFILE_CPI_NAME, userProfileProcessor);
profileServiceProcessor.registerProcessor(profile_tenant_cpiConstants.TENANT_PROFILE_CPI_NAME, teneantProfileProcessor);
+ profileServiceProcessor.registerProcessor(iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_NAME, iamAdminServicesProcessor);
TServerTransport serverTransport;