diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/genericresource.cpp | 5 | ||||
-rw-r--r-- | common/genericresource.h | 1 | ||||
-rw-r--r-- | common/inspector.cpp | 13 | ||||
-rw-r--r-- | common/inspector.h | 6 | ||||
-rw-r--r-- | common/secretstore.cpp | 6 | ||||
-rw-r--r-- | common/secretstore.h | 3 |
6 files changed, 31 insertions, 3 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index b6a8f62..00d7d0c 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "pipeline.h" | 22 | #include "pipeline.h" |
23 | #include "synchronizer.h" | 23 | #include "synchronizer.h" |
24 | #include "inspector.h" | ||
24 | #include "commandprocessor.h" | 25 | #include "commandprocessor.h" |
25 | #include "definitions.h" | 26 | #include "definitions.h" |
26 | #include "storage.h" | 27 | #include "storage.h" |
@@ -50,6 +51,9 @@ void GenericResource::setSecret(const QString &s) | |||
50 | if (mSynchronizer) { | 51 | if (mSynchronizer) { |
51 | mSynchronizer->setSecret(s); | 52 | mSynchronizer->setSecret(s); |
52 | } | 53 | } |
54 | if (mInspector) { | ||
55 | mInspector->setSecret(s); | ||
56 | } | ||
53 | } | 57 | } |
54 | 58 | ||
55 | void GenericResource::setupPreprocessors(const QByteArray &type, const QVector<Sink::Preprocessor *> &preprocessors) | 59 | void GenericResource::setupPreprocessors(const QByteArray &type, const QVector<Sink::Preprocessor *> &preprocessors) |
@@ -68,6 +72,7 @@ void GenericResource::setupSynchronizer(const QSharedPointer<Synchronizer> &sync | |||
68 | 72 | ||
69 | void GenericResource::setupInspector(const QSharedPointer<Inspector> &inspector) | 73 | void GenericResource::setupInspector(const QSharedPointer<Inspector> &inspector) |
70 | { | 74 | { |
75 | mInspector = inspector; | ||
71 | mProcessor->setInspector(inspector); | 76 | mProcessor->setInspector(inspector); |
72 | } | 77 | } |
73 | 78 | ||
diff --git a/common/genericresource.h b/common/genericresource.h index 4e86b75..edcd7d2 100644 --- a/common/genericresource.h +++ b/common/genericresource.h | |||
@@ -70,6 +70,7 @@ private: | |||
70 | QSharedPointer<Pipeline> mPipeline; | 70 | QSharedPointer<Pipeline> mPipeline; |
71 | QSharedPointer<CommandProcessor> mProcessor; | 71 | QSharedPointer<CommandProcessor> mProcessor; |
72 | QSharedPointer<Synchronizer> mSynchronizer; | 72 | QSharedPointer<Synchronizer> mSynchronizer; |
73 | QSharedPointer<Inspector> mInspector; | ||
73 | int mError; | 74 | int mError; |
74 | qint64 mClientLowerBoundRevision; | 75 | qint64 mClientLowerBoundRevision; |
75 | }; | 76 | }; |
diff --git a/common/inspector.cpp b/common/inspector.cpp index 78053a2..0e7a61f 100644 --- a/common/inspector.cpp +++ b/common/inspector.cpp | |||
@@ -30,10 +30,7 @@ using namespace Sink; | |||
30 | Inspector::Inspector(const ResourceContext &context) | 30 | Inspector::Inspector(const ResourceContext &context) |
31 | : QObject(), | 31 | : QObject(), |
32 | mResourceContext(context) | 32 | mResourceContext(context) |
33 | // mEntityStore(Storage::EntityStore::Ptr::create(mResourceContext)), | ||
34 | // mSyncStorage(Sink::storageLocation(), mResourceContext.instanceId() + ".synchronization", Sink::Storage::DataStore::DataStore::ReadWrite) | ||
35 | { | 33 | { |
36 | // SinkTrace() << "Starting synchronizer: " << mResourceContext.resourceType << mResourceContext.instanceId(); | ||
37 | } | 34 | } |
38 | 35 | ||
39 | Inspector::~Inspector() | 36 | Inspector::~Inspector() |
@@ -41,6 +38,16 @@ Inspector::~Inspector() | |||
41 | 38 | ||
42 | } | 39 | } |
43 | 40 | ||
41 | void Inspector::setSecret(const QString &s) | ||
42 | { | ||
43 | mSecret = s; | ||
44 | } | ||
45 | |||
46 | QString Inspector::secret() const | ||
47 | { | ||
48 | return mSecret; | ||
49 | } | ||
50 | |||
44 | KAsync::Job<void> Inspector::processCommand(void const *command, size_t size) | 51 | KAsync::Job<void> Inspector::processCommand(void const *command, size_t size) |
45 | { | 52 | { |
46 | flatbuffers::Verifier verifier((const uint8_t *)command, size); | 53 | flatbuffers::Verifier verifier((const uint8_t *)command, size); |
diff --git a/common/inspector.h b/common/inspector.h index 5ee995e..a1f7c53 100644 --- a/common/inspector.h +++ b/common/inspector.h | |||
@@ -41,13 +41,19 @@ public: | |||
41 | 41 | ||
42 | KAsync::Job<void> processCommand(void const *command, size_t size); | 42 | KAsync::Job<void> processCommand(void const *command, size_t size); |
43 | 43 | ||
44 | void setSecret(const QString &s); | ||
45 | |||
44 | signals: | 46 | signals: |
45 | void notify(Notification); | 47 | void notify(Notification); |
46 | 48 | ||
47 | protected: | 49 | protected: |
50 | QString secret() const; | ||
48 | virtual KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue); | 51 | virtual KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue); |
49 | 52 | ||
50 | Sink::ResourceContext mResourceContext; | 53 | Sink::ResourceContext mResourceContext; |
54 | |||
55 | private: | ||
56 | QString mSecret; | ||
51 | }; | 57 | }; |
52 | 58 | ||
53 | } | 59 | } |
diff --git a/common/secretstore.cpp b/common/secretstore.cpp index 39d5206..27704fa 100644 --- a/common/secretstore.cpp +++ b/common/secretstore.cpp | |||
@@ -29,6 +29,12 @@ using namespace Sink; | |||
29 | 29 | ||
30 | QMutex SecretStore::sMutex; | 30 | QMutex SecretStore::sMutex; |
31 | 31 | ||
32 | SecretStore::SecretStore() | ||
33 | : QObject() | ||
34 | { | ||
35 | |||
36 | } | ||
37 | |||
32 | SecretStore &SecretStore::instance() | 38 | SecretStore &SecretStore::instance() |
33 | { | 39 | { |
34 | static SecretStore s; | 40 | static SecretStore s; |
diff --git a/common/secretstore.h b/common/secretstore.h index 04fdaba..119003a 100644 --- a/common/secretstore.h +++ b/common/secretstore.h | |||
@@ -42,6 +42,9 @@ Q_SIGNALS: | |||
42 | void secretAvailable(const QByteArray &resourceId); | 42 | void secretAvailable(const QByteArray &resourceId); |
43 | 43 | ||
44 | private: | 44 | private: |
45 | Q_DISABLE_COPY(SecretStore); | ||
46 | SecretStore(); | ||
47 | |||
45 | QMap<QByteArray, QString> mCache; | 48 | QMap<QByteArray, QString> mCache; |
46 | static QMutex sMutex; | 49 | static QMutex sMutex; |
47 | }; | 50 | }; |