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 ssl(XmlGenerator gen, SSLConfig ssl) { if (ssl == null) { return; } gen.open("ssl", "enabled", ssl.isEnabled()) .node("factory-class-name", classNameOrImplClass(ssl.getFactoryClassName(), ssl.getFactoryImplementation())) .appendProperties(ssl.getProperties()) .close(); }
private static void mapAttributeConfigXmlGenerator(XmlGenerator gen, MapConfig m) { if (!m.getMapAttributeConfigs().isEmpty()) { gen.open("attributes"); for (MapAttributeConfig attributeCfg : m.getMapAttributeConfigs()) { gen.node("attribute", attributeCfg.getName(), "extractor", attributeCfg.getExtractor()); } gen.close(); } }
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 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 appendItemListenerConfigs(XmlGenerator gen, Collection<ItemListenerConfig> configs) { if (CollectionUtil.isNotEmpty(configs)) { gen.open("item-listeners"); for (ItemListenerConfig lc : configs) { gen.node("item-listener", lc.getClassName(), "include-value", lc.isIncludeValue()); } gen.close(); } }
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 interfacesConfigXmlGenerator(XmlGenerator gen, NetworkConfig netCfg) { InterfacesConfig interfaces = netCfg.getInterfaces(); gen.open("interfaces", "enabled", interfaces.isEnabled()); for (String i : interfaces.getInterfaces()) { gen.node("interface", i); } gen.close(); }
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 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 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 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(); }