Beispiel #1
0
 def getPackageIds(self):
     """
     Returns sorted list of all enabled package ids.
     """
     all = PackageManager.getPackageIds()
     enabled = [id for id in all if self.env.isComponentEnabled \
                (PackageManager.getClasses(IPackage, id)[0])]
     return sorted(enabled)
Beispiel #2
0
 def getPackageIds(self):
     """
     Returns sorted list of all enabled package ids.
     """
     all = PackageManager.getPackageIds()
     enabled = [id for id in all if self.env.isComponentEnabled \
                (PackageManager.getClasses(IPackage, id)[0])]
     return sorted(enabled)
Beispiel #3
0
 def update(self):
     """
     Refresh all ProcessorIndexes.
     """
     self.env.log.debug("Updating ProcessorIndexes ...")
     all = PackageManager.getClasses(IProcessorIndex)
     for cls in all:
         if self.env.isComponentEnabled(cls):
             self._enableProcessorIndex(cls)
         else:
             self._disableProcessorIndex(cls)
     self.env.log.info("ProcessorIndexes have been updated.")
Beispiel #4
0
 def update(self):
     """
     Refresh all ProcessorIndexes.
     """
     self.env.log.debug("Updating ProcessorIndexes ...")
     all = PackageManager.getClasses(IProcessorIndex)
     for cls in all:
         if self.env.isComponentEnabled(cls):
             self._enableProcessorIndex(cls)
         else:
             self._disableProcessorIndex(cls)
     self.env.log.info("ProcessorIndexes have been updated.")
Beispiel #5
0
 def update(self):
     """
     Refresh all SQL views.
     """
     self.env.log.debug("Updating SQLViews ...")
     self._view_objs = dict()
     all = PackageManager.getClasses(ISQLView)
     for cls in all:
         if self.env.isComponentEnabled(cls):
             self._enableView(cls)
         elif hasattr(cls, 'view_id') and cls.view_id in self._view_objs:
             self._disableView(cls)
     self.env.log.info("SQLViews have been updated.")
Beispiel #6
0
 def update(self):
     """
     Refresh all SQL views.
     """
     self.env.log.debug("Updating SQLViews ...")
     self._view_objs = dict()
     all = PackageManager.getClasses(ISQLView)
     for cls in all:
         if self.env.isComponentEnabled(cls):
             self._enableView(cls)
         elif hasattr(cls, 'view_id') and cls.view_id in self._view_objs:
             self._disableView(cls)
     self.env.log.info("SQLViews have been updated.")
Beispiel #7
0
 def update(self):
     """
     Refresh the mapper registry.
     """
     self._urls = dict()
     all = PackageManager.getClasses(IMapper)
     for cls in all:
         if not self.env.isComponentEnabled(cls):
             continue
         # sanity checks
         if not hasattr(cls, 'mapping_url'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute mapping_url is missing."
             self.env.log.warn(msg % (cls, IMapper))
             continue
         self._urls[cls.mapping_url] = cls
Beispiel #8
0
 def update(self):
     """
     Refresh the mapper registry.
     """
     self._urls = dict()
     all = PackageManager.getClasses(IMapper)
     for cls in all:
         if not self.env.isComponentEnabled(cls):
             continue
         # sanity checks
         if not hasattr(cls, 'mapping_url'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute mapping_url is missing."
             self.env.log.warn(msg % (cls, IMapper))
             continue
         self._urls[cls.mapping_url] = cls
Beispiel #9
0
 def getAllPackagesAndResourceTypes(self):
     """
     Returns dictionary of enabled resource type and package IDs.
     
     List of resource types of each package is sorted.
     
     @return: {'package_id': ['resourcetype_id_1', 'resourcetype_id_2']}
     @rtype: dictionary
     """
     ids = self.getPackageIds()
     resourcetypes = dict()
     for id in ids:
         all = PackageManager.getClasses(IResourceType, id)
         resourcetypes[id] = [cls.resourcetype_id for cls in all \
                             if self.env.isComponentEnabled(cls)]
     # sort
     for id in resourcetypes.keys():
         resourcetypes[id] = sorted(resourcetypes[id])
     return resourcetypes
Beispiel #10
0
 def getAllPackagesAndResourceTypes(self):
     """
     Returns dictionary of enabled resource type and package IDs.
     
     List of resource types of each package is sorted.
     
     @return: {'package_id': ['resourcetype_id_1', 'resourcetype_id_2']}
     @rtype: dictionary
     """
     ids = self.getPackageIds()
     resourcetypes = dict()
     for id in ids:
         all = PackageManager.getClasses(IResourceType, id)
         resourcetypes[id] = [cls.resourcetype_id for cls in all \
                             if self.env.isComponentEnabled(cls)]
     # sort
     for id in resourcetypes.keys():
         resourcetypes[id] = sorted(resourcetypes[id])
     return resourcetypes
Beispiel #11
0
 def update(self):
     """
     Refresh the ResourceFormater registry.
     """
     self.env.log.debug("Updating ResourceFormaters ...")
     self._dict = dict()
     all = PackageManager.getClasses(IResourceFormater)
     for cls in all:
         if not self.env.isComponentEnabled(cls):
             continue
         # sanity checks
         if not hasattr(cls, 'package_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute package_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         if not hasattr(cls, 'resourcetype_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute resourcetype_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         if not hasattr(cls, 'format_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute format_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         # format may be a list of strings
         formats = cls.format_id
         if isinstance(formats, basestring):
             formats = list(formats)
         if not isinstance(cls.format_id, list):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute format_id must be a list or string instance."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         for format in formats:
             ids = (cls.package_id, cls.resourcetype_id, format)
             self._dict[ids] = cls
     self.env.log.info("ResourceFormater have been updated.")
Beispiel #12
0
 def update(self):
     """
     Refresh the ResourceFormater registry.
     """
     self.env.log.debug("Updating ResourceFormaters ...")
     self._dict = dict()
     all = PackageManager.getClasses(IResourceFormater)
     for cls in all:
         if not self.env.isComponentEnabled(cls):
             continue
         # sanity checks
         if not hasattr(cls, 'package_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute package_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         if not hasattr(cls, 'resourcetype_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute resourcetype_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         if not hasattr(cls, 'format_id'):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute format_id is missing."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         # format may be a list of strings
         formats = cls.format_id
         if isinstance(formats, basestring):
             formats = list(formats)
         if not isinstance(cls.format_id, list):
             msg = "Class %s has a wrong implementation of %s. " + \
                   "Attribute format_id must be a list or string instance."
             self.env.log.warn(msg % (cls, IResourceFormater))
             continue
         for format in formats:
             ids = (cls.package_id, cls.resourcetype_id, format)
             self._dict[ids] = cls
     self.env.log.info("ResourceFormater have been updated.")
Beispiel #13
0
 def getResourceTypes(self, package_id):
     """
     Returns a list of all enabled resource types for a given package id.
     """
     all = PackageManager.getClasses(IResourceType, package_id)
     return [cls for cls in all if self.env.isComponentEnabled(cls)]
Beispiel #14
0
 def getResourceTypes(self, package_id):
     """
     Returns a list of all enabled resource types for a given package id.
     """
     all = PackageManager.getClasses(IResourceType, package_id)
     return [cls for cls in all if self.env.isComponentEnabled(cls)]