Wolframe, 0.0.3

procProvider.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 //
36 
37 #ifndef _PROCESSOR_PROVIDER_HPP_INCLUDED
38 #define _PROCESSOR_PROVIDER_HPP_INCLUDED
39 
42 #include "database/database.hpp"
47 #include "types/keymap.hpp"
48 #include <list>
49 #include <map>
50 #include <boost/noncopyable.hpp>
51 
52 namespace _Wolframe {
53 namespace db {
55 class DatabaseProvider;
56 }
57 namespace proc {
58 
63  ,private boost::noncopyable
64 {
65 public:
68  const module::ModulesDirectory* modules,
69  prgbind::ProgramLibrary* programs_);
71  virtual ~ProcessorProvider();
72 
74  bool resolveDB( const db::DatabaseProvider& db );
76  bool loadPrograms();
77 
79  virtual cmdbind::CommandHandler* cmdhandler( const std::string& command, const std::string& docformat) const;
80 
82  virtual cmdbind::ProtocolHandler* protocolHandler( const std::string& protocol) const;
84  virtual bool hasProtocol( const std::string& protocol) const;
86  virtual bool hasCommand( const std::string& command) const;
87 
89  virtual db::Database* transactionDatabase() const;
90 
92  virtual db::Transaction* transaction( const std::string& name) const;
93 
95  virtual db::Transaction* transaction( const std::string& dbname, const std::string& name) const;
96 
98  virtual const langbind::AuthorizationFunction* authorizationFunction( const std::string& name) const;
99 
101  virtual const langbind::AuditFunction* auditFunction( const std::string& name) const;
102 
104  virtual const types::NormalizeFunction* normalizeFunction( const std::string& name) const;
105 
107  virtual const types::NormalizeFunctionType* normalizeFunctionType( const std::string& name) const;
108 
110  virtual const langbind::FormFunction* formFunction( const std::string& name) const;
111 
113  virtual const types::FormDescription* formDescription( const std::string& name) const;
114 
116  virtual const langbind::FilterType* filterType( const std::string& name) const;
117 
119  virtual const types::CustomDataType* customDataType( const std::string& name) const;
120 
123  virtual cmdbind::DoctypeDetector* doctypeDetector() const;
124 
126  virtual const std::string& referencePath() const;
127 
128 private:
129  std::string m_dbLabel;
132 
136  {
137  public:
140  :configuration(0){}
146  :unit(unit_),configuration(configuration_){}
149 
150  public:
153  };
154 
155  std::vector<CommandHandlerDef> m_cmd;
157 
159  std::vector<cmdbind::DoctypeDetectorType> m_doctypes;
160  std::vector<std::string> m_programfiles;
162  std::string m_referencePath;
163 };
164 
165 }} // namespace _Wolframe::proc
166 
167 #endif // _PROCESSOR_PROVIDER_HPP_INCLUDED
db::Database * m_db
reference to the transaction database
Definition: procProvider.hpp:130
virtual const langbind::AuditFunction * auditFunction(const std::string &name) const
Get a reference to an audit function identified by name.
Interface to a generic command handler.
Class that defines a command handler class and is able to create instances of it. ...
Definition: commandHandler.hpp:149
Class of basic normalization functions instantiated by arguments.
Definition: normalizeFunction.hpp:81
bool loadPrograms()
Load all configured programs.
virtual db::Database * transactionDatabase() const
Get a reference to the transaction database.
Transaction interface.
Definition: transaction.hpp:52
virtual const types::FormDescription * formDescription(const std::string &name) const
Get a reference to a form description identified by name.
CommandHandlerDef()
Default constructor.
Definition: procProvider.hpp:139
Processor Provider configuration.
virtual const langbind::FormFunction * formFunction(const std::string &name) const
Get a reference to a form function type identified by name.
Command handler interface.
Definition: commandHandler.hpp:54
Abstract class as processor provider interface.
Definition: procProviderInterface.hpp:81
boost::shared_ptr< CommandHandlerUnit > CommandHandlerUnitR
Command handler unit reference.
Definition: commandHandler.hpp:166
virtual cmdbind::DoctypeDetector * doctypeDetector() const
Create a new document type and format detector (defined in modules)
The modules directory used by the constructors of the providers to build themselves.
Definition: moduleDirectory.hpp:48
Database provider.
Definition: DBprovider.hpp:70
Interface of a an authorization function.
Definition: authorizationFunction.hpp:51
Definition of a command handler with its configuration.
Definition: procProvider.hpp:135
Structure defining a type of a filter (used as virtual constructor to create filter instances) ...
Definition: filter.hpp:111
virtual const langbind::FilterType * filterType(const std::string &name) const
Get a reference to a filter type identified by name.
std::string m_dbLabel
idenfifier of the transaction database
Definition: procProvider.hpp:129
Basic normalization function for atomic values (variant type)
Definition: normalizeFunction.hpp:52
CommandHandlerDef(const CommandHandlerDef &o)
Copy constructor.
Definition: procProvider.hpp:142
types::keymap< cmdbind::ProtocolHandlerUnitR > m_protocols
map protocol identifiers to handler units
Definition: procProvider.hpp:158
virtual const types::CustomDataType * customDataType(const std::string &name) const
Get a reference to a custom data type identified by name.
CommandHandlerDef(cmdbind::CommandHandlerUnit *unit_, const config::NamedConfiguration *configuration_)
Constructor.
Definition: procProvider.hpp:145
virtual const types::NormalizeFunction * normalizeFunction(const std::string &name) const
Get a reference to a normalization function identified by name.
cmdbind::CommandHandlerUnitR unit
command handler unit to instantiate new command handlers
Definition: procProvider.hpp:151
const db::DatabaseProvider * m_dbProvider
alternative database
Definition: procProvider.hpp:131
virtual ~ProcessorProvider()
Destructor.
Processor provider, the class that provides access to configured global objects to processors...
Definition: procProvider.hpp:61
std::vector< CommandHandlerDef > m_cmd
list of defined command handlers
Definition: procProvider.hpp:155
Interface to processor provider for language bindings and database.
A named configuration is a normal configuration that provides also an className function.
Definition: configurationBase.hpp:126
Custom Data Type Definition.
Definition: customDataType.hpp:105
Interface for document type and format recognition.
prgbind::ProgramLibrary * m_programs
program library
Definition: procProvider.hpp:161
Form function interface.
Definition: formFunction.hpp:78
template for map with case insensitive key strings
Description of a form structure.
Definition: form.hpp:56
Interface of a an auditing function as special form function.
Definition: auditFunction.hpp:44
std::string m_referencePath
application reference path
Definition: procProvider.hpp:162
Wolframe base database class.
Program library interface.
std::vector< cmdbind::DoctypeDetectorType > m_doctypes
list of document type detectors loaded from modules
Definition: procProvider.hpp:159
virtual bool hasProtocol(const std::string &protocol) const
Find out if a protocol with a specific name exists.
Interface to document type and format detection.
Definition: doctypeDetector.hpp:46
Class representing the program library with all programs loaded.
Definition: programLibrary.hpp:59
~CommandHandlerDef()
Destructor.
Definition: procProvider.hpp:148
virtual bool hasCommand(const std::string &command) const
Find out if a command with a specific name exists.
virtual db::Transaction * transaction(const std::string &name) const
Return a database transaction object for a transaction identified by name.
const config::NamedConfiguration * configuration
command handler configuration
Definition: procProvider.hpp:152
virtual cmdbind::CommandHandler * cmdhandler(const std::string &command, const std::string &docformat) const
Create a new command handler for a command and for a document format (e.g. XML,JSON,...)
types::keymap< std::size_t > m_cmdMap
map of command names to indices in 'm_cmd'
Definition: procProvider.hpp:156
Base class for database interface. All databases should provide this interface.
Definition: database.hpp:50
Processor provider configuration.
Definition: procProviderConfig.hpp:48
Protocol handler interface.
Definition: protocolHandler.hpp:52
virtual const std::string & referencePath() const
Get the application reference path for local path expansion.
virtual const types::NormalizeFunctionType * normalizeFunctionType(const std::string &name) const
Get a reference to a normalization function type identified by name.
virtual cmdbind::ProtocolHandler * protocolHandler(const std::string &protocol) const
Create a new protocol handler.
std::vector< std::string > m_programfiles
list of all programs to load
Definition: procProvider.hpp:160
ProcessorProvider(const ProcProviderConfig *conf, const module::ModulesDirectory *modules, prgbind::ProgramLibrary *programs_)
Constructor.
bool resolveDB(const db::DatabaseProvider &db)
Pass the references to the built database interfaces and let the provider find its transaction databa...
virtual const langbind::AuthorizationFunction * authorizationFunction(const std::string &name) const
Get a reference to an authorization function identified by name.