public class GeneratePDFEngine extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
private String |
_catalog |
protected File |
_catalogRootDirectory
The catalog directory.
|
protected Context |
_context
The avalon context.
|
protected Map<String,Object> |
_contextualParameters
The contextual parameters
|
protected Context |
_environmentContext
The cocoon environment context.
|
protected I18nUtils |
_i18nUtils
The i18n utils.
|
protected boolean |
_initialized
Is the engine initialized ?
|
private User |
_issuer |
protected static Logger |
_LOGGER
The logger.
|
protected String |
_mailFrom
The sender of the email
|
protected ServiceManager |
_manager
The service manager.
|
private static boolean |
_RUNNING
Is the thread running ?
|
protected SourceResolver |
_sourceResolver
The avalon source resolver.
|
Constructor and Description |
---|
GeneratePDFEngine() |
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 |
_doGeneratePDF(Request request)
Generate the PDF file
|
protected void |
_generatePDF(Request request)
Generates the PDF file.
|
protected void |
_sendMail(boolean error)
Sends an email to the user who has launched the generation of PDF
|
void |
configure(Configuration configuration)
Configure the engine (called by the scheduler).
|
protected String |
getFailureMailBody()
Get the body of mail in case of failure
|
protected String |
getLanguage()
Get the language for export
|
protected String |
getMailSubject()
Get the subject of mail
|
protected String |
getSuccessMailBody()
Get the body of mail in case of success
|
void |
initialize(ServiceManager manager,
Context context)
Initialize the alert engine.
|
static boolean |
isRunning()
Test if the engine is running at the time.
|
void |
run() |
void |
setCatalog(String code)
Set the code of catalogue to generate
|
void |
setContextualParameters(Map<String,Object> contextualParameters)
Set the contextual parameters
|
void |
setIssuer(User issuer)
Set the user who launched the PDF export
|
private static void |
setRunning(boolean running) |
private static boolean _RUNNING
protected Context _environmentContext
protected ServiceManager _manager
protected SourceResolver _sourceResolver
protected I18nUtils _i18nUtils
protected File _catalogRootDirectory
protected boolean _initialized
protected Map<String,Object> _contextualParameters
public GeneratePDFEngine()
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 occurspublic void setContextualParameters(Map<String,Object> contextualParameters)
contextualParameters
- the contextual parameterspublic void setCatalog(String code)
code
- the codepublic void setIssuer(User issuer)
issuer
- the issuerprotected void _checkInitialization()
public static boolean isRunning()
private static void setRunning(boolean running)
protected void _dispose()
protected void _generatePDF(Request request) throws AmetysRepositoryException, IOException
request
- The requestAmetysRepositoryException
- if an error occurs.IOException
- if an I/O error occurs.protected void _doGeneratePDF(Request request) throws IOException
request
- the requestIOException
- if an I/O error occurs.protected String getLanguage()
protected void _sendMail(boolean error)
error
- true if the catalog wasn't generated successfully, false otherwise.protected String getMailSubject()
protected String getSuccessMailBody()
protected String getFailureMailBody()