mirror of
https://github.com/QuasarApp/CQtDeployerServer.git
synced 2025-04-26 04:34:31 +00:00
added base package
This commit is contained in:
parent
b0f97c1ed3
commit
9bdb1c8c65
@ -36,7 +36,7 @@ set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts)
|
||||
|
||||
prepareQM(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR} "${LANGS}")
|
||||
|
||||
setVersion(0 0 1)
|
||||
setVersion(0 1 0)
|
||||
|
||||
set(QML_IMPORT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "Qt Creator extra qml import paths")
|
||||
|
||||
|
@ -21,4 +21,13 @@ void IConfiguration::setHostConfig(const HostConfiguration &hostConfig) {
|
||||
_hostConfig = hostConfig;
|
||||
}
|
||||
|
||||
QDataStream &IConfiguration::fromStream(QDataStream &stream) {
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &IConfiguration::toStream(QDataStream &stream) const {
|
||||
return stream;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define ICONFIGURATION_H
|
||||
#include "CQtServer_global.h"
|
||||
#include "hostconfiguration.h"
|
||||
#include <streambase.h>
|
||||
|
||||
namespace CQT {
|
||||
|
||||
@ -16,7 +17,7 @@ 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
|
||||
class CQTSERVER_EXPORT IConfiguration: public QH::StreamBase
|
||||
{
|
||||
public:
|
||||
IConfiguration(const HostConfiguration &hostConfig);
|
||||
@ -34,7 +35,20 @@ public:
|
||||
*/
|
||||
void setHostConfig(const HostConfiguration &hostConfig);
|
||||
|
||||
/**
|
||||
* @brief name This method return the name of the configuration.
|
||||
* @return name of the configuration.
|
||||
*/
|
||||
virtual const QString& name() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
// StreamBase interface
|
||||
QDataStream &fromStream(QDataStream &stream) override;
|
||||
QDataStream &toStream(QDataStream &stream) const override;
|
||||
|
||||
private:
|
||||
|
||||
HostConfiguration _hostConfig;
|
||||
};
|
||||
}
|
||||
|
64
src/Library/src/package.cpp
Normal file
64
src/Library/src/package.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
//#
|
||||
//# 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"
|
||||
#include "package.h"
|
||||
|
||||
namespace CQT {
|
||||
|
||||
|
||||
Package::Package() {
|
||||
|
||||
}
|
||||
|
||||
bool Package::isValid() const {
|
||||
return AbstractData::isValid() && _config && _packageData.size();
|
||||
}
|
||||
|
||||
bool Package::copyFrom(const QH::PKG::AbstractData *other) {
|
||||
AbstractData::copy<Package>(*other);
|
||||
return true;
|
||||
}
|
||||
|
||||
QString Package::toString() const {
|
||||
return AbstractData::toString() + QString(" Configuration id: %0, Data size: %1").
|
||||
arg(_config->name(), _packageData.size());
|
||||
}
|
||||
|
||||
QDataStream &Package::fromStream(QDataStream &stream) {
|
||||
stream >> _packageData;
|
||||
setConfig(initConfiguration());
|
||||
stream >> *_config;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &Package::toStream(QDataStream &stream) const {
|
||||
stream << _packageData;
|
||||
stream << *_config;
|
||||
return stream;
|
||||
}
|
||||
|
||||
const QByteArray &Package::packageData() const {
|
||||
return _packageData;
|
||||
}
|
||||
|
||||
void Package::setPackkageData(const QByteArray &packkageData) {
|
||||
_packageData = packkageData;
|
||||
}
|
||||
|
||||
IConfiguration *Package::config() const {
|
||||
return _config;
|
||||
}
|
||||
|
||||
void Package::setConfig(IConfiguration *config) {
|
||||
if (_config)
|
||||
delete _config;
|
||||
|
||||
_config = config;
|
||||
}
|
||||
}
|
85
src/Library/src/package.h
Normal file
85
src/Library/src/package.h
Normal file
@ -0,0 +1,85 @@
|
||||
//#
|
||||
//# 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 PACKAGE_H
|
||||
#define PACKAGE_H
|
||||
#include <abstractdata.h>
|
||||
#include "CQtServer_global.h"
|
||||
|
||||
|
||||
|
||||
namespace CQT {
|
||||
|
||||
class IConfiguration;
|
||||
class iDistributor;
|
||||
|
||||
/**
|
||||
* @brief The Package class This is class with deployed package. The deployed package should be deploy on the server repository.
|
||||
* 1. The cqtdeployer main tool prepare the package.
|
||||
* 2. The cqtdeployer main tool send the pacakge to the server cqtdeployer tool.
|
||||
* 3. The server tool deploy package on the own host.
|
||||
*/
|
||||
class CQTSERVER_EXPORT Package: public QH::PKG::AbstractData {
|
||||
public:
|
||||
Package();
|
||||
|
||||
bool isValid() const override;
|
||||
bool copyFrom(const QH::PKG::AbstractData *other) override;
|
||||
QString toString() const override;
|
||||
|
||||
// StreamBase interface
|
||||
|
||||
/**
|
||||
* @brief config This method return the pointer to the current configuration.
|
||||
* @return pointer to the cnfiguration.
|
||||
*/
|
||||
IConfiguration *config() const;
|
||||
|
||||
/**
|
||||
* @brief setConfig This method sets new configuration for this package object.
|
||||
* @param config pointer to new configuration.
|
||||
* @note This method remove old configuration if it exists.
|
||||
*/
|
||||
void setConfig(IConfiguration *config);
|
||||
|
||||
/**
|
||||
* @brief packkageData This method retun the physical data of the deployed distribution.
|
||||
* @return reference to the physical data.
|
||||
*/
|
||||
const QByteArray& packageData() const;
|
||||
|
||||
/**
|
||||
* @brief setPackkageData This method sets new data of the distributionkit.
|
||||
* @param packkageData new data of the distributionkeit.
|
||||
*/
|
||||
void setPackkageData(const QByteArray &packkageData);
|
||||
|
||||
protected:
|
||||
QDataStream &fromStream(QDataStream &stream) override;
|
||||
QDataStream &toStream(QDataStream &stream) const override;
|
||||
|
||||
/**
|
||||
* @brief initConfiguration This method must be init new object of the Cnfiguration.
|
||||
* each package type should be contains own configuration type.
|
||||
* @return pointer to the configuration type.
|
||||
* @note This method uses for init data object from the bytesaArray.
|
||||
*/
|
||||
virtual IConfiguration * initConfiguration() const = 0;
|
||||
|
||||
/**
|
||||
* @brief initDistribute This method must be init distribute of this pacakge data.
|
||||
* @return pointer of the distibuteobject.
|
||||
*/
|
||||
virtual iDistributor* initDistribute() const = 0;
|
||||
|
||||
private:
|
||||
IConfiguration *_config = nullptr;
|
||||
QByteArray _packageData;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PACKAGE_H
|
@ -1,3 +1,10 @@
|
||||
//#
|
||||
//# 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 "server.h"
|
||||
namespace CQT {
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
//#
|
||||
//# 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 SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
@ -13,6 +20,7 @@ namespace CQT {
|
||||
*/
|
||||
class Server : public QH::AbstractNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Server();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user