@@ -0,0 +1,1731 @@
+package net.kencochrane.raven;%0A%0Aimport java.util.ServiceLoader;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Apublic abstract class RavenFactory %7B%0A    private static final Logger logger = Logger.getLogger(RavenFactory.class.getCanonicalName());%0A    private static final ServiceLoader%3CRavenFactory%3E RAVEN_FACTORIES = ServiceLoader.load(RavenFactory.class);%0A%0A    public static Raven ravenInstance(Dsn dsn) %7B%0A        for (RavenFactory ravenFactory : RAVEN_FACTORIES) %7B%0A            Raven raven = getRavenSafely(dsn, ravenFactory);%0A            if (raven != null) %7B%0A                return raven;%0A            %7D%0A        %7D%0A%0A        throw new IllegalStateException(%22Couldn't create a raven instance for '%22 + dsn + %22'%22);%0A    %7D%0A%0A    public static Raven ravenInstance(Dsn dsn, String ravenFactoryName) %7B%0A        for (RavenFactory ravenFactory : RAVEN_FACTORIES) %7B%0A            if (!ravenFactoryName.equals(ravenFactory.getClass().getCanonicalName()))%0A                continue;%0A%0A            Raven raven = getRavenSafely(dsn, ravenFactory);%0A            if (raven != null) %7B%0A                return raven;%0A            %7D%0A        %7D%0A%0A        throw new IllegalStateException(%22Couldn't create a raven instance for '%22 + dsn + %22'%22);%0A    %7D%0A%0A    private static Raven getRavenSafely(Dsn dsn, RavenFactory ravenFactory) %7B%0A        Raven raven = null;%0A        try %7B%0A            raven = ravenFactory.createRavenInstance(dsn);%0A        %7D catch (Exception e) %7B%0A            logger.log(Level.WARNING, %22An exception occurred during the creation of a Raven instance with %22 +%0A                    %22'%22 + ravenFactory + %22' using the DSN '%22 + dsn + %22'%22, e);%0A        %7D%0A        return raven;%0A    %7D%0A%0A    public abstract Raven createRavenInstance(Dsn dsn);%0A%7D%0A

Create a Simple factory to create Raven instances