add Rule class and refactor ApplicationServer