Tizen 2.1 base
[platform/framework/native/app-service.git] / inc / FApp_ConditionManagerService.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file         FApp_ConditionManagerService.h
20  * @brief       This is the header file of the _ConditionManagerService class.
21  *
22  * This header file contains the declarations of the _ConditionManagerService class.
23  */
24
25 #ifndef _FAPP_INTERNAL_CONDITION_MANAGER_SERVICE_H_
26 #define _FAPP_INTERNAL_CONDITION_MANAGER_SERVICE_H_
27
28
29 #include <FBaseObject.h>
30 #include <FBaseString.h>
31 #include <FAppTypes.h>
32
33 #include "FApp_ConditionHandler.h"
34
35 namespace Tizen { namespace Base { namespace Collection { class IList; }}}
36 namespace Tizen { namespace App  {
37
38
39 class _ConditionHandler;
40
41 /**
42  * @class       _ConditionManagerService
43  * @brief       This class contains implementaion of conditional app launch feature.
44  * @since 2.1
45  * @see         AppManager, _ConditionManagerProxy
46  */
47 class _ConditionManagerService
48         : public Tizen::Base::Object
49 {
50         typedef Tizen::Base::Collection::ArrayListT<_ConditionHandler*> _ConditionHandlers;
51         typedef Tizen::Base::Collection::HashMapT<Tizen::Base::String, _ConditionHandler*> _ConditionHandlerMap;
52
53
54 public:
55         _ConditionManagerService(void);
56         virtual ~_ConditionManagerService(void);
57         result Construct(void);
58
59         result RegisterAppLaunch(const Tizen::Base::String& packageId, const Tizen::Base::String& executableName, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pArguments, AppManager::LaunchOption option = AppManager::LAUNCH_OPTION_DEFAULT, const Tizen::Base::String* pSectionName = null);
60         result UnregisterAppLaunch(const Tizen::Base::String& packageId, const Tizen::Base::String& executableName, const Tizen::Base::String* pCondition);
61         result UnregisterAppLaunch(const Tizen::Base::String& packageId, const Tizen::Base::String* pExecutableName);   // internal
62         bool IsAppLaunchRegistered(const Tizen::Base::String& packageId, const Tizen::Base::String& executableName, const Tizen::Base::String* pCondition = null);
63
64 private:
65         // internal
66         result InitializePlugins(void);
67         result InitializePluginEntry(Tizen::Base::Collection::IMap& map);
68         result InitializeConditionalOperations(void);
69         result InitializeConditionalOperationEntry(const Tizen::Base::String& sectionName, const Tizen::Base::Collection::IMap& map);
70         _ConditionHandler* GetLaunchConditionHandler(const Tizen::Base::String& pluginName);
71         _ConditionHandler* GetHandlerByCondition(const Tizen::Base::String& condition);
72
73         result ValidateArguments(const Tizen::Base::Collection::IList* pArguments) const;
74
75         static void DumpArguments(const Tizen::Base::Collection::IList* pArguments);
76         void Dump(void) const;
77
78 private:
79         _ConditionHandlers __handlers;
80         _ConditionHandlerMap __handlerLookupTable;
81
82         _StringComparerT __strComparer;
83         _StringHashMapProviderT __strHashMapProvider;
84
85         friend class UTs_ConditionManagerServiceP;
86 };      //_ConditionManagerService
87
88 }} //Tizen::App
89 #endif // _FAPP_INTERNAL_CONDITION_MANAGER_SERVICE_H_