Package org.apache.wiki.notification
Class DefaultSubscriptionManager
java.lang.Object
org.apache.wiki.notification.DefaultSubscriptionManager
- All Implemented Interfaces:
EventListener,org.apache.wiki.api.engine.Initializable,org.apache.wiki.event.WikiEventListener,SubscriptionManager
public class DefaultSubscriptionManager
extends Object
implements SubscriptionManager, org.apache.wiki.api.engine.Initializable, org.apache.wiki.event.WikiEventListener
Default implementation of
SubscriptionManager. It listens to the end of the post-save filtering and sends an
e-mail to every user that is subscribed to the saved page and has an e-mail address in the profile.
The mails are sent from a single background thread, so saving a page never waits for the mail server. The mail does not contain the text of the page. The links in the mails are made absolute with the property "jspwiki.subscription.baseURL", since no request is available here. Pages with an ACL on the view permission are not notified, since the view permission of an offline user cannot be evaluated here.
- Since:
- 3.0.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringScheme and host of the links in the mails, like https://wiki.example.org.Fields inherited from interface org.apache.wiki.notification.SubscriptionManager
PROFILE_ATTR_SUBSCRIPTIONS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(org.apache.wiki.event.WikiEvent event) getSubscriptions(String loginName) Returns the names of the pages a user is subscribed to.voidinitialize(org.apache.wiki.api.core.Engine engine, Properties props) booleanisSubscribed(String loginName, String pageName) Tells whether a user is subscribed to a page.voidSubscribes a user to the changes of a page.voidunsubscribe(String loginName, String pageName) Removes the subscription of a user to a page.
-
Field Details
-
PROP_BASEURL
Scheme and host of the links in the mails, like https://wiki.example.org. Value is "jspwiki.subscription.baseURL".- See Also:
-
-
Constructor Details
-
DefaultSubscriptionManager
public DefaultSubscriptionManager()
-
-
Method Details
-
initialize
public void initialize(org.apache.wiki.api.core.Engine engine, Properties props) throws org.apache.wiki.api.exceptions.WikiException - Specified by:
initializein interfaceorg.apache.wiki.api.engine.Initializable- Throws:
org.apache.wiki.api.exceptions.WikiException
-
subscribe
public void subscribe(String loginName, String pageName) throws org.apache.wiki.api.exceptions.WikiException Subscribes a user to the changes of a page. Subscribing twice has no effect.- Specified by:
subscribein interfaceSubscriptionManager- Parameters:
loginName- login name of the user.pageName- name of the page.- Throws:
org.apache.wiki.api.exceptions.WikiException- if the user does not exist or the profile cannot be saved.
-
unsubscribe
public void unsubscribe(String loginName, String pageName) throws org.apache.wiki.api.exceptions.WikiException Removes the subscription of a user to a page. Removing a subscription that does not exist has no effect.- Specified by:
unsubscribein interfaceSubscriptionManager- Parameters:
loginName- login name of the user.pageName- name of the page.- Throws:
org.apache.wiki.api.exceptions.WikiException- if the user does not exist or the profile cannot be saved.
-
isSubscribed
Tells whether a user is subscribed to a page.- Specified by:
isSubscribedin interfaceSubscriptionManager- Parameters:
loginName- login name of the user.pageName- name of the page.- Returns:
trueif the user is subscribed to the page,falseotherwise, also for an unknown user.
-
getSubscriptions
Returns the names of the pages a user is subscribed to.- Specified by:
getSubscriptionsin interfaceSubscriptionManager- Parameters:
loginName- login name of the user.- Returns:
- an unmodifiable set of page names, empty for an unknown user.
-
actionPerformed
- Specified by:
actionPerformedin interfaceorg.apache.wiki.event.WikiEventListener
-