Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2022 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #include "SessionServerAppManagerFactory.h"
21 : #include "HealthcheckServiceFactory.h"
22 : #include "IEventThread.h"
23 : #include "INamedSocket.h"
24 : #include "IYamlCppWrapper.h"
25 : #include "SessionServerAppFactory.h"
26 : #include "SessionServerAppManager.h"
27 : #include <memory>
28 :
29 : namespace rialto::servermanager::common
30 : {
31 0 : std::unique_ptr<ISessionServerAppManager> createSessionServerAppManager(
32 : std::unique_ptr<ipc::IController> &ipc, const std::shared_ptr<service::IStateObserver> &stateObserver,
33 : const std::list<std::string> &environmentVariables, const std::string &sessionServerPath,
34 : std::chrono::milliseconds sessionServerStartupTimeout, std::chrono::seconds healthcheckInterval,
35 : unsigned numOfFailedPingsBeforeRecovery, unsigned int socketPermissions, const std::string &socketOwner,
36 : const std::string &socketGroup)
37 : {
38 0 : std::shared_ptr<firebolt::rialto::wrappers::IYamlCppWrapper> yamlCppWrapper;
39 0 : if (auto yamlFactory = firebolt::rialto::wrappers::IYamlCppWrapperFactory::getFactory())
40 : {
41 0 : yamlCppWrapper = yamlFactory->createYamlCppWrapper();
42 : }
43 : return std::make_unique<
44 0 : SessionServerAppManager>(ipc, stateObserver,
45 0 : std::make_unique<SessionServerAppFactory>(environmentVariables, sessionServerPath,
46 : sessionServerStartupTimeout,
47 : socketPermissions, socketOwner, socketGroup),
48 0 : std::make_unique<HealthcheckServiceFactory>(healthcheckInterval,
49 : numOfFailedPingsBeforeRecovery),
50 0 : firebolt::rialto::common::IEventThreadFactory::createFactory(),
51 0 : firebolt::rialto::ipc::INamedSocketFactory::getFactory(), yamlCppWrapper);
52 : }
53 : } // namespace rialto::servermanager::common
|