Package net.sourceforge.pebble

Examples of net.sourceforge.pebble.PluginProperties


    } catch (PersistenceException pe) {
      pe.printStackTrace();
    }

    refererFilterManager = new RefererFilterManager(this);
    pluginProperties = new PluginProperties(this);
    blogCompanion = new BlogCompanion(this);
    years = new ArrayList<Year>();

    // create the various indexes for this blog
    searchIndex = new SearchIndex(this);
View Full Code Here


        }

        // Establish default sizes.
        int defaultThumbSize = 200;
        int defaultPopupSize = 640;
        PluginProperties props = blog.getPluginProperties();
        if (props.hasProperty(thumbSizeProp)) {
            try {
                defaultThumbSize =
                  Integer.parseInt(props.getProperty(thumbSizeProp));
            } catch (NumberFormatException nfe) {
                // Ignore.
            }
        }
        if (props.hasProperty(popupSizeProp)) {
            try {
                defaultPopupSize =
                  Integer.parseInt(props.getProperty(popupSizeProp));
            } catch (NumberFormatException nfe) {
                // Ignore.
            }
        }
View Full Code Here

   * @param blogEntry
   *          the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {

    PluginProperties props = blogEntry.getBlog().getPluginProperties();
    int maxPosts = StringUtils.MAX_NUM_OF_POSTS;

    if (props.hasProperty(RelatedPostsDecorator.MAX_POSTS)) {
      try {
        maxPosts = Integer.parseInt(props.getProperty(MAX_POSTS));
      }
      catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
View Full Code Here

   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();
    String regexList = props.getProperty(REGEX_LIST_KEY);
    String regexes[] = null;
    if (regexList != null) {
      regexes = regexList.split(",");
    } else {
      regexes = new String[0];
    }

    int threshold = DEFAULT_THRESHOLD;
    if (props.hasProperty(THRESHOLD_KEY)) {
      try {
        threshold = Integer.parseInt(props.getProperty(THRESHOLD_KEY));
      } catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
    }
View Full Code Here

   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();
    String propertyName = "";
    if (response instanceof Comment) {
      propertyName = COMMENT_THRESHOLD_KEY;
    } else {
      propertyName = TRACKBACK_THRESHOLD_KEY;
    }
    int threshold = DEFAULT_THRESHOLD;
    if (props.hasProperty(propertyName)) {
      try {
        threshold = Integer.parseInt(props.getProperty(propertyName));
      } catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
    }
View Full Code Here

   *
   * @param context   the context in which the decoration is running
   * @param blogEntry the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
    PluginProperties props = blogEntry.getBlog().getPluginProperties();
    int maxLength = StringUtils.MAX_CONTENT_LENGTH;
    if (props.hasProperty(MAX_LENGTH_KEY)) {
      try {
        maxLength = Integer.parseInt(props.getProperty(MAX_LENGTH_KEY));
      } catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
    }
View Full Code Here

   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (isListed(response, props.getProperty(BLACKLIST_KEY))) {
      log.info(response.getTitle() + " marked as pending : IP address " + response.getIpAddress() + " is on blacklist");
      response.setPending();
      response.incrementSpamScore();
    } else if (isListed(response, props.getProperty(WHITELIST_KEY))) {
      // do nothing
    } else {
      log.info(response.getTitle() + " marked as pending : IP address " + response.getIpAddress() + " not on blacklist or whitelist");
      response.setPending();
    }
View Full Code Here

   * Called when a comment or TrackBack has been approved.
   *
   * @param response a Response
   */
  protected void blogEntryResponseApproved(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (response.getIpAddress() == null || response.getIpAddress().trim().length() == 0) {
      return;
    }

    synchronized (props) {
      String whitelist = props.getProperty(WHITELIST_KEY);
      String blacklist = props.getProperty(BLACKLIST_KEY);
      whitelist = addIpAddress(response, whitelist);
      blacklist = removeIpAddress(response, blacklist);
      props.setProperty(WHITELIST_KEY, whitelist);
      props.setProperty(BLACKLIST_KEY, blacklist);
      props.store();
    }
  }
View Full Code Here

   * Called when a comment or TrackBack has been rejected.
   *
   * @param response a Response
   */
  protected void blogEntryResponseRejected(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (response.getIpAddress() == null || response.getIpAddress().trim().length() == 0) {
      return;
    }

    synchronized (props) {
      String blacklist = props.getProperty(BLACKLIST_KEY);
      String whitelist = props.getProperty(WHITELIST_KEY);
      blacklist = addIpAddress(response, blacklist);
      whitelist = removeIpAddress(response, whitelist);
      props.setProperty(BLACKLIST_KEY, blacklist);
      props.setProperty(WHITELIST_KEY, whitelist);
      props.store();
    }
  }
View Full Code Here

      int count = 0;
      while (m.find()) {
        count++;
      }

      PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();
      String propertyName = "";
      if (response instanceof Comment) {
        propertyName = COMMENT_THRESHOLD_KEY;
      } else {
        propertyName = TRACKBACK_THRESHOLD_KEY;
      }
      int threshold = DEFAULT_THRESHOLD;
      if (props.hasProperty(propertyName)) {
        try {
          threshold = Integer.parseInt(props.getProperty(propertyName));
        } catch (NumberFormatException nfe) {
          log.error(nfe.getMessage());
          // do nothing, the value has already been defaulted
        }
      }
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.PluginProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.