Ejemplo n.º 1
0
 @Override
 public void insertAlbum(Album album) {
   try {
     System.out.println(" ta inja koon dadim oomadim, khosh oomadim");
     this.insertEntry(album);
   } catch (StorageException e) {
     System.out.print("Exception encountered:\n");
     System.out.println(
         "Exception class: "
             + e.getClass()
             + "\nException message: "
             + e.getMessage()
             + "\nStack trace: "
             + e.getStackTrace());
   } catch (Exception e) {
     System.out.print("Exception encountered:\n");
     System.out.println(
         "Exception class: "
             + e.getClass()
             + "\nException message: "
             + e.getMessage()
             + "\nStack trace: "
             + e.getStackTrace());
   }
 }
Ejemplo n.º 2
0
  private Album getAlbumInfo(String rowKey, String tableName) {
    try {
      CloudTableClient tableClient = getTableClient();
      Album specificAlbum =
          tableClient
              .execute(tableName, TableOperation.retrieve("1", rowKey, Album.class))
              .getResultAsType();

      return specificAlbum;
    } catch (StorageException storageException) {
      System.out.print("StorageException encountered: ");
      System.out.println(storageException.getMessage());
      return null;
    } catch (Exception e) {
      System.out.print("Exception encountered:\n");
      System.out.println(
          "Exception class: "
              + e.getClass()
              + "\nException message: "
              + e.getMessage()
              + "\nStack trace: "
              + e.getStackTrace());
      return null;
    }
  }
 @Override
 public boolean execute() {
   boolean retVal = true;
   StopWatch watch = new StopWatch();
   try {
     watch.start();
     LOGGER.debug("In generator");
     TenantBlobSizeQueue queue = (TenantBlobSizeQueue) getWorkQueue();
     // get all tenantIds
     List<TenantIdMasterEntity> listTenant = tenantIdMasterDao.getAllTenants();
     for (Iterator<TenantIdMasterEntity> iterator = listTenant.iterator(); iterator.hasNext(); ) {
       TenantIdMasterEntity tenant = (TenantIdMasterEntity) iterator.next();
       String tenantId = tenant.getTenantId();
       // put each tenant Id in queue
       queue.enqueue(tenantId);
       LOGGER.info("Generator : msg added is " + tenantId);
     }
     watch.stop();
     taskCompletionDao.updateTaskCompletionDetails(
         watch.getTotalTimeSeconds(),
         "GenerateMeterBlobSizeWork",
         "Measure blob size for " + listTenant.size() + " tenants");
   } catch (StorageException e) {
     retVal = false;
     LOGGER.error(e.getMessage(), e);
   }
   return retVal;
 }
 @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;
 }
 @Override
 public boolean execute() {
   StopWatch watch = new StopWatch();
   boolean retVal = true;
   try {
     watch.start();
     LOGGER.debug("In generator");
     TenantDBBandwidthQueue queue = (TenantDBBandwidthQueue) getWorkQueue();
     Calendar calendar = Calendar.getInstance();
     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S z");
     dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
     String currentTime = dateFormat.format(calendar.getTime());
     queue.enqueue(currentTime);
     LOGGER.info("Generator : msg added is " + currentTime);
     watch.stop();
     taskCompletionDao.updateTaskCompletionDetails(
         watch.getTotalTimeSeconds(), "GenerateMeterTenantDBBandwidthWork", "");
   } catch (StorageException e) {
     retVal = false;
     LOGGER.error(e.getMessage(), e);
   }
   return retVal;
 }