1 | |
package org.jbehave.core.io.rest.mojo; |
2 | |
|
3 | |
import org.apache.maven.plugin.MojoExecutionException; |
4 | |
import org.apache.maven.plugin.MojoFailureException; |
5 | |
import org.jbehave.core.io.rest.ResourceExporter; |
6 | |
import org.jbehave.core.io.rest.ResourceIndexer; |
7 | |
import org.jbehave.core.io.rest.ResourceUploader; |
8 | |
import org.jbehave.core.io.rest.filesystem.ExportFromFilesystem; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | 0 | public class ExportFromFilesystemMojo extends AbstractFilesystemMojo { |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
String resourcesIncludes; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
String resourcesSyntax; |
33 | |
|
34 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
35 | |
try { |
36 | 0 | getLog().info( |
37 | |
"Exporting from filesystem resources to REST root URI " |
38 | |
+ restRootURI); |
39 | 0 | ResourceExporter exporter = createExporter(); |
40 | 0 | exporter.exportResources(restRootURI); |
41 | 0 | } catch (Exception e) { |
42 | 0 | String message = "Failed to export from filesystem resources to REST root URI " |
43 | |
+ restRootURI; |
44 | 0 | getLog().warn(message); |
45 | 0 | throw new MojoExecutionException(message, e); |
46 | 0 | } |
47 | 0 | } |
48 | |
|
49 | |
private ResourceExporter createExporter() { |
50 | 0 | ResourceIndexer indexer = newResourceIndexer(); |
51 | 0 | ResourceUploader uploader = newResourceUploader(); |
52 | 0 | getLog().info( |
53 | |
"Creating exporter from filesystem using REST provider " |
54 | |
+ restProvider + " with resourcesPath " + resourcesPath |
55 | |
+ ", resourcesExt " + resourcesExt + ", resourcesSyntax " |
56 | |
+ resourcesSyntax + " and resourcesIncludes " |
57 | |
+ resourcesIncludes); |
58 | 0 | return new ExportFromFilesystem(indexer, uploader, resourcesPath, |
59 | |
resourcesExt, resourcesSyntax, resourcesIncludes); |
60 | |
} |
61 | |
|
62 | |
} |