From 3658b63a24aeb6450cde8c6feb8cdeabf8aac08a Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Fri, 3 May 2024 11:14:09 +0300 Subject: [PATCH 1/3] feat(jans-config-api): regenerate lock swagger api Signed-off-by: Yuriy Movchan --- jans-config-api/plugins/docs/lock-plugin-swagger.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml index beddbb80175..78f3ded2d30 100644 --- a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml +++ b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml @@ -134,13 +134,13 @@ components: type: string policyConsumerType: type: string - policiesJsonUrisAccessToken: + policiesJsonUrisAuthorizationToken: type: string policiesJsonUris: type: array items: type: string - policiesZipUrisAccessToken: + policiesZipUrisAuthorizationToken: type: string policiesZipUris: type: array From ee0997e86cabfbe2e511e05a68ae107cb5c1d63e Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Mon, 6 May 2024 19:16:51 +0300 Subject: [PATCH 2/3] feat(jans-lock): reffactor to add statistics support Signed-off-by: Yuriy Movchan --- .../lock/model/config/AppConfiguration.java | 34 +++---- .../message/MessageConsumerFactory.java | 3 +- .../{ => generic}/NullMessageConsumer.java | 2 +- .../consumer/policy}/PolicyConsumer.java | 4 +- .../policy/PolicyConsumerFactory.java | 4 +- .../policy/PolicyConsumerInterface.java | 4 +- .../{ => generic}/NullPolicyConsumer.java | 4 +- .../policy/opa/OpaPolicyConsumer.java | 2 +- .../service/policy/PolicyDownloadService.java | 2 +- .../metric/MetricProducerFactory.java | 89 +++++++++++++++++++ .../provider/metric/MetricProvider.java | 20 +++++ .../metric/MetricProviderInterface.java | 22 +++++ .../provider/metric/NullMessageProvider.java | 53 +++++++++++ 13 files changed, 215 insertions(+), 28 deletions(-) rename jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/{ => generic}/NullMessageConsumer.java (95%) rename {jans-core/message/src/main/java/io/jans/service/policy/consumer => jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy}/PolicyConsumer.java (74%) rename jans-core/message/src/main/java/io/jans/service/policy/consumer/MessagePolicyInterface.java => jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerInterface.java (82%) rename jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/{ => generic}/NullPolicyConsumer.java (90%) create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProducerFactory.java create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProvider.java create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProviderInterface.java create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/NullMessageProvider.java diff --git a/jans-lock/model/src/main/java/io/jans/lock/model/config/AppConfiguration.java b/jans-lock/model/src/main/java/io/jans/lock/model/config/AppConfiguration.java index 88fd3b9b301..2c1f314f783 100644 --- a/jans-lock/model/src/main/java/io/jans/lock/model/config/AppConfiguration.java +++ b/jans-lock/model/src/main/java/io/jans/lock/model/config/AppConfiguration.java @@ -28,6 +28,7 @@ public class AppConfiguration implements Configuration { @DocProperty(description = "List of token channel names", defaultValue = "jans_token") private List tokenChannels; + @DocProperty(description = "Choose whether to disable JDK loggers", defaultValue = "true") private Boolean disableJdkLogger = true; @@ -40,6 +41,9 @@ public class AppConfiguration implements Configuration { @DocProperty(description = "The path to the external log4j2 logging configuration") private String externalLoggerConfiguration; + @DocProperty(description = "Channel for metric reports", defaultValue = "jans_pdp_metric") + private String metricChannel; + @DocProperty(description = "The interval for metric reporter in seconds") private int metricReporterInterval; @@ -55,10 +59,8 @@ public class AppConfiguration implements Configuration { private OpaConfiguration opaConfiguration; - @DocProperty(description = "PDP for data") - private String messageConsumerType; - @DocProperty(description = "PDP for policies") - private String policyConsumerType; + @DocProperty(description = "PDP type") + private String pdpType; @DocProperty(description = "Authorization token to access Json Uris") private String policiesJsonUrisAuthorizationToken; @@ -124,6 +126,14 @@ public void setExternalLoggerConfiguration(String externalLoggerConfiguration) { this.externalLoggerConfiguration = externalLoggerConfiguration; } + public String getMetricChannel() { + return metricChannel; + } + + public void setMetricChannel(String metricChannel) { + this.metricChannel = metricChannel; + } + public int getMetricReporterInterval() { return metricReporterInterval; } @@ -164,20 +174,12 @@ public void setOpaConfiguration(OpaConfiguration opaConfiguration) { this.opaConfiguration = opaConfiguration; } - public String getMessageConsumerType() { - return messageConsumerType; - } - - public void setMessageConsumerType(String messageConsumerType) { - this.messageConsumerType = messageConsumerType; - } - - public String getPolicyConsumerType() { - return policyConsumerType; + public String getPdpType() { + return pdpType; } - public void setPolicyConsumerType(String policyConsumerType) { - this.policyConsumerType = policyConsumerType; + public void setPdpType(String pdpType) { + this.pdpType = pdpType; } public String getPoliciesJsonUrisAuthorizationToken() { diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/MessageConsumerFactory.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/MessageConsumerFactory.java index 5b2a6a5267e..4e166a5ec4a 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/MessageConsumerFactory.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/MessageConsumerFactory.java @@ -9,6 +9,7 @@ import org.slf4j.Logger; import io.jans.lock.model.config.AppConfiguration; +import io.jans.lock.service.consumer.message.generic.NullMessageConsumer; import io.jans.service.cdi.async.Asynchronous; import io.jans.service.cdi.event.ApplicationInitialized; import io.jans.service.cdi.event.ConfigurationUpdate; @@ -79,7 +80,7 @@ private void recreateMessageConsumer() { @Produces @ApplicationScoped public MessageConsumer produceMessageConsumer() { - String messageConsumerType = appConfiguration.getMessageConsumerType(); + String messageConsumerType = appConfiguration.getPdpType(); MessageConsumer messageConsumer = getMessageConsumer(messageConsumerType); return messageConsumer; diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/NullMessageConsumer.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/generic/NullMessageConsumer.java similarity index 95% rename from jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/NullMessageConsumer.java rename to jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/generic/NullMessageConsumer.java index 2a36cbea264..991da86b1b7 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/NullMessageConsumer.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/message/generic/NullMessageConsumer.java @@ -1,4 +1,4 @@ -package io.jans.lock.service.consumer.message; +package io.jans.lock.service.consumer.message.generic; import org.slf4j.Logger; diff --git a/jans-core/message/src/main/java/io/jans/service/policy/consumer/PolicyConsumer.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumer.java similarity index 74% rename from jans-core/message/src/main/java/io/jans/service/policy/consumer/PolicyConsumer.java rename to jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumer.java index 4d0eccc085a..98ac8b2db34 100644 --- a/jans-core/message/src/main/java/io/jans/service/policy/consumer/PolicyConsumer.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumer.java @@ -4,14 +4,14 @@ * Copyright (c) 2023, Janssen Project */ -package io.jans.service.policy.consumer; +package io.jans.lock.service.consumer.policy; /** * Base message consumer * * @author Yuriy Movchan Date: 12/20/2023 */ -public abstract class PolicyConsumer implements MessagePolicyInterface { +public abstract class PolicyConsumer implements PolicyConsumerInterface { public abstract String getPolicyConsumerType(); diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerFactory.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerFactory.java index d6c5c415262..08ce4b9cd06 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerFactory.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerFactory.java @@ -9,11 +9,11 @@ import org.slf4j.Logger; import io.jans.lock.model.config.AppConfiguration; +import io.jans.lock.service.consumer.policy.generic.NullPolicyConsumer; import io.jans.service.cdi.async.Asynchronous; import io.jans.service.cdi.event.ApplicationInitialized; import io.jans.service.cdi.event.ConfigurationUpdate; import io.jans.service.cdi.qualifier.Implementation; -import io.jans.service.policy.consumer.PolicyConsumer; import io.jans.util.StringHelper; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.event.Observes; @@ -68,7 +68,7 @@ private void recreatePolicyConsumer() { @Produces @ApplicationScoped public PolicyConsumer producePolicyConsumer() { - String policyConsumerType = appConfiguration.getPolicyConsumerType(); + String policyConsumerType = appConfiguration.getPdpType(); PolicyConsumer policyConsumer = buildPolicyConsumer(policyConsumerType); return policyConsumer; diff --git a/jans-core/message/src/main/java/io/jans/service/policy/consumer/MessagePolicyInterface.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerInterface.java similarity index 82% rename from jans-core/message/src/main/java/io/jans/service/policy/consumer/MessagePolicyInterface.java rename to jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerInterface.java index 2deb5bba1d2..49f77df127a 100644 --- a/jans-core/message/src/main/java/io/jans/service/policy/consumer/MessagePolicyInterface.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/PolicyConsumerInterface.java @@ -4,7 +4,7 @@ * Copyright (c) 2023, Janssen Project */ -package io.jans.service.policy.consumer; +package io.jans.lock.service.consumer.policy; import java.util.List; @@ -13,7 +13,7 @@ * * @author Yuriy Movchan Date: 12/20/2023 */ -public interface MessagePolicyInterface { +public interface PolicyConsumerInterface { public boolean putPolicies(String sourceUri, List policies); diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/NullPolicyConsumer.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/generic/NullPolicyConsumer.java similarity index 90% rename from jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/NullPolicyConsumer.java rename to jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/generic/NullPolicyConsumer.java index 3b593e6a240..86522a2bad0 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/NullPolicyConsumer.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/generic/NullPolicyConsumer.java @@ -1,11 +1,11 @@ -package io.jans.lock.service.consumer.policy; +package io.jans.lock.service.consumer.policy.generic; import java.util.List; import org.slf4j.Logger; +import io.jans.lock.service.consumer.policy.PolicyConsumer; import io.jans.service.cdi.qualifier.Implementation; -import io.jans.service.policy.consumer.PolicyConsumer; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Instance; import jakarta.inject.Inject; diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/opa/OpaPolicyConsumer.java b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/opa/OpaPolicyConsumer.java index 456644bbd7d..b86f847ba4f 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/opa/OpaPolicyConsumer.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/consumer/policy/opa/OpaPolicyConsumer.java @@ -26,12 +26,12 @@ import io.jans.lock.model.config.AppConfiguration; import io.jans.lock.model.config.OpaConfiguration; +import io.jans.lock.service.consumer.policy.PolicyConsumer; import io.jans.lock.service.external.ExternalLockService; import io.jans.lock.service.external.context.ExternalLockContext; import io.jans.service.EncryptionService; import io.jans.service.cdi.qualifier.Implementation; import io.jans.service.net.BaseHttpService; -import io.jans.service.policy.consumer.PolicyConsumer; import io.jans.util.StringHelper; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/policy/PolicyDownloadService.java b/jans-lock/service/src/main/java/io/jans/lock/service/policy/PolicyDownloadService.java index f4828c40101..4e0aac485b7 100644 --- a/jans-lock/service/src/main/java/io/jans/lock/service/policy/PolicyDownloadService.java +++ b/jans-lock/service/src/main/java/io/jans/lock/service/policy/PolicyDownloadService.java @@ -25,12 +25,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.jans.lock.model.config.AppConfiguration; +import io.jans.lock.service.consumer.policy.PolicyConsumer; import io.jans.lock.service.policy.event.PolicyDownloadEvent; import io.jans.service.EncryptionService; import io.jans.service.cdi.async.Asynchronous; import io.jans.service.cdi.event.Scheduled; import io.jans.service.net.BaseHttpService; -import io.jans.service.policy.consumer.PolicyConsumer; import io.jans.service.timer.event.TimerEvent; import io.jans.service.timer.schedule.TimerSchedule; import io.jans.util.StringHelper; diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProducerFactory.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProducerFactory.java new file mode 100644 index 00000000000..67c534d4c37 --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProducerFactory.java @@ -0,0 +1,89 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.lock.service.provider.metric; + +import org.slf4j.Logger; + +import io.jans.lock.model.config.AppConfiguration; +import io.jans.lock.service.consumer.policy.PolicyConsumer; +import io.jans.service.cdi.async.Asynchronous; +import io.jans.service.cdi.event.ApplicationInitialized; +import io.jans.service.cdi.event.ConfigurationUpdate; +import io.jans.service.cdi.qualifier.Implementation; +import io.jans.util.StringHelper; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.event.Observes; +import jakarta.enterprise.inject.Instance; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; + +/** + * Metric producer factory + * + * @author Yuriy Movchan Date: 05/03/2024 + */ +@ApplicationScoped +public class MetricProducerFactory { + + @Inject + private Logger log; + + @Inject + private AppConfiguration appConfiguration; + + @Inject + @Implementation + private Instance policyConsumerProviderInstances; + + private boolean appStarted = false; + + public void init(@Observes @ApplicationInitialized(ApplicationScoped.class) Object init) { + this.appStarted = true; + } + + @Asynchronous + public void configurationUpdateEvent(@Observes @ConfigurationUpdate AppConfiguration appConfiguration) { + if (!appStarted) { + return; + } + + recreatePolicyConsumer(); + } + + private void recreatePolicyConsumer() { + // Force to create new bean + for (PolicyConsumer policyConsumer : policyConsumerProviderInstances) { + policyConsumerProviderInstances.destroy(policyConsumer); + policyConsumer.destroy(); + log.info("Destroyed policyConsumer instance '{}'", System.identityHashCode(policyConsumer)); + } + + producePolicyConsumer(); + } + + @Produces + @ApplicationScoped + public PolicyConsumer producePolicyConsumer() { + String policyConsumerType = appConfiguration.getPdpType(); + PolicyConsumer policyConsumer = buildPolicyConsumer(policyConsumerType); + + return policyConsumer; + } + + private PolicyConsumer buildPolicyConsumer(String policyConsumerType) { + for (PolicyConsumer policyConsumer : policyConsumerProviderInstances) { + String serviceMessageConsumerType = policyConsumer.getPolicyConsumerType(); + if (StringHelper.equalsIgnoreCase(serviceMessageConsumerType, policyConsumerType)) { + return policyConsumer; + } + } + + log.error("Failed to find policy consumer with type '{}'. Using null policy consumer", policyConsumerType); + return policyConsumerProviderInstances.select(NullMessageProvider.class).get(); + } + +} diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProvider.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProvider.java new file mode 100644 index 00000000000..5a4c70f808e --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProvider.java @@ -0,0 +1,20 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.lock.service.provider.metric; + +/** + * Base message consumer + * + * @author Yuriy Movchan Date: 12/20/2023 + */ +public abstract class MetricProvider implements MetricProviderInterface { + + public abstract String getPolicyConsumerType(); + + public abstract void destroy(); + +} diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProviderInterface.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProviderInterface.java new file mode 100644 index 00000000000..5a39418fcff --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/MetricProviderInterface.java @@ -0,0 +1,22 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.lock.service.provider.metric; + +import java.util.List; + +/** + * Interface for each policy consumer + * + * @author Yuriy Movchan Date: 12/20/2023 + */ +public interface MetricProviderInterface { + + public boolean putPolicies(String sourceUri, List policies); + + public boolean removePolicies(String sourceUri); + +} diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/NullMessageProvider.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/NullMessageProvider.java new file mode 100644 index 00000000000..6a16d23fc39 --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/metric/NullMessageProvider.java @@ -0,0 +1,53 @@ +package io.jans.lock.service.provider.metric; + +import java.util.List; + +import org.slf4j.Logger; + +import io.jans.lock.service.consumer.policy.PolicyConsumer; +import io.jans.service.cdi.qualifier.Implementation; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +/** + * Null policy consumer + * + * @author Yuriy Movchan Date: 12/25/2023 + */ +@Implementation +@ApplicationScoped +public class NullMessageProvider extends PolicyConsumer { + + public static String POLICY_CONSUMER_TYPE = "DISABLED"; + + @Inject + private Logger log; + + @Inject + @Implementation + private Instance policyConsumerProviderInstance; + + @Override + public boolean putPolicies(String sourceUri, List policies) { + log.debug("PutPolicies from {}, count {}", sourceUri, policies.size()); + return true; + } + + @Override + public boolean removePolicies(String sourceUri) { + log.debug("RemovePolicies from {}", sourceUri); + return true; + } + + @Override + public String getPolicyConsumerType() { + return POLICY_CONSUMER_TYPE; + } + + @Override + public void destroy() { + log.debug("Destory Policies"); + } + +} From b77bc17989082d13c9e4fb1d5365f61632ea15d5 Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Wed, 22 May 2024 21:22:55 +0300 Subject: [PATCH 3/3] feat(jans-lock): reffactor code to reuse in message-hub Signed-off-by: Yuriy Movchan --- .gitignore | 2 ++ .../plugins/docs/lock-plugin-swagger.yaml | 6 +++--- .../lock/server/service/AppInitializer.java | 1 - .../service/provider/stat/MetricProvider.java | 18 ++++++++++++++++++ .../provider/stat/MetricProviderInterface.java | 16 ++++++++++++++++ 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProvider.java create mode 100644 jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProviderInterface.java diff --git a/.gitignore b/.gitignore index 37bef2565a4..3fb3fb170a5 100644 --- a/.gitignore +++ b/.gitignore @@ -122,6 +122,8 @@ venv.bak/ # mkdocs documentation /site +/bin + # mypy .mypy_cache/ diff --git a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml index 78f3ded2d30..99109e9349e 100644 --- a/jans-config-api/plugins/docs/lock-plugin-swagger.yaml +++ b/jans-config-api/plugins/docs/lock-plugin-swagger.yaml @@ -117,6 +117,8 @@ components: type: string externalLoggerConfiguration: type: string + metricChannel: + type: string metricReporterInterval: type: integer format: int32 @@ -130,9 +132,7 @@ components: format: int32 opaConfiguration: $ref: '#/components/schemas/OpaConfiguration' - messageConsumerType: - type: string - policyConsumerType: + pdpType: type: string policiesJsonUrisAuthorizationToken: type: string diff --git a/jans-lock/server/src/main/java/io/jans/lock/server/service/AppInitializer.java b/jans-lock/server/src/main/java/io/jans/lock/server/service/AppInitializer.java index 5392ba04c1d..5c14fc6aa49 100644 --- a/jans-lock/server/src/main/java/io/jans/lock/server/service/AppInitializer.java +++ b/jans-lock/server/src/main/java/io/jans/lock/server/service/AppInitializer.java @@ -280,7 +280,6 @@ private void closePersistenceEntryManager(PersistenceEntryManager oldPersistence oldPersistenceEntryManager, oldPersistenceEntryManager.getOperationService()); } } - public void destroy(@Observes @BeforeDestroyed(ApplicationScoped.class) ServletContext init) { log.info("Stopping services and closing DB connections at server shutdown..."); diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProvider.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProvider.java new file mode 100644 index 00000000000..9fde80e7eec --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProvider.java @@ -0,0 +1,18 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.lock.service.provider.stat; + +/** + * Base metric provider + * + * @author Yuriy Movchan Date: 12/20/2023 + */ +public abstract class MetricProvider implements MetricProviderInterface { + + public abstract void destroy(); + +} diff --git a/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProviderInterface.java b/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProviderInterface.java new file mode 100644 index 00000000000..69ff8e57e6c --- /dev/null +++ b/jans-lock/service/src/main/java/io/jans/lock/service/provider/stat/MetricProviderInterface.java @@ -0,0 +1,16 @@ +/* + * Janssen Project software is available under the Apache License (2004). See http://www.apache.org/licenses/ for full text. + * + * Copyright (c) 2023, Janssen Project + */ + +package io.jans.lock.service.provider.stat; + +/** + * Interface for each metric provider + * + * @author Yuriy Movchan Date: 05/10/2024 + */ +public interface MetricProviderInterface { + +}