include "../service/service.sfp" include "../node/node.sfp" schema Apache extends Service { package_name = "apache2" service_name = "apache2" port : Int document_root : String installed : Bool running : Bool php_module : Bool php_mysql_module : Bool server_name : String // load balancer config is_load_balancer : Bool lb_members isset Node lb_method : String // byrequests, bytraffic, bybusyness sub set_port(target isref Integer) { condition { this.installed = true this.running = false } effect { this.port = target } } synchronized sub uninstall { condition { this.installed = true this.running = false this.php_module = false this.php_mysql_module = false } effect { this.installed = false } } sub set_document_root (target isref String) { condition { this.running = false this.installed = true } effect { this.document_root = target } } sub set_server_name (target isref String) { condition { this.running = false this.installed = true } effect { this.server_name = target } } synchronized sub install_php_module { condition { this.installed = true this.running = false } effect { this.php_module = true } } synchronized sub uninstall_php_module { condition { this.running = false } effect { this.php_module = false } } synchronized sub install_php_mysql_module { condition { this.php_module = true this.installed = true this.running = false } effect { this.php_mysql_module = true } } synchronized sub uninstall_php_mysql_module { condition { this.running = false } effect { this.php_mysql_module = false } } sub enable_load_balancer { condition { this.installed = true this.running = false } effect { this.is_load_balancer = true } } sub disable_load_balancer { condition { this.installed = true this.running = false this.is_load_balancer = true } effect { this.is_load_balancer = false } } sub set_lb_members (members isset Node) { condition { this.installed = true this.running = false this.is_load_balancer = true foreach (members as node) { node.created = true } } effect { this.lb_members = members } } sub set_lb_method (target isref String) { condition { this.installed = true this.running = false this.is_load_balancer = true } effect { this.lb_method = target } } }