Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
bb5f56b5
Commit
bb5f56b5
authored
Mar 25, 2015
by
michael.simon
Browse files
Reload hooks together with appconfig
parent
c3b2214b
Changes
4
Hide whitespace changes
Inline
Side-by-side
bwreg-service/src/main/java/edu/kit/scc/webreg/bootstrap/ApplicationBootstrap.java
View file @
bb5f56b5
...
@@ -33,12 +33,10 @@ import edu.kit.scc.webreg.entity.SerialEntity;
...
@@ -33,12 +33,10 @@ import edu.kit.scc.webreg.entity.SerialEntity;
import
edu.kit.scc.webreg.entity.ServiceEntity
;
import
edu.kit.scc.webreg.entity.ServiceEntity
;
import
edu.kit.scc.webreg.service.AdminUserService
;
import
edu.kit.scc.webreg.service.AdminUserService
;
import
edu.kit.scc.webreg.service.GroupService
;
import
edu.kit.scc.webreg.service.GroupService
;
import
edu.kit.scc.webreg.service.GroupServiceHook
;
import
edu.kit.scc.webreg.service.RoleService
;
import
edu.kit.scc.webreg.service.RoleService
;
import
edu.kit.scc.webreg.service.SerialService
;
import
edu.kit.scc.webreg.service.SerialService
;
import
edu.kit.scc.webreg.service.ServiceService
;
import
edu.kit.scc.webreg.service.ServiceService
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.service.UserServiceHook
;
import
edu.kit.scc.webreg.service.impl.HookManager
;
import
edu.kit.scc.webreg.service.impl.HookManager
;
import
edu.kit.scc.webreg.service.mail.TemplateRenderer
;
import
edu.kit.scc.webreg.service.mail.TemplateRenderer
;
import
edu.kit.scc.webreg.service.timer.StandardScheduler
;
import
edu.kit.scc.webreg.service.timer.StandardScheduler
;
...
@@ -154,7 +152,17 @@ public class ApplicationBootstrap {
...
@@ -154,7 +152,17 @@ public class ApplicationBootstrap {
standardScheduler
.
initialize
();
standardScheduler
.
initialize
();
}
}
public
void
reloadConfig
()
{
boolean
reloaded
=
appConfig
.
reload
();
if
(
reloaded
)
{
logger
.
info
(
"Reloading Hooks"
);
hookManager
.
reloadUserHooks
();
hookManager
.
reloadGroupHooks
();
}
}
private
void
checkGroup
(
String
name
,
Integer
createActual
)
{
private
void
checkGroup
(
String
name
,
Integer
createActual
)
{
GroupEntity
entity
=
groupService
.
findByName
(
name
);
GroupEntity
entity
=
groupService
.
findByName
(
name
);
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/bootstrap/ApplicationConfig.java
View file @
bb5f56b5
...
@@ -55,13 +55,18 @@ public class ApplicationConfig implements Serializable {
...
@@ -55,13 +55,18 @@ public class ApplicationConfig implements Serializable {
lastLoad
=
new
Date
();
lastLoad
=
new
Date
();
}
}
public
void
reload
()
{
public
boolean
reload
()
{
ApplicationConfigEntity
newAppConfig
=
dao
.
findReloadActive
(
lastLoad
);
ApplicationConfigEntity
newAppConfig
=
dao
.
findReloadActive
(
lastLoad
);
if
(
newAppConfig
!=
null
)
{
if
(
newAppConfig
!=
null
)
{
logger
.
info
(
"Reloading Application Configuration"
);
logger
.
info
(
"Reloading Application Configuration"
);
appConfig
=
newAppConfig
;
appConfig
=
newAppConfig
;
lastLoad
=
new
Date
();
lastLoad
=
new
Date
();
return
true
;
}
else
{
return
false
;
}
}
}
}
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/HookManager.java
View file @
bb5f56b5
...
@@ -51,6 +51,7 @@ public class HookManager {
...
@@ -51,6 +51,7 @@ public class HookManager {
for
(
String
hook
:
hooks
)
{
for
(
String
hook
:
hooks
)
{
hook
=
hook
.
trim
();
hook
=
hook
.
trim
();
try
{
try
{
logger
.
debug
(
"installing hook {}"
,
hook
);
UserServiceHook
h
=
(
UserServiceHook
)
Class
.
forName
(
hook
).
newInstance
();
UserServiceHook
h
=
(
UserServiceHook
)
Class
.
forName
(
hook
).
newInstance
();
h
.
setAppConfig
(
appConfig
);
h
.
setAppConfig
(
appConfig
);
newUserHooks
.
add
(
h
);
newUserHooks
.
add
(
h
);
...
@@ -77,6 +78,7 @@ public class HookManager {
...
@@ -77,6 +78,7 @@ public class HookManager {
for
(
String
hook
:
hooks
)
{
for
(
String
hook
:
hooks
)
{
hook
=
hook
.
trim
();
hook
=
hook
.
trim
();
try
{
try
{
logger
.
debug
(
"installing hook {}"
,
hook
);
GroupServiceHook
h
=
(
GroupServiceHook
)
Class
.
forName
(
hook
).
newInstance
();
GroupServiceHook
h
=
(
GroupServiceHook
)
Class
.
forName
(
hook
).
newInstance
();
h
.
setAppConfig
(
appConfig
);
h
.
setAppConfig
(
appConfig
);
newGroupHooks
.
add
(
h
);
newGroupHooks
.
add
(
h
);
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/timer/StandardSchedulerImpl.java
View file @
bb5f56b5
...
@@ -26,7 +26,7 @@ import javax.inject.Inject;
...
@@ -26,7 +26,7 @@ import javax.inject.Inject;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
edu.kit.scc.webreg.bootstrap.Application
Config
;
import
edu.kit.scc.webreg.bootstrap.Application
Bootstrap
;
import
edu.kit.scc.webreg.bootstrap.NodeConfiguration
;
import
edu.kit.scc.webreg.bootstrap.NodeConfiguration
;
import
edu.kit.scc.webreg.drools.BpmProcessService
;
import
edu.kit.scc.webreg.drools.BpmProcessService
;
import
edu.kit.scc.webreg.entity.JobClassEntity
;
import
edu.kit.scc.webreg.entity.JobClassEntity
;
...
@@ -62,7 +62,7 @@ public class StandardSchedulerImpl implements StandardScheduler, Serializable {
...
@@ -62,7 +62,7 @@ public class StandardSchedulerImpl implements StandardScheduler, Serializable {
private
BpmProcessService
bpmProcessService
;
private
BpmProcessService
bpmProcessService
;
@Inject
@Inject
private
Application
Config
appConfig
;
private
Application
Bootstrap
appBootstrap
;
@Override
@Override
public
void
initialize
()
{
public
void
initialize
()
{
...
@@ -159,7 +159,7 @@ public class StandardSchedulerImpl implements StandardScheduler, Serializable {
...
@@ -159,7 +159,7 @@ public class StandardSchedulerImpl implements StandardScheduler, Serializable {
bpmProcessService
.
reload
();
bpmProcessService
.
reload
();
// Reload App Config here
// Reload App Config here
app
Config
.
reload
();
app
Bootstrap
.
reload
Config
();
}
}
private
void
cancelTimer
(
Timer
t
)
{
private
void
cancelTimer
(
Timer
t
)
{
...
...
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