summaryrefslogtreecommitdiffstats
path: root/common/facade.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/facade.h')
-rw-r--r--common/facade.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/common/facade.h b/common/facade.h
index b193580..50d93e0 100644
--- a/common/facade.h
+++ b/common/facade.h
@@ -28,6 +28,7 @@
28#include "resourceaccess.h" 28#include "resourceaccess.h"
29#include "domaintypeadaptorfactoryinterface.h" 29#include "domaintypeadaptorfactoryinterface.h"
30#include "storage.h" 30#include "storage.h"
31#include "resourcecontext.h"
31 32
32namespace Sink { 33namespace Sink {
33 34
@@ -48,7 +49,7 @@ class SINK_EXPORT GenericFacade : public Sink::StoreFacade<DomainType>
48{ 49{
49protected: 50protected:
50 SINK_DEBUG_AREA("facade") 51 SINK_DEBUG_AREA("facade")
51 SINK_DEBUG_COMPONENT(mResourceInstanceIdentifier) 52 SINK_DEBUG_COMPONENT(mResourceContext.resourceInstanceIdentifier)
52public: 53public:
53 /** 54 /**
54 * Create a new GenericFacade 55 * Create a new GenericFacade
@@ -56,8 +57,7 @@ public:
56 * @param resourceIdentifier is the identifier of the resource instance 57 * @param resourceIdentifier is the identifier of the resource instance
57 * @param adaptorFactory is the adaptor factory used to generate the mappings from domain to resource types and vice versa 58 * @param adaptorFactory is the adaptor factory used to generate the mappings from domain to resource types and vice versa
58 */ 59 */
59 GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory = DomainTypeAdaptorFactoryInterface::Ptr(), 60 GenericFacade(const ResourceContext &context);
60 const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess = QSharedPointer<Sink::ResourceAccessInterface>());
61 virtual ~GenericFacade(); 61 virtual ~GenericFacade();
62 62
63 static QByteArray bufferTypeForDomainType(); 63 static QByteArray bufferTypeForDomainType();
@@ -68,20 +68,18 @@ public:
68 68
69protected: 69protected:
70 std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> mResultTransformation; 70 std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> mResultTransformation;
71 // TODO use one resource access instance per application & per resource 71 ResourceContext mResourceContext;
72 QSharedPointer<Sink::ResourceAccessInterface> mResourceAccess; 72 Sink::ResourceAccessInterface::Ptr mResourceAccess;
73 DomainTypeAdaptorFactoryInterface::Ptr mDomainTypeAdaptorFactory;
74 QByteArray mResourceInstanceIdentifier;
75}; 73};
76 74
77/** 75/**
78 * A default facade implemenation that simply instantiates a generic resource with the given DomainTypeAdaptorFactory 76 * A default facade implemenation that simply instantiates a generic resource
79 */ 77 */
80template<typename DomainType, typename DomainTypeAdaptorFactory> 78template<typename DomainType>
81class DefaultFacade : public GenericFacade<DomainType> 79class DefaultFacade : public GenericFacade<DomainType>
82{ 80{
83public: 81public:
84 DefaultFacade(const QByteArray &resourceIdentifier) : GenericFacade<DomainType>(resourceIdentifier, QSharedPointer<DomainTypeAdaptorFactory>::create()) {} 82 DefaultFacade(const ResourceContext &context) : GenericFacade<DomainType>(context) {}
85 virtual ~DefaultFacade(){} 83 virtual ~DefaultFacade(){}
86}; 84};
87 85