Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5de9f9f129871246988ada12a727f7490f9d801d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*******************************************************************************
 * Copyright (c) 2011, 2017 IBM Corporation 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:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core;

import java.net.URI;
import java.util.HashMap;

/**
 * Describes how a bundle import will be executed. A bundle importer delegate
 * creates bundle import descriptions when it validates bundle manifests for
 * importing. The result, a set of bundle import descriptions is then passed to
 * TeamUI, which basing on the info from the descriptions instantiate and
 * initialize IScmUrlImportWizardPage pages. The pages can be used to alter the
 * default import configuration e.g. for bundles stored in a CVS repository the
 * user may want to check out HEAD rather than a specific version.
 * <p>
 * <strong>EXPERIMENTAL</strong>. This class has been added as part of a work in
 * progress. There is no guarantee that this API will work or that it will
 * remain the same. Please do not use this API without consulting with the Team
 * team.
 *
 * @since 3.6
 */
public class ScmUrlImportDescription {
	private String url;
	private String project;
	private HashMap<String, Object> properties;

	public ScmUrlImportDescription(String url, String project) {
		this.url = url;
		this.project = project;
	}

	/**
	 * @return project name
	 */
	public String getProject() {
		return project;
	}

	/**
	 * SCM URL
	 *
	 * @return a string representation of the SCM URL
	 */
	public String getUrl() {
		return url;
	}

	public URI getUri() {
		return URI.create(url.replaceAll("\"", "")); //$NON-NLS-1$//$NON-NLS-2$
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * Sets or removes a client property.
	 *
	 * @param key
	 *            property key
	 * @param value
	 *            property value or <code>null</code> to remove the property
	 */
	public synchronized void setProperty(String key, Object value) {
		if (properties == null) {
			properties = new HashMap<>();
		}
		if (value == null) {
			properties.remove(key);
		} else {
			properties.put(key, value);
		}

	}

	/**
	 * Returns the specified client property, or <code>null</code> if none.
	 *
	 * @param key
	 *            property key
	 * @return property value or <code>null</code>
	 */
	public synchronized Object getProperty(String key) {
		if (properties == null) {
			return null;
		}
		return properties.get(key);
	}
}

Back to the top