Hi Charles,

As you said, the way to do that is by configuring Guice to provide
your implementation of the ImageToOperatingSystem, using a linked
binding [1].

You will first have to subclass the ImageToOperatingSystem class and
put your custom logic there (it has to be a subclass, as you won't be
able to bind directly the generic function type as there is already a
binding for it and Guice does not allow duplicated bindings).

Then you just to create a Guice module that configures the binding.
Something like:

class CustomGuiceBindings extends AbstractModule {
   @Override
   protected void configure()
      
bind(ImageToOperatingSystem).to(YourCustomImageToOperatingSystem).in(SINGLETON);
   }
}

And add it to the list of modules you provide when creating the context.

HTH!


Ignasi





[1] https://code.google.com/p/google-guice/wiki/LinkedBindings

On 4 June 2014 19:17, Charles Paclat <char...@paclat.net> wrote:
> I am using JCloud with OpenStack and the Nova APIs.  I am finding that the
> templates that perform matching on the image meta data are not quite
> working for my use cases.  I would like to see about enhancing the
> ImageToOperatingSystem function in my client to be able to parse some
> additional meta data tags on our deployment when they are available.  I
> would also like to support CentOS in the matching for OpenStack.
>
> I am a bit new to Guice,  but it seems to me there must be a way to replace
> the ImageToOperatingSystem function with a custom one.
>
> Is this advisable?  Has anyone else tried to customize Jclouds Nova
> provider in this way?  Is there an example that I can refer to?

Reply via email to