コード例 #1
0
 public static synchronized int getTenantId() throws RSSManagerException {
   try {
     return RSSManagerDataHolder.getInstance().getTenantId();
   } catch (RSSManagerCommonException e) {
     throw new RSSManagerException("Error occurred while determining the tenant id", e);
   }
 }
コード例 #2
0
 /**
  * Retrieves the tenant domain name for a given tenant ID
  *
  * @param tenantId Tenant Id
  * @return Domain name of corresponds to the provided tenant ID
  * @throws RSSManagerException Thrown when there's any error while retrieving the tenant domain
  *     for the provided tenant ID
  */
 public static String getTenantDomainFromTenantId(int tenantId) throws RSSManagerException {
   try {
     TenantManager tenantMgr = RSSManagerDataHolder.getInstance().getTenantManager();
     return tenantMgr.getDomain(tenantId);
   } catch (Exception e) {
     throw new RSSManagerException(
         "Error occurred while retrieving tenant domain for " + "the given tenant ID");
   }
 }
コード例 #3
0
 private static synchronized String loadFromSecureVault(String alias) {
   if (secretResolver == null) {
     secretResolver = SecretResolverFactory.create((OMElement) null, false);
     secretResolver.init(
         RSSManagerDataHolder.getInstance()
             .getSecretCallbackHandlerService()
             .getSecretCallbackHandler());
   }
   return secretResolver.resolve(alias);
 }
コード例 #4
0
 public static synchronized int getTenantId(String tenantDomain) throws RSSManagerCommonException {
   int tenantId = MultitenantConstants.INVALID_TENANT_ID;
   if (null != tenantDomain) {
     try {
       TenantManager tenantManager = RSSManagerDataHolder.getInstance().getTenantManager();
       tenantId = tenantManager.getTenantId(tenantDomain);
     } catch (UserStoreException e) {
       throw new RSSManagerCommonException(
           "Error while retrieving the tenant Id for " + "tenant domain : " + tenantDomain, e);
     }
   }
   return tenantId;
 }
コード例 #5
0
 /**
  * Returns the fully qualified name of the database to be created. This will append an underscore
  * and the tenant's domain name to the database to make it unique for that particular tenant. It
  * will return the database name as it is, if it is created in Super tenant mode.
  *
  * @param databaseName Name of the database
  * @return Fully qualified name of the database
  * @throws RSSManagerException Is thrown if the functionality is interrupted
  */
 public static String getFullyQualifiedDatabaseName(String databaseName)
     throws RSSManagerException {
   String tenantDomain;
   try {
     tenantDomain =
         RSSManagerDataHolder.getInstance()
             .getTenantManager()
             .getDomain(CarbonContext.getThreadLocalCarbonContext().getTenantId());
   } catch (Exception e) {
     throw new RSSManagerException(
         "Error occurred while composing fully qualified name "
             + "of the database '"
             + databaseName
             + "'",
         e);
   }
   if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
     return databaseName + "_" + RSSManagerHelper.processDomainName(tenantDomain);
   }
   return databaseName;
 }