# Path: opsmgr/inventory/plugins.py
# class PluginApplication():
# 
#     def __init__(self, name, function, protocol, host, port, path):
#         self.name = name
#         self.function = function
#         self.protocol = protocol
#         self.host = host
#         self.port = port
#         self.path = path
# 
#     def get_name(self):
#         return self.name
# 
#     def get_function(self):
#         return self.function
# 
#     def get_protocol(self):
#         return self.protocol
# 
#     def get_host(self):
#         return self.host
# 
#     def get_port(self):
#         return self.port
# 
#     def get_path(self):
#         return self.path
# 
#     @staticmethod
#     @entry_exit(exclude_index=[], exclude_name=[])
#     def get_operations_plugins():
#         """ Returns a List of PluginApplication classes so the url for an installed application
#             can be constructed. For plugins installed on the localhost, it is recommened to not use
#             the host field here, but use the host or ip the user specified in the url.
#         """
#         plugin_apps = []
#         plugins = PluginApplication._load_operations_plugins()
#         for _plugin_name, plugin_class in plugins.items():
#             plugin_app = plugin_class.get_application_url()
#             if plugin_app is not None:
#                 plugin_apps.append(plugin_app)
#         return plugin_apps
# 
#     @staticmethod
#     @entry_exit(exclude_index=[], exclude_name=[])
#     def get_plugins_status():
#         """ Returns two list of Strings for critical and warning messages from
#             all plugins on the localhost.
#         """
#         critical_messages = []
#         warning_messages = []
#         plugins = PluginApplication._load_operations_plugins()
#         for _plugin_name, plugin_class in plugins.items():
#             (crit, warn) = plugin_class.get_status()
#             if crit is not None:
#                 critical_messages.extend(crit)
#             if warn is not None:
#                 warning_messages.extend(warn)
#         return (critical_messages, warning_messages)
# 
#     @staticmethod
#     def _load_operations_plugins():
#         """
#         Find the operations plugins and return them as a
#         dictonary[name]=plugin class
#         """
#         return load_plugin_by_namespace(I_OPERATIONS_PLUGINS)


from django.utils.translation import ugettext_lazy as _
from horizon import messages
from horizon import tabs
from operational_mgmt.inventory import tables
from operational_mgmt import rack
from operational_mgmt import resource
from opsmgr.inventory.plugins import PluginApplication
import logging
import opsmgr.inventory.rack_mgr as rack_mgr
import opsmgr.inventory.resource_mgr as resource_mgr
    table_classes = (tables.RackDetailsTable, tables.ResourcesTable)
    template_name = ("op_mgmt/inventory/rack_tab.html")
    preload = False
    _has_more = False
    rack_fields = []
    rack_id = -1

    def get_resources_data(self):
        # Store the rack_id of the current rack into
        # the AddResource action
        tables.AddResourceLink.rack_id = self.rack_id
        # ... and the RemoveResources action
        tables.RemoveResourcesLink.rack_id = self.rack_id
        # Return the list of resources
        return retrieve_rack_resources(self)

    def get_rack_details_data(self):
        # Store the rack_id of the current rack into each action that
        # needs it
        tables.EditRackLink.rack_id = self.rack_id
        tables.RemoveRackLink.rack_id = self.rack_id
        return retrieve_rack_metadata(self)


class GenericTab(RackTabBase):
    name = _("GenericTab")
    slug = "generic_tab"

    def initialize(self, name, rack_id):
        self.name = name

# Path: opsmgr/inventory/plugins.py
# class PluginApplication():
# 
#     def __init__(self, name, function, protocol, host, port, path):
#         self.name = name
#         self.function = function
#         self.protocol = protocol
#         self.host = host
#         self.port = port
#         self.path = path
# 
#     def get_name(self):
#         return self.name
# 
#     def get_function(self):
#         return self.function
# 
#     def get_protocol(self):
#         return self.protocol
# 
#     def get_host(self):
#         return self.host
# 
#     def get_port(self):
#         return self.port
# 
#     def get_path(self):
#         return self.path
# 
#     @staticmethod
#     @entry_exit(exclude_index=[], exclude_name=[])
#     def get_operations_plugins():
#         """ Returns a List of PluginApplication classes so the url for an installed application
#             can be constructed. For plugins installed on the localhost, it is recommened to not use
#             the host field here, but use the host or ip the user specified in the url.
#         """
#         plugin_apps = []
#         plugins = PluginApplication._load_operations_plugins()
#         for _plugin_name, plugin_class in plugins.items():
#             plugin_app = plugin_class.get_application_url()
#             if plugin_app is not None:
#                 plugin_apps.append(plugin_app)
#         return plugin_apps
# 
#     @staticmethod
#     @entry_exit(exclude_index=[], exclude_name=[])
#     def get_plugins_status():
#         """ Returns two list of Strings for critical and warning messages from
#             all plugins on the localhost.
#         """
#         critical_messages = []
#         warning_messages = []
#         plugins = PluginApplication._load_operations_plugins()
#         for _plugin_name, plugin_class in plugins.items():
#             (crit, warn) = plugin_class.get_status()
#             if crit is not None:
#                 critical_messages.extend(crit)
#             if warn is not None:
#                 warning_messages.extend(warn)
#         return (critical_messages, warning_messages)
# 
#     @staticmethod
#     def _load_operations_plugins():
#         """
#         Find the operations plugins and return them as a
#         dictonary[name]=plugin class
#         """
#         return load_plugin_by_namespace(I_OPERATIONS_PLUGINS)


# Path: horizon/operational_mgmt/inventory/tabs.py
from django.utils.translation import ugettext_lazy as _
from horizon import messages
from horizon import tabs
from operational_mgmt.inventory import tables
from operational_mgmt import rack
from operational_mgmt import resource
from opsmgr.inventory.plugins import PluginApplication
import logging
import opsmgr.inventory.rack_mgr as rack_mgr
import opsmgr.inventory.resource_mgr as resource_mgr

    table_classes = (tables.RackDetailsTable, tables.ResourcesTable)
    template_name = ("op_mgmt/inventory/rack_tab.html")
    preload = False
    _has_more = False
    rack_fields = []
    rack_id = -1

    def get_resources_data(self):
        # Store the rack_id of the current rack into
        # the AddResource action
        tables.AddResourceLink.rack_id = self.rack_id
        # ... and the RemoveResources action
        tables.RemoveResourcesLink.rack_id = self.rack_id
        # Return the list of resources
        return retrieve_rack_resources(self)

    def get_rack_details_data(self):
        # Store the rack_id of the current rack into each action that
        # needs it
        tables.EditRackLink.rack_id = self.rack_id
        tables.RemoveRackLink.rack_id = self.rack_id
        return retrieve_rack_metadata(self)


class GenericTab(RackTabBase):
    name = _("GenericTab")
    slug = "generic_tab"

    def initialize(self, name, rack_id):
        self.name = name

        self.slug = name + "_tab"