static {
    // Initialize the cache
    try {
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(Collections.emptyMap());
    } catch (CacheException e) {
      log.severe("Exception creating cache: " + e.getMessage() + ": " + e.getStackTrace());
      cache = null;
    }

    // Read important properties from file
    Properties properties = new Properties();
    try {
      properties.load(new FileInputStream("WEB-INF/project.properties"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    CLIENT_ID = properties.getProperty("clientId");
    CLIENT_SECRET = properties.getProperty("clientSecret");
    REDIRECTION_ENDPOINT = properties.getProperty("redirectionEndpoint");
    AUTHORIZATION_ENDPOINT = properties.getProperty("authorizationEndpoint");
    TOKEN_ENDPOINT = properties.getProperty("tokenEndpoint");

    FACEBOOK_API_ENDPOINT = "https://graph.facebook.com/v2.5/";
    MAX_NUMBER_OF_FACEBOOK_POSTS_TO_REQUEST = 200;
    FACEBOOK_REQUESTED_PROFILE_FIELDS = "id,birthday,hometown,name,website,work";
    FACEBOOK_REQUESTED_FEED_FIELDS =
        "id,name,type,message,status_type,created_time,from,likes%7Bid,name%7D";
  }
Exemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see es.alvsanand.webpage.services.admin.WebAdminService#eraseCache()
   */
  public void eraseCache() {
    Cache cache;

    try {
      logger.debug("Erasing cache data");

      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(Collections.emptyMap());

      for (String cacheName : Globals.CAHE_NAMES) {
        cache.remove(cacheName);
      }
    } catch (CacheException cacheException) {
      logger.error("Error removing erasing cache data.", cacheException);
    }
  }