public XmlGenerator appendAttributes(Map<String, String> attributes) { if (!attributes.isEmpty()) { open("client-attributes"); for (Entry<String, String> entry : attributes.entrySet()) { node("attribute", entry.getValue(), "name", entry.getKey()); } close(); } return this; }
private static void flakeIdGenerator(XmlGenerator gen, Map<String, ClientFlakeIdGeneratorConfig> flakeIdGenerators) { for (Map.Entry<String, ClientFlakeIdGeneratorConfig> entry : flakeIdGenerators.entrySet()) { ClientFlakeIdGeneratorConfig flakeIdGenerator = entry.getValue(); gen.open("flake-id-generator", "name", entry.getKey()) .node("prefetch-count", flakeIdGenerator.getPrefetchCount()) .node("prefetch-validity-millis", flakeIdGenerator.getPrefetchValidityMillis()) .close(); } }
private static void outboundPort(XmlGenerator gen, Collection<String> outboundPortDefinitions) { if (outboundPortDefinitions != null && !outboundPortDefinitions.isEmpty()) { gen.open("outbound-ports"); for (String portDefinitions : outboundPortDefinitions) { gen.node("ports", portDefinitions); } gen.close(); } }
private static void security(XmlGenerator gen, ClientSecurityConfig security) { String credentialsClassname = security.getCredentialsClassname(); Credentials credentials = security.getCredentials(); if (credentialsClassname == null && credentials == null) { return; } gen.open("security") .node("credentials", classNameOrImplClass(credentialsClassname, credentials)) .close(); }
private static void memcacheProtocolXmlGenerator(XmlGenerator gen, Config config) { MemcacheProtocolConfig c = config.getMemcacheProtocolConfig(); if (c == null) { return; } gen.node("memcache-protocol", null, "enabled", c.isEnabled()); }
private static void restApiXmlGenerator(XmlGenerator gen, Config config) { RestApiConfig c = config.getRestApiConfig(); if (c == null) { return; } gen.open("rest-api", "enabled", c.isEnabled()); for (RestEndpointGroup group : RestEndpointGroup.values()) { gen.node("endpoint-group", null, "name", group.name(), "enabled", c.isGroupEnabled(group)); } gen.close(); }
private static void checkAndFillCacheWriterFactoryConfigXml(XmlGenerator gen, String cacheWriter) { if (isNullOrEmpty(cacheWriter)) { return; } gen.node("cache-writer-factory", null, "class-name", cacheWriter); }
private static void lockXmlGenerator(XmlGenerator gen, Config config) { for (LockConfig c : config.getLockConfigs().values()) { gen.open("lock", "name", c.getName()) .node("quorum-ref", c.getQuorumName()) .close(); } }
private static void socketOptions(XmlGenerator gen, SocketOptions socketOptions) { gen.open("socket-options") .node("tcp-no-delay", socketOptions.isTcpNoDelay()) .node("keep-alive", socketOptions.isKeepAlive()) .node("reuse-address", socketOptions.isReuseAddress()) .node("linger-seconds", socketOptions.getLingerSeconds()) .node("buffer-size", socketOptions.getBufferSize()) .close(); }
private static void queryCachePredicate(XmlGenerator gen, PredicateConfig predicate) { String sql = predicate.getSql(); String content = sql != null ? sql : classNameOrImplClass(predicate.getClassName(), predicate.getImplementation()); String type = sql != null ? "sql" : "class-name"; gen.node("predicate", content, "type", type); }
private static void crdtReplicationXmlGenerator(XmlGenerator gen, Config config) { CRDTReplicationConfig replicationConfig = config.getCRDTReplicationConfig(); gen.open("crdt-replication"); if (replicationConfig != null) { gen.node("replication-period-millis", replicationConfig.getReplicationPeriodMillis()) .node("max-concurrent-replication-targets", replicationConfig.getMaxConcurrentReplicationTargets()); } gen.close(); }
private static void evictionConfigXmlGenerator(XmlGenerator gen, EvictionConfig e) { if (e == null) { return; } String comparatorClassName = !isNullOrEmpty(e.getComparatorClassName()) ? e.getComparatorClassName() : null; gen.node("eviction", null, "size", e.getSize(), "max-size-policy", e.getMaximumSizePolicy(), "eviction-policy", e.getEvictionPolicy(), "comparator-class-name", comparatorClassName); }
private static void mapPartitionLostListenerConfigXmlGenerator(XmlGenerator gen, MapConfig m) { if (!m.getPartitionLostListenerConfigs().isEmpty()) { gen.open("partition-lost-listeners"); for (MapPartitionLostListenerConfig c : m.getPartitionLostListenerConfigs()) { gen.node("partition-lost-listener", classNameOrImplClass(c.getClassName(), c.getImplementation())); } gen.close(); } }
private static void mapQueryCachePredicateConfigXmlGenerator(XmlGenerator gen, QueryCacheConfig queryCacheConfig) { PredicateConfig predicateConfig = queryCacheConfig.getPredicateConfig(); String type = predicateConfig.getClassName() != null ? "class-name" : "sql"; String content = predicateConfig.getClassName() != null ? predicateConfig.getClassName() : predicateConfig .getSql(); gen.node("predicate", content, "type", type); }
private static void cachePartitionLostListenerConfigXmlGenerator(XmlGenerator gen, List<CachePartitionLostListenerConfig> configs) { if (configs.isEmpty()) { return; } gen.open("partition-lost-listeners"); for (CachePartitionLostListenerConfig c : configs) { gen.node("partition-lost-listener", classNameOrImplClass(c.getClassName(), c.getImplementation())); } gen.close(); }
private static void appendHotRestartConfig(XmlGenerator gen, HotRestartConfig m) { gen.open("hot-restart", "enabled", m != null && m.isEnabled()) .node("fsync", m != null && m.isFsync()) .close(); }
private static void merkleTreeXmlGenerator(XmlGenerator gen, Config config) { Collection<MerkleTreeConfig> mapMerkleTreeConfigs = config.getMapMerkleTreeConfigs().values(); for (MerkleTreeConfig c : mapMerkleTreeConfigs) { gen.open("merkle-tree", "enabled", c.isEnabled()) .node("mapName", c.getMapName()) .node("depth", c.getDepth()) .close(); } }
private static void wanReplicationSyncGenerator(XmlGenerator gen, WanSyncConfig c) { gen.open("wan-sync") .node("consistency-check-strategy", c.getConsistencyCheckStrategy()) .close(); }
private static void atomicLongXmlGenerator(XmlGenerator gen, Config config) { Collection<AtomicLongConfig> configs = config.getAtomicLongConfigs().values(); for (AtomicLongConfig atomicLongConfig : configs) { MergePolicyConfig mergePolicyConfig = atomicLongConfig.getMergePolicyConfig(); gen.open("atomic-long", "name", atomicLongConfig.getName()) .node("merge-policy", mergePolicyConfig.getPolicy(), "batch-size", mergePolicyConfig.getBatchSize()) .node("quorum-ref", atomicLongConfig.getQuorumName()) .close(); } }
private static void listenerXmlGenerator(XmlGenerator gen, Config config) { if (config.getListenerConfigs().isEmpty()) { return; } gen.open("listeners"); for (ListenerConfig lc : config.getListenerConfigs()) { gen.node("listener", classNameOrImplClass(lc.getClassName(), lc.getImplementation())); } gen.close(); }