-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging the latest 'qa' into 'master' (#303)
* Change version to 1.19.0-SNAPSHOT * 1.19.0-QA version (#297) * updated id and name * updated id and name * Added functionality for disabling modules (OHDSI/ArachneUI#859) * fixed after review(OHDSI/ArachneUI#859) * updated version to 1.19.1 * Bump commons-compress from 1.19 to 1.21 in /arachne-commons (#295) Bumps commons-compress from 1.19 to 1.21. --- updated-dependencies: - dependency-name: org.apache.commons:commons-compress dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump cron-utils from 9.1.3 to 9.1.6 in /arachne-scheduler (#299) Bumps [cron-utils](https://github.com/jmrozanec/cron-utils) from 9.1.3 to 9.1.6. - [Release notes](https://github.com/jmrozanec/cron-utils/releases) - [Commits](jmrozanec/cron-utils@9.1.3...9.1.6) --- updated-dependencies: - dependency-name: com.cronutils:cron-utils dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Added Spark to DBMSType (#300) * 1.19.0-QA based on the latest origin/develop Co-authored-by: Sergey Suvorov <[email protected]> Co-authored-by: Dmitry S <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ajit Londhe <[email protected]>
- Loading branch information
1 parent
6a68055
commit 5e42e2f
Showing
17 changed files
with
167 additions
and
14 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
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
49 changes: 49 additions & 0 deletions
49
...main/java/com/odysseusinc/arachne/commons/api/v1/controller/ModuleSettingsController.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,49 @@ | ||
/* | ||
* | ||
* Copyright 2018 Odysseus Data Services, inc. | ||
* Licensed 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. | ||
* | ||
* Company: Odysseus Data Services, Inc. | ||
* Product Owner/Architecture: Gregory Klebanov | ||
* Authors: Sergey Suvorov | ||
* Created: September 27, 2021 | ||
* | ||
*/ | ||
|
||
package com.odysseusinc.arachne.commons.api.v1.controller; | ||
|
||
import com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult; | ||
import com.odysseusinc.arachne.commons.config.ArachneConfiguration; | ||
import io.swagger.annotations.Api; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Api | ||
@RestController | ||
public class ModuleSettingsController { | ||
private final ArachneConfiguration arachneConfiguration; | ||
|
||
public ModuleSettingsController(ArachneConfiguration arachneConfiguration) { | ||
this.arachneConfiguration = arachneConfiguration; | ||
} | ||
|
||
@RequestMapping(value = "/api/v1/modules/disabled-modules", method = RequestMethod.GET) | ||
public JsonResult<List<String>> getDisabledModules() { | ||
JsonResult<List<String>> result = new JsonResult<>(JsonResult.ErrorCode.NO_ERROR); | ||
result.setResult(arachneConfiguration.getDisabledModules()); | ||
return result; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...c/main/java/com/odysseusinc/arachne/commons/conditions/modules/ModuleAccessException.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,18 @@ | ||
package com.odysseusinc.arachne.commons.conditions.modules; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@ResponseStatus(HttpStatus.NOT_FOUND) | ||
public class ModuleAccessException extends RuntimeException { | ||
private String module; | ||
|
||
public ModuleAccessException(String module) { | ||
this.module = module; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return String.format("Module %s is disabled", this.module); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...mmons/src/main/java/com/odysseusinc/arachne/commons/conditions/modules/ModuleEnabled.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,12 @@ | ||
package com.odysseusinc.arachne.commons.conditions.modules; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.TYPE, ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface ModuleEnabled { | ||
String value(); | ||
} |
34 changes: 34 additions & 0 deletions
34
...src/main/java/com/odysseusinc/arachne/commons/conditions/modules/ModuleEnabledAspect.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,34 @@ | ||
package com.odysseusinc.arachne.commons.conditions.modules; | ||
|
||
import com.odysseusinc.arachne.commons.config.ArachneConfiguration; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Aspect | ||
@Component | ||
public class ModuleEnabledAspect { | ||
private final ArachneConfiguration arachneConfiguration; | ||
|
||
public ModuleEnabledAspect(ArachneConfiguration arachneConfiguration) { | ||
this.arachneConfiguration = arachneConfiguration; | ||
} | ||
|
||
@Around("@within(moduleEnabled)") | ||
public Object checkClassEnabled(ProceedingJoinPoint joinPoint, ModuleEnabled moduleEnabled) throws Throwable { | ||
return checkModuleEnabled(joinPoint, moduleEnabled); | ||
} | ||
|
||
@Around("@annotation(moduleEnabled)") | ||
public Object checkMethodEnabled(ProceedingJoinPoint joinPoint, ModuleEnabled moduleEnabled) throws Throwable { | ||
return checkModuleEnabled(joinPoint, moduleEnabled); | ||
} | ||
|
||
private Object checkModuleEnabled(ProceedingJoinPoint joinPoint, ModuleEnabled moduleEnabled) throws Throwable { | ||
if (arachneConfiguration.isModuleDisabled(moduleEnabled.value())) { | ||
throw new ModuleAccessException(moduleEnabled.value()); | ||
} | ||
return joinPoint.proceed(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ne-commons/src/main/java/com/odysseusinc/arachne/commons/config/ArachneConfiguration.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,26 @@ | ||
package com.odysseusinc.arachne.commons.config; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "arachne") | ||
public class ArachneConfiguration { | ||
@Value("${disabledModules:}") | ||
private List<String> disabledModules; | ||
|
||
public List<String> getDisabledModules() { | ||
return disabledModules; | ||
} | ||
|
||
public void setDisabledModules(List<String> disabledModules) { | ||
this.disabledModules = disabledModules; | ||
} | ||
|
||
public boolean isModuleDisabled(String module) { | ||
return this.disabledModules != null && this.disabledModules.contains(module); | ||
} | ||
} |
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
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
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
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