1 /*
2 * Copyright (c) 2007, Ounce Labs, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the <organization> nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY OUNCE LABS, INC. ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL OUNCE LABS, INC. BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 package org.codehaus.mojo.ounce.core;
28
29 import java.util.List;
30 import java.util.Map;
31
32 import org.apache.maven.plugin.logging.Log;
33 import org.codehaus.plexus.PlexusContainer;
34
35 /**
36 * @author <a href="mailto:brianf@apache.org">Brian Fox</a> This is the interface to define interaction between the
37 * ounce-maven-plugin and the ounce labs core code. Multiple implementations will be created for unit testing,
38 * integration testing and runtime.
39 */
40 public interface OunceCore
41 {
42 String ROLE = OunceCore.class.getName();
43
44 public PlexusContainer container = null;
45
46 /**
47 * Create an Ounce Application
48 *
49 * @param baseDir path of current project (where the file should be created)
50 * @param name Name of the application.
51 * @param applicationRoot Base folder used to calculate the relative location of the projects.
52 * @param projects List of paths to included projects.
53 * @param ounceOptions Extra options
54 * @param log Logger
55 * @throws OunceCoreException
56 */
57 void createApplication( String baseDir, String name, String applicationRoot, List projects, Map ounceOptions,
58 Log log )
59 throws OunceCoreException;
60
61 OunceCoreApplication readApplication( String path, Log log )
62 throws OunceCoreException;
63
64 /**
65 * Create an Ounce Project
66 *
67 * @param baseDir path of current project (where the file should be created)
68 * @param name Name of the project.
69 * @param projectRoot Base folder used to calculate the relative location of the source roots.
70 * @param sourceRoots List of source roots with includes and excludes (bean TBD)
71 * @param webRoot Location of the exploded war (null if not a war)
72 * @param classPath Classpath needed for compilation
73 * @param jdkName Name of JDK configuration known to Ounce Core
74 * @param compilerOptions Bean containing compiler options (based on maven-compiler-plugin options)
75 * @param packaging The packaging type of the current project.
76 * @param ounceOptions Extra Ounce options
77 * @param analyzeStrutsFramework Whether to analyze Struts framework
78 * @param importStrutsValidation Whether to import Struts validation routines
79 * @param log Logger
80 * @throws OunceCoreException
81 */
82 void createProject( String baseDir, String name, String projectRoot, List sourceRoots, String webRoot,
83 String classPath, String jdkName, String compilerOptions, String packaging, Map ounceOptions,
84 boolean analyzeStrutsFramework, boolean importStrutsValidation,
85 Log log )
86 throws OunceCoreException;
87
88 OunceCoreProject readProject( String path, Log log )
89 throws OunceCoreException;
90
91 /**
92 * Initiate a scan on the assessment server.
93 *
94 * @param applicationFile the application file to scan (if name is not used)
95 * @param assessmentName A name for the assessment.
96 * @param assessmentOutput The location to store the assessment results.
97 * @param caller A name to use for auditing purposes.
98 * @param reportType generate this type of report
99 * @param reportOutputType use this output type for the report
100 * @param reportOutputLocation output the report to this location
101 * @param publish automatically publish the results.
102 * @param ounceOptions Extra Ounce options
103 * @param installDir location of ounce client
104 * @param wait if the client should wait for the scan to complete before returning.
105 * @param log
106 * @throws OunceCoreException
107 */
108 void scan( String applicationFile, String assessmentName, String assessmentOutput, String caller,
109 String reportType, String reportOutputType, String reportOutputLocation, boolean publish,
110 Map ounceOptions, String installDir, boolean wait, Log log )
111 throws OunceCoreException;
112
113 /**
114 * Creates any required path variables.
115 *
116 * @param pathVariableMap
117 * @throws OunceCoreException
118 */
119 void createPathVariables( Map pathVariableMap, String installDir, Log log )
120 throws OunceCoreException;
121 }