Skip to content

Commit

Permalink
feat(jans-core): integrate document store manager into applications (#…
Browse files Browse the repository at this point in the history
…9701)

* feat(jans-core): integrate document store manager into applications

Signed-off-by: Yuriy Movchan <[email protected]>

* feat(jans-core): integrate document store manager into applications

Signed-off-by: Yuriy Movchan <[email protected]>

---------

Signed-off-by: Yuriy Movchan <[email protected]>
Co-authored-by: YuriyZ <[email protected]>
  • Loading branch information
yurem and yuriyz authored Oct 31, 2024
1 parent f9b0a91 commit 2f59807
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import io.jans.agama.timer.Transpilation;
import io.jans.service.cdi.event.ApplicationInitialized;
import io.jans.service.cdi.event.ApplicationInitializedEvent;

import io.jans.service.document.store.manager.DocumentStoreManager;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;

@ApplicationScoped
public class AppInitializer {

private final static String DOCUMENT_STORE_MANAGER_JANS_AGAMA_TYPE = "agama"; // Module name

@Inject
private Transpilation trTimer;
Expand All @@ -22,8 +24,14 @@ public class AppInitializer {
@Inject
private DeployerTimer deployerTimer;

@Inject
private DocumentStoreManager documentStoreManager;

public void run(@Observes @ApplicationInitialized(ApplicationScoped.class)
ApplicationInitializedEvent event) {

// Add Agama type to Document Store Manager
documentStoreManager.getSupportedServiceTypes().add(DOCUMENT_STORE_MANAGER_JANS_AGAMA_TYPE);

trTimer.initTimer();
fcleaner.initTimer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@

package io.jans.as.server.service;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
import org.slf4j.Logger;

import com.google.common.collect.Lists;

import io.jans.as.common.service.common.ApplicationFactory;
import io.jans.as.model.common.FeatureFlagType;
import io.jans.as.model.configuration.AppConfiguration;
Expand Down Expand Up @@ -71,17 +84,6 @@
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.servlet.ServletContext;
import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
import org.slf4j.Logger;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

/**
* @author Javier Rojas Blum
Expand Down Expand Up @@ -270,7 +272,10 @@ public void applicationInitialized(@Observes @Initialized(ApplicationScoped.clas
keyGeneratorTimer.initTimer();
statTimer.initTimer();
expirationNotificatorTimer.initTimer();

// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_AUTH_TYPE));

initTimer();
initCibaRequestsProcessor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.jans.casa.model.ApplicationConfiguration;
import io.jans.casa.timer.*;
import io.jans.orm.exception.operation.PersistenceException;
import io.jans.service.document.store.manager.DocumentStoreManager;
import io.jans.util.security.SecurityProviderUtility;

import jakarta.annotation.PostConstruct;
Expand All @@ -20,6 +21,8 @@ public class ConfigurationHandler {

public static final String AGAMA_FLOW_ACR = System.getProperty("acr");

private final static String DOCUMENT_STORE_MANAGER_JANS_CASA_TYPE = "casa"; // Module name

@Inject
private Logger logger;

Expand All @@ -44,6 +47,9 @@ public class ConfigurationHandler {
@Inject
private FSPluginChecker pluginChecker;

@Inject
private DocumentStoreManager documentStoreManager;

private ApplicationConfiguration appConfiguration;

private MainSettings settings;
Expand Down Expand Up @@ -78,7 +84,10 @@ void init() {
computeAcrPluginMapping();
computeCorsOrigins();
saveSettings();


// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_CASA_TYPE));

setAppState(AppStateEnum.OPERATING);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.jans.service.cdi.event.LdapConfigurationReload;
import io.jans.service.cdi.util.CdiUtil;
import io.jans.service.custom.script.CustomScriptManager;
import io.jans.service.document.store.manager.DocumentStoreManager;
import io.jans.service.metric.inject.ReportMetric;
import io.jans.util.StringHelper;
import io.jans.orm.util.properties.FileConfiguration;
Expand All @@ -43,6 +44,7 @@
import jakarta.inject.Named;
import jakarta.servlet.ServletContext;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

Expand All @@ -56,6 +58,8 @@
@Named
public class AppInitializer {

private final static String DOCUMENT_STORE_MANAGER_JANS_FIDO2_TYPE = "jans-fido2"; // Module name

@Inject
private Logger log;

Expand Down Expand Up @@ -104,6 +108,9 @@ public class AppInitializer {
@Inject
private MDS3UpdateTimer mds3UpdateTimer;

@Inject
private DocumentStoreManager documentStoreManager;

@PostConstruct
public void createApplicationComponents() {
try {
Expand Down Expand Up @@ -140,6 +147,9 @@ public void applicationInitialized(@Observes @Initialized(ApplicationScoped.clas
mds3UpdateTimer.initTimer();
customScriptManager.initTimer(supportedCustomScriptTypes);

// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_FIDO2_TYPE));

// Notify plugins about finish application initialization
eventApplicationInitialized.select(ApplicationInitialized.Literal.APPLICATION)
.fire(new ApplicationInitializedEvent());
Expand Down
4 changes: 4 additions & 0 deletions jans-keycloak-link/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<artifactId>jans-keycloak-link-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-core-document-store</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package io.jans.keycloak.link.server.service;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

Expand All @@ -29,6 +30,7 @@
import io.jans.service.cdi.event.LdapConfigurationReload;
import io.jans.service.cdi.util.CdiUtil;
import io.jans.service.custom.script.CustomScriptManager;
import io.jans.service.document.store.manager.DocumentStoreManager;
import io.jans.service.metric.inject.ReportMetric;
import io.jans.service.timer.QuartzSchedulerManager;
import io.jans.util.StringHelper;
Expand All @@ -55,6 +57,8 @@
@ApplicationScoped
public class AppInitializer {

private final static String DOCUMENT_STORE_MANAGER_JANS_KEYCLOAK_LINK_TYPE = "jans-keycloak-link"; // Module name

@Inject
private Logger log;

Expand Down Expand Up @@ -92,6 +96,9 @@ public class AppInitializer {
@Inject
private JansKeycloakLinkTimer jansKeycloakLinkTimer;

@Inject
private DocumentStoreManager documentStoreManager;

@PostConstruct
public void createApplicationComponents() {
try {
Expand Down Expand Up @@ -127,6 +134,10 @@ public void applicationInitialized(@Observes @Initialized(ApplicationScoped.clas
loggerService.initTimer();
customScriptManager.initTimer(supportedCustomScriptTypes);
jansKeycloakLinkTimer.initTimer();

// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_KEYCLOAK_LINK_TYPE));

// Notify plugins about finish application initialization
eventApplicationInitialized.select(ApplicationInitialized.Literal.APPLICATION)
.fire(new ApplicationInitializedEvent());
Expand Down
5 changes: 4 additions & 1 deletion jans-link/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
</properties>

<dependencies>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-core-document-store</artifactId>
</dependency>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-link-model</artifactId>
Expand All @@ -28,7 +32,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
package io.jans.link.server.service;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

import io.jans.link.timer.JansLinkTimer;
import org.slf4j.Logger;

import com.google.common.collect.Lists;

import io.jans.exception.ConfigurationException;
import io.jans.link.service.config.ApplicationFactory;
import io.jans.link.service.config.ConfigurationFactory;
import io.jans.exception.ConfigurationException;
import io.jans.link.timer.JansLinkTimer;
import io.jans.model.custom.script.CustomScriptType;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.model.PersistenceConfiguration;
Expand All @@ -29,6 +30,7 @@
import io.jans.service.cdi.event.LdapConfigurationReload;
import io.jans.service.cdi.util.CdiUtil;
import io.jans.service.custom.script.CustomScriptManager;
import io.jans.service.document.store.manager.DocumentStoreManager;
import io.jans.service.logger.LoggerService;
import io.jans.service.metric.inject.ReportMetric;
import io.jans.service.timer.QuartzSchedulerManager;
Expand Down Expand Up @@ -56,6 +58,8 @@
@ApplicationScoped
public class AppInitializer {

private final static String DOCUMENT_STORE_MANAGER_JANS_LINK_TYPE = "jans-link"; // Module name

@Inject
private Logger log;

Expand Down Expand Up @@ -93,6 +97,9 @@ public class AppInitializer {
@Inject
private JansLinkTimer jansLinkTimer;

@Inject
private DocumentStoreManager documentStoreManager;

@PostConstruct
public void createApplicationComponents() {
try {
Expand Down Expand Up @@ -128,6 +135,10 @@ public void applicationInitialized(@Observes @Initialized(ApplicationScoped.clas
loggerService.initTimer();
customScriptManager.initTimer(supportedCustomScriptTypes);
jansLinkTimer.initTimer();

// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_LINK_TYPE));

// Notify plugins about finish application initialization
eventApplicationInitialized.select(ApplicationInitialized.Literal.APPLICATION)
.fire(new ApplicationInitializedEvent());
Expand Down
4 changes: 4 additions & 0 deletions jans-lock/lock-server/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
<artifactId>jans-core-timer-weld</artifactId>
</dependency>

<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-core-document-store</artifactId>
</dependency>

<!-- RestEasy -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.jans.lock.server.service;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

Expand All @@ -40,6 +41,7 @@
import io.jans.service.cdi.event.LdapConfigurationReload;
import io.jans.service.cdi.util.CdiUtil;
import io.jans.service.custom.script.CustomScriptManager;
import io.jans.service.document.store.manager.DocumentStoreManager;
import io.jans.service.logger.LoggerService;
import io.jans.service.metric.inject.ReportMetric;
import io.jans.service.timer.QuartzSchedulerManager;
Expand Down Expand Up @@ -69,6 +71,8 @@
@ApplicationScoped
public class AppInitializer {

private final static String DOCUMENT_STORE_MANAGER_JANS_LOCK_TYPE = "jans-lock"; // Module name

@Inject
private Logger log;

Expand Down Expand Up @@ -117,6 +121,9 @@ public class AppInitializer {
@Inject
private LoggerService loggerService;

@Inject
private DocumentStoreManager documentStoreManager;

@PostConstruct
public void createApplicationComponents() {
try {
Expand Down Expand Up @@ -156,6 +163,9 @@ public void applicationInitialized(@Observes @Initialized(ApplicationScoped.clas
statusCheckerTimer.initTimer();
customScriptManager.initTimer(supportedCustomScriptTypes);

// Initialize Document Store Manager
documentStoreManager.initTimer(Arrays.asList(DOCUMENT_STORE_MANAGER_JANS_LOCK_TYPE));

// Notify plugins about finish application initialization
eventApplicationInitialized.select(ApplicationInitialized.Literal.APPLICATION)
.fire(new ApplicationInitializedEvent());
Expand Down
6 changes: 5 additions & 1 deletion jans-scim/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
<artifactId>jans-scim-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-core-document-store</artifactId>
</dependency>
<dependency>
<groupId>io.jans</groupId>
<artifactId>jans-core-service</artifactId>
</dependency>
Expand Down
Loading

0 comments on commit 2f59807

Please sign in to comment.