public static void loadSmilies() {
   try {
     cache.add(FQN, ENTRIES, DataAccessDriver.getInstance().newSmilieDAO().selectAll());
     contexted = false;
   } catch (Exception e) {
     throw new SmiliesLoadException("Error while loading smilies: " + e);
   }
 }
  public static List getSmilies() {
    List list = (List) cache.get(FQN, ENTRIES);
    if (!contexted) {
      String forumLink = SystemGlobals.getValue(ConfigKeys.FORUM_LINK);

      for (Iterator iter = list.iterator(); iter.hasNext(); ) {
        Smilie s = (Smilie) iter.next();
        s.setUrl(s.getUrl().replaceAll("#CONTEXT#", forumLink).replaceAll("\\\\", ""));
      }

      cache.add(FQN, ENTRIES, list);
      contexted = true;
    }

    return list;
  }
  /**
   * Load user's roles.
   *
   * @param user The <code>User</code> to load
   * @param force If <code>true</code>, forces a reload. If <code>false</code>, the call will be
   *     ignored if the roles are already loaded.
   * @see SecurityRepository#load(int)
   * @see SecurityRepository#load(int, boolean)
   * @see SecurityRepository#load(User)
   * @return PermissionControl
   */
  public static PermissionControl load(User user, boolean force) {
    String userId = Integer.toString(user.getId());

    if (force || cache.get(FQN, userId) == null) {
      PermissionControl pc = new PermissionControl();

      // load roles
      GroupSecurityDAO dao = DataAccessDriver.getInstance().newGroupSecurityDAO();
      pc.setRoles(dao.loadRolesByUserGroups(user));

      cache.add(FQN, userId, pc);

      return pc;
    }

    return SecurityRepository.get(user.getId());
  }
 /**
  * Adds a new permission control schema to the cache
  *
  * @param userId The user's id to associate with the schema
  * @param pc The <code>PermissionControl</code> instance to add
  */
 public static synchronized void add(int userId, PermissionControl pc) {
   cache.add(FQN, Integer.toString(userId), pc);
 }