dev.galasa.zosmf.internal.properties.ServerPort Maven / Gradle / Ivy
/*
* Licensed Materials - Property of IBM
*
* (c) Copyright IBM Corp. 2019.
*/
package dev.galasa.zosmf.internal.properties;
import dev.galasa.framework.spi.ConfigurationPropertyStoreException;
import dev.galasa.framework.spi.cps.CpsProperties;
import dev.galasa.zosmf.ZosmfManagerException;
/**
* zOSMF Server port
*
* @galasa.cps.property
*
* @galasa.name zosmf.server.[imageid].https
*
* @galasa.description The hostname zOSMF server
*
* @galasa.required Yes
*
* @galasa.default None
*
* @galasa.valid_values
*
* @galasa.examples
* zosmf.server.port=443
* zosmf.server.SYSA.port=443
*
*/
public class ServerPort extends CpsProperties {
public static String get(String imageId) throws ZosmfManagerException {
try {
String serverPort = getStringNulled(ZosmfPropertiesSingleton.cps(), "server", "port", imageId);
if (serverPort == null) {
throw new ZosmfManagerException("Value for zOSMF server port not configured for zOS image " + imageId);
}
int serverPortInt = Integer.parseInt(serverPort);
if (serverPortInt < 0 || serverPortInt > 65535) {
throw new ZosmfManagerException("Invalid value (" + serverPort + ") for zOSMF server port property for zOS image " + imageId + ". Range 0-65535");
}
return serverPort;
} catch (ConfigurationPropertyStoreException e) {
throw new ZosmfManagerException("Problem asking the CPS for the zOSMF server port property for zOS image " + imageId, e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy