diff src/org/tmatesoft/hg/core/SessionContext.java @ 698:822f3a83ff57

in, out and clone tests pass for ssh repositories. Infrastructure to decouple HgRemoteRepository from specific Connector implementation
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 06 Aug 2013 21:18:33 +0200
parents fba85bc1dfb8
children a483b2b68a2e
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/SessionContext.java	Tue Aug 06 13:34:34 2013 +0200
+++ b/src/org/tmatesoft/hg/core/SessionContext.java	Tue Aug 06 21:18:33 2013 +0200
@@ -16,6 +16,12 @@
  */
 package org.tmatesoft.hg.core;
 
+import java.net.URI;
+
+import org.tmatesoft.hg.internal.BasicSessionContext;
+import org.tmatesoft.hg.internal.Experimental;
+import org.tmatesoft.hg.internal.remote.RemoteConnectorDescriptor;
+import org.tmatesoft.hg.repo.HgLookup.RemoteDescriptor;
 import org.tmatesoft.hg.util.LogFacility;
 import org.tmatesoft.hg.util.Path;
 
@@ -67,6 +73,23 @@
 	}
 
 	/**
+	 * Work in progress, provisional API.
+	 * 
+	 * Provides descriptor that knows how to handle connections of specific kind
+	 * 
+	 * FIXME Perhaps, implementation here shall return null for any URI, while the one
+	 * in {@link BasicSessionContext} shall use our internal classes? However,
+	 * present implementation provides support for uris handled in the library itself, and likely
+	 * most clients need this, even if they supply own SessionContext
+	 *  
+	 * @return <code>null</code> if supplied URI doesn't point to a remote repository or repositories of that kind are not supported
+	 */
+	@Experimental(reason="Work in progress, provisional API")
+	public RemoteDescriptor getRemoteDescriptor(URI uri) {
+		return new RemoteConnectorDescriptor.Provider().get(this, uri);
+	}
+
+	/**
 	 * Providers of the context may implement
 	 */
 	public interface Source {