]> git.argeo.org Git - lgpl/argeo-commons.git/blob - runtime/CmsDeploymentImpl.java
Prepare next development cycle
[lgpl/argeo-commons.git] / runtime / CmsDeploymentImpl.java
1 package org.argeo.cms.internal.runtime;
2
3 import org.argeo.api.cms.CmsDeployment;
4 import org.argeo.api.cms.CmsLog;
5 import org.argeo.api.cms.CmsState;
6 import org.osgi.service.http.HttpService;
7
8 /** Implementation of a CMS deployment. */
9 public class CmsDeploymentImpl implements CmsDeployment {
10 private final CmsLog log = CmsLog.getLog(getClass());
11
12 // Readiness
13 private boolean httpExpected = false;
14 private HttpService httpService;
15
16 private CmsState cmsState;
17 // private DeployConfig deployConfig;
18
19 public void start() {
20 // httpExpected = deployConfig.getProps(KernelConstants.JETTY_FACTORY_PID, "default") != null;
21 // if (deployConfig.hasDomain()) {
22 // loadIpaJaasConfiguration();
23 // }
24
25 log.debug(() -> "CMS deployment available");
26 }
27
28 // public void addFactoryDeployConfig(String factoryPid, Dictionary<String, Object> props) {
29 // deployConfig.putFactoryDeployConfig(factoryPid, props);
30 // deployConfig.save();
31 // try {
32 // deployConfig.loadConfigs();
33 // } catch (IOException e) {
34 // throw new IllegalStateException(e);
35 // }
36 // }
37 //
38 // public Dictionary<String, Object> getProps(String factoryPid, String cn) {
39 // return deployConfig.getProps(factoryPid, cn);
40 // }
41
42 public boolean isHttpAvailableOrNotExpected() {
43 return (httpExpected ? httpService != null : true);
44 }
45
46 // private void loadIpaJaasConfiguration() {
47 // if (System.getProperty(KernelConstants.JAAS_CONFIG_PROP) == null) {
48 // String jaasConfig = KernelConstants.JAAS_CONFIG_IPA;
49 // URL url = getClass().getClassLoader().getResource(jaasConfig);
50 // KernelUtils.setJaasConfiguration(url);
51 // log.debug("Set IPA JAAS configuration.");
52 // }
53 // }
54
55 public void stop() {
56 // if (deployConfig != null) {
57 // deployConfig.save();
58 // }
59 }
60
61 // public void setDeployConfig(DeployConfig deployConfig) {
62 // this.deployConfig = deployConfig;
63 // }
64
65 public void setCmsState(CmsState cmsState) {
66 this.cmsState = cmsState;
67 String httpPort = this.cmsState.getDeployProperty("org.osgi.service.http.port");
68 String httpsPort = this.cmsState.getDeployProperty("org.osgi.service.http.port.secure");
69 httpExpected = httpPort != null || httpsPort != null;
70 }
71
72 public void setHttpService(HttpService httpService) {
73 this.httpService = httpService;
74 }
75
76 }