Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
JAliEn
JAliEn
Commits
313b3d71
Commit
313b3d71
authored
Jun 13, 2018
by
Costin Grigoras
Browse files
Move the getUserId method in UserFactory
parent
3bde1647
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/alien/JSh.java
View file @
313b3d71
...
...
@@ -17,6 +17,7 @@ import alien.config.JAliEnIAm;
import
alien.shell.BusyBox
;
import
alien.shell.ShellColor
;
import
alien.shell.commands.JAliEnBaseCommand
;
import
alien.user.UserFactory
;
import
lazyj.commands.CommandOutput
;
import
lazyj.commands.SystemCommand
;
import
lia.util.process.ExternalProcess.ExitStatus
;
...
...
@@ -169,7 +170,7 @@ public class JSh {
Process
p
;
try
{
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"java"
,
"-Duserid="
+
JBoxServer
.
getUserID
(),
"-DAliEnConfig="
+
System
.
getProperty
(
"AliEnConfig"
),
"-server"
,
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"java"
,
"-Duserid="
+
UserFactory
.
getUserID
(),
"-DAliEnConfig="
+
System
.
getProperty
(
"AliEnConfig"
),
"-server"
,
"-Djava.io.tmpdir="
+
System
.
getProperty
(
"java.io.tmpdir"
),
"alien.JBox"
});
}
catch
(
final
IOException
ioe
)
{
...
...
@@ -331,7 +332,7 @@ public class JSh {
private
static
boolean
getJBoxPID
()
{
final
File
f
=
new
File
(
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)),
"jclient_token_"
+
JBoxServer
.
getUserID
());
final
File
f
=
new
File
(
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)),
"jclient_token_"
+
UserFactory
.
getUserID
());
if
(
f
.
exists
())
{
final
byte
[]
buffer
=
new
byte
[(
int
)
f
.
length
()];
...
...
src/alien/api/TomcatServer.java
View file @
313b3d71
...
...
@@ -159,8 +159,8 @@ public class TomcatServer {
final
String
keystorePass
=
new
String
(
JAKeyStore
.
pass
);
final
String
dirName
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
;
final
String
keystoreName
=
dirName
+
"keystore.jks_"
+
JBoxServer
.
getUserID
();
final
String
truststoreName
=
dirName
+
"truststore.jks_"
+
JBoxServer
.
getUserID
();
final
String
keystoreName
=
dirName
+
"keystore.jks_"
+
UserFactory
.
getUserID
();
final
String
truststoreName
=
dirName
+
"truststore.jks_"
+
UserFactory
.
getUserID
();
if
(
ConfigUtils
.
isCentralService
())
JAKeyStore
.
saveKeyStore
(
JAKeyStore
.
getKeyStore
(),
keystoreName
,
JAKeyStore
.
pass
);
...
...
src/alien/user/UserFactory.java
View file @
313b3d71
...
...
@@ -8,6 +8,7 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
alien.config.ConfigUtils
;
import
lazyj.commands.SystemCommand
;
/**
* @author costing
...
...
@@ -254,4 +255,23 @@ public final class UserFactory {
return
null
;
}
/**
* @return current user's ID, if it can be retrieved from the system
*/
public
static
String
getUserID
()
{
String
sUserId
=
System
.
getProperty
(
"userid"
);
if
(
sUserId
==
null
||
sUserId
.
length
()
==
0
)
{
sUserId
=
SystemCommand
.
bash
(
"id -u "
+
System
.
getProperty
(
"user.name"
)).
stdout
;
if
(
sUserId
!=
null
&&
sUserId
.
length
()
>
0
)
System
.
setProperty
(
"userid"
,
sUserId
);
}
if
(
sUserId
!=
null
&&
sUserId
.
length
()
>
0
)
return
sUserId
;
return
null
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment