> +
> +      ImageBuilder builder = new ImageBuilder()
> +            .id(image.label())
> +            .name(image.name())
> +            .description(image.description())
> +            .status(Image.Status.AVAILABLE)
> +            .uri(image.mediaLink())
> +            .providerId(image.publisherName())
> +            .location(createLocation(image.location()));
> +
> +      OperatingSystem.Builder osBuilder = setOperatingSystem(image);
> +      return builder.operatingSystem(osBuilder.build()).build();
> +   }
> +
> +   private OperatingSystem.Builder setOperatingSystem(OSImage image) {
> +      if (image.os() == OSImage.Type.WINDOWS) {

good start, but looking at `images.xml` you should be able to retrieve more 
information out of it.

It is really important for portability that the list of images returned by a 
jclouds provider contain as much details as possible.
For example, `osFamily` and `osVersion` could be generated using something like
```
      OsFamily osFamily = OperatingSystems.osFamily().apply(osImage.label());
      String osVersion = OperatingSystems.version().apply(osImage);
```
where `OperatingSystems` util class will make things like
```
   public static Function<String, OsFamily> osFamily() {
      return new Function<String, OsFamily>() {
         @Override
         public OsFamily apply(final String label) {
            if (label != null) {
               if (label.contains(CENTOS)) return OsFamily.CENTOS;
               else if (label.contains(SUSE)) return OsFamily.SUSE;
               else if (label.contains(UBUNTU)) return OsFamily.UBUNTU;
               else if (label.contains(WINDOWS)) return OsFamily.WINDOWS;
            }
            return OsFamily.UNRECOGNIZED;
         }
      };
   }
```
and similarly for `osVersion`. Make sense?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/117/files#r22094212

Reply via email to