Class CommonUtil
java.lang.Object
org.wso2.carbon.stratos.common.util.CommonUtil
Common Utility methods for Stratos.
Now this class has been growing with several util methods - Should refactor accordingly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.axiom.om.OMElementbuildOMElement(InputStream inputStream) builds the OMElement from the given inputStreamstatic voiddenyAnonAuthorization(String path, org.wso2.carbon.user.core.UserRealm userRealm) static Stringstatic Stringstatic Stringstatic DategetDateFromMonthString(String yearMonth) static StringgetEula()static StringgetMonthString(int relativeMonth) static StringgetMonthString(Calendar calendar) static StringGets the notification email address of the admin upon the tenant creation.static StratosConfigurationstatic Stringstatic Stringstatic booleanstatic booleanisDomainNameAvailable(String tenantDomain) method to check whether a domain name is available to register given a domain namestatic booleanChecks whether the email validation is mandatory from the configuration file.static booleanChecks whether it is for the public cloud setup or Mars.static booleanstatic booleanChecks whether the email sending is enabled from the configuration file.static StratosConfigurationReturns the configurations from the stratos configuration file.static StringLoading the EULA.static voidsetAnonAuthorization(String path, org.wso2.carbon.user.core.UserRealm userRealm) static voidstatic voidsetStratosConfig(StratosConfiguration stratosConfig) static booleanvalidateDomainFromSuccessKey(org.wso2.carbon.registry.core.session.UserRegistry governanceSystemRegistry, String domain, String successKey) validates domain from the successkeystatic voidvalidateEmail(String email) validates the email.static voidvalidateName(String name, String variable)
-
Constructor Details
-
CommonUtil
public CommonUtil()
-
-
Method Details
-
getStratosConfig
-
setStratosConfig
-
getEula
-
setEula
-
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
-
getAdminUserName
-
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
-
getNotificationEmailAddress
Gets the notification email address of the admin upon the tenant creation.- Returns:
- notification email address for the tenant creations.
-
getMonthString
-
getMonthString
-
getDateFromMonthString
- Throws:
ParseException
-
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
validates the email.- Parameters:
email- email address- Throws:
Exception- if validation failed.
-
validateName
- 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 registrydomain- - tenant domainsuccessKey- - successkey- Returns:
- true, if successfully validated
- Throws:
org.wso2.carbon.registry.core.exceptions.RegistryException
-
loadStratosConfiguration
Returns the configurations from the stratos configuration file.- Returns:
- stratos configurations
-
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
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
-