View Javadoc
1   /*
2    * Copyright (C) 2012, GitHub Inc. and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.transport;
11  
12  import java.util.Collections;
13  import java.util.Set;
14  
15  import org.eclipse.jgit.errors.NotSupportedException;
16  import org.eclipse.jgit.errors.TransportException;
17  import org.eclipse.jgit.lib.Repository;
18  
19  /**
20   * Transport protocol contributed via service provider
21   */
22  public class SpiTransport extends Transport {
23  
24  	/**
25  	 * Transport protocol scheme
26  	 */
27  	public static final String SCHEME = "testspi";
28  
29  	/**
30  	 * Instance
31  	 */
32  	public static final TransportProtocol PROTO = new TransportProtocol() {
33  
34  		@Override
35  		public String getName() {
36  			return "Test SPI Transport Protocol";
37  		}
38  
39  		@Override
40  		public Set<String> getSchemes() {
41  			return Collections.singleton(SCHEME);
42  		}
43  
44  		@Override
45  		public Transport open(URIish uri, Repository local, String remoteName)
46  				throws NotSupportedException, TransportException {
47  			throw new NotSupportedException("not supported");
48  		}
49  	};
50  
51  	private SpiTransport(Repository local, URIish uri) {
52  		super(local, uri);
53  	}
54  
55  	@Override
56  	public FetchConnection openFetch() throws NotSupportedException,
57  			TransportException {
58  		throw new NotSupportedException("not supported");
59  	}
60  
61  	@Override
62  	public PushConnection openPush() throws NotSupportedException,
63  			TransportException {
64  		throw new NotSupportedException("not supported");
65  	}
66  
67  	@Override
68  	public void close() {
69  		// Intentionally left blank
70  	}
71  }