Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move plugins to own repo #4

Merged
merged 23 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f02522f
Move plugins to own repo
rehammuzzamil Aug 23, 2023
72255c0
Remove redundant code
rehammuzzamil Aug 23, 2023
b7ce5fc
Remove redundant code
rehammuzzamil Aug 23, 2023
4e006e2
Move PractitionerDetailEndpoint to the plugins repo.
rehammuzzamil Sep 6, 2023
48bb75c
Issue#5 : Move OpenSRP Specific Changes to Fhir Gateway Plugins (cust…
rehammuzzamil Sep 25, 2023
6a4429c
Issue#5 : Move OpenSRP Specific Changes to Fhir Gateway Plugins (cust…
rehammuzzamil Sep 25, 2023
1f027df
Issue#5 : Move OpenSRP Specific Changes to Fhir Gateway Plugins (cust…
rehammuzzamil Sep 27, 2023
449f4cb
Code cleanup and removal of license related files
rehammuzzamil Oct 4, 2023
a28b4a3
Code refactoring, addressing PR feedback, package and module restruct…
rehammuzzamil Oct 13, 2023
9b4f8f0
Code refactoring, addressing PR feedback, package and module restruct…
rehammuzzamil Oct 13, 2023
887efc0
Locate missing changes from the PR https://github.com/opensrp/fhir-ga…
rehammuzzamil Oct 18, 2023
ab1ea14
Locate missing changes from the PR https://github.com/opensrp/fhir-ga…
rehammuzzamil Oct 18, 2023
88609ce
Minor fixes and code refactoring
rehammuzzamil Oct 18, 2023
95ae3db
Address PR feedback
rehammuzzamil Oct 18, 2023
b03066a
Address PR feedback
rehammuzzamil Oct 18, 2023
921d526
Update configurations
rehammuzzamil Oct 18, 2023
7b5fb7e
Exemption of Composition and Binary resource from the authentication …
rehammuzzamil Oct 23, 2023
5d4d419
Remove extra resources/ folder
rehammuzzamil Oct 23, 2023
7e2e5a1
Rename artifact id to gateway
rehammuzzamil Oct 23, 2023
e34b5dc
Update the artifact versioning
ndegwamartin Oct 23, 2023
a19b3d0
Update pom.xml
ndegwamartin Oct 23, 2023
99cdd57
Update pom.xml
ndegwamartin Oct 23, 2023
4e1e0dd
Merge pull request #7 from onaio/ndegwamartin-patch-1
ndegwamartin Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions exec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sample application

This module is to show simple examples of how to use the FHIR Gateway. The
minimal application is
[MainApp](src/main/java/com/google/fhir/gateway/MainApp.java). With this single
class, you can create an executable app with the Gateway [server](../server) and
all of the `AccessChecker` [plugins](../plugins), namely
[ListAccessChecker](../plugins/src/main/java/com/google/fhir/gateway/plugin/ListAccessChecker.java)
and
[PatientAccessChecker](../plugins/src/main/java/com/google/fhir/gateway/plugin/PatientAccessChecker.java).

Two other classes are provided to show how to implement custom endpoints.
1 change: 1 addition & 0 deletions exec/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
spring.main.allow-bean-definition-overriding=true
141 changes: 141 additions & 0 deletions exec/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2021-2023 Google LLC

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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-gateway-plugin</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>exec</artifactId>
<packaging>jar</packaging>

<properties>
<root.basedir>${project.parent.basedir}</root.basedir>
<spring-boot.version>2.7.5</spring-boot.version>
<!-- We do not want to deploy the `exec` uber jar. -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencyManagement>
<dependencies>
<!-- Instead of using spring-boot-starter-parent as POM parent we add
pieces needed from it; also see:
https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#using.import
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>

<!-- This dependency includes the HAPI FHIR Server Framework -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-server</artifactId>
<version>${hapifhir_version}</version>
</dependency>

<!-- This merges the server and sample plugins together -->
<dependency>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>server</artifactId>
<version>0.3.1</version>
</dependency>

<dependency>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>plugins</artifactId>
<version>0.3.1</version>
</dependency>

<!-- For Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.smartregister</groupId>
<artifactId>fhir-common-utils</artifactId>
<version>0.0.9-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.smartregister</groupId>
<artifactId>plugins</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<version>${hapifhir_version}</version>
</dependency>
</dependencies>

<build>

<finalName>${project.parent.artifactId}-${project.artifactId}</finalName>

<plugins>
<!-- With this we can create a standalone executable JAR. -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>org.smartregister.fhir.gateway.MainApp</mainClass>
<!-- We use ZIP layout such that PropertiesLauncher is used and we
can add extra jars through `loader.path` property:
https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html#appendix.executable-jar.property-launcher
This is useful for when people want to inject other plugins into
this binary without recompiling this executable. We recognize
that this is not a very likely pattern; it is probably easier to
create a new executable by including all plugins as dependencies.
-->
<layout>ZIP</layout>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
34 changes: 34 additions & 0 deletions exec/src/main/java/org/smartregister/fhir/gateway/MainApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2021-2023 Google LLC
*
* 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.
*/
package org.smartregister.fhir.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

/**
* This class shows the minimum that is required to create a FHIR Gateway with all AccessChecker
* plugins defined in "com.google.fhir.gateway.plugin".
*/
@SpringBootApplication(
scanBasePackages = {"org.smartregister.fhir.gateway", "com.google.fhir.gateway.plugin"})
@ServletComponentScan({"org.smartregister.fhir.gateway.plugins", "com.google.fhir.gateway"})
public class MainApp {

public static void main(String[] args) {
SpringApplication.run(MainApp.class, args);
}
}
30 changes: 30 additions & 0 deletions exec/src/test/java/org/smartregister/fhir/gateway/MainAppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2021-2023 Google LLC
*
* 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.
*/
package org.smartregister.fhir.gateway;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

// TODO change this test to fail if the expected plugins cannot be found.
@RunWith(SpringRunner.class)
@SpringBootTest
public class MainAppTest {

@Test
public void contextLoads() {}
}
13 changes: 0 additions & 13 deletions license-header.txt

This file was deleted.

71 changes: 71 additions & 0 deletions plugins/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2021-2023 Google LLC

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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-gateway-plugin</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>plugins</artifactId>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.basedir>${project.basedir}</project.basedir>
<hapifhir.version>6.0.1</hapifhir.version>
<fhir.proxy-plugin.version>0.2.0</fhir.proxy-plugin.version>
</properties>

<dependencies>

<dependency>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>server</artifactId>
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>plugins</artifactId>
<version>0.3.1</version>
</dependency>
<!-- Needed for JEE/Servlet support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<version>${hapifhir_version}</version>
</dependency>
<dependency>
<groupId>org.smartregister</groupId>
<artifactId>fhir-common-utils</artifactId>
<version>0.0.10-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2021-2023 Google LLC
*
* 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.
*/
package org.smartregister.fhir.gateway.plugins;

import ca.uhn.fhir.rest.api.RequestTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.hl7.fhir.instance.model.api.IBaseResource;

@Getter
@Setter
public class BundleResources {
private RequestTypeEnum requestType;
private IBaseResource resource;

public BundleResources(RequestTypeEnum requestType, IBaseResource resource) {
this.requestType = requestType;
this.resource = resource;
}
}
Loading