/*
 * FindBugs - Find Bugs in Java programs
 * Copyright (C) 2003-2008 University of Maryland
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.findbugs.cloud;

import edu.umd.cs.findbugs.BugCollection;

/**
 * @author pwilliam
 */
public class CloudFactory {
	
	
	public static Cloud getPlainCloud(BugCollection bc) {
		return new BugCollectionStorageCloud(bc);
	}
	
	public static Cloud getDatabaseCloud(BugCollection bc) {
		Cloud c = new DBCloud(bc);
		if (c.initialize())
			return c;
		return new BugCollectionStorageCloud(bc);
	}
	
}

@@ -911,16 +911,61 @@
 lection;
+%0Aimport edu.umd.cs.findbugs.SystemProperties;
 %0A%0A/**%0A *
@@ -1186,68 +1186,317 @@
 %7B%0A%09%09
-Cloud c = new DBCloud(bc);%0A%09%09if (c.initialize())%0A%09%09%09return c
+if (bc == null) %0A%09%09%09return new BugCollectionStorageCloud(bc);%0A%09%09Cloud c = new DBCloud(bc);%0A%09%09if (c.initialize())%0A%09%09%09return c;%0A%09%09bc.getProject().getGuiCallback().showMessageDialog(%22Unable to connect to database%22);%0A    %09if (SystemProperties.getBoolean(%22findbugs.failIfUnableToConnectToDB%22))%0A    %09%09System.exit(1)
 ;%0A%09%09

check findbugs.failIfUnableToConnectToDB