You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/02/03 15:13:57 UTC
cvs commit: jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck LinkCheckResult.java LinkCheck.java FileToCheck.java
bwalding 2003/02/03 06:13:54
Modified: src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation
LinkValidator.java LinkValidatorManager.java
MailtoLinkValidator.java LinkValidatorCache.java
LinkValidationItem.java HTTPLinkValidator.java
FileLinkValidator.java LinkValidationResult.java
src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck
LinkCheckResult.java LinkCheck.java
FileToCheck.java
Removed: src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation
ValidationResult.java
Log:
Coding conventions
Revision Changes Path
1.2 +57 -3 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidator.java
Index: LinkValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkValidator.java 30 Jan 2003 10:59:21 -0000 1.1
+++ LinkValidator.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,10 +1,64 @@
package org.apache.maven.linkcheck.validation;
-import java.io.File;
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
/**
- * @author Ben Walding
- *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public interface LinkValidator {
1.2 +4 -3 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorManager.java
Index: LinkValidatorManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkValidatorManager.java 30 Jan 2003 10:59:21 -0000 1.1
+++ LinkValidatorManager.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,8 +1,9 @@
package org.apache.maven.linkcheck.validation;
+
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,8 +68,8 @@
import org.apache.commons.logging.LogFactory;
/**
- * @author Ben Walding
- *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public class LinkValidatorManager {
1.2 +60 -2 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/MailtoLinkValidator.java
Index: MailtoLinkValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/MailtoLinkValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MailtoLinkValidator.java 30 Jan 2003 10:59:21 -0000 1.1
+++ MailtoLinkValidator.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,8 +1,66 @@
package org.apache.maven.linkcheck.validation;
-/**
- * @author Ben Walding
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
+ *
+ * Validates mailto links
*/
public class MailtoLinkValidator implements LinkValidator {
private static final LinkValidationResult LVR =
1.2 +3 -3 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorCache.java
Index: LinkValidatorCache.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorCache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkValidatorCache.java 30 Jan 2003 10:59:21 -0000 1.1
+++ LinkValidatorCache.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,8 +65,8 @@
import java.util.Properties;
/**
- * @author Ben Walding
- *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public class LinkValidatorCache {
private LinkValidatorManager lvm;
1.2 +59 -2 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidationItem.java
Index: LinkValidationItem.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidationItem.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkValidationItem.java 30 Jan 2003 10:59:21 -0000 1.1
+++ LinkValidationItem.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,9 +1,66 @@
package org.apache.maven.linkcheck.validation;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
import java.io.File;
/**
- * @author Ben Walding
- *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public class LinkValidationItem {
private File source;
1.2 +59 -2 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/HTTPLinkValidator.java
Index: HTTPLinkValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/HTTPLinkValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HTTPLinkValidator.java 30 Jan 2003 10:59:21 -0000 1.1
+++ HTTPLinkValidator.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,5 +1,61 @@
package org.apache.maven.linkcheck.validation;
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -9,8 +65,9 @@
import com.meterware.httpunit.WebResponse;
/**
- * @author Ben Walding
- *
+ * Checks links which are normal URLs
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public class HTTPLinkValidator implements LinkValidator {
/**
1.2 +65 -2 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/FileLinkValidator.java
Index: FileLinkValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/FileLinkValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileLinkValidator.java 30 Jan 2003 10:59:21 -0000 1.1
+++ FileLinkValidator.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,10 +1,68 @@
package org.apache.maven.linkcheck.validation;
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
import java.io.File;
/**
- * @author Ben Walding
- *
+ * A link validator solely for files on the local filesystem.
+ *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
public class FileLinkValidator implements LinkValidator {
private final static LinkValidationResult LVR_INVALID =
@@ -25,6 +83,11 @@
return LVR_INVALID;
}
+ /**
+ *
+ * @param lvi
+ * @return File
+ */
protected File getFile(LinkValidationItem lvi) {
String link = lvi.getLink();
if (link.indexOf('#') != -1) {
1.2 +58 -2 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidationResult.java
Index: LinkValidationResult.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidationResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkValidationResult.java 30 Jan 2003 10:59:21 -0000 1.1
+++ LinkValidationResult.java 3 Feb 2003 14:13:54 -0000 1.2
@@ -1,8 +1,64 @@
package org.apache.maven.linkcheck.validation;
-/**
- * @author Ben Walding
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
* <b>This is an immutable class.</b><br/>
* <p>
* This class is used to return status responses from the
1.3 +57 -50 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheckResult.java
Index: LinkCheckResult.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheckResult.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LinkCheckResult.java 30 Jan 2003 15:34:26 -0000 1.2
+++ LinkCheckResult.java 3 Feb 2003 14:13:54 -0000 1.3
@@ -1,11 +1,9 @@
package org.apache.maven.linkcheck;
-import org.apache.commons.util.XmlUtils;
-
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,55 +55,64 @@
*
* ====================================================================
*/
+
+import org.apache.commons.util.XmlUtils;
/**
- * @author Ben Walding
- *
+ * An class containing the results of a single check of a link.
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*/
-public class LinkCheckResult {
- private String status;
- private String target;
-
- /**
- * Returns the status.
- * @return String
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- * @param status The status to set
- */
- public void setStatus(String status) {
- this.status = status;
- }
-
- /**
- * Returns the target.
- * @return String
- */
- public String getTarget() {
- return target;
- }
-
- /**
- * Sets the target.
- * @param target The target to set
- */
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String toXML() {
- StringBuffer buf = new StringBuffer();
-
- buf.append(" <result>\n");
- buf.append(" <target>" + XmlUtils.escapeXml(getTarget()) + "</target>\n");
- buf.append(" <status>" + getStatus() + "</status>\n");
- buf.append(" </result>\n");
- return buf.toString();
- }
+public class LinkCheckResult
+{
+ private String status;
+ private String target;
+
+ /**
+ * Returns the status.
+ * @return String
+ */
+ public String getStatus()
+ {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ * @param status The status to set
+ */
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ /**
+ * Returns the target.
+ * @return String
+ */
+ public String getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * Sets the target.
+ * @param target The target to set
+ */
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ public String toXML()
+ {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(" <result>\n");
+ buf.append(" <target>" + XmlUtils.escapeXml(getTarget()) + "</target>\n");
+ buf.append(" <status>" + getStatus() + "</status>\n");
+ buf.append(" </result>\n");
+ return buf.toString();
+ }
}
1.3 +235 -214 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java
Index: LinkCheck.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LinkCheck.java 30 Jan 2003 15:34:26 -0000 1.2
+++ LinkCheck.java 3 Feb 2003 14:13:54 -0000 1.3
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,6 @@
* ====================================================================
*/
-// java imports
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
@@ -74,222 +73,244 @@
import org.apache.maven.linkcheck.validation.MailtoLinkValidator;
/**
- * Change log task. It uses a ChangeLogGenerator and ChangeLogParser to create
- * a Collection of ChangeLogEntry objects, which are used to produce an XML
- * output that represents the list of changes.
- *
- * @author <a href="mailto:ben@walding.com">Ben Walding</a>
+ * The main bean to be called whenever a set of documents should have
+ * their links checked.
+ *
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
* @version $Id$
*/
-public class LinkCheck {
- /** Log */
- private static final Log LOG = LogFactory.getLog(LinkCheck.class);
-
- /**
- * Output file for xml document
- */
- private File output;
-
- /** output encoding for the xml document */
- private String outputEncoding;
-
- private File baseDir;
- private String cache;
- private String exclude;
-
- /**
- * Set the base directory for the change log generator.
- * @param base the base directory
- */
- public void setBasedir(File base) {
- this.baseDir = base;
- }
-
- /**
- * Get the base directory for the change log generator.
- *
- * @return the base directory
- */
- public File getBasedir() {
- return baseDir;
- }
-
- /**
- * Set the output file for the log.
- * @param output the output file
- */
- public void setOutput(File output) {
- this.output = output;
- }
-
- /**
- * Execute task.
- * @throws FileNotFoundException if {@link ChangeLog#base} doesn't exist
- * @throws IOException if there are problems running CVS
- * @throws UnsupportedEncodingException if the underlying platform doesn't
- * support ISO-8859-1 encoding
- */
- List filesToCheck = null; //of FileToCheck
- public void doExecute() throws Exception {
- if (output == null) {
- throw new NullPointerException("output must be set");
- }
- LinkValidatorManager lvm = getLinkValidatorManager();
-
- filesToCheck = new ArrayList();
- lvm.loadCache(cache);
- List files = new ArrayList();
- findFiles(files, baseDir);
- Iterator fileIter = files.iterator();
- while (fileIter.hasNext()) {
- FileToCheck flc = (FileToCheck) fileIter.next();
- try {
- filesToCheck.add(flc);
- flc.check(lvm);
- } catch (Exception e) {
- e.printStackTrace();
- }
+public class LinkCheck
+{
+ /** Log */
+ private static final Log LOG = LogFactory.getLog(LinkCheck.class);
+
+ /**
+ * Output file for xml document
+ */
+ private File output;
+
+ /** output encoding for the xml document */
+ private String outputEncoding;
+
+ private File baseDir;
+ private String cache;
+ private String exclude;
+
+ /**
+ * Set the base directory for the change log generator.
+ * @param base the base directory
+ */
+ public void setBasedir(File base)
+ {
+ this.baseDir = base;
+ }
+
+ /**
+ * Get the base directory for the change log generator.
+ *
+ * @return the base directory
+ */
+ public File getBasedir()
+ {
+ return baseDir;
+ }
+
+ /**
+ * Set the output file for the log.
+ * @param output the output file
+ */
+ public void setOutput(File output)
+ {
+ this.output = output;
+ }
+
+ /**
+ * Execute task.
+ * @throws FileNotFoundException if {@link ChangeLog#base} doesn't exist
+ * @throws IOException if there are problems running CVS
+ * @throws UnsupportedEncodingException if the underlying platform doesn't
+ * support ISO-8859-1 encoding
+ */
+ List filesToCheck = null; //of FileToCheck
+ public void doExecute() throws Exception
+ {
+ if (output == null)
+ {
+ throw new NullPointerException("output must be set");
+ }
+ LinkValidatorManager lvm = getLinkValidatorManager();
+
+ filesToCheck = new ArrayList();
+ lvm.loadCache(cache);
+ List files = new ArrayList();
+ findFiles(files, baseDir);
+ Iterator fileIter = files.iterator();
+ while (fileIter.hasNext())
+ {
+ FileToCheck flc = (FileToCheck) fileIter.next();
+ try
+ {
+ filesToCheck.add(flc);
+ flc.check(lvm);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ createDocument(files);
+ lvm.saveCache(cache);
+ }
+
+ public List getFiles()
+ {
+ return filesToCheck;
+ }
+
+ public void findFiles(List allFiles, File base)
+ {
+ FilenameFilter ff = new FilenameFilter()
+ {
+ /**
+ * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
+ */
+ public boolean accept(File dir, String name)
+ {
+ File n = new File(dir, name);
+ if (n.isDirectory())
+ return true;
+
+ if (name.endsWith(".html"))
+ return true;
+
+ return false;
+ }
+ };
+
+ File[] f = base.listFiles(ff);
+
+ if (f != null)
+ {
+ for (int i = 0; i < f.length; i++)
+ {
+ File file = f[i];
+ if (file.isDirectory())
+ {
+ findFiles(allFiles, file);
}
-
- createDocument(files);
- lvm.saveCache(cache);
- }
-
- public List getFiles() {
- return filesToCheck;
- }
-
- public void findFiles(List allFiles, File base) {
- FilenameFilter ff = new FilenameFilter() {
- /**
- * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
- */
- public boolean accept(File dir, String name) {
- File n = new File(dir, name);
- if (n.isDirectory())
- return true;
-
- if (name.endsWith(".html"))
- return true;
-
- return false;
- }
- };
-
- File[] f = base.listFiles(ff);
-
- if (f != null) {
- for (int i = 0; i < f.length; i++) {
- File file = f[i];
- if (file.isDirectory()) {
- findFiles(allFiles, file);
- } else {
- allFiles.add(new FileToCheck(baseDir, file));
- }
- }
- }
- }
-
- /**
- * Create the XML document from the currently available details
- * @throws FileNotFoundException when the output file previously provided
- * does not exist
- * @throws UnsupportedEncodingException when the platform doesn't support
- * ISO-8859-1 encoding
- */
- private void createDocument(List files) throws Exception {
- PrintWriter out =
- new PrintWriter(
- new OutputStreamWriter(
- new FileOutputStream(output),
- getOutputEncoding()));
-
- StringBuffer buffer = new StringBuffer();
- buffer
- .append("<?xml version=\"1.0\" encoding=\"")
- .append(getOutputEncoding())
- .append("\" ?>\n");
-
- out.write(buffer.toString());
-
- out.write(toXML());
- out.close();
- }
-
- /**
- * Returns the outputEncoding.
- * @return String
- */
- public String getOutputEncoding() {
- return outputEncoding;
- }
-
- /**
- * Sets the outputEncoding.
- * @param outputEncoding The outputEncoding to set
- */
- public void setOutputEncoding(String outputEncoding) {
- this.outputEncoding = outputEncoding;
- }
-
- LinkValidatorManager lvm = null;
- public LinkValidatorManager getLinkValidatorManager() {
- if (lvm == null) {
- lvm = new LinkValidatorManager();
- lvm.setExclude(exclude);
- lvm.addLinkValidator(new FileLinkValidator());
- lvm.addLinkValidator(new HTTPLinkValidator());
- lvm.addLinkValidator(new MailtoLinkValidator());
- lvm.loadCache(cache);
+ else
+ {
+ allFiles.add(new FileToCheck(baseDir, file));
}
- return lvm;
- }
-
- /**
- * Returns the cacheFile.
- * @return String
- */
- public String getCache() {
- return cache;
+ }
}
+ }
- /**
- * Sets the cacheFile.
- * @param cacheFile The cacheFile to set
- */
- public void setCache(String cache) {
- this.cache = cache;
- }
-
- /**
- * Returns the exclude.
- * @return String
- */
- public String getExclude() {
- return exclude;
- }
-
- /**
- * Sets the exclude.
- * @param exclude The exclude to set
- */
- public void setExclude(String exclude) {
- this.exclude = exclude;
- }
-
- public String toXML() {
- StringBuffer buf = new StringBuffer();
-
- buf.append("<linkcheck>\n");
-
- //buf.append(" <files>\n");
- for (Iterator iter = getFiles().iterator(); iter.hasNext();) {
- FileToCheck ftc = (FileToCheck) iter.next();
- buf.append(ftc.toXML());
- }
- //buf.append(" </files>\n");
- buf.append("</linkcheck>\n");
- return buf.toString();
- }
+ /**
+ * Create the XML document from the currently available details
+ * @throws FileNotFoundException when the output file previously provided
+ * does not exist
+ * @throws UnsupportedEncodingException when the platform doesn't support
+ * ISO-8859-1 encoding
+ */
+ private void createDocument(List files) throws Exception
+ {
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output), getOutputEncoding()));
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<?xml version=\"1.0\" encoding=\"").append(getOutputEncoding()).append("\" ?>\n");
+
+ out.write(buffer.toString());
+
+ out.write(toXML());
+ out.close();
+ }
+
+ /**
+ * Returns the outputEncoding.
+ * @return String
+ */
+ public String getOutputEncoding()
+ {
+ return outputEncoding;
+ }
+
+ /**
+ * Sets the outputEncoding.
+ * @param outputEncoding The outputEncoding to set
+ */
+ public void setOutputEncoding(String outputEncoding)
+ {
+ this.outputEncoding = outputEncoding;
+ }
+
+ LinkValidatorManager lvm = null;
+ public LinkValidatorManager getLinkValidatorManager()
+ {
+ if (lvm == null)
+ {
+ lvm = new LinkValidatorManager();
+ lvm.setExclude(exclude);
+ lvm.addLinkValidator(new FileLinkValidator());
+ lvm.addLinkValidator(new HTTPLinkValidator());
+ lvm.addLinkValidator(new MailtoLinkValidator());
+ lvm.loadCache(cache);
+ }
+ return lvm;
+ }
+
+ /**
+ * Returns the cacheFile.
+ * @return String
+ */
+ public String getCache()
+ {
+ return cache;
+ }
+
+ /**
+ * Sets the cacheFile.
+ * @param cacheFile The cacheFile to set
+ */
+ public void setCache(String cache)
+ {
+ this.cache = cache;
+ }
+
+ /**
+ * Returns the exclude.
+ * @return String
+ */
+ public String getExclude()
+ {
+ return exclude;
+ }
+
+ /**
+ * Sets the exclude.
+ * @param exclude The exclude to set
+ */
+ public void setExclude(String exclude)
+ {
+ this.exclude = exclude;
+ }
+
+ public String toXML()
+ {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append("<linkcheck>\n");
+
+ //buf.append(" <files>\n");
+ for (Iterator iter = getFiles().iterator(); iter.hasNext();)
+ {
+ FileToCheck ftc = (FileToCheck) iter.next();
+ buf.append(ftc.toXML());
+ }
+ //buf.append(" </files>\n");
+ buf.append("</linkcheck>\n");
+ return buf.toString();
+ }
}
1.3 +172 -160 jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/FileToCheck.java
Index: FileToCheck.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/linkcheck/src/main/org/apache/maven/linkcheck/FileToCheck.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FileToCheck.java 30 Jan 2003 15:34:26 -0000 1.2
+++ FileToCheck.java 3 Feb 2003 14:13:54 -0000 1.3
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,172 +74,184 @@
import com.meterware.httpunit.WebResponse;
/**
- * @author Ben Walding
+ * @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @version $Id$
*
*/
-public class FileToCheck {
- private File base;
- private File f;
- private String status = STATUS_OK;
- private String message = "";
- private LinkCheck linkcheck;
- private int successful;
- private int unsuccessful;
-
- public static final String STATUS_UNKNOWN = null;
- public static final String STATUS_JTIDY_FAILURE = "Unable to tidy source";
- public static final String STATUS_OK = "OK";
-
- public FileToCheck(File base, File f) {
- this.base = base;
- this.f = f;
- }
-
- private List links = new ArrayList();
-
- public void check(LinkValidatorManager lvm) throws Exception {
- successful = 0;
- unsuccessful = 0;
- status = STATUS_OK;
- message = "";
-
- try {
- WebConversation wc = new WebConversation();
- WebRequest req = new GetMethodWebRequest(f.toURL().toString());
- WebResponse resp = wc.getResponse(req);
- WebLink[] wl = resp.getLinks();
- Map uniqueLinks = new HashMap();
- for (int i = 0;
- i < wl.length;
- i++) { //It puts the current URL in item 0
- WebLink link = wl[i];
- String href =
- link
- .getDOMSubtree()
- .getAttributes()
- .getNamedItem("href")
- .getNodeValue();
-
- uniqueLinks.put(href, href);
- }
-
- Iterator iter = uniqueLinks.keySet().iterator();
- while (iter.hasNext()) {
- String href = (String) iter.next();
-
- //System.out.println("Link Found: " + href);
-
- LinkCheckResult lcr = new LinkCheckResult();
-
- LinkValidationItem lvi = new LinkValidationItem(f, href);
- LinkValidationResult result = lvm.validateLink(lvi);
- lcr.setTarget(href);
-
- switch (result.getStatus()) {
- case LinkValidationResult.UNKNOWN :
- unsuccessful++;
- lcr.setStatus("UNKNOWN REF");
- break;
- case LinkValidationResult.VALID :
- successful++;
- lcr.setStatus("OK");
- break;
- case LinkValidationResult.INVALID :
- unsuccessful++;
- lcr.setStatus("NOT FOUND");
- break;
- }
-
- links.add(lcr);
- }
- } catch (Exception e) {
- message = e.toString();
- System.err.println(e.toString());
- throw (e);
-
+public class FileToCheck
+{
+ private File base;
+ private File f;
+ private String status = STATUS_OK;
+ private String message = "";
+ private LinkCheck linkcheck;
+ private int successful;
+ private int unsuccessful;
+
+ public static final String STATUS_UNKNOWN = null;
+ public static final String STATUS_JTIDY_FAILURE = "Unable to tidy source";
+ public static final String STATUS_OK = "OK";
+
+ public FileToCheck(File base, File f)
+ {
+ this.base = base;
+ this.f = f;
+ }
+
+ private List links = new ArrayList();
+
+ public void check(LinkValidatorManager lvm) throws Exception
+ {
+ successful = 0;
+ unsuccessful = 0;
+ status = STATUS_OK;
+ message = "";
+
+ try
+ {
+ WebConversation wc = new WebConversation();
+ WebRequest req = new GetMethodWebRequest(f.toURL().toString());
+ WebResponse resp = wc.getResponse(req);
+ WebLink[] wl = resp.getLinks();
+ Map uniqueLinks = new HashMap();
+ for (int i = 0; i < wl.length; i++)
+ { //It puts the current URL in item 0
+ WebLink link = wl[i];
+ String href = link.getDOMSubtree().getAttributes().getNamedItem("href").getNodeValue();
+
+ uniqueLinks.put(href, href);
+ }
+
+ Iterator iter = uniqueLinks.keySet().iterator();
+ while (iter.hasNext())
+ {
+ String href = (String) iter.next();
+
+ //System.out.println("Link Found: " + href);
+
+ LinkCheckResult lcr = new LinkCheckResult();
+
+ LinkValidationItem lvi = new LinkValidationItem(f, href);
+ LinkValidationResult result = lvm.validateLink(lvi);
+ lcr.setTarget(href);
+
+ switch (result.getStatus())
+ {
+ case LinkValidationResult.UNKNOWN :
+ unsuccessful++;
+ lcr.setStatus("UNKNOWN REF");
+ break;
+ case LinkValidationResult.VALID :
+ successful++;
+ lcr.setStatus("OK");
+ break;
+ case LinkValidationResult.INVALID :
+ unsuccessful++;
+ lcr.setStatus("NOT FOUND");
+ break;
}
- }
-
- /**
- * Returns the message.
- * @return String
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Returns the status.
- * @return int
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Sets the message.
- * @param message The message to set
- */
- public void setMessage(String message) {
- this.message = message;
- }
- /**
- * Sets the status.
- * @param status The status to set
- */
- public void setStatus(String status) {
- this.status = status;
+ links.add(lcr);
+ }
}
-
- public List getResults() {
- return links;
- }
-
- /**
- * Returns the successful.
- * @return int
- */
- public int getSuccessful() {
- return successful;
+ catch (Exception e)
+ {
+ message = e.toString();
+ System.err.println(e.toString());
+ throw (e);
+
+ }
+ }
+
+ /**
+ * Returns the message.
+ * @return String
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * Returns the status.
+ * @return int
+ */
+ public String getStatus()
+ {
+ return status;
+ }
+
+ /**
+ * Sets the message.
+ * @param message The message to set
+ */
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ /**
+ * Sets the status.
+ * @param status The status to set
+ */
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public List getResults()
+ {
+ return links;
+ }
+
+ /**
+ * Returns the successful.
+ * @return int
+ */
+ public int getSuccessful()
+ {
+ return successful;
+ }
+
+ /**
+ * Returns the unsuccessful.
+ * @return int
+ */
+ public int getUnsuccessful()
+ {
+ return unsuccessful;
+ }
+
+ public String getName()
+ {
+ String baseName = base.getAbsolutePath();
+ String fileName = f.getAbsolutePath();
+ if (fileName.startsWith(baseName))
+ fileName = fileName.substring(baseName.length() + 1);
+
+ fileName = fileName.replace('\\', '/');
+ return fileName;
+ }
+
+ public String toXML()
+ {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(" <file>\n");
+ buf.append(" <name>" + getName() + "</name>\n");
+ buf.append(" <successful>" + getSuccessful() + "</successful>\n");
+ buf.append(" <unsuccessful>" + getUnsuccessful() + "</unsuccessful>\n");
+
+ Iterator iter = getResults().iterator();
+ while (iter.hasNext())
+ {
+ LinkCheckResult result = (LinkCheckResult) iter.next();
+ buf.append(result.toXML());
}
- /**
- * Returns the unsuccessful.
- * @return int
- */
- public int getUnsuccessful() {
- return unsuccessful;
- }
-
- public String getName() {
- String baseName = base.getAbsolutePath();
- String fileName = f.getAbsolutePath();
- if (fileName.startsWith(baseName))
- fileName = fileName.substring(baseName.length() + 1);
+ buf.append(" </file>\n");
- fileName = fileName.replace('\\', '/');
- return fileName;
- }
-
- public String toXML() {
- StringBuffer buf = new StringBuffer();
-
- buf.append(" <file>\n");
- buf.append(" <name>" + getName() + "</name>\n");
- buf.append(" <successful>" + getSuccessful() + "</successful>\n");
- buf.append(" <unsuccessful>" + getUnsuccessful() + "</unsuccessful>\n");
-
- Iterator iter = getResults().iterator();
- while (iter.hasNext()) {
- LinkCheckResult result = (LinkCheckResult) iter.next();
- buf.append(result.toXML());
- }
-
-
- buf.append(" </file>\n");
-
- return buf.toString();
- }
+ return buf.toString();
+ }
}