public class ContentConsistencyEngine extends Object implements Runnable
Modifier and Type | Class and Description |
---|---|
protected class |
ContentConsistencyEngine.ContentExistsHandler
Handler which tests if exists a "/contents/content" tag.
|
Modifier and Type | Field and Description |
---|---|
protected AmetysObjectResolver |
_ametysResolver
The ametys object resolver.
|
protected String |
_baseUrl
The server base URL.
|
protected Context |
_context
The avalon context.
|
protected Context |
_environmentContext
The cocoon environment context.
|
protected I18nUtils |
_i18nUtils
The i18n utils.
|
protected boolean |
_initialized
Is the engine initialized ?
|
protected static Logger |
_LOGGER
The logger.
|
protected static String |
_MAIL_RIGHT
The report e-mail will be sent to users who possess this right on the application context.
|
protected String |
_mailFrom
The content of "from" field in emails.
|
protected ServiceManager |
_manager
The service manager.
|
protected File |
_reportDirectory
The report directory.
|
protected RightManager |
_rightManager
The rights manager.
|
private static boolean |
_RUNNING |
protected SourceResolver |
_sourceResolver
The avalon source resolver.
|
protected UserManager |
_userManager
The users manager.
|
Constructor and Description |
---|
ContentConsistencyEngine() |
Modifier and Type | Method and Description |
---|---|
protected void |
_checkInitialization()
Check the initialization and throw an exception if not initialized.
|
protected void |
_dispose()
Dispose of the resources and looked-up components.
|
protected void |
_generateReport()
Generate the full consistency report.
|
protected void |
_generateReports()
Send all the alerts.
|
protected Map<String,String> |
_getEmailParams()
Get the report e-mail parameters.
|
protected String |
_getMailPart(Map<String,String> parameters)
Get a mail part.
|
protected String |
_getMailUri(Map<String,String> parameters)
Get the pipeline uri for mail body
|
protected void |
_sendErrorEmail()
Send a reminder e-mail to all the users who have the right to edit.
|
protected void |
_sendMails(String subject,
String body,
Set<UserIdentity> users,
String from)
Send the alert emails.
|
void |
configure(Configuration configuration)
Configure the engine (called by the scheduler).
|
void |
initialize(ServiceManager manager,
Context context)
Initialize the alert engine.
|
(package private) static boolean |
isRunning()
Test if the engine is running at the time.
|
void |
run() |
private static void |
setRunning(boolean running) |
protected static final String _MAIL_RIGHT
private static boolean _RUNNING
protected ServiceManager _manager
protected File _reportDirectory
protected boolean _initialized
protected Context _environmentContext
protected AmetysObjectResolver _ametysResolver
protected SourceResolver _sourceResolver
protected RightManager _rightManager
protected UserManager _userManager
protected I18nUtils _i18nUtils
public ContentConsistencyEngine()
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException
manager
- the avalon service manager.context
- the avalon context.ContextException
- if an error occurs retrieving the environment context.ServiceException
- if an error occurs retrieving a component.public void configure(Configuration configuration) throws ConfigurationException
configuration
- the component configuration.ConfigurationException
- if an error occurredprotected void _checkInitialization()
static boolean isRunning()
private static void setRunning(boolean running)
protected void _dispose()
protected void _generateReports() throws AmetysRepositoryException, IOException
AmetysRepositoryException
- if an error occurs.IOException
- if an error occurredprotected void _generateReport() throws IOException
IOException
- if an i/o error occurs.protected void _sendErrorEmail() throws IOException
IOException
- if an error occurs building or sending the mail.protected String _getMailPart(Map<String,String> parameters) throws IOException
parameters
- the pipeline parameters.IOException
- if an error occurredprotected String _getMailUri(Map<String,String> parameters)
parameters
- the mail paramtersprotected Map<String,String> _getEmailParams()
protected void _sendMails(String subject, String body, Set<UserIdentity> users, String from)
subject
- the e-mail subject.body
- the e-mail body.users
- users to send the mail to.from
- the address sending the e-mail.