def __init__(self, globe_name=""): """Initializes globe. Includes getting configuration information for the server and setting up the initial globe file. """ self.is_base_layer_ = {} # Repository of configuration data for serving the globe. self.config_ = portable_config.PortableConfig() self.file_loc_ = glc_unpacker.PackageFileLoc() self.globe_base_directory_ = self.config_.GlobeBaseDirectory() if not globe_name: self.globe_name_ = self.config_.GlobeName() self.port_ = self.config_.Port() # Decide on the type of search to use. # TODO: Allow non-postgres choice in config file. database = self.config_.Database() if not database or database == "None": self.search_db_ = stub_search.StubDatabase() elif database.lower() == "file": self.search_db_ = file_search.FileDatabase() else: self.search_db_ = postgres_search.PostgresDatabase(database) # Serve initial globe specified in the config file. self.ServeGlobe(self.GlobePath())
def __init__(self, packed_file, is_composite): self.file_ = packed_file self.reader_ = glc_unpacker.PortableGlcReader(packed_file) self.unpacker_ = glc_unpacker.GlcUnpacker(self.reader_, is_composite, False) self.data_loc_ = glc_unpacker.PackageFileLoc() if not os.path.isfile(self.file_): raise UnpackerError("Unable to open %s" % self.file_)
def __init__(self, globe_name=""): """Initializes globe. Includes getting configuration information for the server and setting up the initial globe file. Args: globe_name: The name of this globe. Raises: PortableException: if unknown file type or unreadable glx. """ self.is_base_layer_ = {} # Repository of configuration data for serving the globe. self.file_loc_ = glc_unpacker.PackageFileLoc() # For cgi, look for globes relative to the cgi-bin directory. self.globe_base_directory_ = "." self.globe_name_ = globe_name self.glr_name_ = "" self.remote_address_ = "" self.port_ = 80 self.remote_globe_name_ = "" self.remote_globe_description_ = "" self.unpacker_ = None self.is_gee_ = False self.has_imagery_ = False self.has_terrain_ = False self.is_proto_imagery_ = False # Search code removed # Serve initial globe specified in the config file. # raise Exception("path: " + self.GlobePath()) self.ServeGlobe(self.GlobePath())