@Override
 public boolean execute() {
   boolean retval = true;
   try {
     TenantCreationQueue tntCreationQueue = (TenantCreationQueue) getWorkQueue();
     String message = tntCreationQueue.dequeue(SchedulerSettings.MessageVisibilityTimeout);
     if (message == null) {
       LOGGER.debug("Msg is null");
       retval = false;
     } else {
       StopWatch watch = new StopWatch();
       watch.start();
       ProvisioningTenantDTO provisioningTenantDTO = createDTOfromMessage(message);
       boolean tenantCreationSuccess = provisioningService.provisionTenant(provisioningTenantDTO);
       if (tenantCreationSuccess) {
         LOGGER.debug("tenant created :" + provisioningTenantDTO.getTenantId());
       } else {
         LOGGER.debug(
             "tenant creation for tenant ID :" + provisioningTenantDTO.getTenantId() + " failed.");
       }
       watch.stop();
       taskCompletionDao.updateTaskCompletionDetails(
           watch.getTotalTimeSeconds(),
           "ProvisionTenantWork",
           "Tenant " + provisioningTenantDTO.getTenantId() + " is created.");
     }
   } catch (StorageException e) {
     retval = false;
     LOGGER.error(e.getMessage(), e);
   }
   return retval;
 }
  private ProvisioningTenantDTO createDTOfromMessage(String message) {
    ProvisioningTenantDTO provisioningTenantDTO = new ProvisioningTenantDTO();
    String[] strArr = message.split(",");
    String hexPassword;

    provisioningTenantDTO.setTenantId(strArr[0]);
    provisioningTenantDTO.setCompanyName(strArr[1]);
    provisioningTenantDTO.setMemberId(strArr[2]);
    if (strArr.length > 3) {
      // this scenario is for CustomSTS which returns
      // member name and password
      provisioningTenantDTO.setMemberName(strArr[3]);
      // Get the SHA1 encoded password
      String password = strArr[4];
      if (!password.isEmpty()) {
        hexPassword = getSHA1hexPassword(strArr[4]);
        provisioningTenantDTO.setMemberPassword(hexPassword);
      } else {
        provisioningTenantDTO.setMemberPassword("");
      }
    }
    if (strArr.length > 5) {
      // this scenario is for WindowsLiveID which returns
      // invitation code
      provisioningTenantDTO.setInvitationCode(strArr[5]);
    }

    return provisioningTenantDTO;
  }