1 | /* | |
2 | * Copyright (c) 2015 Maxim Yunusov | |
3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | * you may not use this file except in compliance with the License. | |
5 | * You may obtain a copy of the License at | |
6 | * | |
7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, software | |
10 | * distributed under the License is distributed on an "AS IS" BASIS, | |
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | * See the License for the specific language governing permissions and | |
13 | * limitations under the License. | |
14 | */ | |
15 | ||
16 | package org.maxur.perfmodel.backend.service; | |
17 | ||
18 | import org.jvnet.hk2.annotations.Contract; | |
19 | import org.slf4j.Logger; | |
20 | import org.slf4j.LoggerFactory; | |
21 | ||
22 | import javax.annotation.PostConstruct; | |
23 | import javax.inject.Inject; | |
24 | ||
25 | /** | |
26 | * This interface represents Perfomance Model Standalone Application | |
27 | * | |
28 | * @author myunusov | |
29 | * @version 1.0 | |
30 | * @since <pre>30.08.2015</pre> | |
31 | */ | |
32 | @Contract | |
33 | public abstract class Application { | |
34 | ||
35 | private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); | |
36 | ||
37 | @Inject | |
38 | private WebServer webServer; | |
39 | ||
40 | @Inject | |
41 | private Database db; | |
42 | ||
43 | @PostConstruct | |
44 | public final void init() { | |
45 |
1
1. init : removed call to org/maxur/perfmodel/backend/service/Application::onInit → NO_COVERAGE |
onInit(); |
46 | } | |
47 | ||
48 | public final void start() { | |
49 |
1
1. start : removed call to org/maxur/perfmodel/backend/service/WebServer::start → NO_COVERAGE |
webServer.start(); |
50 |
1
1. start : removed call to org/maxur/perfmodel/backend/service/Application::onStart → NO_COVERAGE |
onStart(); |
51 | LOGGER.info("Performance Model Calculator Server is started"); | |
52 | } | |
53 | ||
54 | public final void stop() { | |
55 |
1
1. stop : removed call to org/maxur/perfmodel/backend/service/WebServer::stop → NO_COVERAGE |
webServer.stop(); |
56 |
1
1. stop : removed call to org/maxur/perfmodel/backend/service/Database::stop → NO_COVERAGE |
db.stop(); |
57 |
1
1. stop : removed call to org/maxur/perfmodel/backend/service/Application::onStop → NO_COVERAGE |
onStop(); |
58 | LOGGER.info("Performance Model Calculator Server is stopped"); | |
59 | } | |
60 | ||
61 | public String version() { | |
62 |
1
1. version : mutated return of Object value for org/maxur/perfmodel/backend/service/Application::version to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this.getClass().getPackage().getImplementationVersion(); |
63 | } | |
64 | ||
65 | ||
66 | protected final WebServer webServer() { | |
67 |
1
1. webServer : mutated return of Object value for org/maxur/perfmodel/backend/service/Application::webServer to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return webServer; |
68 | } | |
69 | ||
70 | /** | |
71 | * Returns true if Application is applicable. | |
72 | * | |
73 | * @return true if Application is applicable | |
74 | */ | |
75 | public abstract boolean isApplicable(); | |
76 | ||
77 | /** | |
78 | * Hook on Init | |
79 | */ | |
80 | protected void onInit() { | |
81 | } | |
82 | ||
83 | /** | |
84 | * Hook on Start | |
85 | */ | |
86 | protected void onStart() { | |
87 | } | |
88 | ||
89 | /** | |
90 | * Hook on Stop | |
91 | */ | |
92 | protected void onStop() { | |
93 | } | |
94 | } | |
Mutations | ||
45 |
1.1 |
|
49 |
1.1 |
|
50 |
1.1 |
|
55 |
1.1 |
|
56 |
1.1 |
|
57 |
1.1 |
|
62 |
1.1 |
|
67 |
1.1 |