diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/OpenApiService.java b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/OpenApiService.java index b2e701b4e4e..f367e431e0c 100644 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/OpenApiService.java +++ b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/OpenApiService.java @@ -106,29 +106,29 @@ public void setCorsHeaders(boolean withCorsHeaders) { this.withCorsHeaders = withCorsHeaders; } - public void registerApp(String applicationId, DeploymentContext ctx) { + public void registerApp(String applicationId, DeploymentContext ctx) { final WebBundleDescriptorImpl descriptor = ctx.getModuleMetaData(WebBundleDescriptorImpl.class); final String contextRoot = descriptor.getContextRoot(); final ReadableArchive archive = ctx.getSource(); final ClassLoader classLoader = ctx.getClassLoader(); documents.put(applicationId, new OpenAPISupplier(applicationId, contextRoot, archive, classLoader)); cachedResult = null; - } + } - public void deregisterApp(String applicationId) { + public void deregisterApp(String applicationId) { documents.remove(applicationId); cachedResult = null; - } + } - public void resumeApp(String applicationId) { + public void resumeApp(String applicationId) { documents.get(applicationId).setEnabled(true); cachedResult = null; - } + } - public void suspendApp(String applicationId) { + public void suspendApp(String applicationId) { documents.get(applicationId).setEnabled(false); cachedResult = null; - } + } /** * @return the document If multiple application deployed then merge all the diff --git a/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/source/PasswordAliasConfigSource.java b/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/source/PasswordAliasConfigSource.java index 9224bc6e16d..4a972ace23c 100644 --- a/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/source/PasswordAliasConfigSource.java +++ b/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/source/PasswordAliasConfigSource.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2018-2020 Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) 2018-2021 Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -47,7 +47,6 @@ import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -55,6 +54,10 @@ import org.glassfish.config.support.TranslatedConfigView; import org.glassfish.internal.api.Globals; +import java.util.Set; +import java.util.HashSet; +import java.util.Objects; + /** * * @author steve @@ -62,11 +65,11 @@ public class PasswordAliasConfigSource extends PayaraConfigSource { private final DomainScopedPasswordAliasStore store; - + public PasswordAliasConfigSource() { store = Globals.getDefaultHabitat().getService(DomainScopedPasswordAliasStore.class); } - + @Override public int getOrdinal() { return Integer.parseInt(configService.getMPConfig().getPasswordOrdinality()); @@ -76,21 +79,21 @@ public int getOrdinal() { @Override public Map getProperties() { Map properties = new HashMap<>(); - if (store != null) { - Iterator keys = store.keys(); - while (keys.hasNext()){ - String key = keys.next(); - properties.put(key, new String(store.get(key))); - } - } + store.keys().forEachRemaining(key -> properties.put(key, new String(store.get(key)))); return properties; } + @Override + public Set getPropertyNames() { + Set propertyNames = new HashSet<>(); + store.keys().forEachRemaining(propertyNames::add); + return propertyNames; + } + + @Override public String getValue(String name) { - if (name == null || store == null) { - return null; - } + Objects.requireNonNull(name, "Name perameter cannot be null"); String value = null; @@ -119,5 +122,4 @@ public String getValue(String name) { public String getName() { return "Password Alias"; } - } diff --git a/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/spi/PayaraConfig.java b/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/spi/PayaraConfig.java index d74a605f677..36aba1c0432 100644 --- a/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/spi/PayaraConfig.java +++ b/nucleus/payara-modules/nucleus-microprofile/config-service/src/main/java/fish/payara/nucleus/microprofile/config/spi/PayaraConfig.java @@ -192,7 +192,7 @@ private T getValueInternal(String propertyName, Class propertyType) { public Iterable getPropertyNames() { List result = new ArrayList<>(); for (ConfigSource configSource : sources) { - result.addAll(configSource.getProperties().keySet()); + result.addAll(configSource.getPropertyNames()); } return result; }