@PostConstruct
  public void postConstruct() {
    final SmartLogger sl =
        SmartLogger.start(
            Loggers.LEVEL.SERVER_STATUS, "Login to rackspace cloud", 60000, null, true);
    final boolean status = doLogin();
    if (status) {
      sl.complete(Loggers.DONE);

    } else {
      sl.appendToLogMSG("Login Failed. Destroying Session Bean!");
      sl.complete(Loggers.FAILED);
      throw LOGIN_EXCEPTION;
    }
  }
  @Override
  public Return<File> run(
      File file,
      final Map parameterMap,
      final String userFileExtension,
      final HttpSession session) {
    final SmartLogger sl =
        SmartLogger.start(Loggers.LEVEL.SERVER_STATUS, "Uploading Album Photo", 60000, null, true);
    Return<File> r;
    /** Renaming the file to contain extension for image manipulation flexibility */
    try {
      File newFile = new File(file.getCanonicalPath() + "." + userFileExtension);
      final boolean rename = file.renameTo(newFile);

      if (!rename) {
        sl.complete("Rename Error!");
        return new ReturnImpl<File>(new RuntimeException("Rename Error"), "Rename Error!", true);
      }

      final SessionBoundBadRefWrapper<HumanUserLocal> s =
          (SessionBoundBadRefWrapper<HumanUserLocal>) session.getAttribute(ServletLogin.HumanUser);

      if (!s.isAlive()) {
        sl.complete("No Login!");
        r = new ReturnImpl<File>(ExceptionCache.NO_LOGIN, "Please login!", true);
      } else {
        final HumanId humanId = new HumanId(s.getBoundInstance().getHumanUserId()).getSelfAsValid();

        try {
          try {

            // Uploading Original
            final String cdnFileName = newFile.getName();
            sl.appendToLogMSG(UPLOADING_ORIGINAL_IMAGE);
            final boolean uploadedOriginal =
                client.storeObjectAs(
                    CONTAINER,
                    newFile,
                    FilesConstants.getMimetype(userFileExtension),
                    ORIGINAL + cdnFileName);

            BufferedImage bi = null;

            // Uploading Standard Size
            sl.appendToLogMSG(LOADING_IMAGE_AS_BUFFERED_IMAGE);
            bi = loadImage(newFile);

            sl.appendToLogMSG(SCALING_IMAGE);
            bi = scaleImage(bi, 600); // Reducing size of image to standard view

            sl.appendToLogMSG(SAVING_SCALED_IMAGE);
            saveImage(bi, newFile);

            final String cdnfileName = newFile.getName();
            sl.appendToLogMSG(UPLOADING_STANDARD_IMAGE);
            final boolean uploadedStandard =
                client.storeObjectAs(
                    CONTAINER, newFile, FilesConstants.getMimetype(userFileExtension), cdnfileName);

            // Uploading Thumb
            sl.appendToLogMSG(LOADING_IMAGE_AS_BUFFERED_IMAGE);
            bi = loadImage(newFile);

            sl.appendToLogMSG(SCALING_IMAGE);
            bi =
                scaleImage(
                    bi,
                    190); // Reducing size of image to blueprintcss span-5 just to save bandwidth
            // for the user.

            sl.appendToLogMSG(SAVING_SCALED_IMAGE);
            saveImage(bi, newFile);

            final String cdnThumbFileName = THUMBNAIL + newFile.getName();
            sl.appendToLogMSG(UPLOADING_IMAGE_THUMB);
            final boolean uploadedThumb =
                client.storeObjectAs(
                    CONTAINER,
                    newFile,
                    FilesConstants.getMimetype(userFileExtension),
                    cdnThumbFileName);

            if (uploadedStandard && uploadedThumb && uploadedOriginal) {
              final boolean deleted = newFile.delete();
              if (deleted) {
                final Return<Album> dbr =
                    DB.getHumanCrudPrivateEventLocal(true)
                        .uPrivateEventAddEntryToAlbum(
                            humanId,
                            Long.parseLong((String) parameterMap.get(ALBUM_PIVATE_EVENT_ID)),
                            new Obj<String>(cdnFileName).getSelfAsValid());
                if (dbr.returnStatus() == 0) {
                  sl.complete(Loggers.DONE);
                  r = new ReturnImpl<File>(newFile, ALBUM_PHOTO_UPLOAD_SUCCESSFUL);
                } else {
                  r =
                      new ReturnImpl<File>(
                          new DBOperationException(dbr.returnError()),
                          ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_I_O_ISSUES,
                          true);
                }
              } else {
                r =
                    new ReturnImpl<File>(
                        ExceptionCache.FILE_DELETE_FAILED,
                        ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_CACHING_ISSUES,
                        true);
              }
            } else {
              r =
                  new ReturnImpl<File>(
                      ExceptionCache.CDN_FILE_UPLOAD_FAILED,
                      ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_I_O_ISSUES,
                      true);
            }
          } catch (final IOException e) {
            r = new ReturnImpl<File>(e, ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_I_O_ISSUES, true);
          }
        } catch (
            final RuntimeException e) { // This is for the deleteObject's returnBadly from DB return
          r = new ReturnImpl<File>(e, ALBUM_PHOTO_UPLOAD_FAILED, true);
        } catch (final Exception e) {
          r =
              new ReturnImpl<File>(
                  e, ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_IMAGE_MANIPULATION_ISSUES, true);
        }
      }
    } catch (final IOException e) {
      r = new ReturnImpl<File>(e, ALBUM_PHOTO_UPLOAD_FAILED_DUE_TO_RENAMING_ISSUES, true);
    }
    return r;
  }