def create(self, conn, hostname='localhost.localdomain'):
        """
        Connects to the server and creates the relevant artifacts,
        including the database, the modules database, and the HTTP
        server.

        :param conn: The server connection
        :return:A map containing the content db, the modules db and the HTTP server.
        """
        self.logger.info("Create simple application")
        data_database = Database(self._db_name, hostname)
        data_database.set_forest_names(self._forests)

        modules_database = Database(self._modules_db_name, hostname)

        server = HttpServer(self._http_server, "Default",
                            self._app_port, self._db_name, self._modules_db_name)
        server.set_modules_database_name(self._modules_db_name)

        data_database.create(conn)
        modules_database.create(conn)
        server.create(conn)

        return {
            u'content': data_database,
            u'modules': modules_database,
            u'server': server
        }
Exemplo n.º 2
0
    def modify(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Modify database {0}...".format(args['name']))
        database.update(connection=connection)
    def modify(self, args, config, connection):
        database = Database(args['name'], connection=connection)
        if not database.exists():
            print("Error: Database does not exist: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Modify database {0}...".format(args['name']))
        database.update(connection=connection)
Exemplo n.º 4
0
    def create(self, args, config, connection):
        database = Database(args['name'], args['forest_host'],
                            connection=connection)
        if database.exists():
            print("Error: Database already exists: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Create database {0}...".format(args['name']))
        database.create()
    def create(self, args, config, connection):
        database = Database(args['name'],
                            args['forest_host'],
                            connection=connection)
        if database.exists():
            print("Error: Database already exists: {0}".format(args['name']))
            sys.exit(1)

        if args['json'] is not None:
            database = self._read(args['name'], args['json'])

        self.forests = []
        self._properties(database, args)
        if len(self.forests) > 0:
            database.set_forest_names(self.forests)

        print("Create database {0}...".format(args['name']))
        database.create()