/usr/include/arc/message/MCCLoader.h is in nordugrid-arc-dev 4.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #ifndef __ARC_MCCLOADER_H__
#define __ARC_MCCLOADER_H__
#include <string>
#include <map>
#include <arc/ArcConfig.h>
#include <arc/message/MCC.h>
#include <arc/message/Service.h>
#include <arc/message/Plexer.h>
#include <arc/message/SecHandler.h>
#include <arc/loader/Plugin.h>
#include <arc/loader/Loader.h>
namespace Arc {
// Internal classes - used in private methods
class mcc_connectors_t;
class plexer_connectors_t;
class ChainContext;
/// Creator of Message Component Chains (MCC).
/** This class processes XML configration and creates message chains.
Accepted configuration is defined by XML schema mcc.xsd.
Supported components are of types MCC, Service and Plexer. MCC and
Service are loaded from dynamic libraries. For Plexer only internal
implementation is supported.
This object is also a container for loaded componets. All components
and chains are destroyed if this object is destroyed.
Chains are created in 2 steps. First all components are loaded and
corresponding objects are created. Constructors are supplied with
corresponding configuration subtrees. During next step components
are linked together by calling their Next() methods. Each call
creates labeled link to next component in a chain.
2 step method has an advantage over single step because it allows
loops in chains and makes loading procedure more simple. But that
also means during short period of time components are only partly
configured. Components in such state must produce proper error response
if Message arrives.
Note: Current implementation requires all components and links
to be labeled. All labels must be unique. Future implementation will
be able to assign labels automatically.
*/
class MCCLoader: public Loader {
friend class ChainContext;
public:
typedef std::map<std::string, MCC*> mcc_container_t;
typedef std::map<std::string, Service*> service_container_t;
typedef std::map<std::string, ArcSec::SecHandler*> sechandler_container_t;
typedef std::map<std::string, Plexer*> plexer_container_t;
private:
bool valid_;
/** Set of labeled MCC objects */
mcc_container_t mccs_;
/** Set of labeled MCC objects which are not linked by anything */
mcc_container_t mccs_unlinked_;
/** Set of MCC objects exposed to external interface */
mcc_container_t mccs_exposed_;
/** Set of labeled Service objects */
service_container_t services_;
/** Set of labeled security handlers */
sechandler_container_t sechandlers_;
/** Set of labeled Plexer objects */
plexer_container_t plexers_;
/** Internal method which performs whole stuff specific to
creation of Message Chains.
It is taken out from constructor to make it easier to reconfigure
chains in a future.
Returns true if all objects were succesfully initialized
and all links created. */
bool make_elements(Config& cfg, int level = 0,
mcc_connectors_t *mcc_connectors = NULL,
plexer_connectors_t *plexer_connectors = NULL);
MCC* make_component(Config& cfg, XMLNode cn,
mcc_connectors_t *mcc_connectors = NULL);
ArcSec::SecHandler* make_sec_handler(Config& cfg, XMLNode& node);
ChainContext* context_;
std::string error_description_;
public:
MCCLoader():valid_(false), context_(NULL) {};
/** Constructor that takes whole XML configuration and creates
component chains */
MCCLoader(Config& cfg);
/** Destructor destroys all components created by constructor */
~MCCLoader();
/** Access entry MCCs in chains.
Those are components exposed for external access using 'entry'
attribute */
MCC* operator[](const std::string& id);
MCC* operator[](const char* id) { return operator[](std::string(id)); };
operator bool(void) { return valid_; };
bool operator!(void) { return !valid_; };
const std::string& failure(void) { return error_description_; };
bool ReloadElement(Config& cfg);
};
/// Interface to chain specific functionality
/** Object of this class is associated with every MCCLoader object. It is
accessible for MCC and Service components and provides an interface
to manipulate chains stored in Loader. This makes it possible to
modify chains dynamically - like deploying new services on demand. */
class ChainContext {
friend class MCCLoader;
private:
MCCLoader& loader_;
ChainContext(MCCLoader& loader) : loader_(loader) {};
~ChainContext() {};
public:
/** Returns associated PluginsFactory object */
operator PluginsFactory*() { return loader_.factory_; };
};
} // namespace Arc
#endif /* __ARC_MCCLOADER_H__ */
|