1 package org.apache.maven.doxia.linkcheck;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23
24 import org.apache.maven.doxia.linkcheck.model.LinkcheckModel;
25
26 /**
27 * Tool to check links from html files in a given directory.
28 *
29 * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
30 * @version $Id: LinkCheck.java 709894 2008-11-02 16:42:06Z hboutemy $
31 */
32 public interface LinkCheck
33 {
34 /** Plexus Role */
35 String ROLE = LinkCheck.class.getName();
36
37 /**
38 * Set the base directory for the files to be linkchecked.
39 *
40 * @param base the base directory
41 */
42 void setBasedir( File base );
43
44 /**
45 * Sets the base URL. This is prepended to links that start with '/'.
46 *
47 * @param url the base URL.
48 */
49 void setBaseURL( String url );
50
51 /**
52 * Sets the excluded HTTP errors, i.e. <code>404</code>, a int[] with excluded errors.
53 *
54 * @param excl The excludes to set
55 * @see {@link HttpStatus} for all possible values.
56 */
57 void setExcludedHttpStatusErrors( int[] excl );
58
59 /**
60 * Sets the excluded HTTP warnings, i.e. <code>301</code>, a int[] with excluded errors.
61 *
62 * @param excl The excludes to set
63 * @see {@link HttpStatus} for all possible values.
64 */
65 void setExcludedHttpStatusWarnings( int[] excl );
66
67 /**
68 * Sets the excluded links, a String[] with excluded locations.
69 * Could contains a link, i.e. <code>http://maven.apache.org/</code>,
70 * or pattern links i.e. <code>http://maven.apache.org/**/*.html</code>
71 *
72 * @param excl The excludes to set
73 */
74 void setExcludedLinks( String[] excl );
75
76 /**
77 * Sets the excluded pages, a String[] with excluded locations.
78 *
79 * @param excl The excludes to set
80 */
81 void setExcludedPages( String[] excl );
82
83 /**
84 * Sets the http parameters bean.
85 *
86 * @param http parameters bean.
87 */
88 void setHttp( HttpBean http );
89
90 /**
91 * Sets the cache File.
92 *
93 * @param cacheFile The cacheFile to set. Set this to null to ignore storing the cache.
94 */
95 void setLinkCheckCache( File cacheFile );
96
97 /**
98 * Set the online mode.
99 *
100 * @param onLine online mode.
101 */
102 void setOnline( boolean onLine );
103
104 /**
105 * Set the output file for the results.
106 * If this is null, no output will be written.
107 *
108 * @param file the output file.
109 */
110 void setReportOutput( File file );
111
112 /**
113 * Sets the outputEncoding.
114 *
115 * @param encoding The outputEncoding to set.
116 */
117 void setReportOutputEncoding( String encoding );
118
119 /**
120 * Execute the link check. The basedir <b>should</b> be set before.
121 *
122 * @return the analysis in a <code>LinkCheck</code> model.
123 * @throws LinkCheckException if any
124 * @see #setBasedir(File)
125 */
126 LinkcheckModel execute()
127 throws LinkCheckException;
128
129 /**
130 * Set the encoding to use when processing files.
131 *
132 * @param encoding a valid encoding
133 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html">Supported encodings</a>
134 */
135 void setEncoding( String encoding );
136 }