public void processDatabseSchema()

in src/main/java/com/amazonaws/gdcreplication/util/GDCUtil.java [139:168]


	public void processDatabseSchema(AWSGlue glue, AmazonSQS sqs, String targetGlueCatalogId, Database db,
			String message, String sqsQueueURL, String sourceGlueCatalogId, String exportBatchId,
			String ddbTblNameForDBStatusTracking) {

		DDBUtil ddbUtil = new DDBUtil();
		GlueUtil glueUtil = new GlueUtil();
		SQSUtil sqsUtil = new SQSUtil();

		boolean isDBCreated = false;
		long importRunId = System.currentTimeMillis();
		Database database = glueUtil.getDatabaseIfExist(glue, targetGlueCatalogId, db);
		boolean dbExist = Optional.ofNullable(database).isPresent();
		if (!dbExist) {
			DBReplicationStatus dbStatus = glueUtil.createGlueDatabase(glue, targetGlueCatalogId, db);
			if (dbStatus.isError()) {
				System.out.println("Error in creating database in the Glue Data Catalog. It will be send to DLQ.");
				sqsUtil.sendDatabaseSchemaToDeadLetterQueue(sqs, sqsQueueURL, message, db.getName(), exportBatchId,
						sourceGlueCatalogId);
			} else
				isDBCreated = true;
		} else
			System.out.printf(
					"Database with name '%s' exist already in target Glue Data Catalog. No action will be taken. \n",
					database.getName());
		// Track status in DynamoDB
		ddbUtil.trackDatabaseImportStatus(sourceGlueCatalogId, targetGlueCatalogId, ddbTblNameForDBStatusTracking,
				db.getName(), importRunId, exportBatchId, isDBCreated);
		System.out.printf("Processing of Database shcema completed. Result: DB already exist: %b, DB created: %b. \n",
				dbExist, isDBCreated);
	}