Debian Codegraph @

Source/Control/Loader/CJNICommandLoader.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CJNICommandLoader.h"
22
23
24 namespace Konclude {
25
26 namespace Control {
27
28 namespace Loader {
29
30
31 CJNICommandLoader::CJNICommandLoader(CJNIInstanceManager* instanceManager) : CCommandLineLoader() {
32 mInstanceManager = instanceManager;
33 }
34
35
36 CJNICommandLoader::CJNICommandLoader(CJNIInstanceManager* instanceManager, int argc, char *argv[]) : CCommandLineLoader(argc,argv,false) {
37 mInstanceManager = instanceManager;
38 }
39
40
41 CJNICommandLoader::CJNICommandLoader(CJNIInstanceManager* instanceManager, const QStringList &argList) : CCommandLineLoader(argList,false) {
42 mInstanceManager = instanceManager;
43 }
44
45
46 CJNICommandLoader::~CJNICommandLoader() {
47 }
48
49
50 CLoader* CJNICommandLoader::init(CLoaderFactory *loaderFactory, CConfiguration *config) {
51 configuration = config;
52
53
54 CConfigurationGroup *reasonerConfigGroup = nullptr;
55 if (configuration) {
56 reasonerConfigGroup = configuration->getConfigurationGroup();
57 } else {
58 reasonerConfigGroup = CSingletonProvider<CReasonerConfigurationGroup>::getInstance()->getReferencedConfigurationGroup();
59 configuration = new CConfiguration(reasonerConfigGroup);
60 }
61
62 CConfigDescription* conDes = new CConfigDescription("Konclude.JNI.JNIInstanceManager","",new CJNIInstanceManagerConfigType());
63 reasonerConfigGroup->addConfigProperty(conDes);
64
65 configuration->extendConfigurationGroup(reasonerConfigGroup);
66 CConfigData *confData = configuration->createAndSetConfig("Konclude.JNI.JNIInstanceManager");
67 if (confData) {
68 CJNIInstanceManagerConfigType* confType = dynamic_cast<CJNIInstanceManagerConfigType*>(confData->getConfigType());
69 if (confType) {
70 confType->setJNIInstanceManager(mInstanceManager);
71 }
72 }
73
74
75 CCommandLineLoader::init(loaderFactory,configuration);
76 return this;
77 }
78
79
80 }; // end namespace Loader
81
82 }; // end namespace Control
83
84 }; // end namespace Konclude