com.jalios.jcms
Class WeakLinkManager

java.lang.Object
  extended by com.jalios.jcms.BasicStoreListener
      extended by com.jalios.jcms.WeakLinkManager
All Implemented Interfaces:
PluginComponent, StoreListener

public class WeakLinkManager
extends BasicStoreListener

This class manages the index of weak references on publications. A weak reference is either a wiki link (e.g. [[Title]]) or the URL of a publication (display.jsp?id=xxx). The index is managed through a map (pub, set of referrer).

Since:
jcms-5.5.0
Author:
Olivier Dedieu

Field Summary
static String REVISION
           
 
Method Summary
 Set<Publication> extractPubSetFromImg(String text)
          Returns the set of publication referenced through <img> tag in the given text.
 Set<Publication> extractPubSetFromWysiwyg(String text)
           
 Set<Publication> extractWeakLinkSet(Publication pub)
          Returns the set of publication weakly referenced by the given publication.
static WeakLinkManager getInstance()
           
 Map<String,Set<Publication>> getUrlMap()
          Returns the map of urls referenced by publications.
 Map<String,Set<Publication>> getUrlMap(Workspace ws, Member mbr)
          Returns the map of urls referenced by publications of the given workspace.
 Set<Publication> getUrlReferrerSet(String url)
          Returns all the publications referring the given URL.
 void handleCommitUpdate(Storable storable, Storable oldStorable, boolean firstTime)
          This method gets called when after a storable has been updated.
 void handleCreate(Storable storable, boolean firstTime)
          This method gets called when a storable is created.
 void handleDelete(Storable storable, boolean firstTime)
          This method gets called when a storable is deleted.
 void indexPublication(Publication referrer)
          Indexes the given publication.
 void init()
          Scans and indexes all existing publications then register a StoreListener (myself) to update the index at each change.
 void reindexPublication(Publication referrer)
          Reindexes the given publication.
 void unindexPublication(Publication referrer)
          Unindexes the given publication.
 
Methods inherited from class com.jalios.jcms.BasicStoreListener
handlePrepareUpdate, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

getInstance

public static WeakLinkManager getInstance()

init

public void init()
Scans and indexes all existing publications then register a StoreListener (myself) to update the index at each change.

Since:
jcms-5.5.0

indexPublication

public void indexPublication(Publication referrer)
Indexes the given publication.

Parameters:
referrer - the publication to be indexed.
Since:
jcms-5.5.0

unindexPublication

public void unindexPublication(Publication referrer)
Unindexes the given publication.

Parameters:
referrer - the publication to be unindexed.
Since:
jcms-5.5.0

reindexPublication

public void reindexPublication(Publication referrer)
Reindexes the given publication.

Parameters:
referrer - the publication to be reindexed.
Since:
jcms-5.5.0

getUrlReferrerSet

public Set<Publication> getUrlReferrerSet(String url)
Returns all the publications referring the given URL. CAUTION: DO NOT alter the returned set, clone prior modification..

Parameters:
url - the referee URL
Returns:
all the publications referring the given URL.
Since:
jcms-5.5.0

getUrlMap

public Map<String,Set<Publication>> getUrlMap()
Returns the map of urls referenced by publications. CAUTION: DO NOT alter the returned set, clone prior modification..

Returns:
the map of urls referenced by publications.
Since:
jcms-5.5.0

getUrlMap

public Map<String,Set<Publication>> getUrlMap(Workspace ws,
                                              Member mbr)
Returns the map of urls referenced by publications of the given workspace.

Parameters:
ws - the workspace
mbr - the member used for filtering
Returns:
the map of urls referenced by publications.
Since:
jcms-5.5.0

extractWeakLinkSet

public Set<Publication> extractWeakLinkSet(Publication pub)
Returns the set of publication weakly referenced by the given publication.

Parameters:
pub - the publication
Returns:
the set of publication weakly referring the given publication.
Since:
jcms-5.5.0

handleCreate

public void handleCreate(Storable storable,
                         boolean firstTime)
Description copied from interface: StoreListener
This method gets called when a storable is created.

Specified by:
handleCreate in interface StoreListener
Overrides:
handleCreate in class BasicStoreListener
Parameters:
storable - the storable
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleCreate(Storable, boolean)

handleCommitUpdate

public void handleCommitUpdate(Storable storable,
                               Storable oldStorable,
                               boolean firstTime)
Description copied from interface: StoreListener
This method gets called when after a storable has been updated.

Specified by:
handleCommitUpdate in interface StoreListener
Overrides:
handleCommitUpdate in class BasicStoreListener
Parameters:
storable - the storable, this instance is the object that was created at first and that will be stored in jcms until deletion of the storable with this ID. You should always manipulate this object if you maintain any index.
oldStorable - the previous version of the storable, it is a clone, do not use in any index, it should only be used to access old values.
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleCommitUpdate(Storable, Storable, boolean)

handleDelete

public void handleDelete(Storable storable,
                         boolean firstTime)
Description copied from interface: StoreListener
This method gets called when a storable is deleted.

Specified by:
handleDelete in interface StoreListener
Overrides:
handleDelete in class BasicStoreListener
Parameters:
storable - the storable
firstTime - true if it is the first time this operation is processed
See Also:
StoreListener.handleDelete(Storable, boolean)

extractPubSetFromWysiwyg

public Set<Publication> extractPubSetFromWysiwyg(String text)

extractPubSetFromImg

public Set<Publication> extractPubSetFromImg(String text)
Returns the set of publication referenced through <img> tag in the given text.

Parameters:
text - the text
Returns:
the set of publication referenced through <img> in the given text.
Since:
jcms-5.5.0


Copyright © 2001-2010 Jalios SA. All Rights Reserved.