void reloadUserData ( ) { if ( Utils . isEmptyOrWhitespaces ( this . parameters ) ) { this . logger . warning ( "No parameters were specified in the agent configuration. No user data will be retrieved." ) ; } else if ( ! this . overrideProperties ) { this . logger . fine ( "User data are NOT supposed to be used." ) ; } else if ( Constants . AGENT_RESET . equalsIgnoreCase ( this . parameters ) ) { if ( getMessagingClient ( ) != null && getMessagingClient ( ) . getMessageProcessor ( ) != null ) ( ( AgentMessageProcessor ) getMessagingClient ( ) . getMessageProcessor ( ) ) . resetRequest ( ) ; } else { // Retrieve the agent's configuration AgentProperties props = null ; this . logger . fine ( "User data are supposed to be used. Retrieving in progress..." ) ; if ( AgentConstants . PLATFORM_EC2 . equalsIgnoreCase ( this . parameters ) || AgentConstants . PLATFORM_OPENSTACK . equalsIgnoreCase ( this . parameters ) ) props = this . userDataHelper . findParametersForAmazonOrOpenStack ( this . logger ) ; else if ( AgentConstants . PLATFORM_AZURE . equalsIgnoreCase ( this . parameters ) ) props = this . userDataHelper . findParametersForAzure ( this . logger ) ; else if ( AgentConstants . PLATFORM_VMWARE . equalsIgnoreCase ( this . parameters ) ) props = this . userDataHelper . findParametersForVmware ( this . logger ) ; else if ( Constants . AGENT_RESET . equalsIgnoreCase ( this . parameters ) ) props = new AgentProperties ( ) ; else props = this . userDataHelper . findParametersFromUrl ( this . parameters , this . logger ) ; // If there was a configuration... if ( props != null ) { // Error messages do not matter when we reset an agent String errorMessage = null ; if ( ! Constants . AGENT_RESET . equalsIgnoreCase ( this . parameters ) && ( errorMessage = props . validate ( ) ) != null ) { this . logger . severe ( "An error was found in user data. " + errorMessage ) ; } this . applicationName = props . getApplicationName ( ) ; this . domain = props . getDomain ( ) ; this . scopedInstancePath = props . getScopedInstancePath ( ) ; if ( ! Utils . isEmptyOrWhitespaces ( props . getIpAddress ( ) ) ) { this . ipAddress = props . getIpAddress ( ) ; this . logger . info ( "The agent's address was overwritten from user data and set to " + this . ipAddress ) ; } try { this . logger . info ( "Reconfiguring the agent with user data." ) ; this . userDataHelper . reconfigureMessaging ( this . karafEtc , props . getMessagingConfiguration ( ) ) ; } catch ( Exception e ) { this . logger . severe ( "Error in messaging reconfiguration from user data: " + e ) ; } } } }
Reloads user data .