Skip to content

Commit

Permalink
fix: avoid crash at startup #162
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomer2001 committed Dec 6, 2021
1 parent 657288b commit 57e106f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/src/main/java/org/gluu/casa/core/PersistenceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.jans.as.persistence.model.configuration.GluuConfiguration;
import io.jans.orm.PersistenceEntryManager;
import io.jans.orm.PersistenceEntryManagerFactory;
import io.jans.orm.ldap.operation.LdapOperationService;
Expand All @@ -26,9 +25,10 @@
import javax.inject.Inject;

import org.gluu.casa.model.ApplicationConfiguration;
import org.gluu.casa.core.model.ASConfiguration;
import org.gluu.casa.core.model.CustomScript;
import org.gluu.casa.core.model.JansOrganization;
import org.gluu.casa.core.model.ASConfiguration;
import org.gluu.casa.core.model.GluuConfiguration;
import org.gluu.casa.core.model.Person;
import org.gluu.casa.misc.Utils;
import org.gluu.casa.service.IPersistenceService;
Expand Down Expand Up @@ -269,7 +269,9 @@ public CacheConfiguration getCacheConfiguration() {
}

public DocumentStoreConfiguration getDocumentStoreConfiguration() {
return documentStoreConfiguration;
return null;
//TODO: remove method
//return documentStoreConfiguration;
}

public boolean isBackendLdapEnabled() {
Expand Down Expand Up @@ -342,10 +344,10 @@ private boolean loadApplianceSettings(Properties properties) {
loadASSettings(properties.getProperty("jansAuth_ConfigurationEntryDN"));
rootDn = "o=jans";
success = true;

GluuConfiguration gluuConf = get(GluuConfiguration.class, jsonProperty(staticConfig, "baseDn", "configuration"));
cacheConfiguration = gluuConf.getCacheConfiguration();
documentStoreConfiguration = gluuConf.getDocumentStoreConfiguration();
cacheConfiguration = get(GluuConfiguration.class,
jsonProperty(staticConfig, "baseDn", "configuration")).getCacheConfiguration();
//documentStoreConfiguration = gluuConf.getDocumentStoreConfiguration();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/org/gluu/casa/core/model/GluuConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.gluu.casa.core.model;

import io.jans.orm.annotation.AttributeName;
import io.jans.orm.annotation.DataEntry;
import io.jans.orm.annotation.JsonObject;
import io.jans.orm.annotation.ObjectClass;
import io.jans.orm.model.base.InumEntry;
import io.jans.service.cache.CacheConfiguration;

//For unknown reason io.jans.as.persistence.model.configuration.GluuConfiguration is giving trouble
@DataEntry
@ObjectClass(value = "jansAppConf")
public class GluuConfiguration extends InumEntry {

@AttributeName(name = "jansCacheConf")
@JsonObject
private CacheConfiguration cacheConfiguration;

public CacheConfiguration getCacheConfiguration() {
return cacheConfiguration;
}

public void setCacheConfiguration(CacheConfiguration cacheConfiguration) {
this.cacheConfiguration = cacheConfiguration;
}

}

0 comments on commit 57e106f

Please sign in to comment.