'Explodes services, from host_name, hostgroup_name, and from templetes.
:param hosts:               The hosts container
:param hostgroups:          The hostgoups container
:param contactgroups:       The concactgoups container
:param servicegroups:       The servicegoups container
:param servicedependencies: The servicedependencies container
:param triggers:            The triggers container'

def explode(self, hosts, hostgroups, contactgroups, servicegroups, servicedependencies, triggers):

    self.explode_trigger_string_into_triggers(triggers)
    for t in self.templates.values():
        self.explode_contact_groups_into_contacts(t, contactgroups)
        self.explode_services_from_templates(hosts, t)
    duplicates = [s.id for s in self if s.is_duplicate()]
    for id in duplicates:
        s = self.items[id]
        self.explode_services_duplicates(hosts, s)
        if (not s.configuration_errors):
            self.remove_item(s)
    for s in self.items.values():
        self.explode_host_groups_into_hosts(s, hosts, hostgroups)
        self.explode_contact_groups_into_contacts(s, contactgroups)
        hnames = getattr(s, 'host_name', '')
        hnames = list(set([n.strip() for n in hnames.split(',') if n.strip()]))
        if (len(hnames) == 1):
            self.index_item(s)
        else:
            if (len(hnames) >= 2):
                self.explode_services_from_hosts(hosts, s, hnames)
            if (not s.configuration_errors):
                self.remove_item(s)
    to_remove = []
    for service in self:
        host = hosts.find_by_name(service.host_name)
        if (host and host.is_excluded_for(service)):
            to_remove.append(service)
    for service in to_remove:
        self.remove_item(service)
    for s in self:
        self.register_service_into_servicegroups(s, servicegroups)
        self.register_service_dependencies(s, servicedependencies)
