All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UserPlugins.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/af/UserPlugins.h
22 
23  \brief A singleton for managing the plugins enabled by a specific user.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_INTERNAL_USERPLUGINS_H
27 #define __TERRALIB_QT_AF_INTERNAL_USERPLUGINS_H
28 
29 // TerraLib
30 #include "../../common/Singleton.h"
31 #include "../../common/ThreadingPolicies.h"
32 #include "Config.h"
33 
34 namespace te
35 {
36  namespace qt
37  {
38  namespace af
39  {
40  /*!
41  \class UserPlugins
42 
43  \brief A singleton for managing the plugins enabled by a specific user.
44 
45  This singleton can be used to keep the list of plugins enabled by a given application user.
46 
47  It will look for a plugin configuration file as follows:
48  <ul>
49  <li>first, searchs for the plugin configuration file name in SystemApplicationSettings</li>
50  <li>if the file name is not found in SystemApplicationSettings, uses the default name defined by the macro TERRALIB_APPLICATION_PLUGINS_FILE</li>
51  <li>then it check for this file in the current application dir</li>
52  <li>if not foud it looks in the syste application dir</li>
53  <li>if not found looks in the user folder</li>
54  <li>and finally it uses a location defined by an environment variable TERRALIB_DIR_ENVVAR under TERRALIB_CONFIG_DIR</li>
55  </ul>
56 
57  \ingroup af
58  */
60  : public te::common::ObjectLevelLockable<UserPlugins,
61  ::boost::mutex,
62  ::boost::lock_guard< ::boost::mutex >,
63  ::boost::lock_guard< ::boost::mutex > >,
64  public te::common::Singleton<UserPlugins>
65  {
67 
68  public:
69 
70  /*!
71  \brief It starts all the plugins enabled by the user.
72 
73  \note Thread-safe.
74 
75  \note Before calling this method, unload all plugins.
76  */
77  void load();
78 
79  protected:
80 
81  /*! \brief It initializes the singleton. */
82  UserPlugins();
83 
84  /*! \brief Destructor. */
85  ~UserPlugins();
86  };
87 
88  } // end namespace af
89  } // end namespace qt
90 } // end namespace te
91 
92 #endif // __TERRALIB_QT_AF_INTERNAL_USERPLUGINS_H
Template support for singleton pattern.
Definition: Singleton.h:100
A singleton for managing the plugins enabled by a specific user.
Definition: UserPlugins.h:59
Configuration flags for the TerraLib Application Framework.
This policy assures an object-level locking scheme for a derived class.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:108