-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reactive Refactoring: Namespace, DataSource, Collector (#587)
- Loading branch information
1 parent
7be183b
commit 5c7eef4
Showing
75 changed files
with
9,893 additions
and
4,011 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
oddIngestionApiVersion=0.1.9 | ||
oddIngestionApiVersion=0.1.10 | ||
oddrnGeneratorVersion=0.1.8 | ||
|
||
flywayVersion=7.8.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...orm-api/src/main/java/org/opendatadiscovery/oddplatform/auth/filter/SessionConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.opendatadiscovery.oddplatform.auth.filter; | ||
|
||
public class SessionConstants { | ||
public static String COLLECTOR_ID_SESSION_KEY = "collectorId"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 31 additions & 44 deletions
75
...-api/src/main/java/org/opendatadiscovery/oddplatform/controller/DataSourceController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,65 @@ | ||
package org.opendatadiscovery.oddplatform.controller; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotNull; | ||
import lombok.RequiredArgsConstructor; | ||
import org.opendatadiscovery.oddplatform.api.contract.api.DataSourceApi; | ||
import org.opendatadiscovery.oddplatform.api.contract.model.DataSource; | ||
import org.opendatadiscovery.oddplatform.api.contract.model.DataSourceFormData; | ||
import org.opendatadiscovery.oddplatform.api.contract.model.DataSourceList; | ||
import org.opendatadiscovery.oddplatform.api.contract.model.DataSourceUpdateFormData; | ||
import org.opendatadiscovery.oddplatform.service.DataSourceService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.server.ServerWebExchange; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
import reactor.core.scheduler.Schedulers; | ||
|
||
@RestController | ||
public class DataSourceController | ||
extends | ||
AbstractCRUDController<DataSource, DataSourceList, DataSourceFormData, | ||
DataSourceUpdateFormData, DataSourceService> | ||
implements DataSourceApi { | ||
|
||
public DataSourceController(final DataSourceService entityService) { | ||
super(entityService); | ||
} | ||
@RequiredArgsConstructor | ||
public class DataSourceController implements DataSourceApi { | ||
private final DataSourceService dataSourceService; | ||
|
||
@Override | ||
public Mono<ResponseEntity<Void>> deleteDataSource(final Long dataSourceId, final ServerWebExchange exchange) { | ||
return delete(dataSourceId); | ||
public Mono<ResponseEntity<DataSourceList>> getDataSourceList(final Integer page, final Integer size, | ||
final String query, | ||
final ServerWebExchange exchange) { | ||
return dataSourceService | ||
.list(page, size, query) | ||
.map(ResponseEntity::ok); | ||
} | ||
|
||
@Override | ||
public Mono<ResponseEntity<DataSourceList>> getDataSourceList( | ||
@NotNull @Valid final Integer page, | ||
@NotNull @Valid final Integer size, | ||
@Valid final String query, | ||
final ServerWebExchange exchange | ||
) { | ||
return list(page, size, query); | ||
public Mono<ResponseEntity<Flux<DataSource>>> getActiveDataSourceList(final ServerWebExchange exchange) { | ||
return Mono.just(ResponseEntity.ok(dataSourceService.listActive())); | ||
} | ||
|
||
@Override | ||
public Mono<ResponseEntity<Flux<DataSource>>> getActiveDataSourceList(final ServerWebExchange exchange) { | ||
final Flux<DataSource> response = entityService.listActive() | ||
.subscribeOn(Schedulers.boundedElastic()); | ||
|
||
return Mono.just(ResponseEntity.ok(response)); | ||
public Mono<ResponseEntity<DataSource>> registerDataSource(final Mono<DataSourceFormData> dataSourceFormData, | ||
final ServerWebExchange exchange) { | ||
return dataSourceFormData | ||
.flatMap(dataSourceService::create) | ||
.map(ResponseEntity::ok); | ||
} | ||
|
||
@Override | ||
public Mono<ResponseEntity<DataSource>> registerDataSource( | ||
@Valid final Mono<DataSourceFormData> dataSourceFormData, | ||
final ServerWebExchange exchange | ||
) { | ||
return create(dataSourceFormData); | ||
public Mono<ResponseEntity<DataSource>> updateDataSource(final Long dataSourceId, | ||
final Mono<DataSourceUpdateFormData> formData, | ||
final ServerWebExchange exchange) { | ||
return formData | ||
.flatMap(form -> dataSourceService.update(dataSourceId, form)) | ||
.map(ResponseEntity::ok); | ||
} | ||
|
||
@Override | ||
public Mono<ResponseEntity<DataSource>> updateDataSource( | ||
final Long dataSourceId, | ||
@Valid final Mono<DataSourceUpdateFormData> dataSourceUpdateFormData, | ||
final ServerWebExchange exchange | ||
) { | ||
return update(dataSourceId, dataSourceUpdateFormData); | ||
public Mono<ResponseEntity<Void>> deleteDataSource(final Long dataSourceId, final ServerWebExchange exchange) { | ||
return dataSourceService.delete(dataSourceId) | ||
.then(Mono.just(ResponseEntity.noContent().build())); | ||
} | ||
|
||
@Override | ||
public Mono<ResponseEntity<DataSource>> regenerateDataSourceToken( | ||
final Long dataSourceId, | ||
final ServerWebExchange exchange | ||
) { | ||
return entityService.regenerateDataSourceToken(dataSourceId) | ||
.map(entity -> new ResponseEntity<>(entity, HttpStatus.OK)); | ||
public Mono<ResponseEntity<DataSource>> regenerateDataSourceToken(final Long dataSourceId, | ||
final ServerWebExchange exchange) { | ||
return dataSourceService | ||
.regenerateDataSourceToken(dataSourceId) | ||
.map(ResponseEntity::ok); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.