mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
fix to WebappPublisherConfig
This commit is contained in:
parent
1c1da1f5cd
commit
d22de197a1
@ -42,6 +42,7 @@ public class WebappPublisherConfig {
|
|||||||
private boolean isPublished;
|
private boolean isPublished;
|
||||||
private boolean isEnabledUpdateApi;
|
private boolean isEnabledUpdateApi;
|
||||||
private Profiles profiles;
|
private Profiles profiles;
|
||||||
|
private static boolean isInitialized = false;
|
||||||
|
|
||||||
private static WebappPublisherConfig config;
|
private static WebappPublisherConfig config;
|
||||||
|
|
||||||
@ -52,9 +53,13 @@ public class WebappPublisherConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static WebappPublisherConfig getInstance() {
|
public static WebappPublisherConfig getInstance() {
|
||||||
if (config == null) {
|
if (!isInitialized) {
|
||||||
throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " +
|
try {
|
||||||
"initialized properly");
|
init();
|
||||||
|
} catch (WebappPublisherConfigurationFailedException e) {
|
||||||
|
throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " +
|
||||||
|
"initialized properly");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -95,7 +100,10 @@ public class WebappPublisherConfig {
|
|||||||
this.profiles = profiles;
|
this.profiles = profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() throws WebappPublisherConfigurationFailedException {
|
public synchronized static void init() throws WebappPublisherConfigurationFailedException {
|
||||||
|
if (isInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
File emailSenderConfig = new File(WEBAPP_PUBLISHER_CONFIG_PATH);
|
File emailSenderConfig = new File(WEBAPP_PUBLISHER_CONFIG_PATH);
|
||||||
Document doc = WebappPublisherUtil.convertToDocument(emailSenderConfig);
|
Document doc = WebappPublisherUtil.convertToDocument(emailSenderConfig);
|
||||||
@ -105,6 +113,7 @@ public class WebappPublisherConfig {
|
|||||||
Unmarshaller unmarshaller = ctx.createUnmarshaller();
|
Unmarshaller unmarshaller = ctx.createUnmarshaller();
|
||||||
//unmarshaller.setSchema(getSchema());
|
//unmarshaller.setSchema(getSchema());
|
||||||
config = (WebappPublisherConfig) unmarshaller.unmarshal(doc);
|
config = (WebappPublisherConfig) unmarshaller.unmarshal(doc);
|
||||||
|
isInitialized = true;
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
throw new WebappPublisherConfigurationFailedException("Error occurred while un-marshalling Webapp " +
|
throw new WebappPublisherConfigurationFailedException("Error occurred while un-marshalling Webapp " +
|
||||||
"Publisher Config", e);
|
"Publisher Config", e);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user