Maybe something like this:

```ruby
def executor(node=nil)
  url = !node.nil? ? node['jenkins']['server']['url'] : 'http://0.0.0.0:8080'
  java = find_java_bin(node)
  cli if node.nil? File.join(node['jenkins']['home'], 'jenkins-cli.jar') : '/var/lib/jenkins/jenkins-cli.jar'

  @exector ||= Jenkins::Executor.new(
    url:  url,
    java: java,
    cli:  cli,
  )
end

private

def find_java_bin(node)
  java_home = if node
    node['jenkins']['java_home'] || (node.attribute?('java') ? node['java']['java_home'] : nil)
  else
    nil
  end

  if java_home.nil?
    java = 'java'
  else
    java = File.join(java_home, 'bin', 'java')
  end
end
```

That obviously need some better code but you get the idea. If running in a provider we have a reference to the node object and should be able to extract default values.