2
* Copyright Terracotta, Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
package net.sf.ehcache.config.generator.model.elements;
19
import net.sf.ehcache.config.ManagementRESTServiceConfiguration;
20
import net.sf.ehcache.config.generator.model.NodeElement;
21
import net.sf.ehcache.config.generator.model.SimpleNodeAttribute;
22
import net.sf.ehcache.config.generator.model.SimpleNodeElement;
23
import net.sf.ehcache.statistics.sampled.CacheStatisticsSampler;
26
* Element representing the {@link net.sf.ehcache.config.ManagementRESTServiceConfiguration}
28
* @author Ludovic Orban
31
public class ManagementRESTServiceConfigurationElement extends SimpleNodeElement {
32
private final ManagementRESTServiceConfiguration managementRESTServiceConfiguration;
35
* Construtor accepting the parent and the {@link net.sf.ehcache.config.ManagementRESTServiceConfiguration}
40
public ManagementRESTServiceConfigurationElement(ConfigurationElement parent, ManagementRESTServiceConfiguration cfg) {
41
super(parent, "managementRESTService");
42
this.managementRESTServiceConfiguration = cfg;
47
* Construtor accepting the element and the {@link net.sf.ehcache.config.ManagementRESTServiceConfiguration}
52
public ManagementRESTServiceConfigurationElement(NodeElement element, ManagementRESTServiceConfiguration cfg) {
53
super(element, "managementRESTService");
54
this.managementRESTServiceConfiguration = cfg;
59
if (managementRESTServiceConfiguration == null) {
62
addAttribute(new SimpleNodeAttribute("enabled", managementRESTServiceConfiguration.isEnabled()).defaultValue(false));
63
addAttribute(new SimpleNodeAttribute("bind", managementRESTServiceConfiguration.getBind())
64
.defaultValue(ManagementRESTServiceConfiguration.DEFAULT_BIND));
65
addAttribute(new SimpleNodeAttribute("securityServiceLocation", managementRESTServiceConfiguration
66
.getSecurityServiceLocation()).optional(true));
67
addAttribute(new SimpleNodeAttribute("securityServiceTimeout", managementRESTServiceConfiguration
68
.getSecurityServiceTimeout()).optional(true)
69
.defaultValue(ManagementRESTServiceConfiguration.DEFAULT_SECURITY_SVC_TIMEOUT));
70
addAttribute(new SimpleNodeAttribute("sslEnabled", managementRESTServiceConfiguration.isSslEnabled())
71
.optional(true).defaultValue(false));
72
addAttribute(new SimpleNodeAttribute("needClientAuth", managementRESTServiceConfiguration.isNeedClientAuth())
73
.optional(true).defaultValue(false));
74
addAttribute(new SimpleNodeAttribute("sampleHistorySize", managementRESTServiceConfiguration.getSampleHistorySize())
75
.optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_HISTORY_SIZE));
76
addAttribute(new SimpleNodeAttribute("sampleIntervalSeconds", managementRESTServiceConfiguration
77
.getSampleIntervalSeconds()).optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_INTERVAL_SECS));
78
addAttribute(new SimpleNodeAttribute("sampleSearchIntervalSeconds", managementRESTServiceConfiguration
79
.getSampleSearchIntervalSeconds()).optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_SEARCH_INTERVAL_SEC));