com.google.enterprise.adaptor
Class Config

java.lang.Object
  extended by com.google.enterprise.adaptor.Config

public class Config
extends Object

Configuration values for this program, like the GSA's hostname. Also several knobs, or controls, for changing the behavior of the program.

All available configuration:

required? namemeaning
gsa.acceptsDocControlsHeader use X-Gsa-Doc-Controls HTTP header with namespaced ACLs. Otherwise ACLs are sent without namespace and as metadata. If not set, then an attempt to compute from gsa.version is made. Defaults to true for 7.2.0-0 and later, and false for earlier, as defined by gsa.version.
adaptor.markAllDocsAsPublic Tells GSA all documents are public. Overrides all ACLs and even the setting of Response.setSecure(). Defaults to false
adaptor.fullListingSchedule when to invoke Adaptor.getDocIds, in cron format (minute, hour, day of month, month, day of week). Defaults to 0 3 * * *
adaptor.incrementalPollPeriodSecs number of seconds between invocations of PollingIncrementalLister.getModifiedDocIds. Defaults to 900
adaptor.docContentTimeoutSecs number of seconds adaptor has to complete sending content before it is interrupted. Timing starts when sending content starts. Defaults to 180
adaptor.docHeaderTimeoutSecs number of seconds adaptor has to start sending content before it is interrupted. Defaults to 30
adaptor.pushDocIdsOnStartup whether to invoke Adaptor.getDocIds on process start (in addition to adaptor.fullListingSchedule). Defaults to true
docId.isUrl say your adaptor's document ids are already URLs and avoid them being inserted into adaptor generated URLs. Defaults to false
feed.crawlImmediatelyBitEnabled send bit telling GSA to crawl immediately. Defaults to false
feed.maxUrls set max number of URLs included per feed file. Defaults to 5000
feed.name source name used in feeds. Generated if not provided
feed.noRecrawlBitEnabled send bit telling GSA to crawl your documents only once. Defaults to false
feed.archiveDirectory specifies a directory in which all feeds sent to the GSA will be archived. Feeds that failed to be sent to the GSA will be tagged with "FAILED" in the file name. If no directory is specified, feed files will not be saved.
gsa.version version number used to configure expected GSA features. Defaults to acquiring from GSA. Uses 7.0.14-114 if acquiring fails.
gsa.614FeedWorkaroundEnabled enable detour around particular feed parsing failure found in GSA version 6.14 . Defaults to false
gsa.70AuthMethodWorkaroundEnabled send authmethod in feed files to workaround early GSA 7.0 bug. Defaults to false
gsa.characterEncoding character set used in feed files. Defaults to UTF-8
yes gsa.hostname machine to send feed files to. Process errors if not provided
gsa.admin.hostname administrative host for the GSA. This may be different from gsa.hostname if the GSA's dedicated administrative network interface is enabled. Defaults to the same value as gsa.hostname.
gsa.samlEntityId The SAML Entity ID that identifies the GSA. Defaults to http://google.com/enterprise/gsa/security-manager
journal.reducedMem avoid tracking per URL information in RAM; suggested with over five hundred thousand documents. Defaults to true
gsa.scoringType type of relevance algorithm GSA utilizes to rank documents. Either content or web. Is sent when gsa.acceptsDocControlsHeader is true. Defaults to content
server.dashboardPort port on adaptor's machine for accessing adaptor's dashboard. Defaults to 5679
server.docIdPath part of URL preceding encoded document ids. Defaults to /doc/
server.fullAccessHosts hosts allowed access without authentication (certificates still needed when in secure mode). Defaults to empty but implicitly contains gsa.hostname
server.hostname hostname of adaptor machine for URL generation. The GSA will use this hostname to crawl the adaptor. Defaults to lowercase of automatically detected hostname
server.keyAlias keystore alias where encryption (public and private) keys are stored. Defaults to adaptor
server.maxWorkerThreads number of maximum simultenous retrievals allowed. Defaults to 16
server.port retriever port. Defaults to 5678
server.queueCapacity max retriever queue size. Defaults to 160
server.reverseProxyPort port used in retriever URLs (in case requests are routed through a reverse proxy). Defaults to server.port
server.reverseProxyProtocol either http or https, depending on proxy traffic. Defaults to https in secure mode and http otherwise
server.samlEntityId The SAML Entity ID that the Adaptor will use to identity itself. Defaults to http://google.com/enterprise/gsa/adaptor
server.secure enables https and certificate checking. Defaults to false
server.useCompression compress retrieval responses. Defaults to true
transform.acl.X where X is an integer, match and modify principals as described. Defaults no modifications
transform.pipeline sequence of transformation steps. Defaults to no-pipeline


Constructor Summary
Config()
           
 
Method Summary
 void addKey(String key, String defaultValue)
          Add configuration key.
 boolean ensureLatestConfigLoaded()
           
 Set<String> getAllKeys()
           
 List<Map<String,String>> getListOfConfigs(String key)
          Returns a list of maps corresponding to each item of the comma-separated value of key.
 String getRawValue(String key)
          Get a configuration value exactly as provided in configuration.
 String getValue(String key)
          Get a configuration value as computed based on the configuration.
 Map<String,String> getValuesWithPrefix(String prefix)
          Gets all configuration values that begin with prefix, returning them as a map with the keys having prefix removed.
 void load(File configFile)
          Load user-provided configuration file.
 void load(String configFile)
          Load user-provided configuration file.
 void overrideKey(String key, String defaultValue)
          Change the default value of a preexisting configuration key.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config()
Method Detail

getAllKeys

public Set<String> getAllKeys()

getListOfConfigs

public List<Map<String,String>> getListOfConfigs(String key)
Returns a list of maps corresponding to each item of the comma-separated value of key. Each map is the configuration entries for that item in the list. The 'name' configuration entry is added in each map based on the name provided by the user.

As an example, provided the following config:

adaptor.servers=server1,fluttershy , rainbowDash
adaptor.servers.fluttershy.hostname=fluttershy
adaptor.servers.fluttershy.port=42
adaptor.servers.server1.hostname=applejack
adaptor.servers.server1.port=314
adaptor.servers.rainbowDash.hostname=rainbowdash
adaptor.servers.rainbowDash.port=159
adaptor.servers.rainbowDash.name=20% cooler
adaptor.servers.derpy.hostname=hooves

And calling:

config.getConfigList("adaptor.servers");

Returns:

[{
  "hostname": "applejack",
  "port": "42",
  "name": "server1",
}, {
  "hostname": "fluttershy",
  "port": "314",
  "name": "fluttershy",
}, {
  "hostname": "rainbowdash",
  "port": "159",
  "name": "raindowDash",
}]


load

public void load(String configFile)
          throws IOException
Load user-provided configuration file.

Throws:
IOException

load

public void load(File configFile)
          throws IOException
Load user-provided configuration file.

Throws:
IOException

ensureLatestConfigLoaded

public boolean ensureLatestConfigLoaded()
                                 throws IOException
Returns:
true if configuration file was modified.
Throws:
IOException

validate

public void validate()

getRawValue

public String getRawValue(String key)
Get a configuration value exactly as provided in configuration. Generally, getValue(java.lang.String) should be used instead of this method.

Returns:
raw non-null value of key
Throws:
IllegalStateException - if key has no value

getValue

public String getValue(String key)
Get a configuration value as computed based on the configuration. Some configuration values can be generated from other values. This method returns that computed configuration value instead of the raw value provided in configuration. This method should be preferred over getRawValue(java.lang.String).

Returns:
non-null value of key
Throws:
IllegalStateException - if key has no value

getValuesWithPrefix

public Map<String,String> getValuesWithPrefix(String prefix)
Gets all configuration values that begin with prefix, returning them as a map with the keys having prefix removed.


addKey

public void addKey(String key,
                   String defaultValue)
Add configuration key. If defaultValue is null, then no default value is used and the user must provide one.


overrideKey

public void overrideKey(String key,
                        String defaultValue)
Change the default value of a preexisting configuration key. If defaultValue is null, then no default is used and the user must provide one.