Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 48619 invoked from network); 6 Oct 2003 14:42:11 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Oct 2003 14:42:11 -0000 Received: (qmail 27060 invoked by uid 500); 6 Oct 2003 14:41:52 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 27014 invoked by uid 500); 6 Oct 2003 14:41:52 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 26954 invoked by uid 500); 6 Oct 2003 14:41:51 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 26887 invoked from network); 6 Oct 2003 14:41:51 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 6 Oct 2003 14:41:51 -0000 Received: (qmail 48488 invoked by uid 1342); 6 Oct 2003 14:41:55 -0000 Date: 6 Oct 2003 14:41:55 -0000 Message-ID: <20031006144155.48487.qmail@minotaur.apache.org> From: vgritsenko@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/bean CocoonBean.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N vgritsenko 2003/10/06 07:41:55 Modified: src/java/org/apache/cocoon/bean CocoonBean.java Log: remove unused imports; fix javadoc. ;-P Revision Changes Path 1.33 +34 -39 cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java Index: CocoonBean.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/CocoonBean.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- CocoonBean.java 6 Oct 2003 12:40:14 -0000 1.32 +++ CocoonBean.java 6 Oct 2003 14:41:55 -0000 1.33 @@ -51,7 +51,6 @@ package org.apache.cocoon.bean; import org.apache.cocoon.Constants; -import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.bean.helpers.Crawler; import org.apache.cocoon.bean.helpers.DelayedOutputStream; @@ -68,20 +67,18 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; -import java.util.Map; import java.util.HashMap; import java.util.ArrayList; -import java.util.Collection; import java.util.Iterator; import java.util.List; /** - *

The Cocoon Bean simplifies usage of the Cocoon object. Allows to create, - * configure Cocoon instance and process requests, one by one or multiple + *

The Cocoon Bean simplifies usage of the Cocoon object. Allows to create, + * configure Cocoon instance and process requests, one by one or multiple * with link traversal.

* - *

WARNING: This interface is not stable and could be changed in - * backward incompatible way without prior notice.

+ *

WARNING: This interface is not stable and could be changed in + * backward incompatible way without prior notice.

* @author Stefano Mazzocchi * @author Nicola Ken Barozzi @@ -101,18 +98,18 @@ private List excludePatterns = new ArrayList(); private List includePatterns = new ArrayList(); private List includeLinkExtensions = null; - + // Internal Objects private boolean initialized; private List listeners = new ArrayList(); private boolean verbose; SourceResolver sourceResolver; - private Crawler crawler; + private Crawler crawler; public CocoonBean() { this.crawler = new Crawler(); } - + // // INITIALISATION METHOD // @@ -175,7 +172,7 @@ public boolean followLinks() { return followLinks; } - + public boolean confirmExtensions() { return confirmExtension; } @@ -244,7 +241,7 @@ boolean confirmExtension, String logger) throws IllegalArgumentException { - + Target target; if (root == null && type == null) { target = new Target(sourceURI, destURI); @@ -264,7 +261,7 @@ int preparedPattern[] = WildcardHelper.compilePattern(pattern); excludePatterns.add(preparedPattern); } - + public void addIncludePattern(String pattern) { int preparedPattern[] = WildcardHelper.compilePattern(pattern); includePatterns.add(preparedPattern); @@ -276,26 +273,26 @@ } includeLinkExtensions.add(extension); } - + public void addListener(BeanListener listener) { this.listeners.add(listener); } - public void pageGenerated(String sourceURI, - String destURI, - int pageSize, - int linksInPage, - int newLinksInPage, - int pagesRemaining, - int pagesComplete, + public void pageGenerated(String sourceURI, + String destURI, + int pageSize, + int linksInPage, + int newLinksInPage, + int pagesRemaining, + int pagesComplete, long timeTaken) { Iterator i = listeners.iterator(); while (i.hasNext()) { BeanListener l = (BeanListener) i.next(); - l.pageGenerated(sourceURI, - destURI, - pageSize, - linksInPage, + l.pageGenerated(sourceURI, + destURI, + pageSize, + linksInPage, newLinksInPage, pagesRemaining, pagesComplete, @@ -381,7 +378,7 @@ + crawler.getRemainingCount()); } } - + /** * Processes the given Target and return all links. * @@ -412,14 +409,12 @@ * * * @param target a Target target to process - * @return a Collection containing all links found, as - * Target objects. * @exception Exception if an error occurs */ private void processTarget(Crawler crawler, Target target) throws Exception { int status = 0; - + int linkCount = 0; int newLinkCount = 0; int pageSize = 0; @@ -460,7 +455,7 @@ if (!crawler.hasTranslatedLink(linkTarget)) { try { - final String mimeType = + final String mimeType = getType(linkTarget.getDeparameterizedSourceURI(), linkTarget.getParameters()); linkTarget.setMimeType(mimeType); crawler.addTranslatedLink(linkTarget); @@ -494,7 +489,7 @@ } else { gatheredLinks = null; } - + status = getPage( target.getDeparameterizedSourceURI(), @@ -547,8 +542,8 @@ output.setFileOutputStream(stream); output.flush(); output.close(); - pageGenerated(target.getSourceURI(), - target.getAuthlessDestURI(), + pageGenerated(target.getSourceURI(), + target.getAuthlessDestURI(), pageSize, linkCount, newLinkCount, @@ -580,7 +575,7 @@ if (brokenLinkGenerate) { //Why decode this URI now? //String brokenFile = NetUtils.decodePath(destinationURI); - + if (brokenLinkExtension != null) { target.setExtraExtension(brokenLinkExtension); } @@ -606,7 +601,7 @@ } } } - + public ModifiableSource getSource(Target target) throws IOException, ProcessingException { final String finalDestinationURI = target.getDestinationURI(); @@ -625,7 +620,7 @@ this.releaseSource(src); return lastModified; } - + public void releaseSource(Source source) { sourceResolver.release(source); } @@ -633,13 +628,13 @@ boolean included; Iterator i; HashMap map = new HashMap(); - + if (includePatterns.size() == 0) { included = true; } else { included = false; i = includePatterns.iterator(); - while (i.hasNext()){ + while (i.hasNext()){ int pattern[] = (int[])i.next(); if (WildcardHelper.match(map, uri, pattern)) { included=true;