You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/02/08 19:15:39 UTC
svn commit: r152682 [15/17] - in lenya/trunk/src: java/org/apache/lenya/ac/
java/org/apache/lenya/ac/cache/ java/org/apache/lenya/ac/file/
java/org/apache/lenya/ac/impl/ java/org/apache/lenya/ac/ldap/
java/org/apache/lenya/cms/ac/ java/org/apache/lenya/cms/ac/cocoon/
java/org/apache/lenya/cms/ac/usecase/ java/org/apache/lenya/cms/ac/usecases/
java/org/apache/lenya/cms/ac/workflow/ java/org/apache/lenya/cms/ant/
java/org/apache/lenya/cms/authoring/ java/org/apache/lenya/cms/cocoon/acting/
java/org/apache/lenya/cms/cocoon/bean/
java/org/apache/lenya/cms/cocoon/components/modules/input/
java/org/apache/lenya/cms/cocoon/flow/
java/org/apache/lenya/cms/cocoon/generation/
java/org/apache/lenya/cms/cocoon/matching/
java/org/apache/lenya/cms/cocoon/scheduler/
java/org/apache/lenya/cms/cocoon/source/
java/org/apache/lenya/cms/cocoon/task/
java/org/apache/lenya/cms/cocoon/transformation/
java/org/apache/lenya/cms/cocoon/uriparameterizer/
java/org/apache/lenya/cms/metadata/dublincore/
java/org/apache/lenya/cms/metadata/usecases/
java/org/apache/lenya/cms/publication/
java/org/apache/lenya/cms/publication/file/
java/org/apache/lenya/cms/publication/task/
java/org/apache/lenya/cms/publication/templating/
java/org/apache/lenya/cms/publication/util/
java/org/apache/lenya/cms/publishing/ java/org/apache/lenya/cms/rc/
java/org/apache/lenya/cms/scheduler/ java/org/apache/lenya/cms/scheduler/xml/
java/org/apache/lenya/cms/search/usecases/ java/org/apache/lenya/cms/site/
java/org/apache/lenya/cms/site/tree/
java/org/apache/lenya/cms/site/usecases/ java/org/apache/lenya/cms/task/
java/org/apache/lenya/cms/usecase/ java/org/apache/lenya/cms/workflow/
java/org/apache/lenya/lucene/ java/org/apache/lenya/lucene/html/
java/org/apache/lenya/lucene/index/ java/org/apache/lenya/lucene/parser/
java/org/apache/lenya/net/ java/org/apache/lenya/search/
java/org/apache/lenya/search/crawler/ java/org/apache/lenya/util/
java/org/apache/lenya/workflow/ java/org/apache/lenya/workflow/impl/
java/org/apache/lenya/xml/ test/org/apache/lenya/ac/file/
test/org/apache/lenya/ac/impl/ test/org/apache/lenya/cms/
test/org/apache/lenya/cms/authoring/
test/org/apache/lenya/cms/cocoon/generation/
test/org/apache/lenya/cms/publication/
test/org/apache/lenya/cms/publication/file/ test/org/apache/lenya/cms/rc/
test/org/apache/lenya/cms/site/tree/ test/org/apache/lenya/cms/task/
test/org/apache/lenya/cms/workflow/ test/org/apache/lenya/net/
Modified: lenya/trunk/src/java/org/apache/lenya/search/Grep.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/search/Grep.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/search/Grep.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/search/Grep.java Tue Feb 8 10:13:39 2005
@@ -21,10 +21,12 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.CharBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
+import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.ArrayList;
@@ -32,107 +34,120 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.log4j.Logger;
+
/**
* Utility class to provide a subset of the grep functionality.
*/
public class Grep {
+ private static final Logger log = Logger.getLogger(Grep.class);
- // Charset and decoder for ISO-8859-15
- private static Charset charset = Charset.forName("ISO-8859-15");
+ private static Charset charset = Charset.forName("UTF-8");
private static CharsetDecoder decoder = charset.newDecoder();
/**
* Check if the given file contains the pattern
- *
* @param file the file which is to be searched for the pattern
* @param pattern the pattern that is being searched.
- *
* @return true if the file contains the string, false otherwise.
- *
* @throws IOException
*/
- public static boolean containsPattern(File file, Pattern pattern)
- throws IOException {
-
- // Open the file and then get a channel from the stream
- FileInputStream fis = new FileInputStream(file);
- FileChannel fc = fis.getChannel();
-
- // Get the file's size and then map it into memory
- int sz = (int)fc.size();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
-
- // Decode the file into a char buffer
- CharBuffer cb = decoder.decode(bb);
-
- // Perform the search
- Matcher pm = pattern.matcher(cb); // Pattern matcher
-
- boolean result = pm.find();
-
- // Close the channel and the stream
- fc.close();
- fis.close();
+ public static boolean containsPattern(File file, Pattern pattern) throws IOException {
+ FileChannel fc = null;
+ // Open the file and then get a channel from the stream
+ FileInputStream fis = null;
+ boolean result = false;
+
+ try {
+ fis = new FileInputStream(file);
+ fc = fis.getChannel();
+
+ // Get the file's size and then map it into memory
+ int sz = (int)fc.size();
+ MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
+
+ // Decode the file into a char buffer
+ CharBuffer cb = decoder.decode(bb);
+
+ // Perform the search
+ Matcher pm = pattern.matcher(cb); // Pattern matcher
+
+ result = pm.find();
+ } catch (FileNotFoundException e) {
+ log.error("File not found: " +e.toString());
+ } catch (CharacterCodingException e) {
+ log.error("Problem with encoding: " +e.toString());
+ } catch (IOException e) {
+ log.error("IO Exception: " +e.toString());
+ } finally {
+ // Close the channel and the stream
+ if (fc != null)
+ fc.close();
+ if (fis != null)
+ fis.close();
+ }
return result;
}
/**
* Find all occurences of pattern in a file.
- *
* @param file the file to search for occurences of pattern
* @param pattern the pattern to search for
* @param group which group in the pattern to return
- *
* @return an <code>array</code> of occurences of pattern
* (i.e. the groupth group of the match)
- *
* @throws IOException if the file could not be read.
- *
*/
- public static String[] findPattern(File file, Pattern pattern, int group)
- throws IOException {
+ public static String[] findPattern(File file, Pattern pattern, int group) throws IOException {
ArrayList occurences = new ArrayList();
+ FileInputStream fis = null;
+ FileChannel fc = null;
- // Open the file and then get a channel from the stream
- FileInputStream fis = new FileInputStream(file);
- FileChannel fc = fis.getChannel();
-
- // Get the file's size and then map it into memory
- int sz = (int)fc.size();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
+ try {
+ // Open the file and then get a channel from the stream
+ fis = new FileInputStream(file);
+ fc = fis.getChannel();
+
+ // Get the file's size and then map it into memory
+ int sz = (int)fc.size();
+ MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
- // Decode the file into a char buffer
- CharBuffer cb = decoder.decode(bb);
+ // Decode the file into a char buffer
+ CharBuffer cb = decoder.decode(bb);
- // Perform the search
- Matcher pm = pattern.matcher(cb); // Pattern matcher
+ // Perform the search
+ Matcher pm = pattern.matcher(cb); // Pattern matcher
- while (pm.find()) {
- occurences.add(pm.group(group));
+ while (pm.find()) {
+ occurences.add(pm.group(group));
+ }
+ } catch (FileNotFoundException e) {
+ log.error("file not found " +e.toString());
+ } catch (CharacterCodingException e) {
+ log.error("encoding problem " +e.toString());
+ } catch (IOException e) {
+ log.error("IO exception" +e.toString());
+ } finally {
+ // Close the channel and the stream
+ if (fc != null)
+ fc.close();
+ if (fis != null)
+ fis.close();
}
-
- // Close the channel and the stream
- fc.close();
- fis.close();
-
return (String[])occurences.toArray(new String[occurences.size()]);
}
/**
* Find all files below the given file which contain the given pattern.
- *
* @param file the file where to start the search for the pattern.
* @param pattern the pattern to search for.
- *
* @return an array of files which contain the pattern
- *
* @throws IOException if any of the files could not be opened.
*/
- private static List find_internal(File file, Pattern pattern)
- throws IOException {
+ private static List find_internal(File file, Pattern pattern) throws IOException {
ArrayList fileList = new ArrayList();
if (file.isDirectory()) {
@@ -159,8 +174,7 @@
*
* @throws IOException if any of the files could not be opened.
*/
- public static File[] find(File file, String searchString)
- throws IOException {
+ public static File[] find(File file, String searchString) throws IOException {
Pattern pattern = Pattern.compile(searchString);
List fileList = find_internal(file, pattern);
return (File[])fileList.toArray(new File[fileList.size()]);
Modified: lenya/trunk/src/java/org/apache/lenya/search/crawler/ContentHandler.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/search/crawler/ContentHandler.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/search/crawler/ContentHandler.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/search/crawler/ContentHandler.java Tue Feb 8 10:13:39 2005
@@ -24,90 +24,78 @@
/**
- * DOCUMENT ME!
+ * Content handler interface
*/
public interface ContentHandler {
/**
* Return author
- *
- * @return DOCUMENT ME!
+ * @return The author
*/
String getAuthor();
/**
* Return categories (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The categories
*/
String getCategories();
/**
* Return contents
- *
- * @return DOCUMENT ME!
+ * @return The contents
*/
String getContents();
/**
* Return description (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The description
*/
String getDescription();
/**
* Return META HREF
- *
- * @return DOCUMENT ME!
+ * @return The META HREF
*/
String getHREF();
/**
* Return keywords (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The keywords
*/
String getKeywords();
/**
* Return links
- *
- * @return DOCUMENT ME!
+ * @return The links
*/
List getLinks();
/**
* Return published date (from META tag)
- *
- * @return DOCUMENT ME!
+ * @return The published date
*/
long getPublished();
/**
- * Return description (from META tags)
- *
- * @return DOCUMENT ME!
+ * Return Robot follow (from META tags)
+ * @return The robot follow
*/
boolean getRobotFollow();
/**
- * Return description (from META tags)
- *
- * @return DOCUMENT ME!
+ * Return Robot index (from META tags)
+ * @return The robot index
*/
boolean getRobotIndex();
/**
* Return page title
- *
- * @return DOCUMENT ME!
+ * @return The title
*/
String getTitle();
/**
* Parse Content.
- *
- * @param in DOCUMENT ME!
+ * @param in The Stream
*/
void parse(InputStream in);
}
Modified: lenya/trunk/src/java/org/apache/lenya/search/crawler/HTMLHandler.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/search/crawler/HTMLHandler.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/search/crawler/HTMLHandler.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/search/crawler/HTMLHandler.java Tue Feb 8 10:13:39 2005
@@ -36,7 +36,7 @@
/**
- * DOCUMENT ME!
+ * The HTML handler
*/
public final class HTMLHandler extends ParserCallback implements ContentHandler {
private static final char space = ' ';
@@ -67,29 +67,25 @@
* Constructor - initializes variables
*/
public HTMLHandler() {
- contents = new StringBuffer();
-
- links = new ArrayList();
-
- published = -1;
+ this.contents = new StringBuffer();
+ this.links = new ArrayList();
+ this.published = -1;
// 1996.07.10 15:08:56 PST
- dateFormatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
+ this.dateFormatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
}
/**
- * Parse Content. [24] 320:1
- *
- * @return DOCUMENT ME!
+ * Return the author
+ * @return The author
*/
public String getAuthor() {
- return author;
+ return this.author;
}
/**
* Return categories (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The categories
*/
public String getCategories() {
return this.categories;
@@ -97,8 +93,7 @@
/**
* Return contents
- *
- * @return DOCUMENT ME!
+ * @return The contents
*/
public String getContents() {
return this.contents.toString();
@@ -106,8 +101,7 @@
/**
* Return description (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The description
*/
public String getDescription() {
return this.description;
@@ -115,8 +109,7 @@
/**
* Return META HREF
- *
- * @return DOCUMENT ME!
+ * @return The Meta HREF
*/
public String getHREF() {
return this.href;
@@ -124,8 +117,7 @@
/**
* Return keywords (from META tags)
- *
- * @return DOCUMENT ME!
+ * @return The keywords
*/
public String getKeywords() {
return this.keywords;
@@ -133,17 +125,15 @@
/**
* Return links
- *
- * @return DOCUMENT ME!
+ * @return The links
*/
public List getLinks() {
- return links;
+ return this.links;
}
/**
* Return published date (from META tag)
- *
- * @return DOCUMENT ME!
+ * @return The published date
*/
public long getPublished() {
return this.published;
@@ -151,8 +141,7 @@
/**
* Return boolean true if links are to be followed
- *
- * @return DOCUMENT ME!
+ * @return Whether to follow links
*/
public boolean getRobotFollow() {
return this.robotFollow;
@@ -160,8 +149,7 @@
/**
* Return boolean true if this is to be indexed
- *
- * @return DOCUMENT ME!
+ * @return Whether to index
*/
public boolean getRobotIndex() {
return this.robotIndex;
@@ -169,8 +157,7 @@
/**
* Return page title
- *
- * @return DOCUMENT ME!
+ * @return The title
*/
public String getTitle() {
return this.title;
@@ -178,66 +165,58 @@
/**
* Handle Anchor <A HREF="~"></A> tags
- *
- * @param attribs DOCUMENT ME!
+ * @param attribs The list of attributes
*/
public void handleAnchor(MutableAttributeSet attribs) {
- String href = "";
+ String _href = "";
+ _href = (String) attribs.getAttribute(HTML.Attribute.HREF);
- href = (String) attribs.getAttribute(HTML.Attribute.HREF);
-
- if (href == null) {
+ if (_href == null) {
return;
}
- links.add(href);
-
- state = HREF;
+ this.links.add(_href);
+ this.state = HREF;
}
/**
- * Closing tag
+ * Handle the Closing tag
*
- * @param tag DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param tag The tag
+ * @param pos The position
*/
public void handleEndTag(Tag tag, int pos) {
- if (state == NONE) {
+ if (this.state == NONE) {
return;
}
// In order of precedence == > && > ||
- if ((state == TITLE) && tag.equals(HTML.Tag.TITLE)) {
- state = NONE;
-
+ if ((this.state == TITLE) && tag.equals(HTML.Tag.TITLE)) {
+ this.state = NONE;
return;
}
- if ((state == HREF) && tag.equals(HTML.Tag.A)) {
+ if ((this.state == HREF) && tag.equals(HTML.Tag.A)) {
//links.add(linktext);
- state = NONE;
-
+ this.state = NONE;
return;
}
- if ((state == SCRIPT) && tag.equals(HTML.Tag.SCRIPT)) {
- state = NONE;
-
+ if ((this.state == SCRIPT) && tag.equals(HTML.Tag.SCRIPT)) {
+ this.state = NONE;
return;
}
}
/**
* Handle META tags
- *
- * @param attribs DOCUMENT ME!
+ * @param attribs The set of attributes
*/
public void handleMeta(MutableAttributeSet attribs) {
String name = "";
String content = "";
name = (String) attribs.getAttribute(HTML.Attribute.NAME);
-
content = (String) attribs.getAttribute(HTML.Attribute.CONTENT);
if ((name == null) || (content == null)) {
@@ -247,66 +226,59 @@
name = name.toUpperCase(Locale.ENGLISH);
if (name.equals("DESCRIPTION")) {
- description = content;
-
+ this.description = content;
return;
}
if (name.equals("KEYWORDS")) {
- keywords = content;
-
+ this.keywords = content;
return;
}
if (name.equals("CATEGORIES")) {
- categories = content;
-
+ this.categories = content;
return;
}
if (name.equals("PUBLISHED")) {
try {
- published = dateFormatter.parse(content).getTime();
+ this.published = this.dateFormatter.parse(content).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
-
return;
}
if (name.equals("HREF")) {
- href = content;
-
+ this.href = content;
return;
}
if (name.equals("AUTHOR")) {
- author = content;
-
+ this.author = content;
return;
}
if (name.equals("ROBOTS")) {
if (content.indexOf("noindex") != -1) {
- robotIndex = false;
+ this.robotIndex = false;
}
if (content.indexOf("nofollow") != -1) {
- robotFollow = false;
+ this.robotFollow = false;
}
- author = content;
-
+ this.author = content;
return;
}
}
/**
- * Handle standalone tags
+ * Handle standalone tag
*
- * @param tag DOCUMENT ME!
- * @param attribs DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param tag The tag
+ * @param attribs The set of attributes
+ * @param pos The position
*/
public void handleSimpleTag(Tag tag, MutableAttributeSet attribs, int pos) {
if (tag.equals(HTML.Tag.META)) {
@@ -315,45 +287,42 @@
}
/**
- * Opening tag
+ * Handle Opening tag
*
- * @param tag DOCUMENT ME!
- * @param attribs DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param tag The tag
+ * @param attribs The set of attributes
+ * @param pos The position
*/
public void handleStartTag(Tag tag, MutableAttributeSet attribs, int pos) {
if (tag.equals(HTML.Tag.TITLE)) {
- state = TITLE;
+ this.state = TITLE;
} else if (tag.equals(HTML.Tag.A)) {
handleAnchor(attribs);
} else if (tag.equals(HTML.Tag.SCRIPT)) {
- state = SCRIPT;
+ this.state = SCRIPT;
}
}
/**
* Handle page text
*
- * @param text DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param text The text
+ * @param pos The position
*/
public void handleText(char[] text, int pos) {
- switch (state) {
+ switch (this.state) {
case NONE:
- contents.append(text);
- contents.append(space);
-
+ this.contents.append(text);
+ this.contents.append(space);
break;
case TITLE:
- title = new String(text);
-
+ this.title = new String(text);
break;
case HREF:
- contents.append(text);
- contents.append(space);
-
+ this.contents.append(text);
+ this.contents.append(space);
//linktext = new String(text);
break;
}
@@ -361,8 +330,7 @@
/**
* Parse Content.
- *
- * @param in DOCUMENT ME!
+ * @param in The input stream to parse
*/
public void parse(InputStream in) {
try {
@@ -375,32 +343,20 @@
}
/**
- * Return contents
+ * Reset private fields holding content
*/
private void reset() {
- title = null;
-
- description = null;
-
- keywords = null;
-
- categories = null;
-
- href = null;
-
- author = null;
-
- contents.setLength(0);
-
- links = new ArrayList();
-
- published = -1;
-
- // Robot Instructions
- robotIndex = true;
-
- robotFollow = true;
-
- state = NONE;
+ this.title = null;
+ this.description = null;
+ this.keywords = null;
+ this.categories = null;
+ this.href = null;
+ this.author = null;
+ this.contents.setLength(0);
+ this.links = new ArrayList();
+ this.published = -1;
+ this.robotIndex = true;
+ this.robotFollow = true;
+ this.state = NONE;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/search/crawler/IterativeHTMLCrawler.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/search/crawler/IterativeHTMLCrawler.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/search/crawler/IterativeHTMLCrawler.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/search/crawler/IterativeHTMLCrawler.java Tue Feb 8 10:13:39 2005
@@ -20,26 +20,32 @@
package org.apache.lenya.search.crawler;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
+import java.util.List;
import java.util.StringTokenizer;
+import java.util.TreeSet;
import websphinx.RobotExclusion;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
/**
* Crawl iteratively
*/
public class IterativeHTMLCrawler implements Configurable {
- static Category log = Category.getInstance(IterativeHTMLCrawler.class);
+ private static final Logger log = Logger.getLogger(IterativeHTMLCrawler.class);
java.util.Vector urlsToCrawl;
java.util.TreeSet urlsToCrawlLowerCase;
@@ -56,7 +62,6 @@
/**
* Command line interface
- *
* @param args Configuration file crawler.xconf
*/
public void main(String[] args) {
@@ -68,15 +73,15 @@
try {
if (args.length == 1) {
- configurationFilePath = args[0];
+ this.configurationFilePath = args[0];
try {
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- Configuration configuration = builder.buildFromFile(configurationFilePath);
+ Configuration configuration = builder.buildFromFile(this.configurationFilePath);
configure(configuration);
} catch (Exception e) {
System.err.println("Cannot load crawler configuration!");
}
- new IterativeHTMLCrawler(new File(args[0])).crawl(new URL(baseURL), scopeURL[0]);
+ new IterativeHTMLCrawler(new File(args[0])).crawl(new URL(this.baseURL), this.scopeURL[0]);
} else {
System.err.println("Usage: IterativeHTMLCrawler crawler.xconf");
}
@@ -86,14 +91,12 @@
}
/**
- * DOCUMENT ME!
- *
- * @param configuration DOCUMENT ME!
- *
- * @throws org.apache.avalon.framework.configuration.ConfigurationException DOCUMENT ME!
+ * Configuration of the IterativeHTMLCrawler
+ * @param configuration The configuration
+ * @throws ConfigurationException if an error occurs
*/
- public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
- throws org.apache.avalon.framework.configuration.ConfigurationException {
+ public void configure(Configuration configuration)
+ throws ConfigurationException {
this.baseURL = configuration.getChild("base-url").getAttribute("href");
this.scopeURL[0] = configuration.getChild("scope-url").getAttribute("href");
@@ -106,21 +109,18 @@
/**
* Creates a new IterativeHTMLCrawler object.
- *
- * @param uriList File where all dumped files will be listed
- * @param htdocsDumpDir Directory where htdocs should be dumped
- * @param userAgent User-agent for robots.txt
- */
- public IterativeHTMLCrawler(String uriList, String htdocsDumpDir, String userAgent) {
- this.uriList = uriList;
- this.htdocsDumpDir = htdocsDumpDir;
-
- robot = new RobotExclusion(userAgent);
+ * @param _uriList File where all dumped files will be listed
+ * @param _htdocsDumpDir Directory where htdocs should be dumped
+ * @param _userAgent User-agent for robots.txt
+ */
+ public IterativeHTMLCrawler(String _uriList, String _htdocsDumpDir, String _userAgent) {
+ this.uriList = _uriList;
+ this.htdocsDumpDir = _htdocsDumpDir;
+ this.robot = new RobotExclusion(_userAgent);
}
/**
* Creates a new IterativeHTMLCrawler object.
- *
* @param config Configuration File
*/
public IterativeHTMLCrawler(File config) {
@@ -132,29 +132,28 @@
System.err.println("Cannot load crawler configuration! ");
}
- robot = new RobotExclusion(this.userAgent);
+ this.robot = new RobotExclusion(this.userAgent);
if (this.robotsFile != null && this.robotsDomain != null) {
log.debug(this.robotsFile + " " + this.robotsDomain);
- robot.addLocalEntries(robotsDomain, new File(robotsFile));
+ this.robot.addLocalEntries(this.robotsDomain, new File(this.robotsFile));
}
}
/**
* Crawl
- *
* @param start Start crawling at this URL
* @param scope Limit crawling to this scope
*/
public void crawl(URL start, String scope) {
- scopeURL = new String[1];
- scopeURL[0] = scope;
+ this.scopeURL = new String[1];
+ this.scopeURL[0] = scope;
String seedURL = start.toString();
this.rootURL = seedURL.substring(0, seedURL.indexOf("/", 8));
- urlsToCrawl = new java.util.Vector();
- urlsToCrawlLowerCase = new java.util.TreeSet();
+ this.urlsToCrawl = new java.util.Vector();
+ this.urlsToCrawlLowerCase = new java.util.TreeSet();
String currentURLPath = start.toString().substring(0, start.toString().lastIndexOf("/"));
@@ -172,11 +171,11 @@
int currentPosition = 0;
- while (currentPosition < urlsToCrawl.size()) {
- URL currentURL = (URL) urlsToCrawl.elementAt(currentPosition);
+ while (currentPosition < this.urlsToCrawl.size()) {
+ URL currentURL = (URL) this.urlsToCrawl.elementAt(currentPosition);
currentURLPath = currentURL.toString().substring(0, currentURL.toString().lastIndexOf("/"));
- log.info("INFO: Current Array Size: " + urlsToCrawl.size() + ", Current Position: " + currentPosition + ", Current URL: " + currentURL.toString());
+ log.info("INFO: Current Array Size: " + this.urlsToCrawl.size() + ", Current Position: " + currentPosition + ", Current URL: " + currentURL.toString());
java.util.List urlsWithinPage = parsePage(currentURL.toString());
@@ -193,7 +192,7 @@
if ((urlToCrawl = addURL(urlCandidate, currentURLPath)) != null) {
dumpHTDoc(urlToCrawl);
}
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
log.warn("" + e + " " + urlCandidate);
}
}
@@ -202,84 +201,74 @@
currentPosition = currentPosition + 1;
}
- log.info("Stop crawling at: " + urlsToCrawl.elementAt(urlsToCrawl.size()-1));
-
-
+ log.info("Stop crawling at: " + this.urlsToCrawl.elementAt(this.urlsToCrawl.size()-1));
// Write all crawled URLs into file
try {
- File parent = new File(new File(uriList).getParent());
+ File parent = new File(new File(this.uriList).getParent());
if (!parent.isDirectory()) {
parent.mkdirs();
log.warn("Directory has been created: " + parent);
}
- java.io.PrintWriter out = new java.io.PrintWriter(new FileOutputStream(uriList));
+ PrintWriter out = new PrintWriter(new FileOutputStream(this.uriList));
- for (int i = 0; i < urlsToCrawl.size(); i++) {
- out.println("" + urlsToCrawl.elementAt(i));
+ for (int i = 0; i < this.urlsToCrawl.size(); i++) {
+ out.println("" + this.urlsToCrawl.elementAt(i));
}
out.close();
- } catch (java.io.FileNotFoundException e) {
+ } catch (final FileNotFoundException e) {
log.error("" + e);
}
}
/**
* Add URLs to crawl
- *
- * @param urlCandidate DOCUMENT ME!
- * @param currentURLPath DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws MalformedURLException DOCUMENT ME!
+ * @param urlCandidate URL to add
+ * @param currentURLPath The current URL path
+ * @return Added URL
+ * @throws MalformedURLException if the URL is invalid
*/
public URL addURL(String urlCandidate, String currentURLPath)
throws MalformedURLException {
URL url = new URL(parseHREF(urlCandidate, urlCandidate.toLowerCase(Locale.ENGLISH), currentURLPath));
//completeURL(currentURL,urlCandidate) new URL(currentURLPath+"/"+urlCandidate);
- if (filterURL(urlCandidate, currentURLPath, urlsToCrawlLowerCase)) {
- if (!robot.disallowed(url)) {
+ if (filterURL(urlCandidate, currentURLPath, this.urlsToCrawlLowerCase)) {
+ if (!this.robot.disallowed(url)) {
if (url.getQuery() == null) {
- urlsToCrawl.add(url);
- urlsToCrawlLowerCase.add(url.toString().toLowerCase());
+ this.urlsToCrawl.add(url);
+ this.urlsToCrawlLowerCase.add(url.toString().toLowerCase(Locale.ENGLISH));
log.debug("URL added: " + url);
} else {
log.info("Don't crawl URLs with query string: " + url);
}
return url;
- } else {
- log.info("Disallowed by robots.txt: " + urlCandidate);
}
+ log.info("Disallowed by robots.txt: " + urlCandidate);
}
return null;
}
/**
- * DOCUMENT ME!
- *
- * @param urlString DOCUMENT ME!
- *
- * @return ok, 404
+ * Parse a URL
+ * @param urlString URL to parse
+ * @return ok if the parse succeeded, or an error message if it did not
+ * FIXME why does this return null?
*/
- public java.util.List parsePage(String urlString) {
+ public List parsePage(String urlString) {
String status = "ok";
try {
URL currentURL = new java.net.URL(urlString);
- String currentURLPath = urlString.substring(0, urlString.lastIndexOf("/"));
HttpURLConnection httpCon = (HttpURLConnection) currentURL.openConnection();
httpCon.setRequestProperty("User-Agent", "Lenya Lucene Crawler");
httpCon.connect();
- long lastModified = httpCon.getLastModified();
-
if (httpCon.getResponseCode() == HttpURLConnection.HTTP_OK) {
String contentType = httpCon.getContentType();
@@ -310,22 +299,17 @@
}
/**
- * DOCUMENT ME!
- *
- * @param httpCon DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws java.io.IOException DOCUMENT ME!
+ * Returns a list of links for a HTTP connection
+ * @param httpCon The HTTP connection
+ * @return The list of links
+ * @throws IOException if an IO error occurs
*/
- public static java.util.List handleHTML(HttpURLConnection httpCon)
- throws java.io.IOException {
+ public static List handleHTML(HttpURLConnection httpCon) throws IOException {
ContentHandler handler = new HTMLHandler();
handler.parse(httpCon.getInputStream());
if (handler.getRobotFollow()) {
- java.util.List links = handler.getLinks();
-
+ List links = handler.getLinks();
return links;
}
@@ -334,30 +318,27 @@
/**
* Parse PDF for links
- *
- * @param httpCon DOCUMENT ME!
+ * @param httpCon The HTTP connection
*/
public void handlePDF(HttpURLConnection httpCon) {
log.debug(".handlePDF(): Not handled yet!");
}
/**
- * DOCUMENT ME!
- *
- * @param url DOCUMENT ME!
- * @param currentURLPath DOCUMENT ME!
- * @param links DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Checks if a URL is in the crawling scope
+ * @param url The URL
+ * @param currentURLPath The current URL path
+ * @param links The list of known links
+ * @return whether the URL is in the crawling scope
*/
- public boolean filterURL(String url, String currentURLPath, java.util.TreeSet links) {
+ public boolean filterURL(String url, String currentURLPath, TreeSet links) {
String urlLowCase = url.toLowerCase(Locale.ENGLISH);
if (!(urlLowCase.startsWith("http://") || urlLowCase.startsWith("https://"))) {
url = parseHREF(url, urlLowCase, currentURLPath);
if (url != null) {
- urlLowCase = url.toLowerCase();
+ urlLowCase = url.toLowerCase(Locale.ENGLISH);
}
}
@@ -374,11 +355,9 @@
/**
* Parse URL and complete if necessary
- *
* @param url URL from href
* @param urlLowCase url is lower case
* @param currentURLPath URL of current page
- *
* @return Completed URL
*/
public String parseHREF(String url, String urlLowCase, String currentURLPath) {
@@ -388,7 +367,7 @@
// Looks for incomplete URL and completes them
if (urlLowCase.startsWith("/")) {
- url = rootURL + url;
+ url = this.rootURL + url;
} else if (urlLowCase.startsWith("./")) {
url = currentURLPath + url.substring(1, url.length());
} else if (urlLowCase.startsWith("../")) {
@@ -446,15 +425,13 @@
}
/**
- * DOCUMENT ME!
- *
- * @param url DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Checks if a URL is in the crawling scope
+ * @param url The URL
+ * @return whether the URL is in the crawling scope
*/
public boolean inScope(String url) {
- for (int i = 0; i < scopeURL.length; i++) {
- if (url.startsWith(scopeURL[i])) {
+ for (int i = 0; i < this.scopeURL.length; i++) {
+ if (url.startsWith(this.scopeURL[i])) {
return true;
}
}
@@ -463,28 +440,25 @@
}
/**
- * DOCUMENT ME!
- *
- * @param parent DOCUMENT ME!
- * @param child DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws MalformedURLException DOCUMENT ME!
+ * Returns the complete URL for a child
+ * @param parent The parent URL
+ * @param child The child
+ * @return The complete URL
+ * @throws MalformedURLException if the URL was not valid
+ * FIXME this looks wrong
*/
public URL completeURL(URL parent, String child) throws MalformedURLException {
return parent;
}
/**
- * DOCUMENT ME!
- *
- * @param url DOCUMENT ME!
+ * Dumps the content of a URL to the dump directory
+ * @param url The URL
*/
public void dumpHTDoc(URL url) {
String ext = getExtension(url);
- String filename = htdocsDumpDir + url.getFile();
+ String filename = this.htdocsDumpDir + url.getFile();
File file = new File(filename);
if (filename.charAt(filename.length() - 1) == '/') {
@@ -493,6 +467,7 @@
}
if (ext.equals("html") || ext.equals("htm") || ext.equals("txt") || ext.equals("pdf")) {
+
try {
File parent = new File(file.getParent());
@@ -503,7 +478,7 @@
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
java.io.InputStream in = httpConnection.getInputStream();
- FileOutputStream out = new FileOutputStream(file);
+ FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[1024];
int bytesRead = -1;
while ((bytesRead = in.read(buffer)) >= 0) {
@@ -512,28 +487,32 @@
out.close();
/*
- BufferedInputStream bin = new BufferedInputStream(in);
- BufferedReader reader = new BufferedReader(new InputStreamReader(bin));
+ BufferedInputStream bin = new BufferedInputStream(in);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(bin));
- java.io.FileWriter fw = new java.io.FileWriter(file);
- int i;
+ java.io.FileWriter fw = new java.io.FileWriter(file);
+ int i;
- while ((i = reader.read()) != -1) {
- fw.write(i);
- }
+ while ((i = reader.read()) != -1) {
+ fw.write(i);
+ }
- fw.close();
+ fw.close();
- bin.close();
+ bin.close();
*/
in.close();
httpConnection.disconnect();
log.info("URL dumped: " + url + " (" + file + ")");
- } catch (Exception e) {
+ } catch (final FileNotFoundException e) {
+ log.error("" + e);
+ log.error("URL not dumped: " + url);
+ } catch (final IOException e) {
log.error("" + e);
log.error("URL not dumped: " + url);
}
+
} else {
log.info("URL not dumped: " + url);
}
@@ -565,22 +544,18 @@
*/
/**
- * DOCUMENT ME!
- *
- * @param url DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the extension of a URL
+ * @param url The URL
+ * @return The extension
*/
public String getExtension(URL url) {
return getExtension(new File(url.getPath()));
}
/**
- * DOCUMENT ME!
- *
- * @param file DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the extension of a file
+ * @param file The file
+ * @return The extension
*/
public String getExtension(File file) {
StringTokenizer st = new StringTokenizer(file.getPath(), ".");
Modified: lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java Tue Feb 8 10:13:39 2005
@@ -24,22 +24,22 @@
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
/**
* A map with a maximum capacity. When the map is full, the oldest entry is removed.
*/
public class CacheMap extends HashMap {
- private static final Category log = Category.getInstance(CacheMap.class);
+ private static final Logger log = Logger.getLogger(CacheMap.class);
/**
* Ctor.
- * @param capacity The maximum number of entries.
+ * @param _capacity The maximum number of entries.
*/
- public CacheMap(int capacity) {
- assert capacity > -1;
- this.capacity = capacity;
+ public CacheMap(int _capacity) {
+ assert _capacity > -1;
+ this.capacity = _capacity;
}
private int capacity;
@@ -50,18 +50,16 @@
*/
public Object put(Object key, Object value) {
- if (size() == capacity) {
- Object oldestKey = timeToKey.get(timeToKey.firstKey());
+ if (size() == this.capacity) {
+ Object oldestKey = this.timeToKey.get(this.timeToKey.firstKey());
remove(oldestKey);
if (log.isDebugEnabled()) {
log.debug("Clearing cache");
}
}
- timeToKey.put(new Date(), key);
+ this.timeToKey.put(new Date(), key);
return super.put(key, value);
}
-
-
/**
* @see java.util.Map#get(java.lang.Object)
Modified: lenya/trunk/src/java/org/apache/lenya/util/HTML.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/HTML.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/HTML.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/HTML.java Tue Feb 8 10:13:39 2005
@@ -38,22 +38,19 @@
HTMLHandler htmlHandler;
/**
- * Creates a new HTML object.
- *
- * @param uri DOCUMENT ME!
- *
- * @throws IOException DOCUMENT ME!
+ * Creates a new HTML object from a URI
+ * @param uri The URI
+ * @throws IOException if a IO error occurs
*/
public HTML(String uri) throws IOException {
ParserDelegator pd = new ParserDelegator();
- htmlHandler = new HTMLHandler();
- pd.parse(getReader(uri), htmlHandler, true);
+ this.htmlHandler = new HTMLHandler();
+ pd.parse(getReader(uri), this.htmlHandler, true);
}
/**
- * DOCUMENT ME!
- *
- * @param args DOCUMENT ME!
+ * Command line interface
+ * @param args Command line args
*/
public static void main(String[] args) {
if (args.length != 1) {
@@ -97,48 +94,39 @@
}
/**
- * DOCUMENT ME!
- *
- * @param duplicate DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get Anchor Hrefs
+ * @param duplicate Whether you want duplicate HREFS
+ * @return A list of Hrefs
*/
public List getAnchorHRefs(boolean duplicate) {
if (duplicate) {
- return htmlHandler.getAllAHRefs();
- } else {
- return htmlHandler.getAHRefs();
+ return this.htmlHandler.getAllAHRefs();
}
+ return this.htmlHandler.getAHRefs();
}
/**
- * DOCUMENT ME!
- *
- * @param duplicate DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get Link hrefs
+ * @param duplicate Whether you want duplicate Hrefs
+ * @return A list of Hrefs
*/
public List getLinkHRefs(boolean duplicate) {
if (duplicate) {
- return htmlHandler.getAllLinkHRefs();
- } else {
- return htmlHandler.getLinkHRefs();
+ return this.htmlHandler.getAllLinkHRefs();
}
+ return this.htmlHandler.getLinkHRefs();
}
/**
- * DOCUMENT ME!
- *
- * @param duplicate DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get Image src attributes
+ * @param duplicate Whether you want duplicates
+ * @return A list of src Attributes
*/
public List getImageSrcs(boolean duplicate) {
if (duplicate) {
- return htmlHandler.getAllImageSrcs();
- } else {
- return htmlHandler.getImageSrcs();
+ return this.htmlHandler.getAllImageSrcs();
}
+ return this.htmlHandler.getImageSrcs();
}
private Reader getReader(String uri) throws IOException {
@@ -147,9 +135,8 @@
URLConnection connection = new URL(uri).openConnection();
return new InputStreamReader(connection.getInputStream());
- } else {
- // uri is file
- return new FileReader(uri);
}
+ // uri is file
+ return new FileReader(uri);
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/HTMLHandler.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/HTMLHandler.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/HTMLHandler.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/HTMLHandler.java Tue Feb 8 10:13:39 2005
@@ -26,14 +26,14 @@
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLEditorKit.ParserCallback;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
/**
- * DOCUMENT ME!
+ * HTML handler class
*/
public class HTMLHandler extends ParserCallback {
- Category log = Category.getInstance(HTMLHandler.class);
+ private static final Logger log = Logger.getLogger(HTMLHandler.class);
private ArrayList img_src;
private ArrayList img_src_all;
private ArrayList a_href;
@@ -45,51 +45,51 @@
* Creates a new HTMLHandler object.
*/
public HTMLHandler() {
- img_src_all = new ArrayList();
- img_src = new ArrayList();
- a_href_all = new ArrayList();
- a_href = new ArrayList();
- link_href_all = new ArrayList();
- link_href = new ArrayList();
+ this.img_src_all = new ArrayList();
+ this.img_src = new ArrayList();
+ this.a_href_all = new ArrayList();
+ this.a_href = new ArrayList();
+ this.link_href_all = new ArrayList();
+ this.link_href = new ArrayList();
}
/**
- * DOCUMENT ME!
+ * Handle the start tag
*
- * @param tag DOCUMENT ME!
- * @param attributes DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param tag The tag
+ * @param attributes The set of attributes
+ * @param pos The position
*/
public void handleStartTag(Tag tag, MutableAttributeSet attributes, int pos) {
if (tag.equals(HTML.Tag.A)) {
String href = (String) attributes.getAttribute(HTML.Attribute.HREF);
if (href != null) {
- a_href_all.add(href);
+ this.a_href_all.add(href);
- if (!a_href.contains(href)) {
- a_href.add(href);
+ if (!this.a_href.contains(href)) {
+ this.a_href.add(href);
}
}
}
}
/**
- * DOCUMENT ME!
+ * Handle a simple tag
*
- * @param tag DOCUMENT ME!
- * @param attributes DOCUMENT ME!
- * @param pos DOCUMENT ME!
+ * @param tag The tag
+ * @param attributes The set of attributes
+ * @param pos The position
*/
public void handleSimpleTag(Tag tag, MutableAttributeSet attributes, int pos) {
if (tag.equals(HTML.Tag.IMG)) {
String src = (String) attributes.getAttribute(HTML.Attribute.SRC);
if (src != null) {
- img_src_all.add(src);
+ this.img_src_all.add(src);
- if (!img_src.contains(src)) {
- img_src.add(src);
+ if (!this.img_src.contains(src)) {
+ this.img_src.add(src);
}
}
}
@@ -98,66 +98,60 @@
String href = (String) attributes.getAttribute(HTML.Attribute.HREF);
if (href != null) {
- link_href_all.add(href);
+ this.link_href_all.add(href);
- if (!link_href.contains(href)) {
- link_href.add(href);
+ if (!this.link_href.contains(href)) {
+ this.link_href.add(href);
}
}
}
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get the list of src attributes for images
+ * @return The list of src attributes
*/
public ArrayList getImageSrcs() {
- return img_src;
+ return this.img_src;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get the list of src attributes for all images
+ * @return The list of src attributes
*/
public ArrayList getAllImageSrcs() {
- return img_src_all;
+ return this.img_src_all;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get a list of links
+ * @return The list of links
*/
public ArrayList getLinkHRefs() {
- return link_href;
+ return this.link_href;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get a list of all links
+ * @return The list of links
*/
public ArrayList getAllLinkHRefs() {
- return link_href_all;
+ return this.link_href_all;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get a list of a href=
+ * @return The list of a href
*/
public ArrayList getAHRefs() {
- return a_href;
+ return this.a_href;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Get a list of all a href=
+ * @return The list of a href
*/
public ArrayList getAllAHRefs() {
- return a_href_all;
+ return this.a_href_all;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/Log4Echo.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/Log4Echo.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/Log4Echo.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/Log4Echo.java Tue Feb 8 10:13:39 2005
@@ -21,23 +21,22 @@
import java.util.Locale;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
/**
- * Can be used within shell scripts resp. batch files
+ * Can be used within shell scripts or batch files
*/
public class Log4Echo {
- private static Category log = Category.getInstance(Log4Echo.class);
+ private static Logger log = Logger.getLogger(Log4Echo.class);
/**
* main
- *
- * @param args DOCUMENT ME!
+ * @param args command line args
*/
public static void main(String[] args) {
if (args.length != 2) {
- System.err.println("Usage: java " + new Log4Echo().getClass().getName() + "log-level log-message");
+ System.err.println("Usage: java Log4Echo log-level log-message");
return;
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/NamespaceMap.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/NamespaceMap.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/NamespaceMap.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/NamespaceMap.java Tue Feb 8 10:13:39 2005
@@ -33,26 +33,29 @@
* through the mapper.
*/
public class NamespaceMap {
+ /**
+ * <code>SEPARATOR</code> The seperator character
+ */
public static final String SEPARATOR = ".";
private Map map;
private String prefix;
/**
* Creates a new NamespaceMap object.
- * @param prefix The prefix.
+ * @param _prefix The prefix.
*/
- public NamespaceMap(String prefix) {
- this(new HashMap(), prefix);
+ public NamespaceMap(String _prefix) {
+ this(new HashMap(), _prefix);
}
/**
* Creates a new NamespaceMap.
- * @param map A map containing the prefixed key-value-pairs.
- * @param prefix The prefix.
+ * @param _map A map containing the prefixed key-value-pairs.
+ * @param _prefix The prefix.
*/
- public NamespaceMap(Map map, String prefix) {
- this.map = map;
- this.prefix = prefix;
+ public NamespaceMap(Map _map, String _prefix) {
+ this.map = _map;
+ this.prefix = _prefix;
}
/**
@@ -60,7 +63,7 @@
* @return A string.
*/
public String getPrefix() {
- return prefix;
+ return this.prefix;
}
/**
@@ -68,7 +71,7 @@
* @return The namespace prefix.
*/
protected Map getMapObject() {
- return map;
+ return this.map;
}
/**
@@ -135,12 +138,12 @@
/**
* Puts all prefixed key-value-pairs of map into this map.
- * @param map A map.
+ * @param _map A map.
*/
- public void putAll(Map map) {
- for (Iterator i = map.keySet().iterator(); i.hasNext(); ) {
+ public void putAll(Map _map) {
+ for (Iterator i = _map.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
- put(key, map.get(key));
+ put(key, _map.get(key));
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/RegexFilter.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/RegexFilter.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/RegexFilter.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/RegexFilter.java Tue Feb 8 10:13:39 2005
@@ -32,14 +32,13 @@
/**
* constructor
- *
- * @param pattern Regex pattern applied to simple filename
+ * @param _pattern Regex pattern applied to simple filename
*/
- public RegexFilter(String pattern)
+ public RegexFilter(String _pattern)
{
- if (pattern != null)
+ if (_pattern != null)
{
- this.pattern = Pattern.compile(pattern);
+ this.pattern = Pattern.compile(_pattern);
}
}
@@ -55,7 +54,7 @@
{
if (!(new File(dir, name).isFile())) return false;
- if (pattern != null && !(pattern.matcher(name).matches())) return false;
+ if (this.pattern != null && !(this.pattern.matcher(name).matches())) return false;
return true;
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/SED.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/SED.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/SED.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/SED.java Tue Feb 8 10:13:39 2005
@@ -32,63 +32,64 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
/**
- * Similar to the UNIX sed
+ * Performs pattern substitution similar to the UNIX sed
*/
public class SED {
- static Category log = Category.getInstance(SED.class);
-
- /**
- * Command Line Interface
- *
- * @param args DOCUMENT ME!
- */
- public static void main(String[] args) {
- if (args.length == 0) {
- System.out.println("Usage: org.apache.lenya.util.SED");
- return;
- }
- }
+ private static final Logger log = Logger.getLogger(SED.class);
/**
* Substitute prefix, e.g. ".*world.*" by "universe"
- *
* @param file File which sed shall be applied
- * @param prefixSubstitute Prefix which shall be replaced
+ * @param substitute Prefix which shall be replaced
* @param substituteReplacement Prefix which is going to replace the original
- *
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an IO error occurs
*/
public static void replaceAll(File file, String substitute, String substituteReplacement) throws IOException {
- log.debug("Replace " + substitute + " by " + substituteReplacement);
-
+ PrintStream ps = null;
+ FileOutputStream fos = null;
+ FileInputStream fis = null;
+ FileChannel fc = null;
+
+ log.debug("Replace " + substitute + " by " + substituteReplacement);
+
Pattern pattern = Pattern.compile(substitute);
+
+ try {
- // Open the file and then get a channel from the stream
- FileInputStream fis = new FileInputStream(file);
- FileChannel fc = fis.getChannel();
-
- // Get the file's size and then map it into memory
- int sz = (int)fc.size();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
-
- // Decode the file into a char buffer
- // Charset and decoder for ISO-8859-15
- Charset charset = Charset.forName("ISO-8859-15");
- CharsetDecoder decoder = charset.newDecoder();
- CharBuffer cb = decoder.decode(bb);
-
- Matcher matcher = pattern.matcher(cb);
- String outString = matcher.replaceAll(substituteReplacement);
- log.debug(outString);
-
-
- FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
- PrintStream ps =new PrintStream(fos);
- ps.print(outString);
- ps.close();
- fos.close();
+ // Open the file and then get a channel from the stream
+ fis = new FileInputStream(file);
+ fc = fis.getChannel();
+
+ // Get the file's size and then map it into memory
+ int sz = (int)fc.size();
+ MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
+
+ // Decode the file into a char buffer
+ Charset charset = Charset.forName("UTF-8");
+ CharsetDecoder decoder = charset.newDecoder();
+ CharBuffer cb = decoder.decode(bb);
+
+ Matcher matcher = pattern.matcher(cb);
+ String outString = matcher.replaceAll(substituteReplacement);
+ log.debug(outString);
+
+ fos = new FileOutputStream(file.getAbsolutePath());
+ ps =new PrintStream(fos);
+ ps.print(outString);
+ } catch(final IOException e) {
+ log.error("SED caught exception: " + e.toString());
+ } finally {
+ if (ps != null)
+ ps.close();
+ if (fc != null)
+ fc.close();
+ if (fis != null)
+ fis.close();
+ if (fos != null)
+ fos.close();
+ }
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/ServletHelper.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/ServletHelper.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/ServletHelper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/ServletHelper.java Tue Feb 8 10:13:39 2005
@@ -34,7 +34,7 @@
* Ctor.
*/
private ServletHelper() {
-
+ // do nothing
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/util/Stack.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/Stack.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/Stack.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/Stack.java Tue Feb 8 10:13:39 2005
@@ -23,7 +23,7 @@
/**
- * DOCUMENT ME!
+ * A helper class to implement a stack
*/
// FIXME: this class seems pretty useless. Why not remove it?
@@ -32,31 +32,21 @@
/**
* Creates a new Stack object.
- *
- * @param maxsize DOCUMENT ME!
+ * @param _maxsize The maximum size of the stack
*/
- public Stack(int maxsize) {
- this.maxsize = maxsize;
+ public Stack(int _maxsize) {
+ this.maxsize = _maxsize;
}
/**
- * DOCUMENT ME!
- *
- * @param args DOCUMENT ME!
- */
- public static void main(String[] args) {
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param object DOCUMENT ME!
+ * Push an object on the stack
+ * @param object The object
*/
public void push(Object object) {
insertElementAt(object, 0);
- if (size() == (maxsize + 1)) {
- removeElementAt(maxsize);
+ if (size() == (this.maxsize + 1)) {
+ removeElementAt(this.maxsize);
}
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/util/TidyCommandLine.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/TidyCommandLine.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/TidyCommandLine.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/TidyCommandLine.java Tue Feb 8 10:13:39 2005
@@ -30,19 +30,16 @@
/**
- * DOCUMENT ME!
+ * A commend line interface to Tidy
*/
public class TidyCommandLine {
/**
- * DOCUMENT ME!
- *
- * @param args DOCUMENT ME!
+ * Command line interface
+ * @param args command line args
*/
public static void main(String[] args) {
if (args.length != 3) {
- System.err.println("Usage: java " + new TidyCommandLine().getClass().getName() +
- " http://www.lenya.org index.xhtml error.log");
-
+ System.err.println("Usage: java TidyCommandLine http://www.lenya.org index.xhtml error.log");
return;
}
@@ -54,14 +51,12 @@
}
/**
- * DOCUMENT ME!
- *
- * @param url DOCUMENT ME!
- * @param file DOCUMENT ME!
- * @param err DOCUMENT ME!
- * @param xhtml DOCUMENT ME!
- *
- * @throws Exception DOCUMENT ME!
+ * Tidy the given URL and store it into a file
+ * @param url The URL
+ * @param file The file
+ * @param err The file to hold error messages
+ * @param xhtml Whether to produce XHTML
+ * @throws Exception if an error occurs
*/
public void tidy(URL url, File file, File err, boolean xhtml)
throws Exception {
Modified: lenya/trunk/src/java/org/apache/lenya/util/URLUtil.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/util/URLUtil.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/URLUtil.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/URLUtil.java Tue Feb 8 10:13:39 2005
@@ -23,28 +23,15 @@
/**
- * DOCUMENT ME!
+ * URL utility class
*/
public class URLUtil {
- /**
- * DOCUMENT ME!
- *
- * @param args DOCUMENT ME!
- */
- public static void main(String[] args) {
- System.out.println(URLUtil.complete("http://www.apache.org/download/index.html",
- "../images/lenya.jpeg"));
- System.out.println(URLUtil.complete("http://www.apache.org/download/index.html",
- "/images/lenya.jpeg"));
- }
/**
- * DOCUMENT ME!
- *
- * @param parent DOCUMENT ME!
- * @param child DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns a complete URL from the partial URLs passed in
+ * @param parent The parent part
+ * @param child The child part
+ * @return The complete URL
*/
public static String complete(String parent, String child) {
String url = child;
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java Tue Feb 8 10:13:39 2005
@@ -24,4 +24,5 @@
* Boolean variable assignment.
*/
public interface BooleanVariableAssignment extends Action {
+ // do nothing
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/Situation.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/Situation.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/Situation.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/Situation.java Tue Feb 8 10:13:39 2005
@@ -24,4 +24,5 @@
* workflow transitions can fire at a certain moment.
*/
public interface Situation {
+ // do nothing
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/State.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/State.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/State.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/State.java Tue Feb 8 10:13:39 2005
@@ -23,4 +23,5 @@
* Workflow state.
*/
public interface State {
+ // do nothing
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/SynchronizedWorkflowInstances.java Tue Feb 8 10:13:39 2005
@@ -52,12 +52,18 @@
/**
* Returns all executable events.
+ * @param situation The situation
+ * @return The events
+ * @throws WorkflowException if an error occurs
* @see org.apache.lenya.workflow.WorkflowInstance#getExecutableEvents(org.apache.lenya.workflow.Situation)
*/
String[] getExecutableEvents(Situation situation) throws WorkflowException;
/**
* Invokes an event on all documents.
+ * @param situation The Situation
+ * @param event The event
+ * @throws WorkflowException if an error occurs
* @see org.apache.lenya.workflow.WorkflowInstance#invoke(org.apache.lenya.workflow.Situation, String)
*/
void invoke(Situation situation, String event) throws WorkflowException;
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/Transition.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/Transition.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/Transition.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/Transition.java Tue Feb 8 10:13:39 2005
@@ -42,24 +42,20 @@
/**
* Returns the event of this transition.
- *
* @return the event
*/
Event getEvent();
/**
* Returns the actions of this transition.
- *
* @return the actions
*/
Action[] getActions();
/**
* Returns if the transition can fire in a certain situation.
- *
* @param situation the situation for which the query is requested.
* @param instance The workflow instance to invoke the transition on.
- *
* @return true if the transition can fire in the given situation.
* @throws WorkflowException when an error occurs.
*/
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/Workflow.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/Workflow.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/Workflow.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/Workflow.java Tue Feb 8 10:13:39 2005
@@ -31,7 +31,13 @@
* <li>state variables.</li>
*/
public interface Workflow {
+ /**
+ * <code>NAMESPACE</code> Workflow namespace URI
+ */
String NAMESPACE = "http://apache.org/cocoon/lenya/workflow/1.0";
+ /**
+ * <code>DEFAULT_PREFIX</code> Default workflow namespace prefix
+ */
String DEFAULT_PREFIX = "wf";
/**
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java Tue Feb 8 10:13:39 2005
@@ -25,7 +25,7 @@
*/
public class WorkflowException extends Exception {
/**
- *
+ * Constructor
*/
public WorkflowException() {
super();
@@ -33,7 +33,6 @@
/**
* Create a WorkflowException.
- *
* @param message The message.
*/
public WorkflowException(String message) {
@@ -42,7 +41,6 @@
/**
* Create a WorkflowException.
- *
* @param message The message.
* @param cause The cause.
*/
@@ -52,7 +50,6 @@
/**
* Create a WorkflowException.
- *
* @param cause The cause.
*/
public WorkflowException(Throwable cause) {
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowInstance.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowInstance.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowInstance.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/WorkflowInstance.java Tue Feb 8 10:13:39 2005
@@ -35,7 +35,6 @@
/**
* Returns the current state of this WorkflowInstance.
- *
* @return the current state
*/
State getCurrentState();
@@ -57,7 +56,6 @@
/**
* Indicates that the user invoked an event.
- *
* @param situation The situation in which the event was invoked.
* @param event The event that was invoked.
* @throws WorkflowException if the event cannot be invoked in this situation.
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/AbstractCondition.java Tue Feb 8 10:13:39 2005
@@ -33,8 +33,8 @@
/**
* @see org.apache.lenya.workflow.impl.AbstractCondition#setExpression(java.lang.String)
*/
- public void setExpression(String expression) throws WorkflowException {
- this.expression = expression.trim();
+ public void setExpression(String ex) throws WorkflowException {
+ this.expression = ex.trim();
}
/**
@@ -42,7 +42,7 @@
* @return A string.
*/
public String getExpression() {
- return expression;
+ return this.expression;
}
/**
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/ActionImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/ActionImpl.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/ActionImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/ActionImpl.java Tue Feb 8 10:13:39 2005
@@ -34,7 +34,7 @@
* @param actionId The action ID.
*/
protected ActionImpl(String actionId) {
- id = actionId;
+ this.id = actionId;
}
private String id;
@@ -44,7 +44,7 @@
* @return A string.
*/
public String getId() {
- return id;
+ return this.id;
}
/**
@@ -58,5 +58,6 @@
* @see org.apache.lenya.workflow.Action#execute(org.apache.lenya.workflow.WorkflowInstance)
*/
public void execute(WorkflowInstance instance) throws WorkflowException {
+ // do nothing
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java Tue Feb 8 10:13:39 2005
@@ -31,13 +31,12 @@
/**
* Ctor.
- * @param variable The variable.
- * @param value The value.
+ * @param _variable The variable.
+ * @param _value The value.
*/
- protected BooleanVariableAssignmentImpl(BooleanVariableImpl variable, boolean value) {
- this.variable = variable;
-
- this.value = value;
+ protected BooleanVariableAssignmentImpl(BooleanVariableImpl _variable, boolean _value) {
+ this.variable = _variable;
+ this.value = _value;
}
private BooleanVariableImpl variable;
@@ -56,7 +55,7 @@
* @return A boolean value.
*/
public boolean getValue() {
- return value;
+ return this.value;
}
/**
@@ -64,6 +63,6 @@
* @return A variable.
*/
public BooleanVariableImpl getVariable() {
- return variable;
+ return this.variable;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableCondition.java Tue Feb 8 10:13:39 2005
@@ -36,7 +36,7 @@
* @return A boolean value.
*/
protected boolean getValue() {
- return value;
+ return this.value;
}
/**
@@ -44,7 +44,7 @@
* @return A string.
*/
protected String getVariableName() {
- return variableName;
+ return this.variableName;
}
/**
@@ -58,12 +58,12 @@
"The expression '" + expression + "' must be of the form 'name = [true|false]'");
}
- variableName = sides[0].trim();
- value = Boolean.valueOf(sides[1].trim()).booleanValue();
+ this.variableName = sides[0].trim();
+ this.value = Boolean.valueOf(sides[1].trim()).booleanValue();
if (getLogger().isDebugEnabled()) {
getLogger().debug("Expression: [" + sides[1].trim() + "]");
- getLogger().debug("Setting value: [" + value + "]");
+ getLogger().debug("Setting value: [" + this.value + "]");
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java Tue Feb 8 10:13:39 2005
@@ -30,12 +30,11 @@
/**
* Creates a new instance of BooleanVariableImpl.
* @param variableName The variable name.
- * @param initialValue The initial value of the corresponding variable instances.
+ * @param _initialValue The initial value of the corresponding variable instances.
*/
- protected BooleanVariableImpl(String variableName, boolean initialValue) {
- name = variableName;
-
- this.initialValue = initialValue;
+ protected BooleanVariableImpl(String variableName, boolean _initialValue) {
+ this.name = variableName;
+ this.initialValue = _initialValue;
}
private String name;
@@ -44,7 +43,7 @@
* @see org.apache.lenya.workflow.BooleanVariable#getName()
*/
public String getName() {
- return name;
+ return this.name;
}
private boolean initialValue;
@@ -53,6 +52,6 @@
* @see org.apache.lenya.workflow.BooleanVariable#getInitialValue()
*/
public boolean getInitialValue() {
- return initialValue;
+ return this.initialValue;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/BooleanVariableInstanceImpl.java Tue Feb 8 10:13:39 2005
@@ -30,19 +30,20 @@
/** Creates a new instance of BooleanVariableInstanceImpl */
protected BooleanVariableInstanceImpl() {
+ // do nothing
}
/**
* @see org.apache.lenya.workflow.BooleanVariableInstance#getValue()
*/
public boolean getValue() {
- return value;
+ return this.value;
}
/**
* @see org.apache.lenya.workflow.BooleanVariableInstance#setValue(boolean)
*/
public void setValue(boolean variableValue) {
- value = variableValue;
+ this.value = variableValue;
}
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/EventImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/EventImpl.java?view=diff&r1=152681&r2=152682
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/EventImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/EventImpl.java Tue Feb 8 10:13:39 2005
@@ -32,7 +32,7 @@
* @param eventName The event name.
*/
protected EventImpl(String eventName) {
- name = eventName;
+ this.name = eventName;
}
private String name;
@@ -45,7 +45,7 @@
return getName();
}
- /* (non-Javadoc)
+ /**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object otherObject) {
@@ -61,8 +61,8 @@
return equals;
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
+ /**
+ * @see java.lang.Object#hashCode
*/
public int hashCode() {
return getName().hashCode();
@@ -72,6 +72,6 @@
* @see org.apache.lenya.workflow.Event#getName()
*/
public String getName() {
- return name;
+ return this.name;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org