Class ReportScriptingMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.reporting.AbstractMavenReport
-
- org.postgresql.pljava.pgxs.ReportScriptingMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,org.apache.maven.reporting.MavenMultiPageReport
,org.apache.maven.reporting.MavenReport
@Mojo(name="scripted-report") @Execute(phase=NONE) public class ReportScriptingMojo extends org.apache.maven.reporting.AbstractMavenReport
Maven plugin goal to use JavaScript for configuringMavenReport
during theLifecyclePhase.SITE
.This plugin goal intends to allow the use of JavaScript during
SITE
lifecycle phase with the help ofReportScript
. The motivation behind this is the inability to use Maven AntRun duringSITE
phase.
-
-
Field Summary
Fields Modifier and Type Field Description org.codehaus.plexus.configuration.PlexusConfiguration
script
The script to be used to produce the report, in the scripting language identified by itsmimetype
orengine
attribute.-
Fields inherited from class org.apache.maven.reporting.AbstractMavenReport
outputDirectory, project, siteRenderer
-
-
Constructor Summary
Constructors Constructor Description ReportScriptingMojo()
-
Method Summary
Modifier and Type Method Description boolean
canGenerateReport()
Returns true if a report can be generated, false otherwise.org.apache.maven.reporting.MavenReportException
exceptionWrap(Object object)
Wraps the input object in aMavenReportException
.protected void
executeReport(Locale locale)
String
getCategoryName()
Returns the category name of this report, used byMaven
to display the report under the correct inindex.html
.String
getDescription(Locale locale)
Returns the description of this report, used byMaven
to display report description inindex.html
.String
getInputEncoding()
String
getName(Locale locale)
Returns the name of this report used byMaven
for displaying inindex.html
.String
getOutputEncoding()
String
getOutputName()
Returns the path relative to the target site directory of the this report.org.apache.maven.project.MavenProject
getProject()
boolean
isExternalReport()
Returns false if this report will produce output through a suppliedSink
, true if it is 'external', producing its output some other way.-
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, execute, generate, generate, generate, getOutputDirectory, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, setReportOutputDirectory
-
-
-
-
Field Detail
-
script
@Parameter public org.codehaus.plexus.configuration.PlexusConfiguration script
The script to be used to produce the report, in the scripting language identified by itsmimetype
orengine
attribute.The scripting language must be supported by an engine that implements
Invocable
, and the script, when evaluated, must define functions that correspond to all of the abstract methods ofReportScript
, and any of the default methods that it wishes to override.
-
-
Method Detail
-
getOutputName
public String getOutputName()
Returns the path relative to the target site directory of the this report. This value will be used byMaven
to provide a link to the report fromindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun getOutputName(report)
defined in the JavaScript snippet associated with the report. No default implementation is provided. User must implement the method in JavaScript.
-
isExternalReport
public boolean isExternalReport()
Returns false if this report will produce output through a suppliedSink
, true if it is 'external', producing its output some other way.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun isExternalReport(report)
if defined in the javascript snippet associated with the report. Otherwise, thesuper
implementation is invoked effectively.- Specified by:
isExternalReport
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
isExternalReport
in classorg.apache.maven.reporting.AbstractMavenReport
-
getName
public String getName(Locale locale)
Returns the name of this report used byMaven
for displaying inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun getName(report, locale)
defined in the javascript snippet associated with the report. No default implementation is provided . User must implement the method in javascript.
-
getDescription
public String getDescription(Locale locale)
Returns the description of this report, used byMaven
to display report description inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun getDescription(report, locale)
defined in the javascript snippet associated with the report. No default implementation is provided . User must implement the method in javascript.
-
getCategoryName
public String getCategoryName()
Returns the category name of this report, used byMaven
to display the report under the correct inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun getCategoryName(report)
if defined in the javascript snippet associated with the report. Otherwise, thesuper
implementation is invoked effectively.- Specified by:
getCategoryName
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
getCategoryName
in classorg.apache.maven.reporting.AbstractMavenReport
-
canGenerateReport
public boolean canGenerateReport()
Returns true if a report can be generated, false otherwise.Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokesfun canGenerateReport(report)
if defined in the javascript snippet. Otherwise, thesuper
implementation is invoked effectively.- Specified by:
canGenerateReport
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
canGenerateReport
in classorg.apache.maven.reporting.AbstractMavenReport
-
executeReport
protected void executeReport(Locale locale) throws org.apache.maven.reporting.MavenReportException
Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokes thefun executeReport(report, locale)
with the instance of the current report.- Specified by:
executeReport
in classorg.apache.maven.reporting.AbstractMavenReport
- Throws:
org.apache.maven.reporting.MavenReportException
-
getProject
public org.apache.maven.project.MavenProject getProject()
- Overrides:
getProject
in classorg.apache.maven.reporting.AbstractMavenReport
-
getInputEncoding
public String getInputEncoding()
- Overrides:
getInputEncoding
in classorg.apache.maven.reporting.AbstractMavenReport
-
getOutputEncoding
public String getOutputEncoding()
- Overrides:
getOutputEncoding
in classorg.apache.maven.reporting.AbstractMavenReport
-
exceptionWrap
public org.apache.maven.reporting.MavenReportException exceptionWrap(Object object)
Wraps the input object in aMavenReportException
. The exception returned is constructed as follows: 1) Ifobject
is null, the exception message indicates the same. 2) Ifobject
is already aMavenReportException
, return it as is. 3) Ifobject
is any otherThrowable
, set it as the cause for the exception.MavenReportException
withobject
as its cause. 4) Ifobject
is aString
, set it as the message of the exception. 5) For all other case, the message of the exception is set in this format , Class Name of object: String representation of object.- Parameters:
object
- to wrap in MavenReportException- Returns:
- object wrapped inside a
MavenReportException
-
-