airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata git commit: fixing sharing data migrator pom issues
Date Wed, 23 Nov 2016 15:48:23 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 3582fefa6 -> a1dba1dc2


fixing sharing data migrator pom issues


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a1dba1dc
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a1dba1dc
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a1dba1dc

Branch: refs/heads/develop
Commit: a1dba1dc202baafc9096ae7934528db28745affa
Parents: 3582fef
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Wed Nov 23 10:48:09 2016 -0500
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Wed Nov 23 10:48:21 2016 -0500

----------------------------------------------------------------------
 .../sharing-data-migrator/pom.xml               |  46 ++++-
 .../migrator/airavata/AiravataDataMigrator.java | 193 ++++++++++---------
 2 files changed, 149 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/a1dba1dc/modules/sharing-registry/sharing-data-migrator/pom.xml
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-data-migrator/pom.xml b/modules/sharing-registry/sharing-data-migrator/pom.xml
index e8b2c35..1891151 100644
--- a/modules/sharing-registry/sharing-data-migrator/pom.xml
+++ b/modules/sharing-registry/sharing-data-migrator/pom.xml
@@ -13,11 +13,55 @@
     <packaging>jar</packaging>
     <name>Sharing Data Migrator</name>
 
+    <build>
+    <plugins>
+    <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.5.1</version>
+        <configuration>
+            <source>1.8</source>
+            <target>1.8</target>
+        </configuration>
+    </plugin>
+    </plugins>
+    </build>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.airavata</groupId>
             <artifactId>airavata-sharing-registry-server</artifactId>
-            <version>${project.parent.version}</version>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-data-models</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.thrift</groupId>
+            <artifactId>libthrift</artifactId>
+            <version>0.9.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.12</version>
         </dependency>
     </dependencies>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/a1dba1dc/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
index 3de14d6..f69ffe6 100644
--- a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
+++ b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
@@ -24,8 +24,6 @@ import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.sharing.registry.models.*;
 import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
 import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -35,7 +33,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 public class AiravataDataMigrator {
-    private final static Logger logger = LoggerFactory.getLogger(AiravataDataMigrator.class);
 
     public static void main(String[] args) throws SQLException, ClassNotFoundException, TException,
ApplicationSettingsException {
         Connection expCatConnection = ConnectionFactory.getInstance().getExpCatConnection();
@@ -47,49 +44,53 @@ public class AiravataDataMigrator {
         ResultSet rs = statement.executeQuery(query);
 
         while (rs.next()) {
-            //Creating domain entries
-            Domain domain = new Domain();
-            domain.setName(rs.getString("GATEWAY_ID"));
-            domain.setDescription("Domain entry for " + domain.name);
-
-            govRegistryServerHandler.createDomain(domain);
-
-            //Creating Entity Types for each domain
-            EntityType entityType = new EntityType();
-            entityType.setEntityTypeId(domain.domainId+":PROJECT");
-            entityType.setDomainId(domain.domainId);
-            entityType.setName("PROJECT");
-            entityType.setDescription("Project entity type");
-            govRegistryServerHandler.createEntityType(entityType);
-
-            entityType = new EntityType();
-            entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
-            entityType.setDomainId(domain.domainId);
-            entityType.setName("EXPERIMENT");
-            entityType.setDescription("Experiment entity type");
-            govRegistryServerHandler.createEntityType(entityType);
-
-            entityType = new EntityType();
-            entityType.setEntityTypeId(domain.domainId+":FILE");
-            entityType.setDomainId(domain.domainId);
-            entityType.setName("FILE");
-            entityType.setDescription("File entity type");
-            govRegistryServerHandler.createEntityType(entityType);
-
-            //Creating Permission Types for each domain
-            PermissionType permissionType = new PermissionType();
-            permissionType.setPermissionTypeId(domain.domainId+":READ");
-            permissionType.setDomainId(domain.domainId);
-            permissionType.setName("READ");
-            permissionType.setDescription("Read permission type");
-            govRegistryServerHandler.createPermissionType(permissionType);
-
-            permissionType = new PermissionType();
-            permissionType.setPermissionTypeId(domain.domainId+":WRITE");
-            permissionType.setDomainId(domain.domainId);
-            permissionType.setName("WRITE");
-            permissionType.setDescription("Write permission type");
-            govRegistryServerHandler.createPermissionType(permissionType);
+            try{
+                //Creating domain entries
+                Domain domain = new Domain();
+                domain.setName(rs.getString("GATEWAY_ID"));
+                domain.setDescription("Domain entry for " + domain.name);
+
+                govRegistryServerHandler.createDomain(domain);
+
+                //Creating Entity Types for each domain
+                EntityType entityType = new EntityType();
+                entityType.setEntityTypeId(domain.domainId+":PROJECT");
+                entityType.setDomainId(domain.domainId);
+                entityType.setName("PROJECT");
+                entityType.setDescription("Project entity type");
+                govRegistryServerHandler.createEntityType(entityType);
+
+                entityType = new EntityType();
+                entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
+                entityType.setDomainId(domain.domainId);
+                entityType.setName("EXPERIMENT");
+                entityType.setDescription("Experiment entity type");
+                govRegistryServerHandler.createEntityType(entityType);
+
+                entityType = new EntityType();
+                entityType.setEntityTypeId(domain.domainId+":FILE");
+                entityType.setDomainId(domain.domainId);
+                entityType.setName("FILE");
+                entityType.setDescription("File entity type");
+                govRegistryServerHandler.createEntityType(entityType);
+
+                //Creating Permission Types for each domain
+                PermissionType permissionType = new PermissionType();
+                permissionType.setPermissionTypeId(domain.domainId+":READ");
+                permissionType.setDomainId(domain.domainId);
+                permissionType.setName("READ");
+                permissionType.setDescription("Read permission type");
+                govRegistryServerHandler.createPermissionType(permissionType);
+
+                permissionType = new PermissionType();
+                permissionType.setPermissionTypeId(domain.domainId+":WRITE");
+                permissionType.setDomainId(domain.domainId);
+                permissionType.setName("WRITE");
+                permissionType.setDescription("Write permission type");
+                govRegistryServerHandler.createPermissionType(permissionType);
+            }catch (Exception ex){
+                ex.printStackTrace();
+            }
         }
 
         //Creating user entries
@@ -97,12 +98,17 @@ public class AiravataDataMigrator {
         statement = expCatConnection.createStatement();
         rs = statement.executeQuery(query);
         while(rs.next()){
-            User user = new User();
-            user.setUserId(rs.getString("AIRAVATA_INTERNAL_USER_ID"));
-            user.setDomainId(rs.getString("GATEWAY_ID"));
-            user.setUserName(rs.getString("USER_NAME"));
+            try{
+                User user = new User();
+                user.setUserId(rs.getString("AIRAVATA_INTERNAL_USER_ID"));
+                user.setDomainId(rs.getString("GATEWAY_ID"));
+                user.setUserName(rs.getString("USER_NAME"));
+
+                govRegistryServerHandler.createUser(user);
+            }catch (Exception ex){
+                ex.printStackTrace();
+            }
 
-            govRegistryServerHandler.createUser(user);
         }
 
         //Creating project entries
@@ -110,21 +116,26 @@ public class AiravataDataMigrator {
         statement = expCatConnection.createStatement();
         rs = statement.executeQuery(query);
         while(rs.next()){
-            Entity entity = new Entity();
-            entity.setEntityId(rs.getString("PROJECT_ID"));
-            entity.setDomainId(rs.getString("GATEWAY_ID"));
-            entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":PROJECT");
-            entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
-            entity.setName(rs.getString("PROJECT_NAME"));
-            entity.setDescription(rs.getString("DESCRIPTION"));
-            if(entity.getDescription() == null)
-                entity.setFullText(entity.getName());
-            else
-                entity.setFullText(entity.getName() + " " + entity.getDescription());
-            Map<String, String> metadata = new HashMap<>();
-            metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
-
-            govRegistryServerHandler.createEntity(entity);
+            try{
+                Entity entity = new Entity();
+                entity.setEntityId(rs.getString("PROJECT_ID"));
+                entity.setDomainId(rs.getString("GATEWAY_ID"));
+                entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":PROJECT");
+                entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
+                entity.setName(rs.getString("PROJECT_NAME"));
+                entity.setDescription(rs.getString("DESCRIPTION"));
+                if(entity.getDescription() == null)
+                    entity.setFullText(entity.getName());
+                else
+                    entity.setFullText(entity.getName() + " " + entity.getDescription());
+                Map<String, String> metadata = new HashMap<>();
+                metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
+
+                govRegistryServerHandler.createEntity(entity);
+            }catch (Exception ex) {
+                ex.printStackTrace();
+            }
+
         }
 
         //Creating experiment entries
@@ -132,29 +143,33 @@ public class AiravataDataMigrator {
         statement = expCatConnection.createStatement();
         rs = statement.executeQuery(query);
         while(rs.next()){
-            Entity entity = new Entity();
-            entity.setEntityId(rs.getString("EXPERIMENT_ID"));
-            entity.setDomainId(rs.getString("GATEWAY_ID"));
-            entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":EXPERIMENT");
-            entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
-            entity.setParentEntityId(rs.getString("PROJECT_ID"));
-            entity.setName(rs.getString("EXPERIMENT_NAME"));
-            entity.setDescription(rs.getString("DESCRIPTION"));
-            if(entity.getDescription() == null)
-                entity.setFullText(entity.getName());
-            else
-                entity.setFullText(entity.getName() + " " + entity.getDescription());
-            Map<String, String> metadata = new HashMap<>();
-            metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
-            metadata.put("EXPERIMENT_TYPE", rs.getString("EXPERIMENT_TYPE"));
-            metadata.put("EXECUTION_ID", rs.getString("EXECUTION_ID"));
-            metadata.put("GATEWAY_EXECUTION_ID", rs.getString("GATEWAY_EXECUTION_ID"));
-            metadata.put("ENABLE_EMAIL_NOTIFICATION", rs.getString("ENABLE_EMAIL_NOTIFICATION"));
-            metadata.put("EMAIL_ADDRESSES", rs.getString("EMAIL_ADDRESSES"));
-            metadata.put("GATEWAY_INSTANCE_ID", rs.getString("GATEWAY_INSTANCE_ID"));
-            metadata.put("ARCHIVE", rs.getString("ARCHIVE"));
-
-            govRegistryServerHandler.createEntity(entity);
+            try {
+                Entity entity = new Entity();
+                entity.setEntityId(rs.getString("EXPERIMENT_ID"));
+                entity.setDomainId(rs.getString("GATEWAY_ID"));
+                entity.setEntityTypeId(rs.getString("GATEWAY_ID") + ":EXPERIMENT");
+                entity.setOwnerId(rs.getString("USER_NAME") + "@" + rs.getString("GATEWAY_ID"));
+                entity.setParentEntityId(rs.getString("PROJECT_ID"));
+                entity.setName(rs.getString("EXPERIMENT_NAME"));
+                entity.setDescription(rs.getString("DESCRIPTION"));
+                if(entity.getDescription() == null)
+                    entity.setFullText(entity.getName());
+                else
+                    entity.setFullText(entity.getName() + " " + entity.getDescription());
+                Map<String, String> metadata = new HashMap<>();
+                metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
+                metadata.put("EXPERIMENT_TYPE", rs.getString("EXPERIMENT_TYPE"));
+                metadata.put("EXECUTION_ID", rs.getString("EXECUTION_ID"));
+                metadata.put("GATEWAY_EXECUTION_ID", rs.getString("GATEWAY_EXECUTION_ID"));
+                metadata.put("ENABLE_EMAIL_NOTIFICATION", rs.getString("ENABLE_EMAIL_NOTIFICATION"));
+                metadata.put("EMAIL_ADDRESSES", rs.getString("EMAIL_ADDRESSES"));
+                metadata.put("GATEWAY_INSTANCE_ID", rs.getString("GATEWAY_INSTANCE_ID"));
+                metadata.put("ARCHIVE", rs.getString("ARCHIVE"));
+
+                govRegistryServerHandler.createEntity(entity);
+            }catch (Exception ex){
+                ex.printStackTrace();
+            }
         }
 
         expCatConnection.close();


Mime
View raw message