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Bhsp3`kJALZv~lWTjq?@A`z6GCAhy$+rSwqwol
zz1WnIhz%JBvEq0vTn_K3aYzicWbCa^`Hx%VOKp57@+F_!k^UlIi=l~jDP8C7c{%^;
z)jL(MUcMmT`r-VeJ55LO&LjTn8SKBFg%fvkaq9l{!;6o{{7%kcllz%9GVac{8$H5UCtKI^{PzvxAASBdA%gNt
zsDGpEKb`CU^YV4}VE>-&CjHcx=Z`<=WJ*uo;Jacn30Y(p{7Dr^)BB~Dj`H~Yd(`)5
zQC2Z!lDqg$cnYB4^l(OM-US#3%v1H^EwMD?M+3%1{Wp6e
zASaFWXC=sDZR~-J}`S21fGZ+`gtU#~T4(P%2nAEoDFP#Yk#^Q#o
zZ#D{F-15Af?{(wv%-_W@o-2zeIR89>aely^QB5Dwhp4E1jXc&*XEA5F`TjXL!EhOBzfR{X{$R%;zPtm;k;Aj(
z*+;iBy(W)yg7%-<`-U71RDr^8C!f{Z)OF?s@ecEclipse MicroProfile
For more information about the features used in this application, see the Open Liberty documentation:
- - MicroProfile 6.1
+ - MicroProfile
- Jakarta RESTful Web Services
- Jakarta JSON Processing
- Jakarta Contexts and Dependency Injection
diff --git a/start/src/main/webapp/favicon.ico b/start/src/main/webapp/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..c8652f35e0552d6ea391e0202f15cd5dbb63f5da
GIT binary patch
literal 15086
zcmdU0X;76(mZiETW;(i~V|sqfpN@{GijJO%j+yFG0RchWcTqtF7u*q1R*_8<6~qPH
z5mXQn1Q8V%78ejvP;tQp7jOr`2MCG_iwcUIIX8Ka0t5@J?wOu1BFXnX-uLdgH*aR%
zJoi35y>Ils)$7?)kNx+0`~O2v&qz;C@B8ny_rKTEE8=^xLS=gcCj4c;xu;nR>v{JBIl1D8tE`K
zY(V7fA^js~4(=B@eUN$Nv;lo1r}j6CoMLVoIjOHnq>ZU@c|6(aCOBqbiBNk@!LUAbt=(h#$lc;s^1A_%VH;Ifx&`58?;$
zgZM$&zofn6^95{c*f>gGzC0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%1{Wp6e
zASaFWXC=sDZR~-J}`S21fGZ+`gtU#~T4(P%2nAEoDFP#Yk#^Q#o
zZ#D{F-15Af?{(wv%-_W@o-2zeIR89>aely^QB5Dwhp4E1jXc&*XEA5F`TjXL!EhOBzfR{X{$R%;zPtm;k;Aj(
z*+;iBy(W)yg7%-<`-U71RDr^8C!f{Z)OF?s@ecEclipse MicroProfile
For more information about the features used in this application, see the Open Liberty documentation:
- - MicroProfile 6.1
+ - MicroProfile
- Jakarta RESTful Web Services
- Jakarta JSON Processing
- Jakarta Contexts and Dependency Injection
From f81a5ac3e5d81a0a42f97d8dfbb0dc02063571d6 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Fri, 29 Nov 2024 10:10:35 -0500
Subject: [PATCH 03/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
.../guides/microprofile/util/InventoryUtil.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 4ba0679..5a9da61 100755
--- a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -35,9 +35,11 @@ public class InventoryUtil {
public static JsonObject getProperties(String hostname) {
Client client = ClientBuilder.newClient();
URI propURI = InventoryUtil.buildUri(hostname);
- return client.target(propURI)
- .request(MediaType.APPLICATION_JSON)
- .get(JsonObject.class);
+ JsonObject properties = client.target(propURI)
+ .request(MediaType.APPLICATION_JSON)
+ .get(JsonObject.class);
+ client.close();
+ return properties;
}
// tag::buildLinksForHost[]
From 41400c4d29b1f17bdd4cc123f993a70404096f94 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Fri, 29 Nov 2024 10:24:11 -0500
Subject: [PATCH 04/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 5a9da61..45ef4f0 100755
--- a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -71,7 +71,7 @@ public static boolean responseOk(String hostname) {
HttpURLConnection http = (HttpURLConnection) target.openConnection();
http.setConnectTimeout(50);
int response = http.getResponseCode();
- return (response != 200) ? false : true;
+ return response == 200;
} catch (Exception e) {
return false;
}
From 0d2a1d6206c06d99e07cb43077eac24e599b88c4 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Fri, 29 Nov 2024 10:38:59 -0500
Subject: [PATCH 05/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
.../microprofile/InventoryApplication.java | 4 +---
.../guides/microprofile/InventoryManager.java | 21 +------------------
.../microprofile/InventoryResource.java | 19 +----------------
.../microprofile/util/InventoryUtil.java | 14 ++++++-------
.../guides/microprofile/util/ReadyJson.java | 2 --
5 files changed, 10 insertions(+), 50 deletions(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
index 7158d79..3050399 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
@@ -1,6 +1,5 @@
-// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -8,7 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-// end::copyright[]
package io.openliberty.guides.microprofile;
import jakarta.ws.rs.ApplicationPath;
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
index 3f73102..847d8fd 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
@@ -1,6 +1,5 @@
-// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -8,7 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-// end::copyright[]
package io.openliberty.guides.microprofile;
import java.util.concurrent.ConcurrentHashMap;
@@ -22,18 +20,12 @@
import io.openliberty.guides.microprofile.util.InventoryUtil;
import io.openliberty.guides.microprofile.util.ReadyJson;
-// tag::header[]
-// tag::cdi-scope[]
@ApplicationScoped
-// end::cdi-scope[]
public class InventoryManager {
-// end::header[]
private ConcurrentMap inv = new ConcurrentHashMap<>();
- // tag::get[]
public JsonObject get(String hostname) {
- // tag::method-contents[]
JsonObject properties = inv.get(hostname);
if (properties == null) {
if (InventoryUtil.responseOk(hostname)) {
@@ -44,21 +36,12 @@ public JsonObject get(String hostname) {
}
}
return properties;
- // end::method-contents[]
}
- // end::get[]
- // tag::add[]
public void add(String hostname, JsonObject systemProps) {
- // tag::method-contents[]
inv.putIfAbsent(hostname, systemProps);
- // end::method-contents[]
}
- // end::add[]
-
- // tag::list[]
public JsonObject list() {
- // tag::method-contents[]
JsonObjectBuilder systems = Json.createObjectBuilder();
inv.forEach((host, props) -> {
JsonObject systemProps = Json.createObjectBuilder()
@@ -70,8 +53,6 @@ public JsonObject list() {
systems.add("hosts", systems);
systems.add("total", inv.size());
return systems.build();
- // end::method-contents[]
}
- // end::list[]
}
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
index 269a74c..8d059cc 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
@@ -1,6 +1,5 @@
-// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -8,7 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-// end::copyright[]
package io.openliberty.guides.microprofile;
import jakarta.enterprise.context.ApplicationScoped;
@@ -20,38 +18,23 @@
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
-// tag::header[]
-// tag::cdi-scope[]
@ApplicationScoped
-// end::cdi-scope[]
@Path("hosts")
public class InventoryResource {
-// end::header[]
-
- // tag::injection[]
@Inject
InventoryManager manager;
- // end::injection[]
- // tag::getPropertiesForHost[]
@GET
@Path("{hostname}")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject getPropertiesForHost(@PathParam("hostname") String hostname) {
- // tag::method-contents[]
return manager.get(hostname);
- // end::method-contents[]
}
- // end::getPropertiesForHost[]
- // tag::listContents[]
@GET
@Produces(MediaType.APPLICATION_JSON)
public JsonObject listContents() {
- // tag::method-contents[]
return manager.list();
- // end::method-contents[]
}
- // end::listContents[]
}
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index c6c44c2..41b9c0b 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,5 @@
-// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -8,7 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-// end::copyright[]
package io.openliberty.guides.microprofile.util;
import java.net.HttpURLConnection;
@@ -30,9 +28,11 @@ public class InventoryUtil {
public static JsonObject getProperties(String hostname) {
Client client = ClientBuilder.newClient();
URI propURI = InventoryUtil.buildUri(hostname);
- return client.target(propURI)
- .request(MediaType.APPLICATION_JSON)
- .get(JsonObject.class);
+ JsonObject properties = client.target(propURI)
+ .request(MediaType.APPLICATION_JSON)
+ .get(JsonObject.class);
+ client.close();
+ return properties;
}
public static boolean responseOk(String hostname) {
@@ -41,7 +41,7 @@ public static boolean responseOk(String hostname) {
HttpURLConnection http = (HttpURLConnection) target.openConnection();
http.setConnectTimeout(50);
int response = http.getResponseCode();
- return (response != 200) ? false : true;
+ return response == 200;
} catch (Exception e) {
return false;
}
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
index e7e0860..1bfc818 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
@@ -1,4 +1,3 @@
-// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -8,7 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
-// end::copyright[]
package io.openliberty.guides.microprofile.util;
import jakarta.json.Json;
From 96ecba3fd03cf7e77e3bc695475c9bb3a98bdb2b Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Fri, 29 Nov 2024 10:40:32 -0500
Subject: [PATCH 06/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
.../java/io/openliberty/guides/microprofile/util/ReadyJson.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
index 1bfc818..6a6677a 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 969e82c17d1ecf209b5891c353d10749158160d3 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Fri, 29 Nov 2024 10:45:43 -0500
Subject: [PATCH 07/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
.../openliberty/guides/microprofile/InventoryApplication.java | 2 ++
.../io/openliberty/guides/microprofile/InventoryManager.java | 2 ++
.../io/openliberty/guides/microprofile/InventoryResource.java | 2 ++
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 ++
.../java/io/openliberty/guides/microprofile/util/ReadyJson.java | 2 ++
5 files changed, 10 insertions(+)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
index 3050399..20ac38e 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
@@ -1,3 +1,4 @@
+// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -7,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
+// end::copyright[]
package io.openliberty.guides.microprofile;
import jakarta.ws.rs.ApplicationPath;
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
index 847d8fd..9789d50 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
@@ -1,3 +1,4 @@
+// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -7,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
+// end::copyright[]
package io.openliberty.guides.microprofile;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
index 8d059cc..16c415d 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
@@ -1,3 +1,4 @@
+// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -7,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
+// end::copyright[]
package io.openliberty.guides.microprofile;
import jakarta.enterprise.context.ApplicationScoped;
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 41b9c0b..567a106 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,3 +1,4 @@
+// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -7,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
+// end::copyright[]
package io.openliberty.guides.microprofile.util;
import java.net.HttpURLConnection;
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
index 6a6677a..522824e 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
@@ -1,3 +1,4 @@
+// tag::copyright[]
/*******************************************************************************
* Copyright (c) 2017, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -7,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
+// end::copyright[]
package io.openliberty.guides.microprofile.util;
import jakarta.json.Json;
From 49fa71d30419227a1d92493a826845cba75eaff7 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:08:00 -0500
Subject: [PATCH 08/18] use versionless feature
Signed-off-by: Gilbert Kwan
---
finish/pom.xml | 2 +-
start/pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/finish/pom.xml b/finish/pom.xml
index b77b896..10d1cef 100644
--- a/finish/pom.xml
+++ b/finish/pom.xml
@@ -30,7 +30,7 @@
org.eclipse.microprofile
microprofile
- 6.1
+ 7.0
pom
provided
diff --git a/start/pom.xml b/start/pom.xml
index b77b896..10d1cef 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -30,7 +30,7 @@
org.eclipse.microprofile
microprofile
- 6.1
+ 7.0
pom
provided
From 1431156f0780a6583ea69c7a71a20e3bd15d6a97 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:29:45 -0500
Subject: [PATCH 09/18] Update InventoryUtil.java
---
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 45ef4f0..6700b10 100755
--- a/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/finish/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 8a0cf0317028d24bb889e20410e8f4b4ef41b777 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:30:21 -0500
Subject: [PATCH 10/18] Update InventoryApplication.java
---
.../openliberty/guides/microprofile/InventoryApplication.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
index 20ac38e..eeab602 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 15894187e7febfed904e0e8e5026bcc2aa2b13c2 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:30:40 -0500
Subject: [PATCH 11/18] Update InventoryManager.java
---
.../io/openliberty/guides/microprofile/InventoryManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
index 9789d50..d90dd84 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 08cd244c29a0bab06bb1e8cdcbe2cc5695c7864c Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:31:14 -0500
Subject: [PATCH 12/18] Update InventoryResource.java
---
.../io/openliberty/guides/microprofile/InventoryResource.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
index 16c415d..64de67d 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryResource.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 1f54394c57556e85d406de37cb17a44198315f57 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:31:41 -0500
Subject: [PATCH 13/18] Update InventoryUtil.java
---
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 567a106..1bce562 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 1b4f1886de750f574c66c5966aafa31707e152d8 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:32:09 -0500
Subject: [PATCH 14/18] Update InventoryUtil.java
---
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 1bce562..837042d 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2025 IBM Corporation and others.
+ * Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 6031014d58760011828fc11afcb5f26af6a3f380 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:32:27 -0500
Subject: [PATCH 15/18] Update ReadyJson.java
---
.../java/io/openliberty/guides/microprofile/util/ReadyJson.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
index 522824e..e7e0860 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/ReadyJson.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2024 IBM Corporation and others.
+ * Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From ffe83956ff507eeee1cb8849523607e856fb7736 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:32:57 -0500
Subject: [PATCH 16/18] Update InventoryApplication.java
---
.../openliberty/guides/microprofile/InventoryApplication.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
index eeab602..7158d79 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryApplication.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2025 IBM Corporation and others.
+ * Copyright (c) 2017, 2022 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From b04b5a610246dd617ad6af5212b9f6a40a1beb39 Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:33:31 -0500
Subject: [PATCH 17/18] Update InventoryUtil.java
---
.../io/openliberty/guides/microprofile/util/InventoryUtil.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
index 837042d..1bce562 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/util/InventoryUtil.java
@@ -1,6 +1,6 @@
// tag::copyright[]
/*******************************************************************************
- * Copyright (c) 2017, 2022 IBM Corporation and others.
+ * Copyright (c) 2017, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
From 723bb2b30bef88bcaa1690b8fe2b91916e002d7c Mon Sep 17 00:00:00 2001
From: Gilbert Kwan
Date: Thu, 23 Jan 2025 14:41:04 -0500
Subject: [PATCH 18/18] add a space line
Signed-off-by: Gilbert Kwan
---
.../io/openliberty/guides/microprofile/InventoryManager.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
index d90dd84..f21a840 100755
--- a/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
+++ b/start/src/main/java/io/openliberty/guides/microprofile/InventoryManager.java
@@ -43,6 +43,7 @@ public JsonObject get(String hostname) {
public void add(String hostname, JsonObject systemProps) {
inv.putIfAbsent(hostname, systemProps);
}
+
public JsonObject list() {
JsonObjectBuilder systems = Json.createObjectBuilder();
inv.forEach((host, props) -> {