projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adapt to MS Windows
[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 5c3838a0a3134a4a6e24e202ecd20e0c992e8711..c1f92deb40b3ea7743098bcb0c8e4bbdacc028af 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
@@
-39,6
+39,7
@@
import org.argeo.api.uuid.UuidFactory;
import org.argeo.cms.CmsDeployProperty;
import org.argeo.cms.auth.ident.IdentClient;
import org.argeo.cms.util.FsUtils;
import org.argeo.cms.CmsDeployProperty;
import org.argeo.cms.auth.ident.IdentClient;
import org.argeo.cms.util.FsUtils;
+import org.argeo.cms.util.OS;
/**
* Implementation of a {@link CmsState}, initialising the required services.
/**
* Implementation of a {@link CmsState}, initialising the required services.
@@
-91,19
+92,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
+152,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
+159,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<>();
@@
-172,7
+169,8
@@
public class CmsStateImpl implements CmsState {
try {
if (!Files.exists(privateDir))
Files.createDirectories(privateDir);
try {
if (!Files.exists(privateDir))
Files.createDirectories(privateDir);
- Files.setPosixFilePermissions(privateDir, posixPermissions);
+ if (!OS.LOCAL.isMSWindows())
+ Files.setPosixFilePermissions(privateDir, posixPermissions);
} catch (IOException e) {
log.error("Cannot set permissions on " + privateDir, e);
}
} catch (IOException e) {
log.error("Cannot set permissions on " + privateDir, e);
}