Package org.ametys.plugins.blog
Class InitializeBlogSiteObserver
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.blog.InitializeBlogSiteObserver
-
- All Implemented Interfaces:
Observer,PluginAware,LogEnabled,Serviceable
public class InitializeBlogSiteObserver extends AbstractLogEnabled implements Observer, Serviceable, PluginAware
Initializes all blog pages when a site is created.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_ametysResolverThe ametys object resolver.protected String_i18nCatalogueThe i18n catalogue.protected I18nUtils_i18nUtilsThe i18n utils.protected ObservationManager_observationManagerThe observation manager.protected String_pluginNameThe plugin name.protected ServiceExtensionPoint_serviceEPThe service extension point.protected SharedContentManager_sharedContentManagerThe shared content manager.protected SkinsManager_skinsManagerThe skins manager.protected WorkflowProvider_workflowProviderThe workflow provider-
Fields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description InitializeBlogSiteObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ModifiablePagecreatePage(Sitemap sitemap, String name, String title)Create the blog root page.protected ContentcreateProfileContent(String workflowName, String siteName, String lang, String title)Create a profile content.protected StringgetDefaultXslt(String serviceId)Get the default value of the XSLT parameter of the given service.intgetPriority(Event event)Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.protected voidinitializeAsideZone(ModifiablePage page)Initialize the "aside" zone.protected voidinitializeDefaultZone(ModifiablePage page)Initialize the default zone.protected voidinitializeIndexAboutZone(ModifiablePage indexPage, Content profileContent)Initialize the index page's "about" zone.protected voidinitializeIndexPage(ModifiablePage indexPage, Content profileContent)Initialize the blog index page.protected ContentinitializeProfileDefaultZone(ModifiablePage page)Initialize the profile page's default zone.protected ContentinitializeProfilePage(ModifiablePage page)Initialize the blog profile page.protected voidinitializeSearchDefaultZone(ModifiablePage page)Initialize the search page's default zone.protected voidinitializeSearchPage(ModifiablePage page, Content profileContent)Initialize the search page.protected voidinitializeSite(Site site)Initialize the given site.protected voidinitializeSitemap(Sitemap sitemap)Initialize the given sitemap.voidobserve(Event event, Map<String,Object> transientVars)Observes an event.voidservice(ServiceManager manager)voidsetPluginInfo(String pluginName, String featureName, String id)Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.booleansupports(Event event)Checks if the event is supported.protected Stringtranslate(String key, String language)Translate the key in the plugin's catalogue.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_ametysResolver
protected AmetysObjectResolver _ametysResolver
The ametys object resolver.
-
_skinsManager
protected SkinsManager _skinsManager
The skins manager.
-
_serviceEP
protected ServiceExtensionPoint _serviceEP
The service extension point.
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils.
-
_observationManager
protected ObservationManager _observationManager
The observation manager.
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_sharedContentManager
protected SharedContentManager _sharedContentManager
The shared content manager.
-
_pluginName
protected String _pluginName
The plugin name.
-
_i18nCatalogue
protected String _i18nCatalogue
The i18n catalogue.
-
-
Constructor Detail
-
InitializeBlogSiteObserver
public InitializeBlogSiteObserver()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
supports
public boolean supports(Event event)
Description copied from interface:ObserverChecks if the event is supported. If true, the observe(Event) method will be called.
-
getPriority
public int getPriority(Event event)
Description copied from interface:ObserverRetrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriorityin interfaceObserver- Parameters:
event- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
observe
public void observe(Event event, Map<String,Object> transientVars) throws Exception
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Parameters:
event- the event.transientVars- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
initializeSite
protected void initializeSite(Site site)
Initialize the given site.- Parameters:
site- the Site object.
-
initializeSitemap
protected void initializeSitemap(Sitemap sitemap)
Initialize the given sitemap.- Parameters:
sitemap- the Sitemap object.
-
createPage
protected ModifiablePage createPage(Sitemap sitemap, String name, String title)
Create the blog root page.- Parameters:
sitemap- The sitemapname- The page's nametitle- The page's title- Returns:
- the root page.
-
initializeIndexPage
protected void initializeIndexPage(ModifiablePage indexPage, Content profileContent)
Initialize the blog index page.- Parameters:
indexPage- the blog index page.profileContent- the profile Content.
-
initializeSearchPage
protected void initializeSearchPage(ModifiablePage page, Content profileContent)
Initialize the search page.- Parameters:
page- the search page.profileContent- the profile Content.
-
initializeSearchDefaultZone
protected void initializeSearchDefaultZone(ModifiablePage page)
Initialize the search page's default zone.- Parameters:
page- the search page.
-
initializeProfilePage
protected Content initializeProfilePage(ModifiablePage page)
Initialize the blog profile page.- Parameters:
page- the blog profile page.- Returns:
- the profile content.
-
initializeProfileDefaultZone
protected Content initializeProfileDefaultZone(ModifiablePage page)
Initialize the profile page's default zone.- Parameters:
page- the profile page.- Returns:
- the profile content.
-
initializeDefaultZone
protected void initializeDefaultZone(ModifiablePage page)
Initialize the default zone.- Parameters:
page- The page
-
initializeIndexAboutZone
protected void initializeIndexAboutZone(ModifiablePage indexPage, Content profileContent)
Initialize the index page's "about" zone.- Parameters:
indexPage- the index Page.profileContent- the profile content.
-
initializeAsideZone
protected void initializeAsideZone(ModifiablePage page)
Initialize the "aside" zone.- Parameters:
page- the page on which to initialize the aside zone.
-
createProfileContent
protected Content createProfileContent(String workflowName, String siteName, String lang, String title) throws com.opensymphony.workflow.WorkflowException
Create a profile content.- Parameters:
workflowName- The workflow namesiteName- the site name.lang- the language.title- The content's title- Returns:
- the created person content.
- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs
-
getDefaultXslt
protected String getDefaultXslt(String serviceId)
Get the default value of the XSLT parameter of the given service.- Parameters:
serviceId- the service ID.- Returns:
- the default XSLT parameter value.
-
-