Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-server
Commits
e612f133
Commit
e612f133
authored
4 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
MAINT DOC: Reordered methods in CaosDBServer.
Also a bit of documentation.
parent
98e14752
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conf/core/authtoken.example.yaml
+1
-0
1 addition, 0 deletions
conf/core/authtoken.example.yaml
conf/core/server.conf
+4
-4
4 additions, 4 deletions
conf/core/server.conf
src/main/java/caosdb/server/CaosDBServer.java
+87
-87
87 additions, 87 deletions
src/main/java/caosdb/server/CaosDBServer.java
with
92 additions
and
91 deletions
conf/core/authtoken.example.yaml
+
1
−
0
View file @
e612f133
# TODO: Add documentation.
-
purpose
:
scripting:administration/diagnostics.py
roles
:
-
administration
...
...
This diff is collapsed.
Click to expand it.
conf/core/server.conf
+
4
−
4
View file @
e612f133
...
...
@@ -115,17 +115,17 @@ CERTIFICATES_KEY_STORE_PASSWORD=
SESSION_TIMEOUT_MS
=
600000
# Time after which one-time tokens expire.
# This is only a default value. The actual timeout of
each
token can be
# configured otherwise.
# This is only a default value. The actual timeout of token
s
can be
# configured otherwise
, for example in authtoken.yml
.
# 7days
ONE_TIME_TOKEN_EXPIRES_MS
=
604800000
# Path to config file for one time tokens.
# Path to config file for one time tokens
, for example authtoken.yml
.
AUTHTOKEN_CONFIG
=
# Timeout after which a consumed one-time token expires regardless of the
# maximum of attempts that are allowed for that token. This is only a default
# value. The actual timeout of
each
token can be configured otherwise.
# value. The actual timeout of token
s
can be configured otherwise.
# 30 s
ONE_TIME_TOKEN_ATTEMPTS_TIMEOUT_MS
=
30000
...
...
This diff is collapsed.
Click to expand it.
src/main/java/caosdb/server/CaosDBServer.java
+
87
−
87
View file @
e612f133
...
...
@@ -128,6 +128,60 @@ public class CaosDBServer extends Application {
return
getServerProperties
().
getProperty
(
key
);
}
/**
* This main method starts up a web application that will listen on a port defined in the config
* file.
*
* @param args One option temporarily (for testing) available: silent: If present: disable
* System.out-stream (stream to a NullPrintStream). This makes the response of the database
* amazingly faster.
* @throws IOException
* @throws FileNotFoundException
* @throws SecurityException
* @throws Exception If problems occur.
*/
public
static
void
main
(
final
String
[]
args
)
throws
SecurityException
,
FileNotFoundException
,
IOException
{
try
{
init
(
args
);
initScheduler
();
initServerProperties
();
initTimeZone
();
initOneTimeTokens
();
initShiro
();
initBackend
();
initWebServer
();
initShutDownHook
();
}
catch
(
Exception
e1
)
{
logger
.
error
(
"Could not start the server."
,
e1
);
System
.
exit
(
1
);
}
}
private
static
void
init
(
final
String
[]
args
)
{
// Important change:
// Make silent the default option
START_GUI
=
false
;
for
(
final
String
s
:
args
)
{
if
(
s
.
equals
(
"silent"
))
{
START_GUI
=
false
;
}
else
if
(
s
.
equals
(
"gui"
))
{
START_GUI
=
true
;
}
else
if
(
s
.
equals
(
"nobackend"
))
{
START_BACKEND
=
false
;
}
else
if
(
s
.
equals
(
"insecure"
))
{
INSECURE
=
true
;
}
}
INSECURE
=
INSECURE
&&
isDebugMode
();
// only allow insecure in debug mode
START_BACKEND
=
START_BACKEND
||
!
isDebugMode
();
// always start backend if not in debug mode
}
private
static
void
initScheduler
()
throws
SchedulerException
{
SCHEDULER
=
StdSchedulerFactory
.
getDefaultScheduler
();
SCHEDULER
.
start
();
}
public
static
void
initServerProperties
()
throws
IOException
{
SERVER_PROPERTIES
=
ServerProperties
.
initServerProperties
();
}
...
...
@@ -211,23 +265,15 @@ public class CaosDBServer extends Application {
}
}
private
static
void
init
(
final
String
[]
args
)
{
// Important change:
// Make silent the default option
START_GUI
=
false
;
for
(
final
String
s
:
args
)
{
if
(
s
.
equals
(
"silent"
))
{
START_GUI
=
false
;
}
else
if
(
s
.
equals
(
"gui"
))
{
START_GUI
=
true
;
}
else
if
(
s
.
equals
(
"nobackend"
))
{
START_BACKEND
=
false
;
}
else
if
(
s
.
equals
(
"insecure"
))
{
INSECURE
=
true
;
}
}
INSECURE
=
INSECURE
&&
isDebugMode
();
// only allow insecure in debug mode
START_BACKEND
=
START_BACKEND
||
!
isDebugMode
();
// always start backend if // not in debug mode
public
static
void
initOneTimeTokens
()
throws
Exception
{
OneTimeAuthenticationToken
.
initConfig
();
ConsumedInfoCleanupJob
.
scheduleDaily
();
}
public
static
void
initShiro
()
{
// init Shiro (user authentication/authorization and session management)
final
Ini
config
=
getShiroConfig
();
initShiro
(
config
);
}
public
static
Ini
getShiroConfig
()
{
...
...
@@ -255,12 +301,6 @@ public class CaosDBServer extends Application {
SecurityUtils
.
setSecurityManager
(
securityManager
);
}
public
static
void
initShiro
()
{
// init Shiro (user authentication/authorization and session management)
final
Ini
config
=
getShiroConfig
();
initShiro
(
config
);
}
public
static
void
initBackend
()
throws
Exception
{
if
(
START_BACKEND
)
{
try
(
final
Initialization
init
=
Initialization
.
setUp
())
{
...
...
@@ -286,67 +326,6 @@ public class CaosDBServer extends Application {
}
}
public
static
void
initGUI
()
throws
InterruptedException
{
if
(
START_GUI
)
{
final
CaosDBTerminal
caosDBTerminal
=
new
CaosDBTerminal
();
caosDBTerminal
.
setName
(
"CaosDBTerminal"
);
caosDBTerminal
.
start
();
addPreShutdownHook
(
new
Runnable
()
{
@Override
public
void
run
()
{
caosDBTerminal
.
shutDown
();
SystemErrPanel
.
close
();
}
});
// wait until the terminal is initialized.
Thread
.
sleep
(
1000
);
// add Benchmark
StatsPanel
.
addStat
(
"TransactionBenchmark"
,
TransactionBenchmark
.
getRootInstance
());
}
else
{
logger
.
info
(
"NO GUI"
);
System
.
setOut
(
new
NullPrintStream
());
}
}
public
static
void
initOneTimeTokens
()
throws
Exception
{
OneTimeAuthenticationToken
.
initConfig
();
ConsumedInfoCleanupJob
.
scheduleDaily
();
}
/**
* This main method starts up a web application that will listen on a port defined in the config
* file.
*
* @param args One option temporarily (for testing) available: silent: If present: disable
* System.out-stream (stream to a NullPrintStream). This makes the response of the database
* amazingly faster.
* @throws IOException
* @throws FileNotFoundException
* @throws SecurityException
* @throws Exception If problems occur.
*/
public
static
void
main
(
final
String
[]
args
)
throws
SecurityException
,
FileNotFoundException
,
IOException
{
try
{
init
(
args
);
initScheduler
();
initServerProperties
();
initTimeZone
();
initOneTimeTokens
();
initShiro
();
initBackend
();
initWebServer
();
initShutDownHook
();
}
catch
(
Exception
e1
)
{
logger
.
error
(
"Could not start the server."
,
e1
);
System
.
exit
(
1
);
}
}
private
static
void
initWebServer
()
throws
Exception
{
final
int
port_https
=
Integer
.
parseInt
(
getServerProperty
(
ServerProperties
.
KEY_SERVER_PORT_HTTPS
));
...
...
@@ -372,9 +351,30 @@ public class CaosDBServer extends Application {
}
}
private
static
void
initScheduler
()
throws
SchedulerException
{
SCHEDULER
=
StdSchedulerFactory
.
getDefaultScheduler
();
SCHEDULER
.
start
();
public
static
void
initGUI
()
throws
InterruptedException
{
if
(
START_GUI
)
{
final
CaosDBTerminal
caosDBTerminal
=
new
CaosDBTerminal
();
caosDBTerminal
.
setName
(
"CaosDBTerminal"
);
caosDBTerminal
.
start
();
addPreShutdownHook
(
new
Runnable
()
{
@Override
public
void
run
()
{
caosDBTerminal
.
shutDown
();
SystemErrPanel
.
close
();
}
});
// wait until the terminal is initialized.
Thread
.
sleep
(
1000
);
// add Benchmark
StatsPanel
.
addStat
(
"TransactionBenchmark"
,
TransactionBenchmark
.
getRootInstance
());
}
else
{
logger
.
info
(
"NO GUI"
);
System
.
setOut
(
new
NullPrintStream
());
}
}
private
static
void
initDatatypes
(
final
Access
access
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment