Class CommonUtil

java.lang.Object
org.wso2.carbon.stratos.common.util.CommonUtil

public class CommonUtil extends Object
Common Utility methods for Stratos. Now this class has been growing with several util methods - Should refactor accordingly.
  • Constructor Details

    • CommonUtil

      public CommonUtil()
  • Method Details

    • getStratosConfig

      public static StratosConfiguration getStratosConfig()
    • setStratosConfig

      public static void setStratosConfig(StratosConfiguration stratosConfig)
    • getEula

      public static String getEula()
    • setEula

      public static void setEula(String eula)
    • isEmailValidationMandatory

      public static boolean isEmailValidationMandatory()
      Checks whether the email validation is mandatory from the configuration file.
      Returns:
      true, if the email validation is mandatory to login. Default is false.
    • isTenantManagementEmailsDisabled

      public static boolean isTenantManagementEmailsDisabled()
      Checks whether the email sending is enabled from the configuration file.
      Returns:
      true, if the email sending is disabled. By default, this is disabled, and tenant activation is done without any email sending.
    • getSuperAdminEmail

      public static String getSuperAdminEmail()
    • getAdminUserName

      public static String getAdminUserName()
    • getAdminPassword

      public static String getAdminPassword()
    • isTenantActivationModerated

      public static boolean isTenantActivationModerated()
    • isChargedOnRegistration

      public static boolean isChargedOnRegistration()
    • isPublicCloudSetup

      public static boolean isPublicCloudSetup()
      Checks whether it is for the public cloud setup or Mars.
      Returns:
      true, if it is not for the private cloud setups. Default is true.
    • getTenantDomainRegexPattern

      public static String getTenantDomainRegexPattern()
    • getNotificationEmailAddress

      public static String getNotificationEmailAddress()
      Gets the notification email address of the admin upon the tenant creation.
      Returns:
      notification email address for the tenant creations.
    • getMonthString

      public static String getMonthString(Calendar calendar)
    • getMonthString

      public static String getMonthString(int relativeMonth)
    • getDateFromMonthString

      public static Date getDateFromMonthString(String yearMonth) throws ParseException
      Throws:
      ParseException
    • getCurrentMonthString

      public static String getCurrentMonthString()
    • setAnonAuthorization

      public static void setAnonAuthorization(String path, org.wso2.carbon.user.core.UserRealm userRealm) throws org.wso2.carbon.registry.core.exceptions.RegistryException
      Throws:
      org.wso2.carbon.registry.core.exceptions.RegistryException
    • denyAnonAuthorization

      public static void denyAnonAuthorization(String path, org.wso2.carbon.user.core.UserRealm userRealm) throws org.wso2.carbon.registry.core.exceptions.RegistryException
      Throws:
      org.wso2.carbon.registry.core.exceptions.RegistryException
    • buildOMElement

      public static org.apache.axiom.om.OMElement buildOMElement(InputStream inputStream) throws Exception
      builds the OMElement from the given inputStream
      Parameters:
      inputStream - , given input - inputStream
      Returns:
      OMElement
      Throws:
      Exception
    • validateEmail

      public static void validateEmail(String email) throws Exception
      validates the email.
      Parameters:
      email - email address
      Throws:
      Exception - if validation failed.
    • validateName

      public static void validateName(String name, String variable) throws Exception
      Parameters:
      name - validate the name.
      variable - entry name.
      Throws:
      Exception - if empty
    • validateDomainFromSuccessKey

      public static boolean validateDomainFromSuccessKey(org.wso2.carbon.registry.core.session.UserRegistry governanceSystemRegistry, String domain, String successKey) throws org.wso2.carbon.registry.core.exceptions.RegistryException
      validates domain from the successkey
      Parameters:
      governanceSystemRegistry - - The governance system registry
      domain - - tenant domain
      successKey - - successkey
      Returns:
      true, if successfully validated
      Throws:
      org.wso2.carbon.registry.core.exceptions.RegistryException
    • loadStratosConfiguration

      public static StratosConfiguration loadStratosConfiguration()
      Returns the configurations from the stratos configuration file.
      Returns:
      stratos configurations
    • loadTermsOfUsage

      public static String loadTermsOfUsage()
      Loading the EULA. ultimately we shall be loading the eula from the web page itself. But loading from file should be there to customize the EULA based on the private deployments, etc.
      Returns:
      eula
    • isDomainNameAvailable

      public static boolean isDomainNameAvailable(String tenantDomain) throws Exception
      method to check whether a domain name is available to register given a domain name
      Parameters:
      tenantDomain - , domain name
      Returns:
      true, if the domain is available to register
      Throws:
      Exception