Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8D03B200CBC for ; Tue, 20 Jun 2017 19:10:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8BEF8160BCC; Tue, 20 Jun 2017 17:10:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B04AA160BFB for ; Tue, 20 Jun 2017 19:10:32 +0200 (CEST) Received: (qmail 37073 invoked by uid 500); 20 Jun 2017 17:10:31 -0000 Mailing-List: contact commits-help@jspwiki.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jspwiki.apache.org Delivered-To: mailing list commits@jspwiki.apache.org Received: (qmail 36402 invoked by uid 99); 20 Jun 2017 17:10:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2017 17:10:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 840E1E969D; Tue, 20 Jun 2017 17:10:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: juanpablo@apache.org To: commits@jspwiki.apache.org Date: Tue, 20 Jun 2017 17:11:06 -0000 Message-Id: <17f3f17c9e88456bacfa38640af0a82b@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [42/51] [partial] jspwiki-site git commit: Site + Apidocs Maven Publish archived-at: Tue, 20 Jun 2017 17:10:35 -0000 http://git-wip-us.apache.org/repos/asf/jspwiki-site/blob/7d1a74bd/apidocs/2.10.1/org/apache/wiki/PageSorter.html ---------------------------------------------------------------------- diff --git a/apidocs/2.10.1/org/apache/wiki/PageSorter.html b/apidocs/2.10.1/org/apache/wiki/PageSorter.html new file mode 100755 index 0000000..6cdf574 --- /dev/null +++ b/apidocs/2.10.1/org/apache/wiki/PageSorter.html @@ -0,0 +1,546 @@ + + + + + + + +PageSorter (Apache JSPWiki Main War 2.10.1 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.apache.wiki +
+Class PageSorter

+
+java.lang.Object
+  extended by org.apache.wiki.PageSorter
+
+
+
All Implemented Interfaces:
Comparator
+
+
+
+
public class PageSorter
extends Object
implements Comparator
+ + + + + +
+ +

+Wrapper class for managing and using the PageNameComparator. +

+ Note - this class is deliberately not null safe. Never call any of the + methods with a null argument! +

+ +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+protected static StringPROP_PAGE_NAME_COMPARATOR + +
+           
+  + + + + + + + + + + + + + +
+Constructor Summary
PageSorter() + +
+          Default constructor uses Java "natural" ordering.
PageSorter(Comparator<String> comparator) + +
+          Construct with a particular comparator.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ intcompare(Object o1, + Object o2) + +
+          Compare two page names (Object version).
+ intcompare(String pageName1, + String pageName2) + +
+          Compare two page names (String version).
+ intcompare(WikiPage page1, + WikiPage page2) + +
+          Compare two pages (WikiPage version).
+ booleanequals(Object o) + +
+           
+ voidinitialize(Properties props) + +
+          Called by WikiEngine to initialise this instance.
+ voidsort(List<String> nameList) + +
+          Sorts the specified list into ascending order based on the + PageNameComparator.
+ voidsort(String[] nameArray) + +
+          Sorts the specified array into ascending order based on the + PageNameComparator.
+ voidsortPages(List<Object> pageList) + +
+          Sorts the specified list into ascending order based on the + PageNameComparator.
+ voidsortPages(Object[] pageArray) + +
+          Sorts the specified array into ascending order based on the + PageNameComparator.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+PROP_PAGE_NAME_COMPARATOR

+
+protected static final String PROP_PAGE_NAME_COMPARATOR
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+PageSorter

+
+public PageSorter()
+
+
Default constructor uses Java "natural" ordering. +

+

+
+ +

+PageSorter

+
+public PageSorter(Comparator<String> comparator)
+
+
Construct with a particular comparator. +

+

+
Parameters:
comparator - the Comparator to use
+
+ + + + + + + + +
+Method Detail
+ +

+compare

+
+public int compare(Object o1,
+                   Object o2)
+
+
Compare two page names (Object version). Arguments must be either String + or WikiPage. +

+

+
Specified by:
compare in interface Comparator
+
+
+ +
Throws: +
IllegalArgumentException - if incorrect argument types.
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
+
+
+
+ +

+compare

+
+public int compare(String pageName1,
+                   String pageName2)
+
+
Compare two page names (String version). +

+

+
+
+
+
Parameters:
pageName1 - the first page name
pageName2 - the second page name +
Returns:
see java.util.Comparator
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
+
+
+
+ +

+compare

+
+public int compare(WikiPage page1,
+                   WikiPage page2)
+
+
Compare two pages (WikiPage version). Compares them by name first. If the + same name, compares their versions. +

+

+
+
+
+
Parameters:
page1 - the first page
page2 - the second page +
Returns:
see java.util.Comparator
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
+
+
+
+ +

+equals

+
+public boolean equals(Object o)
+
+
+
Specified by:
equals in interface Comparator
Overrides:
equals in class Object
+
+
+
+
+
+
+ +

+initialize

+
+public void initialize(Properties props)
+
+
Called by WikiEngine to initialise this instance. Tries to use class + given by the PROP_PAGE_NAME_COMPARATOR property as the page name + comparator. Uses a default comparator if this property is not set or + there is any problem loading the specified class. +

+

+
+
+
+
Parameters:
props - this WikiEngine's properties.
+
+
+
+ +

+sort

+
+public void sort(List<String> nameList)
+
+
Sorts the specified list into ascending order based on the + PageNameComparator. The actual sort is done using + Collections.sort(). +

+

+
+
+
+
Parameters:
nameList - the page names to be sorted
+
+
+
+ +

+sort

+
+public void sort(String[] nameArray)
+
+
Sorts the specified array into ascending order based on the + PageNameComparator. The actual sort is done using + Arrays.sort(). +

+

+
+
+
+
Parameters:
nameArray - the page names to be sorted
+
+
+
+ +

+sortPages

+
+public void sortPages(List<Object> pageList)
+
+
Sorts the specified list into ascending order based on the + PageNameComparator. The actual sort is done using + Collections.sort(). +

+

+
+
+
+
Parameters:
pageList - the pages to be sorted
+
+
+
+ +

+sortPages

+
+public void sortPages(Object[] pageArray)
+
+
Sorts the specified array into ascending order based on the + PageNameComparator. The actual sort is done using + Arrays.sort(). +

+

+
+
+
+
Parameters:
pageArray - the pages to be sorted
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved. + + http://git-wip-us.apache.org/repos/asf/jspwiki-site/blob/7d1a74bd/apidocs/2.10.1/org/apache/wiki/PageSorter.png ---------------------------------------------------------------------- diff --git a/apidocs/2.10.1/org/apache/wiki/PageSorter.png b/apidocs/2.10.1/org/apache/wiki/PageSorter.png new file mode 100755 index 0000000..3ea1204 Binary files /dev/null and b/apidocs/2.10.1/org/apache/wiki/PageSorter.png differ http://git-wip-us.apache.org/repos/asf/jspwiki-site/blob/7d1a74bd/apidocs/2.10.1/org/apache/wiki/ReferenceManager.html ---------------------------------------------------------------------- diff --git a/apidocs/2.10.1/org/apache/wiki/ReferenceManager.html b/apidocs/2.10.1/org/apache/wiki/ReferenceManager.html new file mode 100755 index 0000000..c8df037 --- /dev/null +++ b/apidocs/2.10.1/org/apache/wiki/ReferenceManager.html @@ -0,0 +1,739 @@ + + + + + + + +ReferenceManager (Apache JSPWiki Main War 2.10.1 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.apache.wiki +
+Class ReferenceManager

+
+java.lang.Object
+  extended by org.apache.wiki.api.filters.BasicPageFilter
+      extended by org.apache.wiki.ReferenceManager
+
+
+
All Implemented Interfaces:
EventListener, PageFilter, WikiEventListener, InternalModule
+
+
+
+
public class ReferenceManager
extends BasicPageFilter
implements InternalModule, WikiEventListener
+ + + + + + + +
+ +

+Keeps track of wikipage references: +

    +
  • What pages a given page refers to +
  • What pages refer to a given page +
+ + This is a quick'n'dirty approach without any finesse in storage and + searching algorithms; we trust java.util.*. +

+ This class contains two HashMaps, m_refersTo and m_referredBy. The + first is indexed by WikiPage names and contains a Collection of all + WikiPages the page refers to. (Multiple references are not counted, + naturally.) The second is indexed by WikiPage names and contains + a Set of all pages that refer to the indexing page. (Notice - + the keys of both Maps should be kept in sync.) +

+ When a page is added or edited, its references are parsed, a Collection + is received, and we crudely replace anything previous with this new + Collection. We then check each referenced page name and make sure they + know they are referred to by the new page. +

+ Based on this information, we can perform non-optimal searches for + e.g. unreferenced pages, top ten lists, etc. +

+ The owning class must take responsibility of filling in any pre-existing + information, probably by loading each and every WikiPage and calling this + class to update the references when created. +

+ +

+

+
Since:
+
1.6.1
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ReferenceManager(WikiEngine engine) + +
+          Builds a new ReferenceManager.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidactionPerformed(WikiEvent event) + +
+          Fired when a WikiEvent is triggered by an event source.
+ voidclearPageEntries(String pagename) + +
+          Clears the references to a certain page so it's no longer in the map.
+ intdeepHashCode() + +
+          This 'deepHashCode' can be used to determine if there were any + modifications made to the underlying to and by maps of the + ReferenceManager.
+ SetfindCreated() + +
+          Returns a list of all pages that the ReferenceManager knows about.
+ SetfindReferredBy(String pageName) + +
+          Returns all pages that refer to this page.
+ CollectionfindReferrers(String pagename) + +
+          Find all pages that refer to this page.
+ CollectionfindRefersTo(String pageName) + +
+          Returns all pages that this page refers to.
+ CollectionfindUncreated() + +
+          Finds all references to non-existant pages.
+ CollectionfindUnreferenced() + +
+          Finds all unreferenced pages.
+protected  MapgetReferredBy() + +
+          Returns the referred-by list.
+protected  MapgetRefersTo() + +
+          Returns the refers-to list.
+ voidinitialize(Collection pages) + +
+          Initializes the entire reference manager with the initial set of pages + from the collection.
+ voidpageRemoved(WikiPage page) + +
+          Updates the m_referedTo and m_referredBy hashmaps when a page has been + deleted.
+ voidpostSave(WikiContext context, + String content) + +
+          After the page has been saved, updates the reference lists.
+ voidupdateReferences(String page, + Collection<String> references) + +
+          Updates the referred pages of a new or edited WikiPage.
+ + + + + + + +
Methods inherited from class org.apache.wiki.api.filters.BasicPageFilter
destroy, initialize, postTranslate, preSave, preTranslate
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ReferenceManager

+
+public ReferenceManager(WikiEngine engine)
+
+
Builds a new ReferenceManager. +

+

+
Parameters:
engine - The WikiEngine to which this is managing references to.
+
+ + + + + + + + +
+Method Detail
+ +

+initialize

+
+public void initialize(Collection pages)
+                throws ProviderException
+
+
Initializes the entire reference manager with the initial set of pages + from the collection. +

+

+
+
+
+
Parameters:
pages - A collection of all pages you want to be included in the reference + count. +
Throws: +
ProviderException - If reading of pages fail.
Since:
+
2.2
+
+
+
+
+ +

+postSave

+
+public void postSave(WikiContext context,
+                     String content)
+
+
After the page has been saved, updates the reference lists. +

+

+
Specified by:
postSave in interface PageFilter
Overrides:
postSave in class BasicPageFilter
+
+
+
Parameters:
context - The WikiContext
content - The content which was just stored.
+
+
+
+ +

+pageRemoved

+
+public void pageRemoved(WikiPage page)
+
+
Updates the m_referedTo and m_referredBy hashmaps when a page has been + deleted. +

+ Within the m_refersTo map the pagename is a key. The whole key-value-set + has to be removed to keep the map clean. + Within the m_referredBy map the name is stored as a value. Since a key + can have more than one value we have to delete just the key-value-pair + referring page:deleted page. +

+

+
+
+
+
Parameters:
page - Name of the page to remove from the maps.
+
+
+
+ +

+updateReferences

+
+public void updateReferences(String page,
+                             Collection<String> references)
+
+
Updates the referred pages of a new or edited WikiPage. If a refersTo + entry for this page already exists, it is removed and a new one is built + from scratch. Also calls updateReferredBy() for each referenced page. +

+ This is the method to call when a new page has been created and we + want to a) set up its references and b) notify the referred pages + of the references. Use this method during run-time. +

+

+
+
+
+
Parameters:
page - Name of the page to update.
references - A Collection of Strings, each one pointing to a page this page references.
+
+
+
+ +

+getRefersTo

+
+protected Map getRefersTo()
+
+
Returns the refers-to list. For debugging. +

+

+
+
+
+ +
Returns:
The refers-to list.
+
+
+
+ +

+getReferredBy

+
+protected Map getReferredBy()
+
+
Returns the referred-by list. For debugging. +

+

+
+
+
+ +
Returns:
Referred-by lists.
+
+
+
+ +

+clearPageEntries

+
+public void clearPageEntries(String pagename)
+
+
Clears the references to a certain page so it's no longer in the map. +

+

+
+
+
+
Parameters:
pagename - Name of the page to clear references for.
+
+
+
+ +

+findUnreferenced

+
+public Collection findUnreferenced()
+
+
Finds all unreferenced pages. This requires a linear scan through + m_referredBy to locate keys with null or empty values. +

+

+
+
+
+ +
Returns:
The Collection of Strings
+
+
+
+ +

+findUncreated

+
+public Collection findUncreated()
+
+
Finds all references to non-existant pages. This requires a linear + scan through m_refersTo values; each value must have a corresponding + key entry in the reference Maps, otherwise such a page has never + been created. +

+ Returns a Collection containing Strings of unreferenced page names. + Each non-existant page name is shown only once - we don't return information + on who referred to it. +

+

+
+
+
+ +
Returns:
A Collection of Strings
+
+
+
+ +

+findReferrers

+
+public Collection findReferrers(String pagename)
+
+
Find all pages that refer to this page. Returns null if the page + does not exist or is not referenced at all, otherwise returns a + collection containing page names (String) that refer to this one. +

+

+

+
+
+
+
Parameters:
pagename - The page to find referrers for. +
Returns:
A Collection of Strings. (This is, in fact, a Set, and is likely + to change at some point to a Set). May return null, if the page + does not exist, or if it has no references.
+
+
+
+ +

+findReferredBy

+
+public Set findReferredBy(String pageName)
+
+
Returns all pages that refer to this page. Note that this method + returns an unmodifiable Map, which may be abruptly changed. So any + access to any iterator may result in a ConcurrentModificationException. +

+ The advantages of using this method over findReferrers() is that + it is very fast, as it does not create a new object. The disadvantages + are that it does not do any mapping between plural names, and you + may end up getting a ConcurrentModificationException. +

+

+
+
+
+
Parameters:
pageName - Page name to query. +
Returns:
A Set of Strings containing the names of all the pages that refer + to this page. May return null, if the page does not exist or + has not been indexed yet.
Since:
+
2.2.33
+
+
+
+
+ +

+findRefersTo

+
+public Collection findRefersTo(String pageName)
+
+
Returns all pages that this page refers to. You can use this as a quick + way of getting the links from a page, but note that it does not link any + InterWiki, image, or external links. It does contain attachments, though. +

+ The Collection returned is unmutable, so you cannot change it. It does reflect + the current status and thus is a live object. So, if you are using any + kind of an iterator on it, be prepared for ConcurrentModificationExceptions. +

+ The returned value is a Collection, because a page may refer to another page + multiple times. +

+

+
+
+
+
Parameters:
pageName - Page name to query +
Returns:
A Collection of Strings containing the names of the pages that this page + refers to. May return null, if the page does not exist or has not + been indexed yet.
Since:
+
2.2.33
+
+
+
+
+ +

+deepHashCode

+
+public int deepHashCode()
+
+
This 'deepHashCode' can be used to determine if there were any + modifications made to the underlying to and by maps of the + ReferenceManager. The maps of the ReferenceManager are not + synchronized, so someone could add/remove entries in them while the + hashCode is being computed. +

+

+
+
+
+ +
Returns:
Sum of the hashCodes for the to and by maps of the + ReferenceManager
Since:
+
2.3.24
+
+
+
+
+ +

+findCreated

+
+public Set findCreated()
+
+
Returns a list of all pages that the ReferenceManager knows about. + This should be roughly equivalent to PageManager.getAllPages(), but without + the potential disk access overhead. Note that this method is not guaranteed + to return a Set of really all pages (especially during startup), but it is + very fast. +

+

+
+
+
+ +
Returns:
A Set of all defined page names that ReferenceManager knows about.
Since:
+
2.3.24
+
+
+
+
+ +

+actionPerformed

+
+public void actionPerformed(WikiEvent event)
+
+
Fired when a WikiEvent is triggered by an event source. +

+

+
Specified by:
actionPerformed in interface WikiEventListener
+
+
+
Parameters:
event - a WikiEvent object
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved. + + http://git-wip-us.apache.org/repos/asf/jspwiki-site/blob/7d1a74bd/apidocs/2.10.1/org/apache/wiki/ReferenceManager.png ---------------------------------------------------------------------- diff --git a/apidocs/2.10.1/org/apache/wiki/ReferenceManager.png b/apidocs/2.10.1/org/apache/wiki/ReferenceManager.png new file mode 100755 index 0000000..7574045 Binary files /dev/null and b/apidocs/2.10.1/org/apache/wiki/ReferenceManager.png differ