001: package net.javacoding.jspider.mockobjects;
002:
003: import net.javacoding.jspider.api.model.Cookie;
004: import net.javacoding.jspider.api.model.Site;
005: import net.javacoding.jspider.core.Agent;
006: import net.javacoding.jspider.core.SpiderContext;
007: import net.javacoding.jspider.core.dispatch.EventDispatcher;
008: import net.javacoding.jspider.spi.Rule;
009: import net.javacoding.jspider.core.rule.Ruleset;
010: import net.javacoding.jspider.core.storage.Storage;
011:
012: import java.io.InputStream;
013: import java.net.*;
014:
015: /**
016: * Mock implementation of a SpiderContext.
017: *
018: * $Id: SimpleSpiderContext.java,v 1.14 2003/04/29 17:53:50 vanrogu Exp $
019: *
020: * @author Günther Van Roey
021: */
022: public class SimpleSpiderContext implements SpiderContext {
023:
024: protected URL baseUrl;
025:
026: public SimpleSpiderContext() throws MalformedURLException {
027: this (new URL("http://j-spider.sourceforge.net"));
028: }
029:
030: public SimpleSpiderContext(URL url) {
031: this .baseUrl = url;
032: }
033:
034: public void setCookies(Site site, Cookie[] cookies) {
035: }
036:
037: public void preHandle(URLConnection connection) {
038: }
039:
040: public void preHandle(URLConnection connection, Site site) {
041: }
042:
043: public void postHandle(URLConnection connection, Site site) {
044: }
045:
046: public Storage getStorage() {
047: return null;
048: }
049:
050: public Agent getAgent() {
051: return null;
052: }
053:
054: public void setAgent(Agent agent) {
055: }
056:
057: public URL getBaseURL() {
058: return baseUrl;
059: }
060:
061: public EventDispatcher getEventDispatcher() {
062: return null;
063: }
064:
065: public Ruleset getSiteSpiderRules(Site site) {
066: return null;
067: }
068:
069: public Ruleset getSiteParserRules(Site site) {
070: return null;
071: }
072:
073: public Rule getSiteRobotsTXTRule(Site site) {
074: return null;
075: }
076:
077: public Ruleset getGeneralSpiderRules() {
078: return null;
079: }
080:
081: public Ruleset getGeneralParserRules() {
082: return null;
083: }
084:
085: public Ruleset getSiteRules(Site site) {
086: return null;
087: }
088:
089: public void throttle(Site site) {
090: }
091:
092: public void registerRobotsTXT(Site site, InputStream inputStream) {
093: }
094:
095: public void registerRobotsTXTError(Site site) {
096: }
097:
098: public void registerRobotsTXTSkipped(Site site) {
099: }
100:
101: public void registerNewSite(Site site) {
102: }
103:
104: public boolean getUseProxy() {
105: return false;
106: }
107:
108: public String getUserAgent() {
109: return null;
110: }
111: }
|