package org.jboss.pnc.core;

import org.jboss.pnc.core.exception.CoreException;
import org.jboss.pnc.spi.builddriver.BuildDriver;
import org.jboss.pnc.model.BuildType;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;

/**
 * Created by <a href="mailto:matejonnet@gmail.com">Matej Lazar</a> on 2014-11-23.
 */
@ApplicationScoped
public class BuildDriverFactory {

    @Inject
    Instance<BuildDriver> availableDrivers;

    public BuildDriver getBuildDriver(BuildType buildType) throws CoreException {

        for (BuildDriver driver : availableDrivers) {
            if (driver.canBuild(buildType)) {
                return driver;
            }
        }

        throw new CoreException("No build driver available for " + buildType + " build type.");
    }

}

@@ -98,73 +98,73 @@
 pnc.
-spi.builddriver.BuildDriver;%0Aimport org.jboss.pnc.model.BuildType
+model.BuildType;%0Aimport org.jboss.pnc.spi.builddriver.BuildDriver
 ;%0A%0Ai
@@ -819,16 +819,78 @@
 type.%22);
+ //TODO create test to make sure exception is properly handled
 %0A    %7D%0A%0A

Add todo note.