Java Code Examples for org.wso2.carbon.utils.CarbonUtils#getPortFromServerConfig()

The following examples show how to use org.wso2.carbon.utils.CarbonUtils#getPortFromServerConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntitlementServiceComponent.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Read the port from identity.xml which is overridden by carbon.xml to facilitating
 * multiple servers at a time.
 */
private int readThriftReceivePort() {
    int port = -1;
    String portValue = IdentityUtil.getProperty(ThriftConfigConstants.PARAM_RECEIVE_PORT);
    //if the port contains a template string that refers to carbon.xml
    if ((portValue.contains("${")) && (portValue.contains("}"))) {
        port = (CarbonUtils.getPortFromServerConfig(portValue));
    } else { //if port directly mentioned in identity.xml
        port = Integer.parseInt(portValue);
    }
    return port;
}
 
Example 2
Source File: EntitlementServiceComponent.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Read the port from identity.xml which is overridden by carbon.xml to facilitating
 * multiple servers at a time.
 */
private int readThriftReceivePort() {
    int port = -1;
    String portValue = IdentityUtil.getProperty(ThriftConfigConstants.PARAM_RECEIVE_PORT);
    //if the port contains a template string that refers to carbon.xml
    if ((portValue.contains("${")) && (portValue.contains("}"))) {
        port = (CarbonUtils.getPortFromServerConfig(portValue));
    } else { //if port directly mentioned in identity.xml
        port = Integer.parseInt(portValue);
    }
    return port;
}
 
Example 3
Source File: LDAPConfigurationBuilder.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Set LDAP server port. Port is read from embedded-ldap.conf, and if it refers to port in
 * carbon.xml (Ports/EmbeddedLDAP configuration section), then it is read from carbon.xml
 *
 * @param portParamValue
 * @return The port either read from embedded-ldap.xml or carbon.xml
 */
private int getPort(String portParamValue) {
    int port = -1;
    if (portParamValue != null) {
        if (portParamValue.startsWith("${")) { // should port be taken from carbon.xml?
            port = CarbonUtils.getPortFromServerConfig(portParamValue);
        } else { //else read from embedded-ldap.xml
            port = Integer.parseInt(portParamValue);
        }
    }
    return port;
}
 
Example 4
Source File: ThriftAuthenticationServiceComponent.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
public static int readPortOffset() {
    return CarbonUtils.getPortFromServerConfig(ThriftAuthenticationConstants.CARBON_CONFIG_PORT_OFFSET_NODE) + 1;
}
 
Example 5
Source File: ThriftAuthenticationServiceComponent.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public static int readPortOffset() {
    return CarbonUtils.
            getPortFromServerConfig(ThriftAuthenticationConstants.CARBON_CONFIG_PORT_OFFSET_NODE) + 1;
}