added skeleton of the cqtdeployer server

This commit is contained in:
Andrei Yankovich 2021-03-21 13:54:19 +03:00
parent abaddfcdf3
commit b0f97c1ed3
15 changed files with 5654 additions and 13 deletions

View File

@ -22,6 +22,8 @@ include(Heart/QuasarAppLib/CMake/ccache.cmake)
include(Heart/QuasarAppLib/CMake/QuasarAppCITargets.cmake) include(Heart/QuasarAppLib/CMake/QuasarAppCITargets.cmake)
# Add sub directories # Add sub directories
set(HEART_BUILD_LVL 0)
add_subdirectory(Heart)
add_subdirectory(src) add_subdirectory(src)
if (${QT_VERSION_MAJOR}) if (${QT_VERSION_MAJOR})
add_subdirectory(tests) add_subdirectory(tests)

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

5420
docs/serverimplmodel.qmodel Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
add_definitions(-DCQtDeployerServer_LIBRARY) add_definitions(-DCQTSERVER_LIBRARY)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
@ -26,9 +26,7 @@ set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Private")
add_library(${PROJECT_NAME} ${SOURCE_CPP}) add_library(${PROJECT_NAME} ${SOURCE_CPP})
if (${QT_VERSION_MAJOR}) target_link_libraries(${PROJECT_NAME} PUBLIC Qt::Core Heart)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt::Core)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR}) target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR}) target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR})

View File

@ -15,6 +15,6 @@ namespace CQT {
* @note you should be invoke this method before using the cqt server library. * @note you should be invoke this method before using the cqt server library.
* @return true if the initialize finished successful * @return true if the initialize finished successful
*/ */
bool CQtDeployerServer_EXPORT init(); bool CQTSERVER_EXPORT init();
}; };

View File

@ -10,10 +10,10 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#if defined(CQtDeployerServer_LIBRARY) #if defined(CQTSERVER_LIBRARY)
# define CQtDeployerServer_EXPORT Q_DECL_EXPORT # define CQTSERVER_EXPORT Q_DECL_EXPORT
#else #else
# define CQtDeployerServer_EXPORT Q_DECL_IMPORT # define CQTSERVER_EXPORT Q_DECL_IMPORT
#endif #endif
#endif //CQtDeployerServer_GLOBAL_H #endif //CQtDeployerServer_GLOBAL_H

View File

@ -0,0 +1,15 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "CQtServer_global.h"
#ifdef Q_OS_LINUX
#define DEFAULT_LOCATION "/var/www/cqt"
#endif
// fix me. for windows showl be selected a new default dirrectory.
#ifdef Q_OS_WIN32
#define DEFAULT_LOCATION "C:/cqt"
#endif
#endif // CONFIG_H

View File

@ -0,0 +1,25 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "hostconfiguration.h"
#include "config.h"
namespace CQT {
HostConfiguration::HostConfiguration() {
_location = DEFAULT_LOCATION;
}
QString HostConfiguration::location() const
{
return _location;
}
void HostConfiguration::setLocation(const QString &location)
{
_location = location;
}
}

View File

@ -0,0 +1,40 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef HOSTCONFIGURATION_H
#define HOSTCONFIGURATION_H
#include <QString>
#include "CQtServer_global.h"
namespace CQT {
/**
* @brief The HostConfiguration class This is host configuration of the ctdeployer server.
*/
class CQTSERVER_EXPORT HostConfiguration
{
public:
HostConfiguration();
/**
* @brief location This method return current value of the repsitories path.
* @return path to location of the repositories.
*/
QString location() const;
/**
* @brief setLocation This method sets a location of the repositories.
* @param location This is a new value of the repository location.
*/
void setLocation(const QString &location);
private:
QString _location;
};
}
#endif // HOSTCONFIGURATION_H

View File

@ -0,0 +1,24 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "iconfiguration.h"
namespace CQT {
IConfiguration::IConfiguration(const HostConfiguration &hostConfig) {
setHostConfig(hostConfig);
}
const HostConfiguration &IConfiguration::hostConfig() const {
return _hostConfig;
}
void IConfiguration::setHostConfig(const HostConfiguration &hostConfig) {
_hostConfig = hostConfig;
}
}

View File

@ -0,0 +1,41 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef ICONFIGURATION_H
#define ICONFIGURATION_H
#include "CQtServer_global.h"
#include "hostconfiguration.h"
namespace CQT {
/**
* @brief The IConfiguration class This is base interface of all configuration.
* The configuratin received from the main CQtDeployer application.
*/
class CQTSERVER_EXPORT IConfiguration
{
public:
IConfiguration(const HostConfiguration &hostConfig);
/**
* @brief hostConfig This is host configuration of the cqtdeployer server.
* This configuration received from the config file on the server host.
* @return constant reference to the host configuration.
*/
const HostConfiguration& hostConfig() const;
/**
* @brief setHostConfig This method sets a new values of the host configuratiun.
* @param hostConfig This is new value of the host configuration.
*/
void setHostConfig(const HostConfiguration &hostConfig);
private:
HostConfiguration _hostConfig;
};
}
#endif // ICONFIGURATION_H

View File

@ -1,6 +1,26 @@
#include "idistributor.h" //#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
iDistributor::iDistributor() #include "idistributor.h"
{ #include "iconfiguration.h"
namespace CQT {
iDistributor::~iDistributor() {
delete _configuration;
}
bool iDistributor::setConfiguraion(const IConfiguration *config) {
if (!config)
return false;
_configuration = config;
return true;
}
} }

View File

@ -1,16 +1,44 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef IDISTRIBUTOR_H #ifndef IDISTRIBUTOR_H
#define IDISTRIBUTOR_H #define IDISTRIBUTOR_H
namespace CQT { namespace CQT {
class IConfiguration;
/** /**
* @brief The iDistributor class This is main interface for deploy repositories on server. * @brief The iDistributor class This is main interface for deploy repositories on server.
*/ */
class iDistributor class iDistributor
{ {
public: public:
iDistributor(); iDistributor() = default;
virtual bool deploy(); virtual ~iDistributor();
/**
* @brief setConfiguraion This method sets confgura
* @param config This is pointer to the new configuration
* @return true if the configuration sets successfull.
* @note The iDistributor object will delete the config object selfly when its will be destroyed
* @note This method not check config object to compatibility with own implementation.
* So you need to validate config object using dynamic_cast operator in a implementation of the deploy method.
*/
bool setConfiguraion(const IConfiguration* config);
/**
* @brief deploy This method deploy new update or release of the deployament application on server.
* @return true if the application deployed successful
*/
virtual bool deploy() = 0;
private:
const IConfiguration* _configuration = nullptr;
}; };
} }
#endif // IDISTRIBUTOR_H #endif // IDISTRIBUTOR_H

View File

@ -0,0 +1,8 @@
#include "server.h"
namespace CQT {
Server::Server()
{
}
}

20
src/Library/src/server.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef SERVER_H
#define SERVER_H
#include "abstractnode.h"
namespace CQT {
/**
* @brief The Server class This is implementation of the CQtDeployer Server.
* Exmaple of the base implemnentation:
*
* \image html ServerImplementation.svg width=800px
*/
class Server : public QH::AbstractNode
{
public:
Server();
};
}
#endif // SERVER_H