Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
4cba5690
Commit
4cba5690
authored
Apr 16, 2017
by
Matija Obreza
Browse files
Display HZ cluster information
parent
1b7ef416
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/admin/HazelcastController.java
0 → 100644
View file @
4cba5690
/**
* Copyright 2015 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package
org.genesys2.server.servlet.controller.admin
;
import
com.hazelcast.core.HazelcastInstance
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
/**
* Manage caches
*
* @author mobreza
*/
@Controller
@RequestMapping
(
"/admin/hazelcast"
)
@PreAuthorize
(
"hasRole('ADMINISTRATOR')"
)
public
class
HazelcastController
{
public
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
HazelcastController
.
class
);
@Autowired
private
HazelcastInstance
hazelcastInstance
;
@RequestMapping
(
value
=
"/"
,
method
=
RequestMethod
.
GET
)
public
String
viewHzSetup
(
Model
model
)
{
// LOG.debug("Got HZ = {}", hazelcastInstance);
model
.
addAttribute
(
"hzConfig"
,
hazelcastInstance
.
getConfig
());
model
.
addAttribute
(
"hzCluster"
,
hazelcastInstance
.
getCluster
());
return
"/admin/hazelcast/index"
;
}
}
src/main/java/org/genesys2/spring/config/HazelcastConfig.java
View file @
4cba5690
...
...
@@ -38,7 +38,7 @@ import org.springframework.context.annotation.Import;
@Configuration
@EnableCaching
@Import
({
HazelcastConfigDev
.
class
,
HazelcastConfigAWS
.
class
,
HazelcastConfigCacher
.
class
})
@Import
({
HazelcastConfigAWS
.
class
,
HazelcastConfigCacher
.
class
})
public
abstract
class
HazelcastConfig
{
/// Interfaces on which HZ should bind
...
...
src/main/java/org/genesys2/spring/config/HazelcastConfigCacher.java
View file @
4cba5690
...
...
@@ -20,7 +20,6 @@ import com.hazelcast.config.Config;
import
com.hazelcast.config.GroupConfig
;
import
com.hazelcast.config.JoinConfig
;
import
com.hazelcast.config.NetworkConfig
;
import
com.hazelcast.config.TcpIpConfig
;
import
com.hazelcast.core.Hazelcast
;
import
com.hazelcast.core.HazelcastInstance
;
import
com.hazelcast.core.ManagedContext
;
...
...
@@ -30,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.context.annotation.Profile
;
@Configuration
@Profile
({
"cacher"
})
@Profile
({
"cacher"
,
"dev"
})
public
class
HazelcastConfigCacher
extends
HazelcastConfig
{
@Bean
...
...
src/main/resources/content/language.properties
View file @
4cba5690
...
...
@@ -719,6 +719,7 @@ menu.admin.usermanagement=User management
menu.admin.repository
=
Repository
menu.admin.repository.files
=
Repository file manager
menu.admin.repository.galleries
=
Image galleries
menu.admin.hazelcast
=
Hazelcast
news.content.page.all.title
=
News list
news.archive.title
=
News Archive
...
...
src/main/webapp/WEB-INF/decorator/1/admin.jsp
View file @
4cba5690
...
...
@@ -108,6 +108,9 @@
<a
class=
""
href=
"
<c:url
value=
"/admin/logger/"
/>
"
>
<spring:message
code=
"menu.admin.loggers"
/>
</a>
</li>
<li>
<a
class=
""
href=
"
<c:url
value=
"/admin/hazelcast/"
/>
"
>
<spring:message
code=
"menu.admin.hazelcast"
/></a>
</li>
<li>
<a
class=
""
href=
"
<c:url
value=
"/admin/ds2/"
/>
"
>
<spring:message
code=
"menu.admin.ds2"
/>
</a>
...
...
src/main/webapp/WEB-INF/jsp/admin/hazelcast/index.jsp
0 → 100644
View file @
4cba5690
<!DOCTYPE html>
<%@ include
file=
"/WEB-INF/jsp/init.jsp"
%>
<html>
<head>
<title><spring:message
code=
"admin.page.title"
/></title>
</head>
<body>
<h1>
Hazelcast cluster
</h1>
${hzCluster}
${hzCluster.clusterState}
<h3>
Members
</h3>
<ul>
<c:forEach
items=
"
${
hzCluster
.
members
}
"
var=
"member"
>
<li>
${member}
</li>
</c:forEach>
</ul>
<h3>
Hazelcast configuration
</h3>
<h4>
Properties
</h4>
<c:out
value=
"
${
hzConfig
.
properties
}
"
/>
<h4>
Group configuration
</h4>
<c:out
value=
"
${
hzConfig
.
groupConfig
}
"
/>
<h4>
Network configuration
</h4>
<c:out
value=
"
${
hzConfig
.
networkConfig
}
"
/>
<h4>
Maps
</h4>
<c:out
value=
"
${
hzConfig
.
mapConfigs
}
"
/>
<h4>
Queues
</h4>
<c:out
value=
"
${
hzConfig
.
queueConfigs
}
"
/>
<small>
<h4>
Entire configuration
</h4>
<c:out
value=
"
${
hzConfig
}
"
/>
</small>
</body>
</html>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment