diff options
Diffstat (limited to 'org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java')
-rw-r--r-- | org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java deleted file mode 100644 index 50b7ea6e3..000000000 --- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Mylar project committers - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylar.internal.trac.core; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.mylar.internal.trac.core.ITracClient.Version; - -/** - * @author Steffen Pingel - */ -public class TracClientFactory { - - public static ITracClient createClient(String location, Version version, String username, String password) - throws MalformedURLException { - URL url = new URL(location); - - if (version == Version.TRAC_0_9) { - return new Trac09Client(url, version, username, password); - } else if (version == Version.XML_RPC) { - return new TracXmlRpcClient(url, version, username, password); - } - - throw new RuntimeException("Invalid repository version: " + version); - } - - /** - * Tries all supported access types for <code>location</code> and returns - * the corresponding version if successful; throws an exception otherwise. - * - * <p> - * Order of the tried access types: XML-RPC, Trac 0.9 - */ - public static Version probeClient(String location, String username, String password) throws MalformedURLException, - TracException { - URL url = new URL(location); - try { - ITracClient repository = new TracXmlRpcClient(url, Version.XML_RPC, username, password); - repository.validate(); - return Version.XML_RPC; - } catch (TracException e) { - try { - ITracClient repository = new Trac09Client(url, Version.TRAC_0_9, username, password); - repository.validate(); - return Version.TRAC_0_9; - } catch (TracLoginException e2) { - throw e; - } catch (TracException e2) { - } - } - - throw new TracException(); - } - -} |