def search(base, scope, filter, attrs, limit, callback, &block)
controls = SearchControls.new
controls.search_scope = scope
controls.count_limit = limit if limit
unless attrs.blank?
controls.returning_attributes = attrs.to_java(:string)
end
@context.search(base, filter, controls).each do |result|
attributes = {}
result.attributes.get_all.each do |attribute|
attributes[attribute.get_id] = attribute.get_all.collect do |value|
value.is_a?(String) ? value : String.from_java_bytes(value)
end
end
callback.call([result.name_in_namespace, attributes], block)
end
end