All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.standalone.config.NetexConfig Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.standalone.config;

import java.util.regex.Pattern;

public class NetexConfig {

    private static final String EMPTY_STRING_PATTERN = "$^";

    private static final String IGNORE_FILE_PATTERN = EMPTY_STRING_PATTERN;

    private static final String SHARED_FILE_PATTERN = "shared-data\\.xml";

    private static final String SHARED_GROUP_FILE_PATTERN = "(\\w{3})-.*-shared\\.xml";

    private static final String GROUP_FILE_PATTERN = "(\\w{3})-.*\\.xml";

    private static final String NETEX_FEED_ID = "DefaultFeed";

    /**
     * This field is used to identify the specific NeTEx feed. It is used instead of the feed_id
     * field in GTFS file feed_info.txt.
     */
    public final String netexFeedId;

    /**
     * This field is used to exclude matching files in the module file(zip file entries).
     * The ignored files are not loaded.
     * 

* Default value is '$^' witch matches empty stings (not a valid file name). * @see #sharedFilePattern */ public final Pattern ignoreFilePattern; /** * This field is used to match shared files(zip file entries) in the module file. * Shared files are loaded first. Then the rest of the files are grouped and loaded. *

* The pattern 'shared-data\.xml' matches 'shared-data.xml' *

* File names are matched in the following order - and treated accordingly to the first match: *

    *
  1. {@link #ignoreFilePattern}
  2. *
  3. Shared file pattern (this)
  4. *
  5. {@link #sharedGroupFilePattern}.
  6. *
  7. {@link #groupFilePattern}.
  8. *
*

* Default value is 'shared-data\.xml' */ public final Pattern sharedFilePattern; /** * This field is used to match shared group files in the module file(zip file entries). * Typically this is used to group all files from one agency together. *

* Shared group files are loaded after shared files, but before the matching group * files. Each group of files are loaded as a unit, followed by next group. *

* Files are grouped together by the first group pattern in the regular expression. *

* The pattern '(\w{3})-.*-shared\.xml' matches 'RUT-shared.xml' with * group 'RUT'. *

* Default value is '(\w{3})-.*-shared\.xml' * @see #sharedFilePattern * @see #groupFilePattern */ public final Pattern sharedGroupFilePattern; /** * This field is used to match group files in the module file(zip file entries). * group files are loaded right the after shared group files are loaded. *

* Files are grouped together by the first group pattern in the regular expression. *

* The pattern '(\w{3})-.*\.xml' matches 'RUT-Line-208-Hagalia-Nevlunghavn.xml' with * group 'RUT'. *

* Default value is '(\w{3})-.*\.xml' * @see #sharedFilePattern * @see #sharedGroupFilePattern */ public final Pattern groupFilePattern; NetexConfig(NodeAdapter config) { ignoreFilePattern = config.asPattern("ignoreFilePattern", IGNORE_FILE_PATTERN); sharedFilePattern = config.asPattern("sharedFilePattern", SHARED_FILE_PATTERN); sharedGroupFilePattern = config.asPattern("sharedGroupFilePattern", SHARED_GROUP_FILE_PATTERN); groupFilePattern = config.asPattern("groupFilePattern", GROUP_FILE_PATTERN); netexFeedId = config.asText("netexFeedId", NETEX_FEED_ID); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy