Skip to content

Commit

Permalink
Merge pull request #97 from ankitmashu/Modify/postgres
Browse files Browse the repository at this point in the history
moved postgres out of example folder
  • Loading branch information
gopal-mahajan authored Aug 1, 2024
2 parents e4776d4 + 960ee2a commit f981ea1
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 402 deletions.
6 changes: 2 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ pipeline {

recordIssues(
enabledForFailure: true,
blameDisabled: true,
forensicsDisabled: true,
skipBlames: true,
qualityGates: [[threshold:0, type: 'TOTAL', unstable: false]],
tool: checkStyle(pattern: 'target/checkstyle-result.xml')
)
recordIssues(
enabledForFailure: true,
blameDisabled: true,
forensicsDisabled: true,
skipBlames: true,
qualityGates: [[threshold:100, type: 'TOTAL', unstable: false]],
tool: pmdParser(pattern: 'target/pmd.xml')
)
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/iudx/rs/proxy/apiserver/ApiServerVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,13 @@ public void start() throws Exception {
router
.get(apis.getConsumerAuditEndpoint())
.handler(TokenDecodeHandler.create(vertx))
.handler(new ConsentLogRequestHandler(vertx, isAdexInstance))
.handler(AuthHandler.create(vertx, apis, isAdexInstance))
.handler(this::contextBodyCall)
.handler(this::getConsumerAuditDetail);

router
.get(apis.getProviderAuditEndpoint())
.handler(TokenDecodeHandler.create(vertx))
.handler(new ConsentLogRequestHandler(vertx, isAdexInstance))
.handler(AuthHandler.create(vertx, apis, isAdexInstance))
.handler(this::contextBodyCall)
.handler(this::getProviderAuditDetail);

// Post Queries
Expand Down Expand Up @@ -164,19 +160,15 @@ public void start() throws Exception {
router
.get(apis.getOverviewEndPoint())
.handler(TokenDecodeHandler.create(vertx))
.handler(new ConsentLogRequestHandler(vertx, isAdexInstance))
.handler(AuthHandler.create(vertx, apis, isAdexInstance))
.handler(this::contextBodyCall)
.handler(this::getMonthlyOverview)
.failureHandler(validationsFailureHandler);

// Metering Summary
router
.get(apis.getSummaryEndPoint())
.handler(TokenDecodeHandler.create(vertx))
.handler(new ConsentLogRequestHandler(vertx, isAdexInstance))
.handler(AuthHandler.create(vertx, apis, isAdexInstance))
.handler(this::contextBodyCall)
.handler(this::getAllSummaryHandler)
.failureHandler(validationsFailureHandler);

Expand Down
29 changes: 0 additions & 29 deletions src/main/java/iudx/rs/proxy/database/DatabaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,6 @@ static DatabaseService createProxy(Vertx vertx, String address) {
return new DatabaseServiceVertxEBProxy(vertx, address);
}

/**
* The searchQuery implements the search operation with the database.
*
* @param request which is a JsonObject
* @param handler which is a Request Handler
* @return DatabaseService which is a Service
*/
@Fluent
DatabaseService searchQuery(JsonObject request, Handler<AsyncResult<JsonObject>> handler)
throws ServiceException;

/**
* The countQuery implements the count operation with the database.
*
* @param request which is a JsonObject
* @param handler which is a Request Handler
* @return DatabaseService which is a Service
*/
@Fluent
DatabaseService countQuery(JsonObject request, Handler<AsyncResult<JsonObject>> handler)
throws ServiceException;

/**
* The execute query implements the String query in the database.
*
* @param jsonObject which is a JsonObject
* @param handler which is a Request Handler
* @return DatabaseService which is a Service
*/
@Fluent
DatabaseService executeQuery(
final JsonObject jsonObject, Handler<AsyncResult<JsonObject>> handler)
Expand Down
28 changes: 25 additions & 3 deletions src/main/java/iudx/rs/proxy/database/DatabaseVerticle.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
package iudx.rs.proxy.database;

import static iudx.rs.proxy.common.Constants.DB_SERVICE_ADDRESS;
import static iudx.rs.proxy.database.postgres.Constants.*;
import static iudx.rs.proxy.database.postgres.Constants.POOL_SIZE;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.json.JsonObject;
import io.vertx.pgclient.PgConnectOptions;
import io.vertx.pgclient.PgPool;
import io.vertx.serviceproxy.ServiceBinder;
import iudx.rs.proxy.database.example.postgres.PostgresServiceImpl;
import io.vertx.sqlclient.PoolOptions;
import iudx.rs.proxy.database.postgres.PostgresServiceImpl;

public class DatabaseVerticle extends AbstractVerticle {

private ServiceBinder binder;
private MessageConsumer<JsonObject> consumer;
private DatabaseService dbServiceImpl;
private PgPool pgClient;

@Override
public void start() throws Exception {
String databaseIp = config().getString(DATABASE_IP);
int databasePort = config().getInteger(DATABASE_PORT);
String databaseName = config().getString(DATABASE_NAME);
String databaseUserName = config().getString(DATABASE_USERNAME);
String databasePassword = config().getString(DATABASE_PASSWORD);
int poolSize = config().getInteger(POOL_SIZE);

PgConnectOptions connectOptions =
new PgConnectOptions()
.setPort(databasePort)
.setHost(databaseIp)
.setDatabase(databaseName)
.setUser(databaseUserName)
.setPassword(databasePassword);

PoolOptions poolOptions = new PoolOptions().setMaxSize(poolSize);
pgClient = PgPool.pool(vertx, connectOptions, poolOptions);

binder = new ServiceBinder(vertx);
dbServiceImpl = new PostgresServiceImpl(vertx, config());
dbServiceImpl = new PostgresServiceImpl(pgClient);
consumer = binder.setAddress(DB_SERVICE_ADDRESS).register(DatabaseService.class, dbServiceImpl);
}

Expand Down

This file was deleted.

Loading

0 comments on commit f981ea1

Please sign in to comment.