001package com.avaje.ebean.config; 002 003import java.util.Properties; 004 005/** 006 * Configuration for the container that holds the EbeanServer instances. 007 * <p> 008 * Provides configuration for cluster communication (if clustering is used). The cluster communication is 009 * used to invalidate appropriate parts of the L2 cache across the cluster. 010 */ 011public class ContainerConfig { 012 013 protected boolean clusterActive; 014 015 protected Properties properties; 016 017 /** 018 * Return true if clustering is active. 019 */ 020 public boolean isClusterActive() { 021 return clusterActive; 022 } 023 024 /** 025 * Set to true for clustering to be active. 026 */ 027 public void setClusterActive(boolean clusterActive) { 028 this.clusterActive = clusterActive; 029 } 030 031 /** 032 * Return the deployment properties. 033 */ 034 public Properties getProperties() { 035 return properties; 036 } 037 038 /** 039 * Set the deployment properties. 040 */ 041 public void setProperties(Properties properties) { 042 this.properties = properties; 043 } 044 045 /** 046 * Load the settings from properties. 047 */ 048 public void loadFromProperties(Properties properties) { 049 this.properties = properties; 050 this.clusterActive = getProperty(properties, "ebean.cluster.active", clusterActive); 051 } 052 053 /** 054 * Return the boolean property setting. 055 */ 056 protected boolean getProperty(Properties properties, String key, boolean defaultValue) { 057 return "true".equalsIgnoreCase(properties.getProperty(key, Boolean.toString(defaultValue))); 058 } 059 060}