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
_ametysResolver
The ametys object resolver.protected String
_i18nCatalogue
The i18n catalogue.protected I18nUtils
_i18nUtils
The i18n utils.protected ObservationManager
_observationManager
The observation manager.protected String
_pluginName
The plugin name.protected ServiceExtensionPoint
_serviceEP
The service extension point.protected SharedContentManager
_sharedContentManager
The shared content manager.protected SkinsManager
_skinsManager
The skins manager.protected WorkflowProvider
_workflowProvider
The 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 ModifiablePage
createPage(Sitemap sitemap, String name, String title)
Create the blog root page.protected Content
createProfileContent(String workflowName, String siteName, String lang, String title)
Create a profile content.protected String
getDefaultXslt(String serviceId)
Get the default value of the XSLT parameter of the given service.int
getPriority(Event event)
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.protected void
initializeAsideZone(ModifiablePage page)
Initialize the "aside" zone.protected void
initializeDefaultZone(ModifiablePage page)
Initialize the default zone.protected void
initializeIndexAboutZone(ModifiablePage indexPage, Content profileContent)
Initialize the index page's "about" zone.protected void
initializeIndexPage(ModifiablePage indexPage, Content profileContent)
Initialize the blog index page.protected Content
initializeProfileDefaultZone(ModifiablePage page)
Initialize the profile page's default zone.protected Content
initializeProfilePage(ModifiablePage page)
Initialize the blog profile page.protected void
initializeSearchDefaultZone(ModifiablePage page)
Initialize the search page's default zone.protected void
initializeSearchPage(ModifiablePage page, Content profileContent)
Initialize the search page.protected void
initializeSite(Site site)
Initialize the given site.protected void
initializeSitemap(Sitemap sitemap)
Initialize the given sitemap.void
observe(Event event, Map<String,Object> transientVars)
Observes an event.void
service(ServiceManager manager)
void
setPluginInfo(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.boolean
supports(Event event)
Checks if the event is supported.protected String
translate(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:PluginAware
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.- Specified by:
setPluginInfo
in 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
supports
public boolean supports(Event event)
Description copied from interface:Observer
Checks if the event is supported. If true, the observe(Event) method will be called.
-
getPriority
public int getPriority(Event event)
Description copied from interface:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in 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:Observer
Observes an event.- Specified by:
observe
in 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.
-
-