org.apache.stratos.lb.common.conf.util
Class LoadBalancerConfigUtil

java.lang.Object
  extended by org.apache.stratos.lb.common.conf.util.LoadBalancerConfigUtil

public final class LoadBalancerConfigUtil
extends Object

Utility methods for Autoscale mediator


Method Summary
static byte[] getBytesFromFile(File file)
          Returns the contents of the file in a byte array
static String getDomain(String str)
          Deprecated. Extract the domain part given a string which is in <sub_domain>#<domain> format.
static String getSubDomain(String str)
          Deprecated. Extract the sub_domain part given a string which is in <sub_domain>#<domain> format.
static List<TenantDomainContext> getTenantDomainContexts(String tenantRange, String domain, String subDomain)
           
static List<Integer> getTenantIds(String tenantRange)
          This method will read the tenant range string and return a list of tenant ids which is derived from tenant range string.
static String getUserData(String payloadFileName)
           
static void handleException(String msg)
          handles the exception
static void handleException(String msg, Exception e)
          handles the exception
static String replaceVariables(String text)
          Replaces the variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

handleException

public static void handleException(String msg)
handles the exception

Parameters:
msg - exception message

handleException

public static void handleException(String msg,
                                   Exception e)
handles the exception

Parameters:
msg - exception message
e - exception

replaceVariables

public static String replaceVariables(String text)
Replaces the variables

Parameters:
text - input string
Returns:
output String

getUserData

public static String getUserData(String payloadFileName)

getBytesFromFile

public static byte[] getBytesFromFile(File file)
                               throws IOException
Returns the contents of the file in a byte array

Parameters:
file - - Input File
Returns:
Bytes from the file
Throws:
IOException - , if retrieving the file contents failed.

getDomain

public static String getDomain(String str)
Deprecated. Extract the domain part given a string which is in <sub_domain>#<domain> format.

Parameters:
str - in <sub_domain>#<domain> format.
Returns:
the domain part. If # is not present this will return the trimmed input string.

getSubDomain

public static String getSubDomain(String str)
Deprecated. Extract the sub_domain part given a string which is in <sub_domain>#<domain> format.

Parameters:
str - in <sub_domain>#<domain> format.
Returns:
the sub_domain part. If # is not present this will return null.

getTenantDomainContexts

public static List<TenantDomainContext> getTenantDomainContexts(String tenantRange,
                                                                String domain,
                                                                String subDomain)

getTenantIds

public static List<Integer> getTenantIds(String tenantRange)
This method will read the tenant range string and return a list of tenant ids which is derived from tenant range string.

Parameters:
tenantRange -
Returns:
list of tenant ids.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.