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 main():
    """Display Error Message, if the server is running."""
    port = portable_config.PortableConfig().Port()
    root = Tkinter.Tk()
    root.title('Uninstall portable server')
    root.withdraw()
    uninstaller_flag = os.getenv('GEE_PORTABLE_SILENT_UNINSTALLER_DELETE_DATA')
    unistall_msg = ('Portable Server is Running. \n'
                    'Please Stop the server for Uninstallation.')
    if IsServerRunning(port):
        if uninstaller_flag is None:
            tkMessageBox.showerror('Uninstallation Failed!',
                                   '%s' % unistall_msg)
        else:
            print 'Uninstallation Failed!\n%s ' % unistall_msg
        sys.exit(1)
Beispiel #3
0
def main(argv):
    port = portable_config.PortableConfig().Port()
    if IsServerRunning(port):
        StopServer(port)

    if len(argv) > 1:
        StartServer(argv[1])
    else:
        StartServer()

    # Give the server a chance to get started.
    time.sleep(2)

    cmd = "open http://localhost:%s" % port
    print "Running %s" % cmd
    os.system(cmd)
    print "Done."
Beispiel #4
0
def main(argv):
  os.chdir(os.path.abspath(os.path.dirname(argv[0])))
  port = portable_config.PortableConfig().Port()
  # Note double clicking the start_server, will start the default globe in
  # config only when a server is not running already. Double clicking will have
  # no effect when already a server is running. To force start a server always
  # drag-and-drop a globe to start_server.

  if IsServerRunning(port):
    StopServer(port)

  # This section is to start a web browser tab with 3 sec delay in background
  cmd = ("ping 127.0.0.1 -n 1 -w 1000 > nul & "
         "ping 127.0.0.1 -n 3 -w 1000 > nul & "
         "start http://localhost:%s") % port
  subprocess.Popen('CMD /K "%s"' % cmd)

  StartServer()
def main(argv):
    os.chdir(os.path.abspath(os.path.dirname(argv[0])))
    port = portable_config.PortableConfig().Port()
    # Note double clicking the start_server, will start the default globe in
    # config only when a server is not running already. Double clicking will have
    # no effect when already a server is running. To force start a server always
    # drag-and-drop a globe to start_server.
    if IsServerRunning(port):
        if len(argv) > 1:
            StopServer(port)
            StartServer()
    else:
        print "Server was not running."
        StartServer()

    # Give the server a chance to get started.
    time.sleep(1)

    cmd = "start local/home.url"
    print "Running %s" % cmd
    os.system(cmd)
    time.sleep(5)
    print "Done."