use of com.sun.enterprise.admin.servermgmt.DomainException in project Payara by payara.
the class DomainPortValidator method validateAndSetPorts.
/**
* Validate's the port. If custom port value is not given then it retrieves
* its default value. If the port is already been occupied then it picks
* randomly available port value.
*
* @throws DomainException If any exception occurs in validation.
*/
public void validateAndSetPorts() throws DomainException {
Properties domainProperties = _domainConfig.getDomainProperties();
try {
// Validate and gets the port values.
final Integer adminPortInt = getPort(domainProperties, DomainConfig.K_ADMIN_PORT, (String) _domainConfig.get(DomainConfig.K_ADMIN_PORT), _defaultProps.getProperty(SubstitutableTokens.ADMIN_PORT_TOKEN_NAME), "Admin");
_domainConfig.add(DomainConfig.K_ADMIN_PORT, adminPortInt);
final Integer instancePortInt = getPort(domainProperties, DomainConfig.K_INSTANCE_PORT, (String) _domainConfig.get(DomainConfig.K_INSTANCE_PORT), _defaultProps.getProperty(SubstitutableTokens.HTTP_PORT_TOKEN_NAME), "HTTP Instance");
_domainConfig.add(DomainConfig.K_INSTANCE_PORT, instancePortInt);
final Integer jmsPort = getPort(domainProperties, DomainConfig.K_JMS_PORT, null, _defaultProps.getProperty(SubstitutableTokens.JMS_PROVIDER_PORT_TOKEN_NAME), "JMS");
_domainConfig.add(DomainConfig.K_JMS_PORT, jmsPort);
domainProperties.setProperty(PortConstants.JMS, jmsPort.toString());
final Integer orbPort = getPort(domainProperties, DomainConfig.K_ORB_LISTENER_PORT, null, _defaultProps.getProperty(SubstitutableTokens.ORB_LISTENER_PORT_TOKEN_NAME), "IIOP");
_domainConfig.add(DomainConfig.K_ORB_LISTENER_PORT, orbPort);
final Integer httpSSLPort = getPort(domainProperties, DomainConfig.K_HTTP_SSL_PORT, null, _defaultProps.getProperty(SubstitutableTokens.HTTP_SSL_PORT_TOKEN_NAME), "HTTP_SSL");
_domainConfig.add(DomainConfig.K_HTTP_SSL_PORT, httpSSLPort);
final Integer iiopSSLPort = getPort(domainProperties, DomainConfig.K_IIOP_SSL_PORT, null, _defaultProps.getProperty(SubstitutableTokens.ORB_SSL_PORT_TOKEN_NAME), "IIOP_SSL");
_domainConfig.add(DomainConfig.K_IIOP_SSL_PORT, iiopSSLPort);
final Integer iiopMutualAuthPort = getPort(domainProperties, DomainConfig.K_IIOP_MUTUALAUTH_PORT, null, _defaultProps.getProperty(SubstitutableTokens.ORB_MUTUALAUTH_PORT_TOKEN_NAME), "IIOP_MUTUALAUTH");
_domainConfig.add(DomainConfig.K_IIOP_MUTUALAUTH_PORT, iiopMutualAuthPort);
final Integer jmxPort = getPort(domainProperties, DomainConfig.K_JMX_PORT, null, _defaultProps.getProperty(SubstitutableTokens.JMX_SYSTEM_CONNECTOR_PORT_TOKEN_NAME), "JMX_ADMIN");
_domainConfig.add(DomainConfig.K_JMX_PORT, jmxPort);
final Integer osgiShellTelnetPort = getPort(domainProperties, DomainConfig.K_OSGI_SHELL_TELNET_PORT, null, _defaultProps.getProperty(SubstitutableTokens.OSGI_SHELL_TELNET_PORT_TOKEN_NAME), "OSGI_SHELL");
_domainConfig.add(DomainConfig.K_OSGI_SHELL_TELNET_PORT, osgiShellTelnetPort);
final Integer javaDebuggerPort = getPort(domainProperties, DomainConfig.K_JAVA_DEBUGGER_PORT, null, _defaultProps.getProperty(SubstitutableTokens.JAVA_DEBUGGER_PORT_TOKEN_NAME), "JAVA_DEBUGGER");
_domainConfig.add(DomainConfig.K_JAVA_DEBUGGER_PORT, javaDebuggerPort);
checkPortPrivilege(new Integer[] { adminPortInt, instancePortInt, jmsPort, orbPort, httpSSLPort, jmsPort, orbPort, httpSSLPort, iiopSSLPort, iiopMutualAuthPort, jmxPort, osgiShellTelnetPort, javaDebuggerPort });
} catch (Exception ex) {
throw new DomainException(ex);
}
}
Aggregations