# File lib/openshift-origin-controller/app/models/component_instance.rb, line 44
  def elaborate(app)
    comp,profile,cart = get_component_definition(app)

    self.dependencies = []
    
    # cart map has all the sub-cartridges that will get instantiated through this component instance
    cart_map, cart_map_keys = get_cartridges_for_dependencies(comp, cart)

    group_list = cart_map_keys.map { |key| 
      cartprofile = cart_map[key]
      elaborate_cartridge(cartprofile[0], cartprofile[1], app) 
    }.flatten

    self.dependencies.each do |dep|
      cinst = app.comp_instance_map[dep]
      new_conns = ComponentInstance.establish_connections(cinst, self, app)
      new_conns.each { |conn|
        if conn.from_connector.type.match(/^FILESYSTEM/) or conn.from_connector.type.match(/^AFUNIX/)
          self.exec_order << dep if not self.exec_order.include? dep
        end
      }
    end

    ComponentInstance.establish_connections(self, self, app)

    resolve_exec_order(app)

    return group_list
  end