import optparse
import sys

try:
    from db.sedb import SEDB
    from common import modules
    from common import prototypes
except ImportError:
    import stateengine.db.sedb.SEDB as SEDB
    import stateengine.common.modules as modules
    import stateengine.common.prototypes as prototypes

class SEAdmin(object):
    pass


# Test
def main():

    opts = optparse.OptionParser()
    opts.add_option("-c", "--client", action="store_true", default=False,
                    dest="client", help="Start up SE Client")
    opts.add_option("-s", "--server", action="store_true", default=False,
                    dest="server", help="Start the SE Server")
    opts.add_option("-p", "--poll", action="store_true", default=False,
                    dest="poll", help="Client will poll for actions")
    opts.add_option("", "--host", action="store", default="",
                    dest="host", help="Add a host name")

    o, a = opts.parse_args(sys.argv)
    
    if o.client:
        import client
        client.startClient(o.poll)
        sys.exit()
    elif o.server:
        import server
        server.startServer()
        sys.exit()
    
    db = SEDB()

    if o.host != "":
        id = db.addHost(o.host)
        sys.exit()

    opts.print_help()


if __name__ == "__main__":
    main()

    
