;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.number-toss) ;;;;;; ;;; Database (def class* number-toss-database (database-mixin postgresql) ()) (def special-variable *number-toss-database* (make-instance 'number-toss-database :connection-specification (list :database +default-database-name+ :user-name +default-database-user-name+ :password +default-database-password+))) ;;;;;; ;;; Application (def class* number-toss-application (application-with-home-package application-with-perec-support) ()) (def special-variable *number-toss-application* (make-instance 'number-toss-application :database *number-toss-database*)) ;;;;;; ;;; Server (def (class* e) number-toss-server (broker-based-server) ()) (def special-variable *number-toss-server* (make-instance 'number-toss-server :host +any-host+ :port +default-http-server-port+ :brokers (list *number-toss-application*))) (def method startup-server :after ((server number-toss-server) &key &allow-other-keys) (bind ((name "Clear Scoreboards")) (register-timer-entry (hu.dwim.web-server::timer-of server) (named-lambda clear-scoreboards () (bordeaux-threads::make-thread 'scoreboard/clear-all :name name)) :interval +recalculation-frequency+ :name name))) ;;;;;; ;;; Production (def function executable-toplevel () "The toplevel function that is called when the dwim Server is started from the command line. For development use (asdf:develop-system :hu.dwim.number-toss) instead." (with-standard-toplevel-restarts (bind ((options (append (list +help-command-line-option+) (list +quiet-command-line-option+) (copy-command-line-options +database-command-line-options+ :database-port +default-postgresql-database-server-port+ :database-name +default-database-name+ :database-user-name +default-database-user-name+ :database-password +default-database-password+) +generic-command-line-options+)) (arguments (parse-command-line-arguments options))) (process-help-command-line-argument options arguments) (process-quiet-command-line-argument arguments) (run-production-server arguments :hu.dwim.number-toss *number-toss-server* *number-toss-application*)) +process-return-code/no-error+))