001: /*
002: *
003: * Copyright (c) 2000-2001 Silvere Martin-Michiellot All Rights Reserved.
004: *
005: * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
006: * royalty free, license to use, modify but not to redistribute this
007: * software in source and binary code form,
008: * provided that i) this copyright notice and license appear on all copies of
009: * the software; and ii) Licensee does not utilize the software in a manner
010: * which is disparaging to Silvere Martin-Michiellot.
011: *
012: * This software is provided "AS IS," without a warranty of any kind. ALL
013: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
014: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
015: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
016: * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
017: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
018: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
019: * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
020: * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023: * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
024: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
025: *
026: * This software is not designed or intended for use in on-line control of
027: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028: * the design, construction, operation or maintenance of any nuclear
029: * facility. Licensee represents and warrants that it will not use or
030: * redistribute the Software for such purposes.
031: *
032: * @Author: Silvere Martin-Michiellot
033: *
034: */
035:
036: package com.db.loaders;
037:
038: import java.net.URL;
039: import java.io.Reader;
040:
041: /**
042: * This class implements the Loader interface. To use
043: * a file loader would extend this class.
044: */
045: public abstract class LoaderBase implements Loader {
046:
047: /** Stores the types of objects that the user wishes to load.*/
048: protected int loadFlags = 0;
049:
050: /** Stores the baseUrl for data files associated with the URL
051: * passed into load(URL).*/
052: protected URL baseUrl = null;
053:
054: /** Stores the basePath for data files associated with the file
055: * passed into load(String).*/
056: protected String basePath = null;
057:
058: // Constructors
059:
060: /**
061: * Constructs a Loader with default values for all variables.
062: */
063: public LoaderBase() {
064: }
065:
066: /**
067: * Constructs a Loader with the specified flags word.
068: */
069: public LoaderBase(int flags) {
070: loadFlags = flags;
071: }
072:
073: // Variable get/set methods
074:
075: /**
076: * This method sets the base URL name for data files associated with
077: * the file. The baseUrl should be null by default, which is an indicator
078: * to the loader that it should look for any associated files starting
079: * from the same place as the URL passed into the load(URL) method.
080: * Note: Users of setBaseUrl() would then use load(URL)
081: * as opposed to load(String).
082: */
083: public void setBaseUrl(URL url) {
084: baseUrl = url;
085: }
086:
087: /**
088: * This method sets the base path name for data files associated with
089: * the file. The basePath should be null by default, which is an indicator
090: * to the loader that it should look for any associated files starting
091: * from the same directory as the file passed into the load(String)
092: * method.
093: * Note: Users of setBasePath() would then use load(String)
094: * as opposed to load(URL).
095: */
096: public void setBasePath(String pathName) {
097: basePath = pathName;
098: }
099:
100: /**
101: * Returns the current base URL setting.
102: */
103: public URL getBaseUrl() {
104: return baseUrl;
105: }
106:
107: /**
108: * Returns the current base path setting.
109: */
110: public String getBasePath() {
111: return basePath;
112: }
113:
114: /**
115: * This method sets the load flags for the file. The flags should
116: * equal 0 by default (which tells the loader to only load geometry).
117: */
118: public void setFlags(int flags) {
119: loadFlags = flags;
120: }
121:
122: /**
123: * Returns the current loading flags setting.
124: */
125: public int getFlags() {
126: return loadFlags;
127: }
128:
129: }
|