⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blog.java

📁 pebble-blog 博客源码博客源码博客源码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
  /**   * Removes a category.   *   * @param category    the Category to be removed   */  public synchronized void removeCategory(Category category) {    if (getCategory(category.getId()) != null) {      CategoryBuilder builder = new CategoryBuilder(this, rootCategory);      builder.removeCategory(category);    }  }  /**   * Gets the list of tags associated with this blog.   */  public List<Tag> getTags() {    return tagIndex.getTags();  }  /**   * Gets the tag with the specified name.   *   * @param name    the name as a String   * @return  a Tag instance   */  public Tag getTag(String name) {    return new Tag(name, this);  }  /**   * Gets the object managing referer filters.   *   * @return  a RefererFilterManager instance   */  public RefererFilterManager getRefererFilterManager() {    return this.refererFilterManager;  }  /**   * Gets the search index.   *   * @return  a BlogEntryIndex instance   */  public SearchIndex getSearchIndex() {    return this.searchIndex;  }  /**   * Gets the blog entry index.   *   * @return  a BlogEntryIndex instance   */  public BlogEntryIndex getBlogEntryIndex() {    return this.blogEntryIndex;  }  /**   * Gets the response index.   *   * @return  a ResponseIndex instance   */  public ResponseIndex getResponseIndex() {    return this.responseIndex;  }  /**   * Gets the tag index.   *   * @return  a TagIndex instance   */  public TagIndex getTagIndex() {    return this.tagIndex;  }  /**   * Gets the category index.   *   * @return  a CategoryIndex instance   */  public CategoryIndex getCategoryIndex() {    return this.categoryIndex;  }  /**   * Gets the author index.   *   * @return  a AuthorIndex instance   */  public AuthorIndex getAuthorIndex() {    return this.authorIndex;  }  /**   * Gets the story index.   *   * @return  a StaticPageIndex instance   */  public StaticPageIndex getStaticPageIndex() {    return this.staticPageIndex;  }  /**   * Logs this request for blog.   *   * @param request   the HttpServletRequest instance for this request   */  public synchronized void log(HttpServletRequest request, int status) {    String externalUri = (String)request.getAttribute(Constants.EXTERNAL_URI);    if (externalUri.matches("/images/.+")) {      // do nothing, we don't want to log the following types of requests      // - a blog's images    } else {      // log the request      logger.log(request, status);    }  }  /**   * Gets an object representing the editable theme.   *   * @return    an EditableTheme instance   */  public Theme getEditableTheme() {    return editableTheme;  }  /**   * Sets an object representing the editable theme.   *   * @param editableTheme    an EditableTheme instance   */  public void setEditableTheme(Theme editableTheme) {    this.editableTheme = editableTheme;  }  /**   * Gets the location where the blog files are stored.   *   * @return    an absolute, local path on the filing system   */  public String getFilesDirectory() {    return getRoot() + File.separator + "files";  }  /**   * Gets the location where the blog theme is stored.   *   * @return    an absolute, local path on the filing system   */  public String getThemeDirectory() {    return getRoot() + File.separator + "theme";  }  /**   * Gets the location where the plugin properties file is stored.   *   * @return    an absolute, local path on the filing system   */  public String getPluginPropertiesFile() {    return getRoot() + File.separator + "plugin.properties";  }  /**   * Determines whether this blog is public.   *   * @return  true if public, false otherwise   */  public boolean isPublic() {    return properties.getProperty(PRIVATE_KEY).equalsIgnoreCase(FALSE);  }  /**   * Determines whether this blog is private.   *   * @return  true if public, false otherwise   */  public boolean isPrivate() {    return properties.getProperty(PRIVATE_KEY).equalsIgnoreCase(TRUE);  }  /**   * Called to start (i.e. activate/initialise, restore the theme, etc) this   * blog.   */  void start() {    log.debug("Starting blog with ID " + getId());    // reindex the blog if the indexes don't exist    File indexes = new File(getIndexesDirectory());    if (!indexes.exists()) {      indexes.mkdir();      reindex();    }    File imagesDirectory = new File(getImagesDirectory());    if (!imagesDirectory.exists()) {      imagesDirectory.mkdir();    }    File filesDirectory = new File(getFilesDirectory());    if (!filesDirectory.exists()) {      filesDirectory.mkdir();    }    File logDirectory = new File(getLogsDirectory());    if (!logDirectory.exists()) {      logDirectory.mkdir();    }    logger.start();    editableTheme.restore();    // call blog listeners    eventDispatcher.fireBlogEvent(new BlogEvent(this, BlogEvent.BLOG_STARTED));    log.info("Started blog with ID " + getId());  }  /**   * Called to shutdown this blog.   */  void stop() {    log.debug("Stopping blog with ID " + getId());    logger.stop();    editableTheme.backup();    // call blog listeners    eventDispatcher.fireBlogEvent(new BlogEvent(this, BlogEvent.BLOG_STOPPED));    log.info("Stopped blog with ID " + getId());  }  /**   * Gets the logger associated with this blog.   *   * @return    an AbstractLogger implementation   */  public AbstractLogger getLogger() {    return this.logger;  }  /**   * Gets the list of plugins.   *   * @return  a comma separated list of class names   */  public String getContentDecorators() {    return getProperty(CONTENT_DECORATORS_KEY);  }  /**   * Gets the decorator manager associated with this blog.   *   * @return  a BlogEntryDecoratorManager instance   */  public ContentDecoratorChain getContentDecoratorChain() {    return this.decoratorChain;  }  /**   * Gets the list of blog listeners as a String.   *   * @return  a String   */  public String getBlogListeners() {    return getProperty(BLOG_LISTENERS_KEY);  }  /**   * Gets the list of blog entry listeners as a String.   *   * @return  a String   */  public String getBlogEntryListeners() {    return getProperty(BLOG_ENTRY_LISTENERS_KEY);  }  /**   * Gets the list of comment listeners as a String.   *   * @return  a String   */  public String getCommentListeners() {    return getProperty(COMMENT_LISTENERS_KEY);  }  /**   * Gets the list of TrackBack listeners as a String.   *   * @return  a String   */  public String getTrackBackListeners() {    return getProperty(TRACKBACK_LISTENERS_KEY);  }  /**   * Gets the name the event dispatcher.   *   * @return  a String   */  public String getEventDispatcherName() {    return getProperty(EVENT_DISPATCHER_KEY);  }  /**   * Gets the event dispatcher in use.   *   * @return  an EventDispatcher implementation   */  public EventDispatcher getEventDispatcher() {    return this.eventDispatcher;  }  /**   * Gets the event listsner list.   */  public EventListenerList getEventListenerList() {    return this.eventListenerList;  }  public PluginProperties getPluginProperties() {    return this.pluginProperties;  }  /**   * Gets the name of the permalink provider.   *   * @return    the fully qualified class name of the permalink provider   */  public String getPermalinkProviderName() {    return properties.getProperty(PERMALINK_PROVIDER_KEY);  }  /**   * Gets the permalink provider in use.   *   * @return  a PermalinkProvider instance   */  public PermalinkProvider getPermalinkProvider() {    return this.permalinkProvider;  }  /**   * Sets the permalink provider in use.   *   * @param provider    PermalinkProvider instance   */  public void setPermalinkProvider(PermalinkProvider provider) {    this.permalinkProvider = provider;    this.permalinkProvider.setBlog(this);  }  public void reindex() {    log.info("Reindexing blog with ID " + getId());    blogEntryIndex.clear();    responseIndex.clear();    tagIndex.clear();    categoryIndex.clear();    authorIndex.clear();    searchIndex.clear();    staticPageIndex.clear();    BlogService service = new BlogService();    try {      List<BlogEntry> blogEntries = service.getBlogEntries(this);      blogEntryIndex.index(blogEntries);      responseIndex.index(blogEntries);      tagIndex.index(blogEntries);      categoryIndex.index(blogEntries);      authorIndex.index(blogEntries);      searchIndex.indexBlogEntries(blogEntries);    } catch (BlogServiceException e) {      // do nothing    }    try {      List<StaticPage> staticPages = service.getStaticPages(this);      staticPageIndex.index(staticPages);      searchIndex.indexStaticPages(staticPages);    } catch (BlogServiceException e) {      // do nothing    }  }  /**   * Indicates whether some other object is "equal to" this one.   *   * @param o   the reference object with which to compare.   * @return <code>true</code> if this object is the same as the obj   *         argument; <code>false</code> otherwise.   * @see #hashCode()   * @see java.util.Hashtable   */  public boolean equals(Object o) {    if (this == o) {      return true;    }    if (!(o instanceof Blog)) {      return false;    }    Blog blog = (Blog)o;    return getId().equals(blog.getId());  }  public String getCommentConfirmationStrategyName() {    return getProperty(COMMENT_CONFIRMATION_STRATEGY_KEY);  }  public CommentConfirmationStrategy getCommentConfirmationStrategy() {    return commentConfirmationStrategy;  }  public String getTrackBackConfirmationStrategyName() {    return getProperty(TRACKBACK_CONFIRMATION_STRATEGY_KEY);  }  public TrackBackConfirmationStrategy getTrackBackConfirmationStrategy() {    return trackBackConfirmationStrategy;  }  public Cache getBlogEntryCache() {    return blogEntryCache;  }  public void setBlogEntryCache(Cache blogEntryCache) {    this.blogEntryCache = blogEntryCache;  }  public boolean isRichTextEditorForCommentsEnabled() {    String s = getProperty(RICH_TEXT_EDITOR_FOR_COMMENTS_ENABLED_KEY);    return s != null && s.equalsIgnoreCase("true");  }  public EmailSubscriptionList getEmailSubscriptionList() {    return emailSubscriptionList;  }  public List<NewsFeedEntry> getNewsFeedEntries() {    return NewsFeedCache.getInstance().getNewsFeedEntries(this);  }  public List<NewsFeedEntry> getRecentNewsFeedEntries() {    List<NewsFeedEntry> entries = getNewsFeedEntries();    if (entries.size() > getRecentBlogEntriesOnHomePage()) {      entries = entries.subList(0, getRecentBlogEntriesOnHomePage());    }    return entries;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -