Skip to content

Commit

Permalink
Update configuration code samples (hazelcast#400)
Browse files Browse the repository at this point in the history
Update configuration code samples

- update XMLs to 4.0 which for samples which are able to use 4.0
- cleanup warnings in code
- bump XMLs to 3.12 for examples for which I am not unsure if they can
be upgraded to 4.0
  • Loading branch information
mmedenjak authored Mar 12, 2020
1 parent 4415792 commit 9c08b34
Show file tree
Hide file tree
Showing 40 changed files with 65 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
2 changes: 2 additions & 0 deletions enterprise/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<module>client-custom-credentials</module>
<module>client-token-credentials</module>
<module>client-failover-cluster</module>
<module>ssl</module>
<module>symmetric-encryption</module>
</modules>

<repositories>
Expand Down
File renamed without changes.
11 changes: 4 additions & 7 deletions network-configuration/ssl/pom.xml → enterprise/ssl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@

<artifactId>ssl</artifactId>
<name>Network Configuration - SSL</name>

<description>
Network Configuration - SSL
</description>
<description>Network Configuration - SSL</description>

<parent>
<groupId>com.hazelcast.samples.network-configuration</groupId>
<artifactId>network-configuration</artifactId>
<artifactId>enterprise</artifactId>
<groupId>com.hazelcast.samples.enterprise</groupId>
<version>0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<!-- needed for checkstyle/findbugs -->
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<license-key>YOUR_LICENSE_KEY</license-key>

<network>
<join>
<multicast enabled="true"/>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@

<artifactId>symmetric-encryption</artifactId>
<name>Network Configuration - Symmetric Encryption</name>

<description>
Network Configuration - Symmetric Encryption
</description>
<description>Network Configuration - Symmetric Encryption</description>

<parent>
<groupId>com.hazelcast.samples.network-configuration</groupId>
<artifactId>network-configuration</artifactId>
<artifactId>enterprise</artifactId>
<groupId>com.hazelcast.samples.enterprise</groupId>
<version>0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<license-key>YOUR_LICENSE_KEY</license-key>

<network>
<join>
<multicast enabled="true"/>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<hazelcast-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/client-config
http://www.hazelcast.com/schema/client-config/hazelcast-client-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Properties;

public class YamlConfigClasspath {
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
// taking the member port from system properties
System.setProperty("hazelcast.member.port", "5555");
Config config = new ClasspathYamlConfig("hazelcast-sample.yaml");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class Member {

public static void main(String[] args) throws Exception {
public static void main(String[] args) {
HazelcastInstance hz1 = Hazelcast.newHazelcastInstance();
HazelcastInstance hz2 = Hazelcast.newHazelcastInstance();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
3 changes: 2 additions & 1 deletion network-configuration/aws/src/main/resources/hazelcast.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
Expand Down
1 change: 1 addition & 0 deletions network-configuration/jclouds-partitiongroup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<jclouds.version>1.9.1</jclouds.version>
<hazelcast.version>3.12.6</hazelcast.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
xmlns="http://www.hazelcast.com/schema/config">
http://www.hazelcast.com/schema/config/hazelcast-config-3.12.xsd">

<properties>
<property name="hazelcast.discovery.enabled">true</property>
Expand Down
1 change: 1 addition & 0 deletions network-configuration/jclouds/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<jclouds.version>1.9.1</jclouds.version>
<hazelcast.version>3.12.6</hazelcast.version>
</properties>

<dependencies>
Expand Down
21 changes: 3 additions & 18 deletions network-configuration/jclouds/src/main/resources/hazelcast.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
xmlns="http://www.hazelcast.com/schema/config">
http://www.hazelcast.com/schema/config/hazelcast-config-3.12.xsd">

<properties>
<property name="hazelcast.discovery.enabled">true</property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<properties>
<property name="hazelcast.discovery.enabled">true</property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
2 changes: 0 additions & 2 deletions network-configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
<module>multicast-plugin</module>
<module>partitiongroup</module>
<module>port</module>
<module>ssl</module>
<module>symmetric-encryption</module>
<module>tcpip</module>
<module>advanced-network-configuration</module>
</modules>
Expand Down
3 changes: 2 additions & 1 deletion network-configuration/port/src/main/resources/hazelcast.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
3 changes: 2 additions & 1 deletion network-configuration/tcpip/src/main/resources/hazelcast.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<network>
Expand Down
8 changes: 3 additions & 5 deletions variable-replacers/hazelcast-exec-linux.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<config-replacers>
<replacer class-name="com.hazelcast.sample.replacer.ExecReplacer"/>
</config-replacers>

<group>
<name>$EXEC{echo -n Variable Test Group}</name>
</group>
<cluster-name>$EXEC{echo -n Variable Test Group}</cluster-name>

</hazelcast>
8 changes: 3 additions & 5 deletions variable-replacers/hazelcast-exec-windows.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<config-replacers>
Expand All @@ -13,7 +12,6 @@
</replacer>
</config-replacers>

<group>
<name>$EXEC{cmd.exe#/c#echo Variable Test Group}</name>
</group>
<cluster-name>$EXEC{cmd.exe#/c#echo Variable Test Group}</cluster-name>

</hazelcast>
7 changes: 2 additions & 5 deletions variable-replacers/hazelcast-plain.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<group>
<name>Variable Test Group</name>
</group>
<cluster-name>Variable Test Group</cluster-name>

</hazelcast>
9 changes: 3 additions & 6 deletions variable-replacers/hazelcast-with-replacers.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"
http://www.hazelcast.com/schema/config/hazelcast-config-4.0.xsd"
xmlns="http://www.hazelcast.com/schema/config">

<config-replacers>
Expand All @@ -19,9 +18,7 @@
<replacer class-name="com.hazelcast.sample.replacer.IdReplacer"/>
</config-replacers>

<group>
<!-- Use EncryptionReplacer (provided in Hazelcast) and IdReplacer (from this code-sample) together-->
<name>$ENC{nnPgTqJCcCQ=:23000:B4y/nlp6M0t3q6YiKImW+w==} $ID{Test Group}</name>
</group>
<!-- Use EncryptionReplacer (provided in Hazelcast) and IdReplacer (from this code-sample) together-->
<cluster-name>$ENC{nnPgTqJCcCQ=:23000:B4y/nlp6M0t3q6YiKImW+w==} $ID{Test Group}</cluster-name>

</hazelcast>

0 comments on commit 9c08b34

Please sign in to comment.