Enterprise Information Portal APIs

com.ibm.gcs.component.config
Class Config

java.lang.Object
  |
  +--com.ibm.gcs.component.config.Config

public class Config
extends java.lang.Object

This represents the GCS configuration, with two sections: Globals and an array of Groups. It can be constructed directly from an XML config file. It is currently read-only for thread safety.

See Also:
Globals, Group

Constructor Summary
Config(java.lang.String configFileName)
          (constructor) loads the config from an XML file
Config(java.lang.String name, java.io.InputStream is)
          (constructor) loads the config from an input stream.
Config(java.lang.String configFileName, java.util.List seeds, java.util.List includePatterns)
          (constructor) loads the config from an XML file, and adds specified seeds and include patterns
 
Method Summary
 void addIncludePattern(java.lang.String pattern)
          adds an include pattern to the first CrawlPattern in the first Group of this Config
 void addSeed(java.lang.String seedURL)
          adds a seed URL to a CrawlPattern in this Config
 Globals getGlobals()
           
 Group getGroup(java.lang.String name)
           
 Group[] getGroups()
          returns an array of the group configs
 java.lang.String getName()
          Returns the name of this configuration.
 com.ibm.gcs.parsetools.ParseTreeModel getParseTree()
          returns the parse tree, which is the parsed XML document
static void main(java.lang.String[] args)
          Testing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config(java.lang.String configFileName)
       throws ConfigException
(constructor) loads the config from an XML file
Parameters:
configFileName - name of file from which the configuration is to be read
Throws:
ConfigException - when there is some problem parsing the configuration file

Config

public Config(java.lang.String configFileName,
              java.util.List seeds,
              java.util.List includePatterns)
       throws ConfigException
(constructor) loads the config from an XML file, and adds specified seeds and include patterns

Config

public Config(java.lang.String name,
              java.io.InputStream is)
       throws ConfigException
(constructor) loads the config from an input stream. Reads the stream according to encoding specified in the XML document or the default encoding if no encoding is specified.
Parameters:
is - The XML byte stream.
Throws:
ConfigException - when there is some problem parsing the configuration file
Method Detail

addSeed

public void addSeed(java.lang.String seedURL)
             throws ConfigException
adds a seed URL to a CrawlPattern in this Config

addIncludePattern

public void addIncludePattern(java.lang.String pattern)
                       throws ConfigException
adds an include pattern to the first CrawlPattern in the first Group of this Config

getName

public java.lang.String getName()
Returns the name of this configuration. Normally the file name of the configuration file.
Returns:
String The name of this configuration

getParseTree

public com.ibm.gcs.parsetools.ParseTreeModel getParseTree()
returns the parse tree, which is the parsed XML document
Returns:
a ParseTreeModel object

getGroups

public Group[] getGroups()
returns an array of the group configs

getGroup

public Group getGroup(java.lang.String name)
Returns:
a group by name

getGlobals

public Globals getGlobals()
Returns:
the globals config

main

public static void main(java.lang.String[] args)
Testing. Creates a Config from an xmlfile.

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.