From a4f93259845d709caa1526d7fad974378e38cae4 Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 24 Dec 2010 17:44:30 +0000 Subject: [PATCH] server mode for Qt, missing tables git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@667 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- README | 4 +- doc/index.html | 59 ++++-- doc/qtsrv.html | 58 +++++ doc/wolf-comm.html | 9 +- examples/clock/clock.wolf | 36 +++- examples/clock/qtc/clock.cpp | 106 +++++++++ examples/clock/qtc/clock.h | 26 ++ examples/clock/qtc/clock.pro | 15 ++ examples/clock/qts/clock.cpp | 137 +++++++++++ examples/clock/qts/clock.h | 14 ++ examples/clock/qts/clockserv.pro | 16 ++ phpbase/autoload.php | 2 + phpbase/exception.php | 37 ++- qtbase/include/WServer | 1 + qtbase/include/WServerReply | 1 + qtbase/include/WServerRequest | 1 + qtbase/include/interface.h | 6 + qtbase/include/server.h | 118 ++++++++++ qtbase/include/transaction.h | 5 +- qtbase/src/interface.cpp | 12 +- qtbase/src/server.cpp | 442 +++++++++++++++++++++++++++++++++++ qtbase/src/server_p.h | 40 ++++ qtbase/src/transaction.cpp | 15 ++ qtbase/wbase.pro | 7 +- woc/php/phpclass.cpp | 4 +- woc/php/phpout.h | 2 + woc/php/phptrans.cpp | 2 +- woc/proc/procclass.cpp | 31 +++- woc/proc/procclass.h | 17 +- woc/proc/proctrans.cpp | 7 +- woc/proc/proctrans.h | 6 +- woc/qt/qtclass.cpp | 5 +- woc/qt/qtout.cpp | 3 +- woc/qt/qtstrans.cpp | 476 +++++++++++++++++++++++++++++++++++++- woc/qt/qtstrans.h | 23 ++- 35 files changed, 1682 insertions(+), 61 deletions(-) create mode 100644 doc/qtsrv.html create mode 100644 examples/clock/qtc/clock.cpp create mode 100644 examples/clock/qtc/clock.h create mode 100644 examples/clock/qtc/clock.pro create mode 100644 examples/clock/qts/clock.cpp create mode 100644 examples/clock/qts/clock.h create mode 100644 examples/clock/qts/clockserv.pro create mode 100644 qtbase/include/WServer create mode 100644 qtbase/include/WServerReply create mode 100644 qtbase/include/WServerRequest create mode 100644 qtbase/include/server.h create mode 100644 qtbase/src/server.cpp create mode 100644 qtbase/src/server_p.h diff --git a/README b/README index 7b4d073..553f29b 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ version 0.5 (c) Konrad Rosenbaum, 2009-2010 Directories qtbase, woc: -The CPP-source files are licensed under GPLv3 or at your option any newer version +The C++-source files are licensed under GPLv3 or at your option any newer version of the license. See COPYING.GPL for details. Directory phpbase: @@ -24,4 +24,4 @@ own terms. Documentation -------------- -See doc/index.html for documentation. +See doc/index.html for documentation and build-instructions. diff --git a/doc/index.html b/doc/index.html index 9765131..993bd58 100644 --- a/doc/index.html +++ b/doc/index.html @@ -5,7 +5,7 @@

Introduction

-PACK is a toolkit that speeds up the development of web based client-server-applications by providing wrappers for database storage and client-server communication. The main component is the Web Object Compiler (WOC) that translates XML based interface descriptions into the target language.

+PACK is a toolkit that speeds up the development of database driven web based client-server-applications by providing wrappers for database storage and client-server communication. The main component is the Web Object Compiler (WOC) that translates XML based interface descriptions into the target language.

The following languages are currently supported:
@@ -16,11 +16,11 @@ The following languages are currently supported:
- + - + @@ -29,27 +29,52 @@ The following languages are currently supported:
- + -
C++/Qt 4.x yesplannedplanned
PHP 5.xplannedplanned yes
XML Schemaplanned for validationplanned/incomplete for validation and as base for SOAP
+ +XML SOAP + planned/incomplete generates WSDL and Schema files for the communication layer only + +

+ + +

Building PACK

+ +For compiling PACK you need a C++ compiler (eg. GCC) and Qt4.x. +The meta-compiler WOC requires at least Qt 4.4, the Qt binding itself requires at least Qt 4.7. +For compiling and running generated code it all depends on your target:
+ + + + +
C++/QtA C++ compiler and at least Qt 4.7, modules: Core, Network, XML, optionally XMLpatterns
PHPPHP, at least version 5.2
SOAPany compatible toolkit that can handle WSDL files

+ +Compiling the meta-compiler is relatively easy: just enter the woc directory and call qmake and make (or open the woc.pro file in QtCreator and compile from there). The same approach works for PACK's Qt base library. The PHP library of PACK does not need to be compiled, just include it in your project.

Concepts

-In a classic three-tier architecture (see below) there are two interface layers: data and communication. -The Web Object Compiler helps implementing these three-tier architecture interfaces.

+In a classic three-tier architecture (see below) there are two interface layers between the actual tiers: data and communication. +The Web Object Compiler helps implementing these interfaces between layers.

- - - - + + - - - + +
Layer 3Client Presentation Layer
Communication InterfaceServer Abstraction Layer
Network Protocol (eg. HTTP)
Communication Abstraction Layer
Layer 3Client, Presentation
Communication InterfaceCommunication Abstraction Layer
Layer 2Server Business Logic
Data InterfaceDatabase Abstraction Layer
DB-Protocol (eg. LibMySQL)
Layer 1Database (eg. MySQL)
Data InterfaceDatabase Abstraction Layer
Layer 1Database (eg. MySQL, PostgreSQL)
Three Tier Architecture

+PACK currently supports MySQL and PostgreSQL as databases, but it is relatively easy to port to new SQL-based database systems. Non-SQL relational database systems may be usable, but take much more effort to create an interface driver.

+ +The structure of the database is written up as XML statements in PACK's WOLF files - from this PACK generates the code necessary to create the database tables and to execute queries.

+ +The Data Interface provides wrapper classes around tables which are more convenient to use than plain SQL and will also automatically use the correct SQL dialect for queries.

+ +The business logic needs to be written by the user, but using PACK's facilities it is often very easy to do.

+ +The Communication Interface generated by PACK contains two types of structures: communication classes and transactions. Transactions are operations that the client can execute (remotely) in the server. Each transaction has a unique name, input data and output data. This data can use primitive built-in types or project specific communication classes. These classes define structures of primitive types and other communication classes that enclose the data that is transferred between client and server. The classes also wrap the code necessary to serialize and unserialize themselves during transmission. In addition it is possible to write direct translations between database tables and communication classes to assist in some of the typical translations often performed in the business logic. +

The Language