From f039652d4b62de8b00708400ce0457652af31150 Mon Sep 17 00:00:00 2001 From: Felix Mumme Date: Mon, 18 Nov 2024 01:04:43 +0100 Subject: [PATCH] init repo --- .gitignore | 28 +++ .idea/.gitignore | 8 + .idea/aws.xml | 11 + .idea/checkstyle-idea.xml | 15 ++ .idea/compiler.xml | 13 ++ .idea/encodings.xml | 7 + .idea/jarRepositories.xml | 20 ++ .idea/misc.xml | 14 ++ .idea/uiDesigner.xml | 124 +++++++++++ .idea/vcs.xml | 6 + do | 58 ++++++ pom.xml | 194 ++++++++++++++++++ .../annotations/EnablePermissionManager.java | 15 ++ .../PermissionManagerSdkConfiguration.java | 13 ++ .../java/de/mummeit/pmg/api/PmgClient.java | 14 ++ .../permission-manager-sdk-application.yaml | 12 ++ 16 files changed, 552 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/aws.xml create mode 100644 .idea/checkstyle-idea.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100755 do create mode 100644 pom.xml create mode 100644 src/main/java/de/mummeit/common/annotations/EnablePermissionManager.java create mode 100644 src/main/java/de/mummeit/common/config/PermissionManagerSdkConfiguration.java create mode 100644 src/main/java/de/mummeit/pmg/api/PmgClient.java create mode 100644 src/main/resources/permission-manager-sdk-application.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06a336c --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +.gitea-token +/target/** diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..de54e2d --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..f1ca92b --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,15 @@ + + + + 10.20.1 + JavaOnly + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..2c778f9 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e122dea --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/do b/do new file mode 100755 index 0000000..f219a8d --- /dev/null +++ b/do @@ -0,0 +1,58 @@ +#!/bin/bash +set -euo pipefail +script_dir="$(cd "$(dirname "${0}")"; pwd -P)" + + +app_name='permission-manager' + +postgres_image="postgres:16-alpine" +postgres_port=16060 +postgres_container_name="pmg-db" + +go_junit_report_version='latest' +gocov_version='latest' +gocov_xml_version='latest' +linter_version='v1.62.0' +swag_version='v1.16.3' + +grey='\033[0;37m' +red='\033[1;31m' +green='\033[1;32m' +cyan='\033[1;36m' +yellow='\033[1;33m' +normal='\033[0m' + +function log { + echo -e "$@" +} + + +## full-release : creates and publishes a new release to maven central +function task_full_release() { + gitea_token="$(cat ${script_dir}/.gitea-token)" + + task_build + mvn jreleaser:full-release -Dgitea.token="$gitea_token" +} + + +## build : builds the application and stages files +function task_build() { + mvn clean + mvn -Pstage +} + +function task_usage { + echo "Usage: $0" + sed -n 's/^##//p' <$0 | column -t -s ':' | sed -E $'s/^/\t/' | sort +} + +cmd=${1:-} +shift || true +resolved_command=$(echo "task_${cmd}" | sed 's/-/_/g') +if [[ "$(LC_ALL=C type -t "${resolved_command}")" == "function" ]]; then + ${resolved_command} "$@" +else + task_usage + exit 1 +fi diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..881a525 --- /dev/null +++ b/pom.xml @@ -0,0 +1,194 @@ + + + + 4.0.0 + SDK to use the permission-manager in a Spring-Boot application + https://git.mumme-it.de/Mumme-IT/permission-manager-sdk-java + + de.mumme-it + permission-manager-sdk + 0.1.0 + + Mumme-IT + https://mumme-it.de + + + permission-manager-sdk + + + UTF-8 + 21 + 21 + 21 + + + + + Apache-2.0 + https://spdx.org/licenses/Apache-2.0.html + repo + + + + + + junit + junit + 4.13.1 + test + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + 4.1.2 + + + io.github.openfeign.form + feign-form + 3.8.0 + + + + org.projectlombok + lombok + 1.18.32 + provided + + + + + + femumme + Felix Mumme + + + + + scm:git:https://git.mumme-it.de/Mumme-IT/permission-manager-sdk-java.git + scm:git:https://git.mumme-it.de/Mumme-IT/permission-manager-sdk-java.git + + https://git.mumme-it.de/Mumme-IT/permission-manager-sdk-java.git + HEAD + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.2 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.8.0 + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + org.jreleaser + jreleaser-maven-plugin + 1.15.0 + + + + + + org.jreleaser + jreleaser-maven-plugin + 1.15.0 + + + + ALWAYS + COMMAND + true# + + + + + + + + ALWAYS + https://central.sonatype.com/api/v1/publisher + target/staging-deploy + false + + + + + + + https://git.mumme-it.de + https://git.mumme-it.de + Mumme-IT + permission-manager-sdk-java + ${gitea.token} + + + + + + + + + + + stage + + local::file:./target/staging-deploy + + + deploy + + + org.apache.maven.plugins + maven-javadoc-plugin + + + package + attach-javadocs + + jar + + + true + + + + + + org.apache.maven.plugins + maven-source-plugin + + + package + attach-sources + + jar + + + true + + + + + + + + + diff --git a/src/main/java/de/mummeit/common/annotations/EnablePermissionManager.java b/src/main/java/de/mummeit/common/annotations/EnablePermissionManager.java new file mode 100644 index 0000000..c5c777d --- /dev/null +++ b/src/main/java/de/mummeit/common/annotations/EnablePermissionManager.java @@ -0,0 +1,15 @@ +package de.mummeit.common.annotations; + +import de.mummeit.common.config.PermissionManagerSdkConfiguration; +import org.springframework.context.annotation.Import; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Import(PermissionManagerSdkConfiguration.class) +public @interface EnablePermissionManager { +} diff --git a/src/main/java/de/mummeit/common/config/PermissionManagerSdkConfiguration.java b/src/main/java/de/mummeit/common/config/PermissionManagerSdkConfiguration.java new file mode 100644 index 0000000..73057c0 --- /dev/null +++ b/src/main/java/de/mummeit/common/config/PermissionManagerSdkConfiguration.java @@ -0,0 +1,13 @@ +package de.mummeit.common.config; + +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +@EnableFeignClients +@ComponentScan(basePackages = "de.mummeit") +@Configuration +@PropertySource(value = "classpath:permission-manager-sdk-application.yaml") +public class PermissionManagerSdkConfiguration { +} \ No newline at end of file diff --git a/src/main/java/de/mummeit/pmg/api/PmgClient.java b/src/main/java/de/mummeit/pmg/api/PmgClient.java new file mode 100644 index 0000000..d15a143 --- /dev/null +++ b/src/main/java/de/mummeit/pmg/api/PmgClient.java @@ -0,0 +1,14 @@ +package de.mummeit.pmg.api; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +@FeignClient( + name = "pmg", + url = "${pmg.url}" +) +public interface PmgClient { + + @GetMapping("/health") + public String getHealthStatus(); +} diff --git a/src/main/resources/permission-manager-sdk-application.yaml b/src/main/resources/permission-manager-sdk-application.yaml new file mode 100644 index 0000000..f0d9216 --- /dev/null +++ b/src/main/resources/permission-manager-sdk-application.yaml @@ -0,0 +1,12 @@ +spring: + application: + name: permisssion-manager-sdk +feign: + client: + config: + randomjokeapi: + connect-timeout: 1000 + read-timeout: 2000 + +randomjokeapi: + url: https://official-joke-api.appspot.com/random_joke \ No newline at end of file