private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }
managementRESTService = getDefaultClusteredManagementRESTServiceConfiguration(configuration); if (managementRESTService != null && managementRESTService.isEnabled()) { initializeManagementService(managementRESTService);
private void init() { if (managementRESTServiceConfiguration == null) { return; } addAttribute(new SimpleNodeAttribute("enabled", managementRESTServiceConfiguration.isEnabled()).defaultValue(false)); addAttribute(new SimpleNodeAttribute("bind", managementRESTServiceConfiguration.getBind()) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_BIND)); addAttribute(new SimpleNodeAttribute("securityServiceLocation", managementRESTServiceConfiguration .getSecurityServiceLocation()).optional(true)); addAttribute(new SimpleNodeAttribute("securityServiceTimeout", managementRESTServiceConfiguration .getSecurityServiceTimeout()).optional(true) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_SECURITY_SVC_TIMEOUT)); addAttribute(new SimpleNodeAttribute("sslEnabled", managementRESTServiceConfiguration.isSslEnabled()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("needClientAuth", managementRESTServiceConfiguration.isNeedClientAuth()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("sampleHistorySize", managementRESTServiceConfiguration.getSampleHistorySize()) .optional(true).defaultValue(StatisticsGateway.DEFAULT_HISTORY_SIZE)); addAttribute(new SimpleNodeAttribute("sampleIntervalSeconds", managementRESTServiceConfiguration .getSampleIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_INTERVAL_SECS)); addAttribute(new SimpleNodeAttribute("sampleSearchIntervalSeconds", managementRESTServiceConfiguration .getSampleSearchIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_SEARCH_INTERVAL_SECS)); } }
private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }
private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }
/** * {@inheritDoc} */ public void setSampledStatisticsEnabled(final boolean enableStatistics) { if (cacheManager == null) { throw new IllegalStateException("You must add the cache to a CacheManager before enabling/disabling sampled statistics."); } boolean oldValue = isSampledStatisticsEnabled(); if (oldValue != enableStatistics) { if (enableStatistics) { ManagementRESTServiceConfiguration mgmtRESTConfigSvc = cacheManager.getConfiguration().getManagementRESTService(); if (mgmtRESTConfigSvc != null && mgmtRESTConfigSvc.isEnabled()) { sampledCacheStatistics.enableSampledStatistics(cacheManager.getTimer(), mgmtRESTConfigSvc.makeSampledCounterConfig(), mgmtRESTConfigSvc.makeSampledGetRateCounterConfig(), mgmtRESTConfigSvc.makeSampledSearchRateCounterConfig()); } else { sampledCacheStatistics.enableSampledStatistics(cacheManager.getTimer()); } setStatisticsEnabled(true); } else { sampledCacheStatistics.disableSampledStatistics(); } firePropertyChange("SampledStatisticsEnabled", oldValue, enableStatistics); } }
managementRESTService = getDefaultClusteredManagementRESTServiceConfiguration(configuration); if (managementRESTService != null && managementRESTService.isEnabled()) { initializeManagementService(managementRESTService);
managementRESTService = getDefaultClusteredManagementRESTServiceConfiguration(configuration); if (managementRESTService != null && managementRESTService.isEnabled()) { initializeManagementService(managementRESTService);
if (managementRESTService != null && managementRESTService.isEnabled()) {
private AgentMetadataEntity buildAgentMetadata() { AgentMetadataEntity ame = new AgentMetadataEntity(); ame.setAgentId(AgentEntity.EMBEDDED_AGENT_ID); ame.setAgencyOf(AGENCY); ame.setVersion(this.getClass().getPackage().getImplementationVersion()); ame.setRestAPIVersion("v1"); ame.setAvailable(true); if (isTsaBridged()) { ame.setSecured(isTsaSecured()); ame.setSslEnabled(isTsaSecured()); ame.setNeedClientAuth(false); } else { ame.setSecured(Utils.trimToNull(configuration.getSecurityServiceLocation()) != null); ame.setSslEnabled(Utils.trimToNull(configuration.getSecurityServiceLocation()) != null); ame.setNeedClientAuth(configuration.isNeedClientAuth()); } ame.setLicensed(ServiceLocator.locate(LicenseService.class).isLicensed()); ame.setSampleHistorySize(configuration.getSampleHistorySize()); ame.setSampleIntervalSeconds(configuration.getSampleIntervalSeconds()); ame.setEnabled(configuration.isEnabled()); return ame; }
private void init() { if (managementRESTServiceConfiguration == null) { return; } addAttribute(new SimpleNodeAttribute("enabled", managementRESTServiceConfiguration.isEnabled()).defaultValue(false)); addAttribute(new SimpleNodeAttribute("bind", managementRESTServiceConfiguration.getBind()) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_BIND)); addAttribute(new SimpleNodeAttribute("securityServiceLocation", managementRESTServiceConfiguration .getSecurityServiceLocation()).optional(true)); addAttribute(new SimpleNodeAttribute("securityServiceTimeout", managementRESTServiceConfiguration .getSecurityServiceTimeout()).optional(true) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_SECURITY_SVC_TIMEOUT)); addAttribute(new SimpleNodeAttribute("sslEnabled", managementRESTServiceConfiguration.isSslEnabled()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("needClientAuth", managementRESTServiceConfiguration.isNeedClientAuth()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("sampleHistorySize", managementRESTServiceConfiguration.getSampleHistorySize()) .optional(true).defaultValue(StatisticsGateway.DEFAULT_HISTORY_SIZE)); addAttribute(new SimpleNodeAttribute("sampleIntervalSeconds", managementRESTServiceConfiguration .getSampleIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_INTERVAL_SECS)); addAttribute(new SimpleNodeAttribute("sampleSearchIntervalSeconds", managementRESTServiceConfiguration .getSampleSearchIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_SEARCH_INTERVAL_SECS)); } }
private void init() { if (managementRESTServiceConfiguration == null) { return; } addAttribute(new SimpleNodeAttribute("enabled", managementRESTServiceConfiguration.isEnabled()).defaultValue(false)); addAttribute(new SimpleNodeAttribute("bind", managementRESTServiceConfiguration.getBind()) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_BIND)); addAttribute(new SimpleNodeAttribute("securityServiceLocation", managementRESTServiceConfiguration .getSecurityServiceLocation()).optional(true)); addAttribute(new SimpleNodeAttribute("securityServiceTimeout", managementRESTServiceConfiguration .getSecurityServiceTimeout()).optional(true) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_SECURITY_SVC_TIMEOUT)); addAttribute(new SimpleNodeAttribute("sslEnabled", managementRESTServiceConfiguration.isSslEnabled()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("needClientAuth", managementRESTServiceConfiguration.isNeedClientAuth()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("sampleHistorySize", managementRESTServiceConfiguration.getSampleHistorySize()) .optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_HISTORY_SIZE)); addAttribute(new SimpleNodeAttribute("sampleIntervalSeconds", managementRESTServiceConfiguration .getSampleIntervalSeconds()).optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_INTERVAL_SECS)); addAttribute(new SimpleNodeAttribute("sampleSearchIntervalSeconds", managementRESTServiceConfiguration .getSampleSearchIntervalSeconds()).optional(true).defaultValue(CacheStatisticsSampler.DEFAULT_SEARCH_INTERVAL_SEC)); } }
private void init() { if (managementRESTServiceConfiguration == null) { return; } addAttribute(new SimpleNodeAttribute("enabled", managementRESTServiceConfiguration.isEnabled()).defaultValue(false)); addAttribute(new SimpleNodeAttribute("bind", managementRESTServiceConfiguration.getBind()) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_BIND)); addAttribute(new SimpleNodeAttribute("securityServiceLocation", managementRESTServiceConfiguration .getSecurityServiceLocation()).optional(true)); addAttribute(new SimpleNodeAttribute("securityServiceTimeout", managementRESTServiceConfiguration .getSecurityServiceTimeout()).optional(true) .defaultValue(ManagementRESTServiceConfiguration.DEFAULT_SECURITY_SVC_TIMEOUT)); addAttribute(new SimpleNodeAttribute("sslEnabled", managementRESTServiceConfiguration.isSslEnabled()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("needClientAuth", managementRESTServiceConfiguration.isNeedClientAuth()) .optional(true).defaultValue(false)); addAttribute(new SimpleNodeAttribute("sampleHistorySize", managementRESTServiceConfiguration.getSampleHistorySize()) .optional(true).defaultValue(StatisticsGateway.DEFAULT_HISTORY_SIZE)); addAttribute(new SimpleNodeAttribute("sampleIntervalSeconds", managementRESTServiceConfiguration .getSampleIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_INTERVAL_SECS)); addAttribute(new SimpleNodeAttribute("sampleSearchIntervalSeconds", managementRESTServiceConfiguration .getSampleSearchIntervalSeconds()).optional(true).defaultValue(StatisticsGateway.DEFAULT_SEARCH_INTERVAL_SECS)); } }