projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix first init
[lgpl/argeo-commons.git]
/
org.argeo.cms
/
src
/
org
/
argeo
/
cms
/
internal
/
runtime
/
CmsStateImpl.java
diff --git
a/org.argeo.cms/src/org/argeo/cms/internal/runtime/CmsStateImpl.java
b/org.argeo.cms/src/org/argeo/cms/internal/runtime/CmsStateImpl.java
index 6921de77abc4b07954907ebde4d2d7f679a2dc31..d364620f56f09118a99cd36564146c1f61919a8f 100644
(file)
--- a/
org.argeo.cms/src/org/argeo/cms/internal/runtime/CmsStateImpl.java
+++ b/
org.argeo.cms/src/org/argeo/cms/internal/runtime/CmsStateImpl.java
@@
-38,7
+38,7
@@
import org.argeo.api.cms.CmsState;
import org.argeo.api.uuid.UuidFactory;
import org.argeo.cms.CmsDeployProperty;
import org.argeo.cms.auth.ident.IdentClient;
import org.argeo.api.uuid.UuidFactory;
import org.argeo.cms.CmsDeployProperty;
import org.argeo.cms.auth.ident.IdentClient;
-import org.argeo.util.FsUtils;
+import org.argeo.
cms.
util.FsUtils;
/**
* Implementation of a {@link CmsState}, initialising the required services.
/**
* Implementation of a {@link CmsState}, initialising the required services.
@@
-91,19
+91,21
@@
public class CmsStateImpl implements CmsState {
}
public void start() {
}
public void start() {
-// Runtime.getRuntime().addShutdownHook(new CmsShutdown());
-
try {
try {
+ // First init check
+ Path privateBase = getDataPath(KernelConstants.DIR_PRIVATE);
+ if (privateBase != null && !Files.exists(privateBase)) {// first init
+ firstInit();
+ Files.createDirectories(privateBase);
+ }
+
initSecurity();
// initArgeoLogger();
if (log.isTraceEnabled())
log.trace("CMS State started");
initSecurity();
// initArgeoLogger();
if (log.isTraceEnabled())
log.trace("CMS State started");
-// String stateUuidStr = KernelUtils.getFrameworkProp(Constants.FRAMEWORK_UUID);
-// this.uuid = UUID.fromString(stateUuidStr);
this.uuid = uuidFactory.timeUUID();
this.uuid = uuidFactory.timeUUID();
-// this.cleanState = stateUuid.equals(frameworkUuid);
// hostname
this.hostname = getDeployProperty(CmsDeployProperty.HOST);
// hostname
this.hostname = getDeployProperty(CmsDeployProperty.HOST);
@@
-149,12
+151,6
@@
public class CmsStateImpl implements CmsState {
log.debug("## CMS starting... (" + uuid + ")\n" + sb + "\n");
}
log.debug("## CMS starting... (" + uuid + ")\n" + sb + "\n");
}
- Path privateBase = getDataPath(KernelConstants.DIR_PRIVATE);
- if (privateBase != null && !Files.exists(privateBase)) {// first init
- firstInit();
- Files.createDirectories(privateBase);
- }
-
} catch (RuntimeException | IOException e) {
log.error("## FATAL: CMS state failed", e);
}
} catch (RuntimeException | IOException e) {
log.error("## FATAL: CMS state failed", e);
}
@@
-162,7
+158,7
@@
public class CmsStateImpl implements CmsState {
private void initSecurity() {
// private directory permissions
private void initSecurity() {
// private directory permissions
- Path privateDir =
KernelUtils.getOsgiInstance
Path(KernelConstants.DIR_PRIVATE);
+ Path privateDir =
getData
Path(KernelConstants.DIR_PRIVATE);
if (privateDir != null) {
// TODO rather check whether we can read and write
Set<PosixFilePermission> posixPermissions = new HashSet<>();
if (privateDir != null) {
// TODO rather check whether we can read and write
Set<PosixFilePermission> posixPermissions = new HashSet<>();