Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 216278 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/RepositoryEvent.java (-149 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.core.repository;
12
13
import java.net.URI;
14
import java.util.EventObject;
15
16
/**
17
 * An event indicating a repository was added, removed, changed,
18
 * or discovered.
19
 * 
20
 * @noextend This class is not intended to be subclassed by clients.
21
 */
22
public class RepositoryEvent extends EventObject {
23
	private static final long serialVersionUID = 3082402920617281765L;
24
25
	/**
26
	 * A change kind constant (value 0), indicating a repository was added to the 
27
	 * list of repositories known to a repository manager.
28
	 */
29
	public static final int ADDED = 0;
30
31
	/**
32
	 * A change kind constant (value 1), indicating a repository was removed from 
33
	 * the list of repositories known to a repository manager.
34
	 */
35
	public static final int REMOVED = 1;
36
37
	/**
38
	 * A change kind constant (value 2), indicating a repository known to a 
39
	 * repository manager was modified.
40
	 */
41
	public static final int CHANGED = 2;
42
43
	/**
44
	 * A change kind constant (value 4), indicating a new repository was discovered.
45
	 * This event is a way to notify repository managers in a generic way about
46
	 * a newly discovered repository. The repository manager will typically receive
47
	 * this event, add the repository to its list of known repositories, and issue
48
	 * a subsequent {@link #ADDED} event. Other clients should not typically
49
	 * listen for this kind of event.
50
	 */
51
	public static final int DISCOVERED = 4;
52
53
	/**
54
	 * A change kind constant (value 8), indicating the repository's enablement
55
	 * was changed.  The {{@link #isRepositoryEnabled()} method can be used
56
	 * to find out the new enablement state of the repository, and to deduce
57
	 * the previous enablement state.
58
	 */
59
	public static final int ENABLEMENT = 8;
60
61
	private final int kind, type;
62
	private boolean isEnabled;
63
	private String nickname;
64
65
	/**
66
	 * Creates and returns a new repository discovery event.
67
	 * @param location the location of the repository that changed.
68
	 * @param nickname the repository nickname
69
	 * @param repositoryType the type of repository that was changed
70
	 * @param enabled whether the repository is enabled
71
	 * @return A new repository discovery event
72
	 * @see IRepository#PROP_NICKNAME
73
	 */
74
	public static RepositoryEvent newDiscoveryEvent(URI location, String nickname, int repositoryType, boolean enabled) {
75
		RepositoryEvent event = new RepositoryEvent(location, repositoryType, DISCOVERED, enabled);
76
		event.nickname = nickname;
77
		return event;
78
	}
79
80
	/**
81
	 * Creates a new repository event.
82
	 * 
83
	 * @param location the location of the repository that changed.
84
	 * @param repositoryType the type of repository that was changed
85
	 * @param kind the kind of change that occurred.
86
	 * @param enabled whether the repository is enabled
87
	 */
88
	public RepositoryEvent(URI location, int repositoryType, int kind, boolean enabled) {
89
		super(location);
90
		this.kind = kind;
91
		this.type = repositoryType;
92
		isEnabled = enabled;
93
	}
94
95
	/**
96
	 * Returns the kind of change that occurred.
97
	 *
98
	 * @return the kind of change that occurred.
99
	 * @see #ADDED
100
	 * @see #REMOVED
101
	 * @see #CHANGED
102
	 * @see #DISCOVERED
103
	 * @see #ENABLEMENT
104
	 */
105
	public int getKind() {
106
		return kind;
107
	}
108
109
	/**
110
	 * Returns the nickname of the repository. This method is only applicable
111
	 * for the {@link #DISCOVERED} event type. For other event types this
112
	 * method returns <code>null</code>.
113
	 */
114
	public String getRepositoryNickname() {
115
		return nickname;
116
	}
117
118
	/**
119
	 * Returns the location of the repository associated with this event.
120
	 * 
121
	 * @return the location of the repository associated with this event.
122
	 */
123
	public URI getRepositoryLocation() {
124
		return (URI) getSource();
125
	}
126
127
	/**
128
	 * Returns the type of repository associated with this event. Clients
129
	 * should not assume that the set of possible repository types is closed;
130
	 * clients should ignore events from repository types they don't know about.
131
	 * 
132
	 * @return the type of repository associated with this event.
133
	 *  ({@link IRepository#TYPE_METADATA} or {@link IRepository#TYPE_ARTIFACT}).
134
	 */
135
	public int getRepositoryType() {
136
		return type;
137
	}
138
139
	/**
140
	 * Returns whether the affected repository is enabled.
141
	 * 
142
	 * @return <code>true</code> if the repository is enabled,
143
	 * and <code>false</code> otherwise.
144
	 */
145
	public boolean isRepositoryEnabled() {
146
		return isEnabled;
147
	}
148
149
}
(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java (-188 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.core.repository;
12
13
import java.net.URI;
14
import java.util.Map;
15
import org.eclipse.core.runtime.IAdaptable;
16
17
/**
18
 * Base interface that defines common properties that may be provided by 
19
 * various kinds of repositories.
20
 * 
21
 * @noimplement This interface is not intended to be implemented by clients.
22
 */
23
public interface IRepository extends IAdaptable {
24
	/** 
25
	 * The key for a boolean property indicating that the repository
26
	 * is a system repository.  System repositories are implementation details
27
	 * that are not subject to general access, hidden from the typical user, etc.
28
	 */
29
	public static final String PROP_SYSTEM = "p2.system"; //$NON-NLS-1$
30
31
	/**
32
	 * The key for a boolean property indicating that repository metadata is
33
	 * stored in compressed form.  A compressed repository will have lower
34
	 * bandwidth cost to read when remote, but higher processing cost to
35
	 * uncompress when reading.
36
	 */
37
	public static final String PROP_COMPRESSED = "p2.compressed"; //$NON-NLS-1$
38
39
	/**
40
	 * The key for a string property providing a human-readable name for the repository.
41
	 */
42
	public static final String PROP_NAME = "name"; //$NON-NLS-1$
43
44
	/**
45
	 * The key for a string property providing a user-defined name for the repository.
46
	 * This property is never stored in the repository itself, but is instead tracked and managed
47
	 * by an {@link IRepositoryManager}.
48
	 */
49
	public static final String PROP_NICKNAME = "p2.nickname"; //$NON-NLS-1$
50
51
	/**
52
	 * The key for a string property providing a human-readable description for the repository.
53
	 */
54
	public static final String PROP_DESCRIPTION = "description"; //$NON-NLS-1$
55
56
	/**
57
	 * The key for a string property providing the common base URL that should
58
	 * be replaced with the mirror URL.
59
	 */
60
	public static final String PROP_MIRRORS_BASE_URL = "p2.mirrorsBaseURL"; //$NON-NLS-1$
61
62
	/**
63
	 * The key for a string property providing a URL that can return mirrors of this
64
	 * repository.
65
	 */
66
	public static final String PROP_MIRRORS_URL = "p2.mirrorsURL"; //$NON-NLS-1$
67
68
	/**
69
	 * The key for a string property containing the time when the repository was last modified.
70
	 */
71
	public static final String PROP_TIMESTAMP = "p2.timestamp"; //$NON-NLS-1$
72
73
	/**
74
	 * The key for a string property providing the user name to an authenticated
75
	 * URL.  This key is used in the secure preference store for repository data.
76
	 * @see #PREFERENCE_NODE
77
	 */
78
	public static final String PROP_USERNAME = "username"; //$NON-NLS-1$
79
80
	/**
81
	 * The key for a string property providing the password to an authenticated
82
	 * URL.  This key is used in the secure preference store for repository data.
83
	 * @see #PREFERENCE_NODE
84
	 */
85
	public static final String PROP_PASSWORD = "password"; //$NON-NLS-1$
86
87
	/**
88
	 * The node identifier for repository secure preference store.
89
	 */
90
	public static final String PREFERENCE_NODE = "org.eclipse.equinox.p2.repository"; //$NON-NLS-1$
91
92
	/**
93
	 * A repository type constant (value 0) representing a metadata repository.
94
	 */
95
	public static final int TYPE_METADATA = 0;
96
97
	/**
98
	 * A repository type constant (value 1) representing an artifact repository.
99
	 */
100
	public static final int TYPE_ARTIFACT = 1;
101
102
	/** 
103
	 * General purpose zero-valued bit mask constant. Useful whenever you need to
104
	 * supply a bit mask with no bits set.
105
	 */
106
	public static final int NONE = 0;
107
108
	/**
109
	 * An option flag constant (value 1) indicating an enabled repository.
110
	 */
111
	public static final int ENABLED = 1;
112
113
	/**
114
	 * Returns the URL of the repository.
115
	 * TODO: Should we use URL or URI? URL requires a protocol handler
116
	 * to be installed in Java.  Can the URL have any protocol?
117
	 * @return the URL of the repository.
118
	 */
119
	public URI getLocation();
120
121
	/**
122
	 * Returns the name of the repository.
123
	 * @return the name of the repository.
124
	 */
125
	public String getName();
126
127
	/**
128
	 * Returns a string representing the type of the repository.
129
	 * @return the type of the repository.
130
	 */
131
	public String getType();
132
133
	/**
134
	 * Returns a string representing the version for the repository type.
135
	 * @return the version of the type of the repository.
136
	 */
137
	public String getVersion();
138
139
	/**
140
	 * Returns a brief description of the repository.
141
	 * @return the description of the repository.
142
	 */
143
	public String getDescription();
144
145
	/**
146
	 * Returns the name of the provider of the repository.
147
	 * @return the provider of this repository.
148
	 */
149
	public String getProvider();
150
151
	/**
152
	 * Returns a read-only collection of the properties of the repository.
153
	 * @return the properties of this repository.
154
	 */
155
	public Map getProperties();
156
157
	/**
158
	 * Returns <code>true</code> if this repository can be modified.
159
	 * @return whether or not this repository can be modified
160
	 */
161
	public boolean isModifiable();
162
163
	/**
164
	 * Set the name of the repository.
165
	 */
166
	public void setName(String name);
167
168
	/**
169
	 * Sets the description of the repository.
170
	 */
171
	public void setDescription(String description);
172
173
	/**
174
	 * Sets the value of the property with the given key. Returns the old property
175
	 * associated with that key, if any.  Setting a value of <code>null</code> will
176
	 * remove the corresponding key from the properties of this repository.
177
	 * 
178
	 * @param key The property key
179
	 * @param value The new property value, or <code>null</code> to remove the key
180
	 * @return The old property value, or <code>null</code> if there was no old value
181
	 */
182
	public String setProperty(String key, String value);
183
184
	/**
185
	 * Sets the name of the provider of the repository.
186
	 */
187
	public void setProvider(String provider);
188
}
(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/ICompositeRepository.java (-41 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.core.repository;
12
13
import java.net.URI;
14
import java.util.List;
15
16
public interface ICompositeRepository extends IRepository {
17
	/**
18
	 * 
19
	 * @return a list of URIs containing the locations of the children repositories
20
	 */
21
	public abstract List getChildren();
22
23
	/**
24
	 * Removes all child repositories
25
	 */
26
	public abstract void removeAllChildren();
27
28
	/**
29
	 * Removes specified URI from list of child repositories.
30
	 * Does nothing if specified URI is not a child repository
31
	 * @param child
32
	 */
33
	public abstract void removeChild(URI child);
34
35
	/**
36
	 * Adds a specified URI to list of child repositories.
37
	 * Does nothing if URI is a duplicate of an existing child repository.
38
	 * @param child
39
	 */
40
	public abstract void addChild(URI child);
41
}
(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepositoryManager.java (-207 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.core.repository;
12
13
import java.net.URI;
14
15
/**
16
 * The common base class for metadata and artifact repository managers.
17
 * <p>
18
 * A repository manager keeps track of a set of known repositories, and provides 
19
 * caching of these known repositories to avoid unnecessary loading of repositories 
20
 * from the disk or network.  The manager fires {@link RepositoryEvent}s when the 
21
 * set of known repositories changes.
22
 * 
23
 * @noimplement This interface is not intended to be implemented by clients.
24
 */
25
public interface IRepositoryManager {
26
	/**
27
	 * Constant used to indicate that all enabled repositories are of interest.
28
	 */
29
	public static final int REPOSITORIES_ALL = 0;
30
31
	/**
32
	 * Constant used to indicate that disabled repositories are of interest.
33
	 * @see #getKnownRepositories(int)
34
	 */
35
	public static final int REPOSITORIES_DISABLED = 1 << 3;
36
37
	/**
38
	 * Constant used to indicate that local repositories are of interest.
39
	 * @see #getKnownRepositories(int)
40
	 */
41
	public static final int REPOSITORIES_LOCAL = 1 << 2;
42
43
	/**
44
	 * Constant used to indicate that non-system repositories are of interest.
45
	 * @see IRepository#PROP_SYSTEM
46
	 * @see #getKnownRepositories(int)
47
	 */
48
	public static final int REPOSITORIES_NON_SYSTEM = 1 << 1;
49
50
	/**
51
	 * Constant used to indicate that system repositories are of interest.
52
	 * @see IRepository#PROP_SYSTEM
53
	 * @see #getKnownRepositories(int)
54
	 */
55
	public static final int REPOSITORIES_SYSTEM = 1 << 0;
56
57
	/**
58
	 * Constant used to indicate that a repository manager should only load the
59
	 * repository if the repository is modifiable.
60
	 * @see IRepository#isModifiable()
61
	 */
62
	public static final int REPOSITORY_HINT_MODIFIABLE = 1 << 0;
63
64
	/**
65
	 * Adds the repository at the given location to the list of repositories tracked by 
66
	 * this repository manager.
67
	 * <p>
68
	 * If there is a known disabled repository at the given location, it will become
69
	 * enabled as a result of this method. Thus the caller can be guaranteed that
70
	 * there is a known, enabled repository at the given location when this method returns.
71
	 * 
72
	 * @param location The location of the repository to add
73
	 * @see #isEnabled(URI)
74
	 */
75
	public void addRepository(URI location);
76
77
	/**
78
	 * Returns whether a repository at the given location is in the list of repositories
79
	 * tracked by this repository manager.
80
	 * 
81
	 * @param location The location of the repository to look for
82
	 * @return <code>true</code> if the repository is known to this manager,
83
	 * and <code>false</code> otherwise
84
	 */
85
	public boolean contains(URI location);
86
87
	/**
88
	 * Returns the artifact repository locations known to the repository manager.
89
	 * <p>
90
	 * Note that the repository manager does not guarantee that a valid repository
91
	 * exists at any of the returned locations at any particular moment in time.
92
	 * A subsequent attempt to load a repository at any of the given locations may
93
	 * or may not succeed.
94
	 * 
95
	 * @param flags an integer bit-mask indicating which repositories should be
96
	 * returned.  <code>REPOSITORIES_ALL</code> can be used as the mask when
97
	 * all enabled repositories should be returned.
98
	 * @return the locations of the repositories managed by this repository manager.
99
	 * 
100
	 * @see #REPOSITORIES_ALL
101
	 * @see #REPOSITORIES_SYSTEM
102
	 * @see #REPOSITORIES_NON_SYSTEM
103
	 * @see #REPOSITORIES_LOCAL
104
	 * @see #REPOSITORIES_DISABLED
105
	 */
106
	public URI[] getKnownRepositories(int flags);
107
108
	/**
109
	 * Returns the property associated with the repository at the given URI, 
110
	 * without loading the repository.
111
	 * <p>
112
	 * Note that some properties for a repository can only be
113
	 * determined when that repository is loaded.  This method will return <code>null</code>
114
	 * for such properties.  Only values for the properties that are already
115
	 * known by a repository manager will be returned. 
116
	 * <p>
117
	 * If a client wishes to retrieve a property value from a repository 
118
	 * regardless of the cost of retrieving it, the client should load the 
119
	 * repository and then retrieve the property from the repository itself.
120
	 * 
121
	 * @param location the URI of the repository in question
122
	 * @param key the String key of the property desired
123
	 * @return the value of the property, or <code>null</code> if the repository
124
	 * does not exist, the value does not exist, or the property value 
125
	 * could not be determined without loading the repository.
126
	 * 
127
	 * @see IRepository#getProperties()
128
	 * @see #setRepositoryProperty(URI, String, String)
129
	 */
130
	public String getRepositoryProperty(URI location, String key);
131
132
	/**
133
	 * Sets the property associated with the repository at the given URI, 
134
	 * without loading the repository.
135
	 * <p>
136
	 * This method stores properties in a cache in the repository manager and does
137
	 * not write the property to the backing repository. This is useful for making
138
	 * repository properties available without incurring the cost of loading the repository.
139
	 * When the repository is loaded, it will overwrite any conflicting properties that
140
	 * have been set using this method.
141
	 * </p>
142
	 * <p>
143
	 * To persistently set a property on a repository, clients must load
144
	 * the repository and call {@link IRepository#setProperty(String, String)}.
145
	 * </p>
146
	 * 
147
	 * @param location the URI of the repository in question
148
	 * @param key the String key of the property desired
149
	 * @param value the value to set the property to
150
	 * @see #getRepositoryProperty(URI, String)
151
	 * @see IRepository#setProperty(String, String)
152
	 */
153
	public void setRepositoryProperty(URI location, String key, String value);
154
155
	/**
156
	 * Returns the enablement value of a repository.  Disabled repositories are known
157
	 * to the repository manager, but are never used in the context of provisioning
158
	 * operations. Disabled repositories are useful as a form of bookmark to indicate that a 
159
	 * repository location is of interest, but not currently used.
160
	 * <p>
161
	 * Note that enablement is a property of the repository manager and not a property
162
	 * of the affected repository. The enablement of the repository is discarded when 
163
	 * a repository is removed from the repository manager.
164
	 * 
165
	 * @param location The location of the repository whose enablement is requested
166
	 * @return <code>true</code> if the repository is enabled, and
167
	 * <code>false</code> if it is not enabled, or if the repository location 
168
	 * is not known to the repository manager.
169
	 * @see #REPOSITORIES_DISABLED
170
	 * @see #setEnabled(URI, boolean)
171
	 */
172
	public boolean isEnabled(URI location);
173
174
	/**
175
	 * Removes the repository at the given location from the list of
176
	 * repositories known to this repository manager.  The underlying
177
	 * repository is not deleted. This method has no effect if the given
178
	 * repository is not already known to this repository manager.
179
	 * 
180
	 * @param location The location of the repository to remove
181
	 * @return <code>true</code> if a repository was removed, and 
182
	 * <code>false</code> otherwise.
183
	 */
184
	public boolean removeRepository(URI location);
185
186
	/**
187
	 * Sets the enablement of a repository. Disabled repositories are known
188
	 * to the repository manager, but are never used in the context of provisioning
189
	 * operation. Disabled repositories are useful as a form of bookmark to indicate that a 
190
	 * repository location is of interest, but not currently used.
191
	 * <p>
192
	 * Note that enablement is a property of the repository manager and not a property
193
	 * of the affected repository. The enablement of the repository is discarded when 
194
	 * a repository is removed from the repository manager.
195
	 * <p>
196
	 * This method has no effect if the given repository location is not known to the
197
	 * repository manager.
198
	 * 
199
	 * @param location The location of the repository to enable or disable
200
	 * @param enablement <code>true</code>to enable the repository, and
201
	 * <code>false</code> to disable the repository
202
	 * @see #REPOSITORIES_DISABLED
203
	 * @see #isEnabled(URI)
204
	 */
205
	public void setEnabled(URI location, boolean enablement);
206
207
}
(-)src/org/eclipse/equinox/internal/provisional/p2/core/repository/RepositoryCreationException.java (-21 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.core.repository;
12
13
public class RepositoryCreationException extends Exception {
14
15
	private static final long serialVersionUID = -5648382121963317100L;
16
17
	public RepositoryCreationException(Throwable e) {
18
		super(e);
19
	}
20
21
}
(-)src/org/eclipse/equinox/internal/p2/core/helpers/messages.properties (-8 lines)
Lines 9-21 Link Here
9
#     IBM Corporation - initial API and implementation
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
10
###############################################################################
11
11
12
repoMan_adding = Adding repository {0}
13
repoMan_exists=Repository already exists at {0}.
14
repoMan_failedRead=The repository could not be read: {0}.
15
repoMan_internalError=Internal error.
16
repoMan_notExists=No repository found at {0}.
17
repoMan_save=Saving repository settings
18
repoMan_unknownType=Unknown repository type at {0}.
19
20
Util_Invalid_Zip_File_Format=Invalid zip file format
12
Util_Invalid_Zip_File_Format=Invalid zip file format
21
Util_Error_Unzipping=Error unzipping {0}: {1}
13
Util_Error_Unzipping=Error unzipping {0}: {1}
(-)src/org/eclipse/equinox/internal/p2/core/helpers/Messages.java (-8 lines)
Lines 25-38 Link Here
25
		// Do not instantiate
25
		// Do not instantiate
26
	}
26
	}
27
27
28
	public static String repoMan_adding;
29
	public static String repoMan_exists;
30
	public static String repoMan_failedRead;
31
	public static String repoMan_internalError;
32
	public static String repoMan_notExists;
33
	public static String repoMan_save;
34
	public static String repoMan_unknownType;
35
36
	public static String Util_Invalid_Zip_File_Format;
28
	public static String Util_Invalid_Zip_File_Format;
37
	public static String Util_Error_Unzipping;
29
	public static String Util_Error_Unzipping;
38
30
(-)src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java (-953 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.core.helpers;
12
13
import java.lang.ref.SoftReference;
14
import java.net.*;
15
import java.util.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.preferences.IPreferencesService;
18
import org.eclipse.equinox.internal.p2.core.Activator;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
21
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.*;
23
import org.eclipse.osgi.util.NLS;
24
import org.osgi.service.prefs.BackingStoreException;
25
import org.osgi.service.prefs.Preferences;
26
27
/**
28
 * Common code shared between artifact and metadata repository managers.
29
 */
30
public abstract class AbstractRepositoryManager implements IRepositoryManager, ProvisioningListener {
31
	protected static class RepositoryInfo {
32
		public String description;
33
		public boolean isEnabled = true;
34
		public boolean isSystem = false;
35
		public URI location;
36
		public String name;
37
		public String nickname;
38
		public SoftReference repository;
39
		public String suffix;
40
41
		public RepositoryInfo() {
42
			super();
43
		}
44
	}
45
46
	public static final String ATTR_SUFFIX = "suffix"; //$NON-NLS-1$
47
	public static final String EL_FACTORY = "factory"; //$NON-NLS-1$
48
	public static final String EL_FILTER = "filter"; //$NON-NLS-1$
49
	public static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$
50
	public static final String KEY_ENABLED = "enabled"; //$NON-NLS-1$
51
	public static final String KEY_NAME = "name"; //$NON-NLS-1$
52
	public static final String KEY_NICKNAME = "nickname"; //$NON-NLS-1$
53
	public static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$
54
	public static final String KEY_SUFFIX = "suffix"; //$NON-NLS-1$
55
	public static final String KEY_SYSTEM = "isSystem"; //$NON-NLS-1$
56
	public static final String KEY_TYPE = "type"; //$NON-NLS-1$
57
	public static final String KEY_URI = "uri"; //$NON-NLS-1$
58
	public static final String KEY_URL = "url"; //$NON-NLS-1$
59
	public static final String KEY_VERSION = "version"; //$NON-NLS-1$
60
61
	public static final String NODE_REPOSITORIES = "repositories"; //$NON-NLS-1$
62
63
	/**
64
	 * Map of String->RepositoryInfo, where String is the repository key
65
	 * obtained via getKey(URI).
66
	 */
67
	protected Map repositories = null;
68
69
	//lock object to be held when referring to the repositories field
70
	protected final Object repositoryLock = new Object();
71
72
	/**
73
	 * Cache List of repositories that are not reachable. Maintain cache
74
	 * for short duration because repository may become available at any time.
75
	 */
76
	protected SoftReference unavailableRepositories;
77
78
	/**
79
	 * Set used to manage exclusive load locks on repository locations.
80
	 */
81
	private Map loadLocks = new HashMap();
82
83
	protected AbstractRepositoryManager() {
84
		IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(Activator.getContext(), IProvisioningEventBus.SERVICE_NAME);
85
		if (bus != null)
86
			bus.addListener(this);
87
	}
88
89
	/**
90
	 * Adds a repository to the list of known repositories
91
	 * @param repository the repository object to add
92
	 * @param signalAdd whether a repository change event should be fired
93
	 * @param suffix the suffix used to load the repository, or <code>null</code> if unknown
94
	 */
95
	protected void addRepository(IRepository repository, boolean signalAdd, String suffix) {
96
		boolean added = false;
97
		synchronized (repositoryLock) {
98
			if (repositories == null)
99
				restoreRepositories();
100
			String key = getKey(repository.getLocation());
101
			RepositoryInfo info = (RepositoryInfo) repositories.get(key);
102
			if (info == null) {
103
				info = new RepositoryInfo();
104
				added = true;
105
				repositories.put(key, info);
106
			}
107
			info.repository = new SoftReference(repository);
108
			info.name = repository.getName();
109
			info.description = repository.getDescription();
110
			info.location = repository.getLocation();
111
			String value = (String) repository.getProperties().get(IRepository.PROP_SYSTEM);
112
			if (value != null)
113
				info.isSystem = Boolean.valueOf(value).booleanValue();
114
			info.suffix = suffix;
115
		}
116
		// save the given repository in the preferences.
117
		remember(repository, suffix);
118
		if (added && signalAdd)
119
			broadcastChangeEvent(repository.getLocation(), IRepository.TYPE_METADATA, RepositoryEvent.ADDED, true);
120
	}
121
122
	/* (non-Javadoc)
123
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#addRepository(java.net.URI)
124
	 */
125
	public void addRepository(URI location) {
126
		//add the repository, or enable it if already known
127
		if (!addRepository(location, true, true))
128
			setEnabled(location, true);
129
	}
130
131
	/**
132
	 * Adds the repository to the list of known repositories. 
133
	 * @param location The repository location
134
	 * @param isEnabled Whether the repository should be enabled
135
	 * @param signalAdd Whether a repository add event should be broadcast
136
	 * @return <code>true</code> if the repository was actually added, and 
137
	 * <code>false</code> otherwise.
138
	 */
139
	private boolean addRepository(URI location, boolean isEnabled, boolean signalAdd) {
140
		RepositoryInfo info = new RepositoryInfo();
141
		info.location = location;
142
		info.isEnabled = isEnabled;
143
		boolean added = true;
144
		synchronized (repositoryLock) {
145
			if (repositories == null)
146
				restoreRepositories();
147
			if (contains(location))
148
				return false;
149
			added = repositories.put(getKey(location), info) == null;
150
			// save the given repository in the preferences.
151
			remember(info, true);
152
		}
153
		if (added && signalAdd)
154
			broadcastChangeEvent(location, getRepositoryType(), RepositoryEvent.ADDED, isEnabled);
155
		return added;
156
	}
157
158
	protected IRepository basicGetRepository(URI location) {
159
		synchronized (repositoryLock) {
160
			if (repositories == null)
161
				restoreRepositories();
162
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
163
			if (info == null || info.repository == null)
164
				return null;
165
			IRepository repo = (IRepository) info.repository.get();
166
			//update our repository info because the repository may have changed
167
			if (repo != null)
168
				addRepository(repo, false, null);
169
			return repo;
170
		}
171
	}
172
173
	public IRepository basicRefreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
174
		clearNotFound(location);
175
		boolean wasEnabled = isEnabled(location);
176
		//remove the repository so  event is broadcast and repositories can clear their caches
177
		if (!removeRepository(location))
178
			fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
179
		try {
180
			IRepository result = loadRepository(location, monitor, null, 0);
181
			setEnabled(location, wasEnabled);
182
			return result;
183
		} catch (ProvisionException e) {
184
			//if we failed to load, make sure the repository is not lost
185
			addRepository(location, wasEnabled, true);
186
			throw e;
187
		}
188
	}
189
190
	private void broadcastChangeEvent(URI location, int repositoryType, int kind, boolean isEnabled) {
191
		IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(Activator.getContext(), IProvisioningEventBus.class.getName());
192
		if (bus != null)
193
			bus.publishEvent(new RepositoryEvent(location, repositoryType, kind, isEnabled));
194
	}
195
196
	/**
197
	 * Check if we recently attempted to load the given location and failed
198
	 * to find anything. Returns <code>true</code> if the repository was not
199
	 * found, and <code>false</code> otherwise.
200
	 */
201
	private boolean checkNotFound(URI location) {
202
		if (unavailableRepositories == null)
203
			return false;
204
		List badRepos = (List) unavailableRepositories.get();
205
		if (badRepos == null)
206
			return false;
207
		return badRepos.contains(location);
208
	}
209
210
	/**
211
	 * Clear the fact that we tried to load a repository at this location and did not find anything.
212
	 */
213
	protected void clearNotFound(URI location) {
214
		List badRepos;
215
		if (unavailableRepositories != null) {
216
			badRepos = (List) unavailableRepositories.get();
217
			if (badRepos != null) {
218
				badRepos.remove(location);
219
				return;
220
			}
221
		}
222
	}
223
224
	/* (non-Javadoc)
225
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#contains(java.net.URI)
226
	 */
227
	public boolean contains(URI location) {
228
		synchronized (repositoryLock) {
229
			if (repositories == null)
230
				restoreRepositories();
231
			return repositories.containsKey(getKey(location));
232
		}
233
	}
234
235
	/* (non-Javadoc)
236
	 * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager#createRepository(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
237
	 */
238
	protected IRepository doCreateRepository(URI location, String name, String type, Map properties) throws ProvisionException {
239
		Assert.isNotNull(name);
240
		Assert.isNotNull(type);
241
		IRepository result = null;
242
		try {
243
			enterLoad(location);
244
			boolean loaded = false;
245
			try {
246
				//repository should not already exist
247
				loadRepository(location, (IProgressMonitor) null, type, 0);
248
				loaded = true;
249
			} catch (ProvisionException e) {
250
				//expected - fall through and create the new repository
251
			}
252
			if (loaded)
253
				fail(location, ProvisionException.REPOSITORY_EXISTS);
254
255
			IExtension extension = RegistryFactory.getRegistry().getExtension(getRepositoryProviderExtensionPointId(), type);
256
			if (extension == null)
257
				fail(location, ProvisionException.REPOSITORY_UNKNOWN_TYPE);
258
			//		MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
259
			//		if (factory == null)
260
			//			fail(location, ProvisionException.REPOSITORY_FAILED_READ);
261
			result = factoryCreate(location, name, type, properties, extension);
262
			if (result == null)
263
				fail(location, ProvisionException.REPOSITORY_FAILED_READ);
264
			clearNotFound(location);
265
			addRepository(result, false, null);
266
		} finally {
267
			exitLoad(location);
268
		}
269
		//fire event after releasing load lock
270
		broadcastChangeEvent(location, getRepositoryType(), RepositoryEvent.ADDED, true);
271
		return result;
272
	}
273
274
	/**
275
	 * Returns the executable extension, or <code>null</code> if there
276
	 * was no corresponding extension, or an error occurred loading it
277
	 */
278
	protected Object createExecutableExtension(IExtension extension, String element) {
279
		IConfigurationElement[] elements = extension.getConfigurationElements();
280
		CoreException failure = null;
281
		for (int i = 0; i < elements.length; i++) {
282
			if (elements[i].getName().equals(element)) {
283
				try {
284
					return elements[i].createExecutableExtension("class"); //$NON-NLS-1$
285
				} catch (CoreException e) {
286
					log("Error loading repository extension: " + extension.getUniqueIdentifier(), failure); //$NON-NLS-1$
287
					return null;
288
				}
289
			}
290
		}
291
		log("Malformed repository extension: " + extension.getUniqueIdentifier(), null); //$NON-NLS-1$
292
		return null;
293
	}
294
295
	/**
296
	 * Obtains an exclusive right to load a repository at the given location. Blocks
297
	 * if another thread is currently loading at that location. Invocation of this
298
	 * method must be followed by a subsequent call to {@link #exitLoad(URI)}.
299
	 * 
300
	 * To avoid deadlock between the loadLock and repositoryLock, this method
301
	 * must not be called when repositoryLock is held.
302
	 * 
303
	 * @param location The location to lock
304
	 */
305
	private void enterLoad(URI location) {
306
		Thread current = Thread.currentThread();
307
		synchronized (loadLocks) {
308
			while (true) {
309
				Thread owner = (Thread) loadLocks.get(location);
310
				if (owner == null || current.equals(owner))
311
					break;
312
				try {
313
					loadLocks.wait();
314
				} catch (InterruptedException e) {
315
					//keep trying
316
				}
317
			}
318
			loadLocks.put(location, current);
319
		}
320
	}
321
322
	/**
323
	 * Relinquishes the exclusive right to load a repository at the given location. Unblocks
324
	 * other threads waiting to load at that location.
325
	 * @param location The location to unlock
326
	 */
327
	private void exitLoad(URI location) {
328
		synchronized (loadLocks) {
329
			loadLocks.remove(location);
330
			loadLocks.notifyAll();
331
		}
332
	}
333
334
	/**
335
	 * Creates and returns a repository using the given repository factory extension. Returns
336
	 * null if no factory could be found associated with that extension.
337
	 */
338
	protected abstract IRepository factoryCreate(URI location, String name, String type, Map properties, IExtension extension) throws ProvisionException;
339
340
	/**
341
	 * Loads and returns a repository using the given repository factory extension. Returns
342
	 * null if no factory could be found associated with that extension.
343
	 */
344
	protected abstract IRepository factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException;
345
346
	protected void fail(URI location, int code) throws ProvisionException {
347
		String msg = null;
348
		switch (code) {
349
			case ProvisionException.REPOSITORY_EXISTS :
350
				msg = NLS.bind(Messages.repoMan_exists, location);
351
				break;
352
			case ProvisionException.REPOSITORY_UNKNOWN_TYPE :
353
				msg = NLS.bind(Messages.repoMan_unknownType, location);
354
				break;
355
			case ProvisionException.REPOSITORY_FAILED_READ :
356
				msg = NLS.bind(Messages.repoMan_failedRead, location);
357
				break;
358
			case ProvisionException.REPOSITORY_NOT_FOUND :
359
				msg = NLS.bind(Messages.repoMan_notExists, location);
360
				break;
361
		}
362
		if (msg == null)
363
			msg = Messages.repoMan_internalError;
364
		throw new ProvisionException(new Status(IStatus.ERROR, getBundleId(), code, msg, null));
365
	}
366
367
	protected IExtension[] findMatchingRepositoryExtensions(String suffix, String type) {
368
		IConfigurationElement[] elt = null;
369
		if (type != null && type.length() > 0) {
370
			IExtension ext = RegistryFactory.getRegistry().getExtension(getRepositoryProviderExtensionPointId(), type);
371
			elt = (ext != null) ? ext.getConfigurationElements() : new IConfigurationElement[0];
372
		} else {
373
			elt = RegistryFactory.getRegistry().getConfigurationElementsFor(getRepositoryProviderExtensionPointId());
374
		}
375
		int count = 0;
376
		for (int i = 0; i < elt.length; i++) {
377
			if (EL_FILTER.equals(elt[i].getName())) {
378
				if (!suffix.equals(elt[i].getAttribute(ATTR_SUFFIX))) {
379
					elt[i] = null;
380
				} else {
381
					count++;
382
				}
383
			} else {
384
				elt[i] = null;
385
			}
386
		}
387
		IExtension[] results = new IExtension[count];
388
		for (int i = 0; i < elt.length; i++) {
389
			if (elt[i] != null)
390
				results[--count] = elt[i].getDeclaringExtension();
391
		}
392
		return results;
393
	}
394
395
	protected String[] getAllSuffixes() {
396
		IConfigurationElement[] elements = RegistryFactory.getRegistry().getConfigurationElementsFor(getRepositoryProviderExtensionPointId());
397
		ArrayList result = new ArrayList(elements.length);
398
		result.add(getDefaultSuffix());
399
		for (int i = 0; i < elements.length; i++) {
400
			if (elements[i].getName().equals(EL_FILTER)) {
401
				String suffix = elements[i].getAttribute(ATTR_SUFFIX);
402
				if (!result.contains(suffix))
403
					result.add(suffix);
404
			}
405
		}
406
		return (String[]) result.toArray(new String[result.size()]);
407
	}
408
409
	/**
410
	 * Returns the bundle id of the bundle that provides the concrete repository manager
411
	 * @return a symbolic bundle id
412
	 */
413
	protected abstract String getBundleId();
414
415
	/**
416
	 * Returns the default repository suffix. This is used to ensure a particular
417
	 * repository type is preferred over all others.
418
	 */
419
	protected abstract String getDefaultSuffix();
420
421
	/*
422
	 * Return a string key based on the given repository location which
423
	 * is suitable for use as a preference node name.
424
	 * TODO: convert local file system URI to canonical form
425
	 */
426
	private String getKey(URI location) {
427
		String key = location.toString().replace('/', '_');
428
		//remove trailing slash
429
		if (key.endsWith("_")) //$NON-NLS-1$
430
			key = key.substring(0, key.length() - 1);
431
		return key;
432
	}
433
434
	/* (non-Javadoc)
435
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#getKnownRepositories(int)
436
	 */
437
	public URI[] getKnownRepositories(int flags) {
438
		synchronized (repositoryLock) {
439
			if (repositories == null)
440
				restoreRepositories();
441
			ArrayList result = new ArrayList();
442
			int i = 0;
443
			for (Iterator it = repositories.values().iterator(); it.hasNext(); i++) {
444
				RepositoryInfo info = (RepositoryInfo) it.next();
445
				if (matchesFlags(info, flags))
446
					result.add(info.location);
447
			}
448
			return (URI[]) result.toArray(new URI[result.size()]);
449
		}
450
	}
451
452
	/**
453
	 * Return the preference node which is the root for where we store the repository information.
454
	 */
455
	Preferences getPreferences() {
456
		IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(Activator.getContext(), IPreferencesService.class.getName());
457
458
		try {
459
			return prefService.getRootNode().node("/profile/_SELF_/" + getBundleId() + "/" + NODE_REPOSITORIES); //$NON-NLS-1$ //$NON-NLS-2$
460
		} catch (IllegalArgumentException e) {
461
			return null;
462
		}
463
	}
464
465
	/**
466
	 * Restores a repository location from the preferences.
467
	 */
468
	private URI getRepositoryLocation(Preferences node) {
469
		//prefer the location stored in URI form
470
		String locationString = node.get(KEY_URI, null);
471
		try {
472
			if (locationString != null)
473
				return new URI(locationString);
474
		} catch (URISyntaxException e) {
475
			log("Error while restoring repository: " + locationString, e); //$NON-NLS-1$
476
		}
477
		//we used to store the repository as a URL, so try old key for backwards compatibility
478
		locationString = node.get(KEY_URL, null);
479
		try {
480
			if (locationString != null)
481
				return URIUtil.toURI(new URL(locationString));
482
		} catch (MalformedURLException e) {
483
			log("Error while restoring repository: " + locationString, e); //$NON-NLS-1$
484
		} catch (URISyntaxException e) {
485
			log("Error while restoring repository: " + locationString, e); //$NON-NLS-1$
486
		}
487
		return null;
488
	}
489
490
	/*(non-Javadoc)
491
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#getRepositoryProperty(java.net.URI, java.lang.String)
492
	 */
493
	public String getRepositoryProperty(URI location, String key) {
494
		synchronized (repositoryLock) {
495
			if (repositories == null)
496
				restoreRepositories();
497
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
498
			if (info == null)
499
				return null;// Repository not found
500
			if (IRepository.PROP_DESCRIPTION.equals(key))
501
				return info.description;
502
			else if (IRepository.PROP_NAME.equals(key))
503
				return info.name;
504
			else if (IRepository.PROP_SYSTEM.equals(key))
505
				return Boolean.toString(info.isSystem);
506
			else if (IRepository.PROP_NICKNAME.equals(key))
507
				return info.nickname;
508
			// Key not known, return null
509
			return null;
510
		}
511
	}
512
513
	/*(non-Javadoc)
514
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#getRepositoryProperty(java.net.URI, java.lang.String)
515
	 */
516
	public void setRepositoryProperty(URI location, String key, String value) {
517
		synchronized (repositoryLock) {
518
			if (repositories == null)
519
				restoreRepositories();
520
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
521
			if (info == null)
522
				return;// Repository not found
523
			if (IRepository.PROP_DESCRIPTION.equals(key))
524
				info.description = value;
525
			else if (IRepository.PROP_NAME.equals(key))
526
				info.name = value;
527
			else if (IRepository.PROP_NICKNAME.equals(key))
528
				info.nickname = value;
529
			else if (IRepository.PROP_SYSTEM.equals(key))
530
				//only true if value.equals("true") which is OK because a repository is only system if it's explicitly set to system.
531
				info.isSystem = Boolean.valueOf(value).booleanValue();
532
			remember(info, true);
533
		}
534
	}
535
536
	/**
537
	 * Returns the fully qualified id of the repository provider extension point.
538
	 */
539
	protected abstract String getRepositoryProviderExtensionPointId();
540
541
	/**
542
	 * Returns the system property used to specify additional repositories to be
543
	 * automatically added to the list of known repositories.
544
	 */
545
	protected abstract String getRepositorySystemProperty();
546
547
	/**
548
	 * Returns the repository type stored in this manager.
549
	 */
550
	protected abstract int getRepositoryType();
551
552
	/* (non-Javadoc)
553
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#isEnabled(java.net.URI)
554
	 */
555
	public boolean isEnabled(URI location) {
556
		synchronized (repositoryLock) {
557
			if (repositories == null)
558
				restoreRepositories();
559
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
560
			if (info != null)
561
				return info.isEnabled;
562
			// Repository not found, return false
563
			return false;
564
		}
565
	}
566
567
	protected IRepository loadRepository(URI location, IProgressMonitor monitor, String type, int flags) throws ProvisionException {
568
		boolean added = false;
569
		IRepository result = null;
570
571
		try {
572
			enterLoad(location);
573
			result = basicGetRepository(location);
574
			if (result != null)
575
				return result;
576
			if (checkNotFound(location))
577
				fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
578
			//add the repository first so that it will be enabled, but don't send add event until after the load
579
			added = addRepository(location, true, false);
580
			String[] suffixes = sortSuffixes(getAllSuffixes(), location);
581
			SubMonitor sub = SubMonitor.convert(monitor, NLS.bind(Messages.repoMan_adding, location), suffixes.length * 100);
582
			ProvisionException failure = null;
583
			try {
584
				for (int i = 0; i < suffixes.length; i++) {
585
					if (sub.isCanceled())
586
						throw new OperationCanceledException();
587
					try {
588
						result = loadRepository(location, suffixes[i], type, flags, sub.newChild(100));
589
					} catch (ProvisionException e) {
590
						failure = e;
591
						break;
592
					}
593
					if (result != null) {
594
						addRepository(result, false, suffixes[i]);
595
						break;
596
					}
597
				}
598
			} finally {
599
				sub.done();
600
			}
601
			if (result == null) {
602
				//if we just added the repository, remove it because it cannot be loaded
603
				if (added)
604
					removeRepository(location, false);
605
				//eagerly cleanup missing system repositories
606
				if (Boolean.valueOf(getRepositoryProperty(location, IRepository.PROP_SYSTEM)).booleanValue())
607
					removeRepository(location);
608
				else
609
					rememberNotFound(location);
610
				if (failure != null)
611
					throw failure;
612
				fail(location, ProvisionException.REPOSITORY_NOT_FOUND);
613
			}
614
		} finally {
615
			exitLoad(location);
616
		}
617
		//broadcast the add event after releasing lock
618
		if (added)
619
			broadcastChangeEvent(location, IRepository.TYPE_METADATA, RepositoryEvent.ADDED, true);
620
		return result;
621
	}
622
623
	private IRepository loadRepository(URI location, String suffix, String type, int flags, SubMonitor monitor) throws ProvisionException {
624
		IExtension[] providers = findMatchingRepositoryExtensions(suffix, type);
625
		// Loop over the candidates and return the first one that successfully loads
626
		monitor.beginTask("", providers.length * 10); //$NON-NLS-1$
627
		for (int i = 0; i < providers.length; i++)
628
			try {
629
				IRepository repo = factoryLoad(location, providers[i], flags, monitor);
630
				if (repo != null)
631
					return repo;
632
			} catch (ProvisionException e) {
633
				if (e.getStatus().getCode() != ProvisionException.REPOSITORY_NOT_FOUND)
634
					throw e;
635
			} catch (Exception e) {
636
				//catch and log unexpected errors and move onto the next factory
637
				log("Unexpected error loading extension: " + providers[i].getUniqueIdentifier(), e); //$NON-NLS-1$
638
			} catch (LinkageError e) {
639
				//catch and log unexpected errors and move onto the next factory
640
				log("Unexpected error loading extension: " + providers[i].getUniqueIdentifier(), e); //$NON-NLS-1$
641
			}
642
		return null;
643
	}
644
645
	protected void log(String message, Throwable t) {
646
		LogHelper.log(new Status(IStatus.ERROR, getBundleId(), message, t));
647
	}
648
649
	private boolean matchesFlags(RepositoryInfo info, int flags) {
650
		if ((flags & REPOSITORIES_SYSTEM) == REPOSITORIES_SYSTEM)
651
			if (!info.isSystem)
652
				return false;
653
		if ((flags & REPOSITORIES_NON_SYSTEM) == REPOSITORIES_NON_SYSTEM)
654
			if (info.isSystem)
655
				return false;
656
		if ((flags & REPOSITORIES_DISABLED) == REPOSITORIES_DISABLED) {
657
			if (info.isEnabled)
658
				return false;
659
		} else {
660
			//ignore disabled repositories for all other flag types
661
			if (!info.isEnabled)
662
				return false;
663
		}
664
		if ((flags & REPOSITORIES_LOCAL) == REPOSITORIES_LOCAL)
665
			return "file".equals(info.location.getScheme()); //$NON-NLS-1$
666
		return true;
667
	}
668
669
	/*(non-Javadoc)
670
	 * @see org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener#notify(java.util.EventObject)
671
	 */
672
	public void notify(EventObject o) {
673
		if (o instanceof RepositoryEvent) {
674
			RepositoryEvent event = (RepositoryEvent) o;
675
			if (event.getKind() == RepositoryEvent.DISCOVERED && event.getRepositoryType() == getRepositoryType())
676
				addRepository(event.getRepositoryLocation(), event.isRepositoryEnabled(), true);
677
		}
678
	}
679
680
	/**
681
	 * Sets a preference and returns <code>true</code> if the preference
682
	 * was actually changed.
683
	 */
684
	protected boolean putValue(Preferences node, String key, String newValue) {
685
		String oldValue = node.get(key, null);
686
		if (oldValue == newValue || (oldValue != null && oldValue.equals(newValue)))
687
			return false;
688
		if (newValue == null)
689
			node.remove(key);
690
		else
691
			node.put(key, newValue);
692
		return true;
693
	}
694
695
	/*
696
	 * Add the given repository object to the preferences and save.
697
	 */
698
	private void remember(IRepository repository, String suffix) {
699
		boolean changed = false;
700
		Preferences node = getPreferences();
701
		// Ensure we retrieved preferences
702
		if (node == null)
703
			return;
704
		node = node.node(getKey(repository.getLocation()));
705
706
		try {
707
			changed |= putValue(node, KEY_URI, repository.getLocation().toString());
708
			changed |= putValue(node, KEY_URL, null);
709
			changed |= putValue(node, KEY_DESCRIPTION, repository.getDescription());
710
			changed |= putValue(node, KEY_NAME, repository.getName());
711
			changed |= putValue(node, KEY_PROVIDER, repository.getProvider());
712
			changed |= putValue(node, KEY_TYPE, repository.getType());
713
			changed |= putValue(node, KEY_VERSION, repository.getVersion());
714
			changed |= putValue(node, KEY_SYSTEM, (String) repository.getProperties().get(IRepository.PROP_SYSTEM));
715
			changed |= putValue(node, KEY_SUFFIX, suffix);
716
			if (changed)
717
				saveToPreferences();
718
		} catch (IllegalStateException e) {
719
			//the repository was removed concurrently, so we don't need to save it
720
		}
721
	}
722
723
	/**
724
	 * Writes the state of the repository information into the appropriate preference node.
725
	 * 
726
	 * @param info The info to write to the preference node
727
	 * @param flush <code>true</code> if the preference node should be flushed to
728
	 * disk, and <code>false</code> otherwise
729
	 */
730
	private boolean remember(RepositoryInfo info, boolean flush) {
731
		boolean changed = false;
732
		Preferences node = getPreferences();
733
		// Ensure we retrieved preferences
734
		if (node == null)
735
			return changed;
736
		node = node.node(getKey(info.location));
737
		try {
738
			changed |= putValue(node, KEY_URI, info.location.toString());
739
			changed |= putValue(node, KEY_URL, null);
740
			changed |= putValue(node, KEY_SYSTEM, Boolean.toString(info.isSystem));
741
			changed |= putValue(node, KEY_DESCRIPTION, info.description);
742
			changed |= putValue(node, KEY_NAME, info.name);
743
			changed |= putValue(node, KEY_NICKNAME, info.nickname);
744
			changed |= putValue(node, KEY_SUFFIX, info.suffix);
745
			changed |= putValue(node, KEY_ENABLED, Boolean.toString(info.isEnabled));
746
			if (changed && flush)
747
				saveToPreferences();
748
			return changed;
749
		} catch (IllegalStateException e) {
750
			//the repository was removed concurrently, so we don't need to save it
751
			return false;
752
		}
753
	}
754
755
	/**
756
	 * Cache the fact that we tried to load a repository at this location and did not find anything.
757
	 */
758
	private void rememberNotFound(URI location) {
759
		List badRepos;
760
		if (unavailableRepositories != null) {
761
			badRepos = (List) unavailableRepositories.get();
762
			if (badRepos != null) {
763
				badRepos.add(location);
764
				return;
765
			}
766
		}
767
		badRepos = new ArrayList();
768
		badRepos.add(location);
769
		unavailableRepositories = new SoftReference(badRepos);
770
	}
771
772
	public boolean removeRepository(URI toRemove) {
773
		return removeRepository(toRemove, true);
774
	}
775
776
	private boolean removeRepository(URI toRemove, boolean signalRemove) {
777
		Assert.isNotNull(toRemove);
778
		final String repoKey = getKey(toRemove);
779
		synchronized (repositoryLock) {
780
			if (repositories == null)
781
				restoreRepositories();
782
			if (repositories.remove(repoKey) == null)
783
				return false;
784
		}
785
		// remove the repository from the preference store
786
		try {
787
			if (Tracing.DEBUG_REMOVE_REPO) {
788
				String msg = "Removing repository: " + toRemove; //$NON-NLS-1$
789
				Tracing.debug(msg);
790
				new Exception(msg).printStackTrace();
791
			}
792
			Preferences node = getPreferences();
793
			if (node != null) {
794
				getPreferences().node(repoKey).removeNode();
795
				saveToPreferences();
796
			}
797
			clearNotFound(toRemove);
798
		} catch (BackingStoreException e) {
799
			log("Error saving preferences", e); //$NON-NLS-1$
800
		}
801
		//TODO: compute and pass appropriate isEnabled flag
802
		if (signalRemove)
803
			broadcastChangeEvent(toRemove, getRepositoryType(), RepositoryEvent.REMOVED, true);
804
		return true;
805
	}
806
807
	/*
808
	 * Load the list of repositories from the preferences.
809
	 */
810
	private void restoreFromPreferences() {
811
		// restore the list of repositories from the preference store
812
		Preferences node = getPreferences();
813
		if (node == null)
814
			return;
815
		String[] children;
816
		try {
817
			children = node.childrenNames();
818
		} catch (BackingStoreException e) {
819
			log("Error restoring repositories from preferences", e); //$NON-NLS-1$
820
			return;
821
		}
822
		for (int i = 0; i < children.length; i++) {
823
			Preferences child = node.node(children[i]);
824
			URI location = getRepositoryLocation(child);
825
			if (location == null)
826
				continue;
827
			RepositoryInfo info = new RepositoryInfo();
828
			info.location = location;
829
			info.name = child.get(KEY_NAME, null);
830
			info.nickname = child.get(KEY_NICKNAME, null);
831
			info.description = child.get(KEY_DESCRIPTION, null);
832
			info.isSystem = child.getBoolean(KEY_SYSTEM, false);
833
			info.isEnabled = child.getBoolean(KEY_ENABLED, true);
834
			info.suffix = child.get(KEY_SUFFIX, null);
835
			repositories.put(getKey(info.location), info);
836
		}
837
		// now that we have loaded everything, remember them
838
		saveToPreferences();
839
	}
840
841
	private void restoreFromSystemProperty() {
842
		String locationString = Activator.getContext().getProperty(getRepositorySystemProperty());
843
		if (locationString != null) {
844
			StringTokenizer tokenizer = new StringTokenizer(locationString, ","); //$NON-NLS-1$
845
			while (tokenizer.hasMoreTokens()) {
846
				try {
847
					addRepository(new URI(tokenizer.nextToken()), true, true);
848
				} catch (URISyntaxException e) {
849
					log("Error while restoring repository " + locationString, e); //$NON-NLS-1$
850
				}
851
			}
852
		}
853
	}
854
855
	/**
856
	 * Restores the repository list.
857
	 */
858
	private void restoreRepositories() {
859
		synchronized (repositoryLock) {
860
			repositories = new HashMap();
861
			restoreSpecialRepositories();
862
			restoreFromSystemProperty();
863
			restoreFromPreferences();
864
		}
865
	}
866
867
	/**
868
	 * Hook method to restore special additional repositories.
869
	 */
870
	protected void restoreSpecialRepositories() {
871
		//by default no special repositories
872
	}
873
874
	/*
875
	 * Save the list of repositories to the file-system.
876
	 */
877
	private void saveToPreferences() {
878
		try {
879
			Preferences node = getPreferences();
880
			if (node != null)
881
				node.flush();
882
		} catch (BackingStoreException e) {
883
			log("Error while saving repositories in preferences", e); //$NON-NLS-1$
884
		}
885
	}
886
887
	/* (non-Javadoc)
888
	 * @see org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager#setEnabled(java.net.URI, boolean)
889
	 */
890
	public void setEnabled(URI location, boolean enablement) {
891
		synchronized (repositoryLock) {
892
			if (repositories == null)
893
				restoreRepositories();
894
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
895
			if (info == null || info.isEnabled == enablement)
896
				return;
897
			info.isEnabled = enablement;
898
			remember(info, true);
899
		}
900
		broadcastChangeEvent(location, getRepositoryType(), RepositoryEvent.ENABLEMENT, enablement);
901
	}
902
903
	/**
904
	 * Shuts down the repository manager.
905
	 */
906
	public void shutdown() {
907
		IProvisioningEventBus bus = (IProvisioningEventBus) ServiceHelper.getService(Activator.getContext(), IProvisioningEventBus.SERVICE_NAME);
908
		if (bus != null)
909
			bus.removeListener(this);
910
		//ensure all repository state in memory is written to disk
911
		boolean changed = false;
912
		synchronized (repositoryLock) {
913
			if (repositories != null) {
914
				for (Iterator it = repositories.values().iterator(); it.hasNext();) {
915
					RepositoryInfo info = (RepositoryInfo) it.next();
916
					changed |= remember(info, false);
917
				}
918
			}
919
		}
920
		if (changed) {
921
			if (Tracing.DEBUG)
922
				Tracing.debug("Unsaved preferences when shutting down " + getClass().getName()); //$NON-NLS-1$
923
			saveToPreferences();
924
		}
925
		repositories = null;
926
		unavailableRepositories = null;
927
	}
928
929
	/**
930
	 * Optimize the order in which repository suffixes are searched by trying 
931
	 * the last successfully loaded suffix first.
932
	 */
933
	private String[] sortSuffixes(String[] suffixes, URI location) {
934
		synchronized (repositoryLock) {
935
			if (repositories == null)
936
				restoreRepositories();
937
			RepositoryInfo info = (RepositoryInfo) repositories.get(getKey(location));
938
			if (info == null || info.suffix == null)
939
				return suffixes;
940
			//move lastSuffix to the front of the list but preserve order of remaining entries
941
			String lastSuffix = info.suffix;
942
			for (int i = 0; i < suffixes.length; i++) {
943
				if (lastSuffix.equals(suffixes[i])) {
944
					System.arraycopy(suffixes, 0, suffixes, 1, i);
945
					suffixes[0] = lastSuffix;
946
					return suffixes;
947
				}
948
			}
949
		}
950
		return suffixes;
951
	}
952
953
}
(-)src/org/eclipse/equinox/internal/p2/persistence/XMLConstants.java (-63 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Genuitec, LLC - added license support
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.persistence;
13
14
public interface XMLConstants {
15
16
	// Constants used in defining a default processing instruction
17
	// including a class name and a version of the associated XML
18
	// for some category of objects.
19
	//	e.g. <?category class='a.b.c.SomeClass' version='1.2.3'?>
20
	//
21
	public static final String PI_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
22
	public static final String PI_VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
23
24
	// Element and attribute names for a standard property collection.
25
	//	e.g. <properties size='1'>
26
	//			<property name='some_name' value='some_value'/>
27
	//		 </properties>
28
	public static final String PROPERTIES_ELEMENT = "properties"; //$NON-NLS-1$
29
	public static final String PROPERTY_ELEMENT = "property"; //$NON-NLS-1$
30
	public static final String PROPERTY_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
31
	public static final String PROPERTY_VALUE_ATTRIBUTE = "value"; //$NON-NLS-1$
32
33
	// Constants for the names of common general attributes
34
	public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
35
	public static final String PARENT_ID_ATTRIBUTE = "parentId"; //$NON-NLS-1$
36
	public static final String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
37
	public static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
38
	public static final String VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
39
	public static final String VERSION_RANGE_ATTRIBUTE = "range"; //$NON-NLS-1$
40
	public static final String NAMESPACE_ATTRIBUTE = "namespace"; //$NON-NLS-1$
41
	public static final String CLASSIFIER_ATTRIBUTE = "classifier"; //$NON-NLS-1$
42
	public static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
43
	public static final String PROVIDER_ATTRIBUTE = "provider"; //$NON-NLS-1$
44
	public static final String URL_ATTRIBUTE = "url"; //$NON-NLS-1$
45
	public static final String URI_ATTRIBUTE = "uri"; //$NON-NLS-1$
46
47
	// Constants for the license and copyright elements
48
	public static final String LICENSES_ELEMENT = "licenses"; //$NON-NLS-1$
49
	public static final String LICENSE_ELEMENT = "license"; //$NON-NLS-1$
50
	public static final String COPYRIGHT_ELEMENT = "copyright"; //$NON-NLS-1$
51
52
	// A constant for the name of an attribute of a collection or array element
53
	// specifying the size or length
54
	public static final String COLLECTION_SIZE_ATTRIBUTE = "size"; //$NON-NLS-1$
55
56
	// A constant for an empty array of attribute names
57
	public static String[] noAttributes = new String[0];
58
59
	//Constants for attributes of a composite repository
60
	public static final String CHILDREN_ELEMENT = "children"; //$NON-NLS-1$
61
	public static final String CHILD_ELEMENT = "child"; //$NON-NLS-1$
62
	public static final String LOCATION_ELEMENT = "location"; //$NON-NLS-1$
63
}
(-)src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java (-69 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.io.OutputStream;
14
import java.io.UnsupportedEncodingException;
15
import java.net.URI;
16
import org.eclipse.core.runtime.URIUtil;
17
import org.eclipse.equinox.internal.provisional.p2.core.Version;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.ICompositeRepository;
19
20
/*
21
 * Class used to persist a composite repository.
22
 */
23
public class CompositeWriter extends XMLWriter implements XMLConstants {
24
25
	private static final String REPOSITORY_ELEMENT = "repository"; //$NON-NLS-1$
26
	private static final Version CURRENT_VERSION = new Version(1, 0, 0);
27
28
	public CompositeWriter(OutputStream output, String type) throws UnsupportedEncodingException {
29
		super(output, new XMLWriter.ProcessingInstruction[] {XMLWriter.ProcessingInstruction.makeClassVersionInstruction(type, ICompositeRepository.class, CURRENT_VERSION)});
30
		// TODO: add a processing instruction for the metadata version
31
	}
32
33
	/**
34
	 * Writes a list of URIs referring to sub repositories
35
	 */
36
	protected void writeChildren(URI[] children) {
37
		if (children == null || children.length == 0)
38
			return;
39
		start(CHILDREN_ELEMENT);
40
		attribute(COLLECTION_SIZE_ATTRIBUTE, children.length);
41
		for (int i = 0; i < children.length; i++)
42
			writeChild(children[i]);
43
		end(CHILDREN_ELEMENT);
44
	}
45
46
	protected void writeChild(URI encodedURI) {
47
		String unencodedString = URIUtil.toUnencodedString(encodedURI);
48
		start(CHILD_ELEMENT);
49
		attribute(LOCATION_ELEMENT, unencodedString);
50
		end(CHILD_ELEMENT);
51
	}
52
53
	/**
54
	 * Write the given composite repository to the output stream.
55
	 */
56
	public void write(CompositeRepositoryState repository) {
57
		start(REPOSITORY_ELEMENT);
58
		attribute(NAME_ATTRIBUTE, repository.getName());
59
		attribute(TYPE_ATTRIBUTE, repository.getType());
60
		attribute(VERSION_ATTRIBUTE, repository.getVersion());
61
		attributeOptional(PROVIDER_ATTRIBUTE, repository.getProvider());
62
		attributeOptional(DESCRIPTION_ATTRIBUTE, repository.getDescription()); // TODO: could be cdata?
63
		writeProperties(repository.getProperties());
64
		writeChildren(repository.getChildren());
65
		end(REPOSITORY_ELEMENT);
66
		flush();
67
	}
68
69
}
(-)src/org/eclipse/equinox/internal/p2/persistence/messages.properties (-27 lines)
Removed Link Here
1
###############################################################################
2
# Copyright (c) 2007, 2008 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
###############################################################################
11
12
# All these errors are bound to 5 args: 0-msg, 1-root, 2-name, 3-line, 4-column
13
XMLParser_Error_At_Line=Error at line {3}{1}: {0}
14
XMLParser_Error_At_Line_Column=Error at line {3}, column {4}{1}: {0}
15
XMLParser_Error_At_Name_Line=Error in {2} at line {3}: {0}
16
XMLParser_Error_At_Name_Line_Column=Error in {2} at line {3}, column {4}: {0}
17
18
XMLParser_No_SAX_Parser=Unable to acquire a SAX parser service.
19
XMLParser_Missing_Required_Attribute=Missing required attribute in "{0}": {1}
20
XMLParser_Illegal_Value_For_Attribute=Illegal value for attribute "{0}" of element "{1}": {2}
21
XMLParser_Duplicate_Element=Duplicate singleton element in element "{0}": <{1}{2}>
22
23
io_failedRead=Unable to read repository at {0}
24
io_IncompatibleVersion=\
25
Metadata repository has incompatible version {0}; expected {1}
26
io_parseError=\
27
Error parsing composite repository
(-)src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java (-307 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.io.*;
14
import java.util.*;
15
import org.eclipse.equinox.internal.provisional.p2.core.Version;
16
17
public class XMLWriter implements XMLConstants {
18
19
	public static class ProcessingInstruction {
20
21
		private String target;
22
		private String[] data;
23
24
		// The standard UTF-8 processing instruction
25
		public static final String XML_UTF8 = "<?xml version='1.0' encoding='UTF-8'?>"; //$NON-NLS-1$
26
27
		public ProcessingInstruction(String target, String[] attrs, String[] values) {
28
			// Lengths of attributes and values must be the same
29
			this.target = target;
30
			this.data = new String[attrs.length];
31
			for (int i = 0; i < attrs.length; i++) {
32
				data[i] = attributeImage(attrs[i], values[i]);
33
			}
34
		}
35
36
		public static ProcessingInstruction makeClassVersionInstruction(String target, Class clazz, Version version) {
37
			return new ProcessingInstruction(target, new String[] {PI_CLASS_ATTRIBUTE, PI_VERSION_ATTRIBUTE}, new String[] {clazz.getName(), version.toString()});
38
		}
39
40
		public String toString() {
41
			StringBuffer sb = new StringBuffer("<?"); //$NON-NLS-1$
42
			sb.append(this.target).append(' ');
43
			for (int i = 0; i < data.length; i++) {
44
				sb.append(this.data[i]);
45
				if (i < data.length - 1) {
46
					sb.append(' ');
47
				}
48
			}
49
			sb.append("?>"); //$NON-NLS-1$
50
			return sb.toString();
51
		}
52
	}
53
54
	private Stack elements; // XML elements that have not yet been closed
55
	private boolean open; // Can attributes be added to the current element?
56
	private String indent; // used for each level of indentation
57
58
	private PrintWriter pw;
59
60
	public XMLWriter(OutputStream output, ProcessingInstruction[] piElements) throws UnsupportedEncodingException {
61
		this.pw = new PrintWriter(new OutputStreamWriter(output, "UTF8"), false); //$NON-NLS-1$
62
		println(ProcessingInstruction.XML_UTF8);
63
		this.elements = new Stack();
64
		this.open = false;
65
		this.indent = "  "; //$NON-NLS-1$
66
		if (piElements != null) {
67
			for (int i = 0; i < piElements.length; i++) {
68
				println(piElements[i].toString());
69
			}
70
		}
71
	}
72
73
	// start a new element
74
	public void start(String name) {
75
		if (this.open) {
76
			println('>');
77
		}
78
		indent();
79
		print('<');
80
		print(name);
81
		this.elements.push(name);
82
		this.open = true;
83
	}
84
85
	// end the most recent element with this name
86
	public void end(String name) {
87
		if (this.elements.empty()) {
88
			throw new EndWithoutStartError();
89
		}
90
		int index = this.elements.search(name);
91
		if (index == -1) {
92
			throw new EndWithoutStartError(name);
93
		}
94
		for (int i = 0; i < index; i += 1) {
95
			end();
96
		}
97
	}
98
99
	// end the current element
100
	public void end() {
101
		if (this.elements.empty()) {
102
			throw new EndWithoutStartError();
103
		}
104
		String name = (String) this.elements.pop();
105
		if (this.open) {
106
			println("/>"); //$NON-NLS-1$
107
		} else {
108
			printlnIndented("</" + name + '>', false); //$NON-NLS-1$
109
		}
110
		this.open = false;
111
	}
112
113
	public static String escape(String txt) {
114
		StringBuffer buffer = null;
115
		for (int i = 0; i < txt.length(); ++i) {
116
			String replace;
117
			char c = txt.charAt(i);
118
			switch (c) {
119
				case '<' :
120
					replace = "&lt;"; //$NON-NLS-1$
121
					break;
122
				case '>' :
123
					replace = "&gt;"; //$NON-NLS-1$
124
					break;
125
				case '"' :
126
					replace = "&quot;"; //$NON-NLS-1$
127
					break;
128
				case '\'' :
129
					replace = "&apos;"; //$NON-NLS-1$
130
					break;
131
				case '&' :
132
					replace = "&amp;"; //$NON-NLS-1$
133
					break;
134
				case '\t' :
135
					replace = "&#x9;"; //$NON-NLS-1$
136
					break;
137
				case '\n' :
138
					replace = "&#xA;"; //$NON-NLS-1$
139
					break;
140
				case '\r' :
141
					replace = "&#xD;"; //$NON-NLS-1$
142
					break;
143
				default :
144
					// this is the set of legal xml scharacters in unicode excluding high surrogates since they cannot be represented with a char
145
					// see http://www.w3.org/TR/REC-xml/#charsets
146
					if ((c >= '\u0020' && c <= '\uD7FF') || (c >= '\uE000' && c <= '\uFFFD')) {
147
						if (buffer != null)
148
							buffer.append(c);
149
						continue;
150
					}
151
					replace = Character.isWhitespace(c) ? " " : null; //$NON-NLS-1$
152
			}
153
			if (buffer == null) {
154
				buffer = new StringBuffer(txt.length() + 16);
155
				buffer.append(txt.substring(0, i));
156
			}
157
			if (replace != null)
158
				buffer.append(replace);
159
		}
160
161
		if (buffer == null)
162
			return txt;
163
164
		return buffer.toString();
165
	}
166
167
	// write a boolean attribute if it doesn't have the default value
168
	public void attribute(String name, boolean value, boolean defaultValue) {
169
		if (value != defaultValue) {
170
			attribute(name, value);
171
		}
172
	}
173
174
	public void attribute(String name, boolean value) {
175
		attribute(name, Boolean.toString(value));
176
	}
177
178
	public void attribute(String name, int value) {
179
		attribute(name, Integer.toString(value));
180
	}
181
182
	public void attributeOptional(String name, String value) {
183
		if (value != null && value.length() > 0) {
184
			attribute(name, value);
185
		}
186
	}
187
188
	public void attribute(String name, Object value) {
189
		if (!this.open) {
190
			throw new AttributeAfterNestedContentError();
191
		}
192
		if (value == null) {
193
			return; // optional attribute with no value
194
		}
195
		print(' ');
196
		print(name);
197
		print("='"); //$NON-NLS-1$
198
		print(escape(value.toString()));
199
		print('\'');
200
	}
201
202
	public void cdata(String data) {
203
		cdata(data, true);
204
	}
205
206
	public void cdata(String data, boolean escape) {
207
		if (this.open) {
208
			println('>');
209
			this.open = false;
210
		}
211
		if (data != null) {
212
			printlnIndented(data, escape);
213
		}
214
	}
215
216
	public void flush() {
217
		this.pw.flush();
218
	}
219
220
	public void writeProperties(Map properties) {
221
		writeProperties(PROPERTIES_ELEMENT, properties);
222
	}
223
224
	public void writeProperties(String propertiesElement, Map properties) {
225
		if (properties != null && properties.size() > 0) {
226
			start(propertiesElement);
227
			attribute(COLLECTION_SIZE_ATTRIBUTE, properties.size());
228
			for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
229
				String name = (String) iter.next();
230
				writeProperty(name, (String) properties.get(name));
231
			}
232
			end(propertiesElement);
233
		}
234
	}
235
236
	public void writeProperty(String name, String value) {
237
		start(PROPERTY_ELEMENT);
238
		attribute(PROPERTY_NAME_ATTRIBUTE, name);
239
		attribute(PROPERTY_VALUE_ATTRIBUTE, value);
240
		end();
241
	}
242
243
	protected static String attributeImage(String name, String value) {
244
		if (value == null) {
245
			return ""; // optional attribute with no value
246
		}
247
		return name + "='" + escape(value) + '\''; //$NON-NLS-1$
248
	}
249
250
	private void println(char c) {
251
		this.pw.println(c);
252
	}
253
254
	private void println(String s) {
255
		this.pw.println(s);
256
	}
257
258
	private void println() {
259
		this.pw.println();
260
	}
261
262
	private void print(char c) {
263
		this.pw.print(c);
264
	}
265
266
	private void print(String s) {
267
		this.pw.print(s);
268
	}
269
270
	private void printlnIndented(String s, boolean escape) {
271
		if (s.length() == 0) {
272
			println();
273
		} else {
274
			indent();
275
			println(escape ? escape(s) : s);
276
		}
277
	}
278
279
	private void indent() {
280
		for (int i = this.elements.size(); i > 0; i -= 1) {
281
			print(this.indent);
282
		}
283
	}
284
285
	public static class AttributeAfterNestedContentError extends Error {
286
		private static final long serialVersionUID = 1L; // not serialized
287
	}
288
289
	public static class EndWithoutStartError extends Error {
290
		private static final long serialVersionUID = 1L; // not serialized
291
		private String name;
292
293
		public EndWithoutStartError() {
294
			super();
295
		}
296
297
		public EndWithoutStartError(String name) {
298
			super();
299
			this.name = name;
300
		}
301
302
		public String getName() {
303
			return this.name;
304
		}
305
	}
306
307
}
(-)src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryState.java (-93 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.net.URI;
14
import java.util.Map;
15
16
/*
17
 * Instances of this class represent a composite repository (either metadata
18
 * or artifact) and are used in persisting or retrieving the repository to/from disk.
19
 */
20
public class CompositeRepositoryState {
21
	private String name;
22
	private String type;
23
	private String version;
24
	private String provider;
25
	private String description;
26
	private URI location;
27
	private Map properties;
28
	private URI[] children;
29
30
	public void setName(String value) {
31
		name = value;
32
	}
33
34
	public String getName() {
35
		return name;
36
	}
37
38
	public void setType(String value) {
39
		type = value;
40
	}
41
42
	public String getType() {
43
		return type;
44
	}
45
46
	public void setVersion(String value) {
47
		version = value;
48
	}
49
50
	public String getVersion() {
51
		return version;
52
	}
53
54
	public void setProvider(String value) {
55
		provider = value;
56
	}
57
58
	public String getProvider() {
59
		return provider;
60
	}
61
62
	public void setDescription(String value) {
63
		description = value;
64
	}
65
66
	public String getDescription() {
67
		return description;
68
	}
69
70
	public void setLocation(URI value) {
71
		location = value;
72
	}
73
74
	public URI getLocation() {
75
		return location;
76
	}
77
78
	public void setProperties(Map value) {
79
		properties = value;
80
	}
81
82
	public Map getProperties() {
83
		return properties;
84
	}
85
86
	public void setChildren(URI[] value) {
87
		children = value;
88
	}
89
90
	public URI[] getChildren() {
91
		return children;
92
	}
93
}
(-)src/org/eclipse/equinox/internal/p2/persistence/CompositeParser.java (-218 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.io.*;
14
import java.net.URI;
15
import java.util.*;
16
import javax.xml.parsers.ParserConfigurationException;
17
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
18
import org.eclipse.equinox.internal.provisional.p2.core.Version;
19
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
20
import org.eclipse.osgi.util.NLS;
21
import org.osgi.framework.BundleContext;
22
import org.xml.sax.*;
23
24
/*
25
 * Class used to read a composite repository.
26
 */
27
public class CompositeParser extends XMLParser implements XMLConstants {
28
29
	private static final Version CURRENT_VERSION = new Version(1, 0, 0);
30
	static final VersionRange XML_TOLERANCE = new VersionRange(CURRENT_VERSION, true, new Version(2, 0, 0), false);
31
	private static final String REQUIRED_CAPABILITY_ELEMENT = "required"; //$NON-NLS-1$
32
	private static final String REPOSITORY_ELEMENT = "repository"; //$NON-NLS-1$
33
	String repositoryType;
34
	private CompositeRepositoryState theState;
35
36
	protected class ChildrenHandler extends AbstractHandler {
37
		private ArrayList children;
38
39
		public ChildrenHandler(AbstractHandler parentHandler, Attributes attributes) {
40
			super(parentHandler, CHILDREN_ELEMENT);
41
			String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
42
			children = (size != null ? new ArrayList(new Integer(size).intValue()) : new ArrayList(4));
43
		}
44
45
		public URI[] getChildren() {
46
			int size = children.size();
47
			URI[] result = new URI[size];
48
			int i = 0;
49
			for (Iterator it = children.iterator(); it.hasNext(); i++) {
50
				result[i] = (URI) it.next();
51
			}
52
			return result;
53
		}
54
55
		public void startElement(String name, Attributes attributes) {
56
			if (name.equals(CHILD_ELEMENT)) {
57
				new ChildHandler(this, attributes, children);
58
			} else {
59
				invalidElement(name, attributes);
60
			}
61
		}
62
	}
63
64
	protected class ChildHandler extends AbstractHandler {
65
		private final String[] required = new String[] {LOCATION_ELEMENT};
66
		private final String[] optional = new String[] {};
67
68
		URI currentRepo = null;
69
70
		private List repos;
71
72
		public ChildHandler(AbstractHandler parentHandler, Attributes attributes, List repos) {
73
			super(parentHandler, CHILD_ELEMENT);
74
			String[] values = parseAttributes(attributes, required, optional);
75
			this.repos = repos;
76
			//skip entire subrepository if the location is missing
77
			if (values[0] == null)
78
				return;
79
			currentRepo = checkURI(REQUIRED_CAPABILITY_ELEMENT, URI_ATTRIBUTE, values[0]);
80
81
		}
82
83
		public void startElement(String name, Attributes attributes) {
84
			checkCancel();
85
		}
86
87
		protected void finished() {
88
			if (currentRepo != null)
89
				repos.add(currentRepo);
90
		}
91
	}
92
93
	private final class RepositoryDocHandler extends DocHandler {
94
95
		public RepositoryDocHandler(String rootName, RootHandler rootHandler) {
96
			super(rootName, rootHandler);
97
		}
98
99
		public void processingInstruction(String target, String data) throws SAXException {
100
			if (repositoryType.equals(target)) {
101
				// TODO: should the root handler be constructed based on class
102
				// 		 via an extension registry mechanism?
103
				// String clazz = extractPIClass(data);
104
				// TODO: version tolerance by extension
105
				Version repositoryVersion = extractPIVersion(target, data);
106
				if (!XML_TOLERANCE.isIncluded(repositoryVersion)) {
107
					throw new SAXException(NLS.bind(Messages.io_IncompatibleVersion, repositoryVersion, XML_TOLERANCE));
108
				}
109
			}
110
		}
111
	}
112
113
	/*
114
	 * Handler for the "repository" attribute.
115
	 */
116
	private final class RepositoryHandler extends RootHandler {
117
118
		private final String[] required = new String[] {NAME_ATTRIBUTE, TYPE_ATTRIBUTE, VERSION_ATTRIBUTE};
119
		private final String[] optional = new String[] {DESCRIPTION_ATTRIBUTE, PROVIDER_ATTRIBUTE};
120
		private PropertiesHandler propertiesHandler = null;
121
		private ChildrenHandler childrenHandler = null;
122
		private CompositeRepositoryState state;
123
		private String[] attrValues = new String[required.length + optional.length];
124
125
		public RepositoryHandler() {
126
			super();
127
		}
128
129
		public CompositeRepositoryState getRepository() {
130
			return state;
131
		}
132
133
		protected void handleRootAttributes(Attributes attributes) {
134
			attrValues = parseAttributes(attributes, required, optional);
135
			attrValues[2] = checkVersion(REPOSITORY_ELEMENT, VERSION_ATTRIBUTE, attrValues[2]).toString();
136
		}
137
138
		public void startElement(String name, Attributes attributes) {
139
			if (PROPERTIES_ELEMENT.equals(name)) {
140
				if (propertiesHandler == null) {
141
					propertiesHandler = new PropertiesHandler(this, attributes);
142
				} else {
143
					duplicateElement(this, name, attributes);
144
				}
145
			} else if (CHILDREN_ELEMENT.equals(name)) {
146
				if (childrenHandler == null) {
147
					childrenHandler = new ChildrenHandler(this, attributes);
148
				} else {
149
					duplicateElement(this, name, attributes);
150
				}
151
			} else {
152
				invalidElement(name, attributes);
153
			}
154
		}
155
156
		/*
157
		 * If we parsed valid XML then fill in our repository state object with the parsed data.
158
		 */
159
		protected void finished() {
160
			if (isValidXML()) {
161
				state = new CompositeRepositoryState();
162
				state.setName(attrValues[0]);
163
				state.setType(attrValues[1]);
164
				state.setVersion(attrValues[2]);
165
				state.setDescription(attrValues[3]);
166
				state.setProvider(attrValues[4]);
167
				state.setProperties((propertiesHandler == null ? new OrderedProperties(0) //
168
						: propertiesHandler.getProperties()));
169
				state.setChildren((childrenHandler == null ? new URI[0] //
170
						: childrenHandler.getChildren()));
171
			}
172
		}
173
	}
174
175
	public CompositeParser(BundleContext context, String bundleId, String type) {
176
		super(context, bundleId);
177
		this.repositoryType = type;
178
	}
179
180
	public void parse(File file) throws IOException {
181
		parse(new FileInputStream(file));
182
	}
183
184
	public synchronized void parse(InputStream stream) throws IOException {
185
		this.status = null;
186
		try {
187
			// TODO: currently not caching the parser since we make no assumptions
188
			//		 or restrictions on concurrent parsing
189
			getParser();
190
			RepositoryHandler repositoryHandler = new RepositoryHandler();
191
			xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler));
192
			xmlReader.parse(new InputSource(stream));
193
			if (isValidXML()) {
194
				theState = repositoryHandler.getRepository();
195
			}
196
		} catch (SAXException e) {
197
			throw new IOException(e.getMessage());
198
		} catch (ParserConfigurationException e) {
199
			throw new IOException(e.getMessage());
200
		} finally {
201
			stream.close();
202
		}
203
	}
204
205
	public CompositeRepositoryState getRepositoryState() {
206
		return theState;
207
	}
208
209
	//TODO what?
210
	protected Object getRootObject() {
211
		return null;
212
	}
213
214
	protected String getErrorMessage() {
215
		return Messages.io_parseError;
216
	}
217
218
}
(-)src/org/eclipse/equinox/internal/p2/persistence/Messages.java (-37 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import org.eclipse.osgi.util.NLS;
14
15
public class Messages extends NLS {
16
17
	private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.persistence.messages"; //$NON-NLS-1$
18
19
	static {
20
		// load message values from bundle file and assign to fields below
21
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
22
	}
23
24
	public static String XMLParser_No_SAX_Parser;
25
	public static String XMLParser_Error_At_Line;
26
	public static String XMLParser_Error_At_Line_Column;
27
	public static String XMLParser_Error_At_Name_Line;
28
	public static String XMLParser_Error_At_Name_Line_Column;
29
	public static String XMLParser_Missing_Required_Attribute;
30
	public static String XMLParser_Illegal_Value_For_Attribute;
31
	public static String XMLParser_Duplicate_Element;
32
33
	public static String io_failedRead;
34
	public static String io_IncompatibleVersion;
35
	public static String io_parseError;
36
37
}
(-)src/org/eclipse/equinox/internal/p2/persistence/CompositeRepositoryIO.java (-87 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.io.*;
14
import java.net.URL;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.p2.core.Activator;
17
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.osgi.util.NLS;
20
21
/**
22
 * This class reads and writes repository metadata (e.g. table of contents files) 
23
 * for composite artifact and metadata repositories.
24
 * <p>
25
 * Note: This class is not used for reading or writing the actual composite repositories.
26
 */
27
public class CompositeRepositoryIO {
28
29
	/**
30
	 * Writes the given repository to the stream.
31
	 * This method performs buffering, and closes the stream when finished.
32
	 */
33
	public void write(CompositeRepositoryState repository, OutputStream output, String type) {
34
		OutputStream bufferedOutput = null;
35
		try {
36
			try {
37
				bufferedOutput = new BufferedOutputStream(output);
38
				CompositeWriter repositoryWriter = new CompositeWriter(bufferedOutput, type);
39
				repositoryWriter.write(repository);
40
			} finally {
41
				if (bufferedOutput != null) {
42
					bufferedOutput.close();
43
				}
44
			}
45
		} catch (IOException ioe) {
46
			// TODO shouldn't this throw a core exception?
47
			ioe.printStackTrace();
48
		}
49
	}
50
51
	/**
52
	 * Reads the composite repository from the given stream,
53
	 * and returns the contained array of abstract composite repositories.
54
	 * 
55
	 * This method performs buffering, and closes the stream when finished.
56
	 */
57
	public CompositeRepositoryState read(URL location, InputStream input, String type, IProgressMonitor monitor) throws ProvisionException {
58
		BufferedInputStream bufferedInput = null;
59
		try {
60
			try {
61
				bufferedInput = new BufferedInputStream(input);
62
				CompositeParser repositoryParser = new CompositeParser(Activator.getContext(), Activator.ID, type);
63
				repositoryParser.parse(input);
64
				IStatus result = repositoryParser.getStatus();
65
				switch (result.getSeverity()) {
66
					case IStatus.CANCEL :
67
						throw new OperationCanceledException();
68
					case IStatus.ERROR :
69
						throw new ProvisionException(result);
70
					case IStatus.WARNING :
71
					case IStatus.INFO :
72
						LogHelper.log(result);
73
				}
74
				CompositeRepositoryState repositoryState = repositoryParser.getRepositoryState();
75
				if (repositoryState == null)
76
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, Messages.io_parseError, null));
77
				return repositoryState;
78
			} finally {
79
				if (bufferedInput != null)
80
					bufferedInput.close();
81
			}
82
		} catch (IOException ioe) {
83
			String msg = NLS.bind(Messages.io_failedRead, location);
84
			throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, msg, ioe));
85
		}
86
	}
87
}
(-)src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java (-770 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.persistence;
12
13
import java.net.*;
14
import java.util.List;
15
import java.util.StringTokenizer;
16
import javax.xml.parsers.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.equinox.internal.p2.core.Activator;
19
import org.eclipse.equinox.internal.p2.core.StringPool;
20
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
21
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
22
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
23
import org.eclipse.osgi.util.NLS;
24
import org.osgi.framework.BundleContext;
25
import org.eclipse.equinox.internal.provisional.p2.core.Version;
26
import org.osgi.util.tracker.ServiceTracker;
27
import org.xml.sax.*;
28
import org.xml.sax.ContentHandler;
29
import org.xml.sax.helpers.DefaultHandler;
30
31
public abstract class XMLParser extends DefaultHandler implements XMLConstants {
32
33
	// Get the root object that is being parsed.
34
	protected abstract Object getRootObject();
35
36
	// Get a generic parser error message for inclusion in an error status
37
	protected abstract String getErrorMessage();
38
39
	protected BundleContext context; // parser class bundle context
40
	protected String bundleId; // parser class bundle id
41
42
	protected XMLReader xmlReader; // the XML reader for the parser
43
44
	protected MultiStatus status = null; // accumulation of non-fatal errors
45
	protected Locator locator = null; // document locator, if supported by the parser
46
47
	protected StringPool stringPool = new StringPool();//used to eliminate string duplication
48
	private IProgressMonitor monitor;
49
50
	private static ServiceTracker xmlTracker = null;
51
52
	public XMLParser(BundleContext context, String pluginId) {
53
		super();
54
		this.context = context;
55
		this.bundleId = pluginId;
56
	}
57
58
	/**
59
	 *  Non-fatal errors accumulated during parsing.
60
	 */
61
	public IStatus getStatus() {
62
		return (status != null ? status : Status.OK_STATUS);
63
	}
64
65
	/**
66
	 * Returns the canonical form of a string. Used to eliminate duplicate equal 
67
	 * strings.
68
	 */
69
	protected String canonicalize(String string) {
70
		return stringPool == null ? string : stringPool.add(string);
71
	}
72
73
	public boolean isValidXML() {
74
		return (status == null || !status.matches(IStatus.ERROR | IStatus.CANCEL));
75
	}
76
77
	private static SAXParserFactory acquireXMLParsing(BundleContext context) {
78
		if (xmlTracker == null) {
79
			xmlTracker = new ServiceTracker(context, SAXParserFactory.class.getName(), null);
80
			xmlTracker.open();
81
		}
82
		return (SAXParserFactory) xmlTracker.getService();
83
	}
84
85
	protected static void releaseXMLParsing() {
86
		if (xmlTracker != null) {
87
			xmlTracker.close();
88
		}
89
	}
90
91
	protected SAXParser getParser() throws ParserConfigurationException, SAXException {
92
		SAXParserFactory factory = acquireXMLParsing(this.context);
93
		if (factory == null) {
94
			throw new SAXException(Messages.XMLParser_No_SAX_Parser);
95
		}
96
		factory.setNamespaceAware(true);
97
		factory.setValidating(false);
98
		try {
99
			factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$
100
		} catch (SAXException se) {
101
			// some parsers may not support string interning
102
		}
103
		SAXParser theParser = factory.newSAXParser();
104
		if (theParser == null) {
105
			throw new SAXException(Messages.XMLParser_No_SAX_Parser);
106
		}
107
		xmlReader = theParser.getXMLReader();
108
		return theParser;
109
	}
110
111
	public static String makeSimpleName(String localName, String qualifiedName) {
112
		if (localName != null && localName.length() > 0) {
113
			return localName;
114
		}
115
		int nameSpaceIndex = qualifiedName.indexOf(":"); //$NON-NLS-1$
116
		return (nameSpaceIndex == -1 ? qualifiedName : qualifiedName.substring(nameSpaceIndex + 1));
117
	}
118
119
	/**
120
	 * Set the document locator for the parser
121
	 * 
122
	 * @see org.xml.sax.ContentHandler#setDocumentLocator
123
	 */
124
	public void setDocumentLocator(Locator docLocator) {
125
		locator = docLocator;
126
	}
127
128
	/**
129
	 * Sets the progress monitor for the parser
130
	 */
131
	protected void setProgressMonitor(IProgressMonitor monitor) {
132
		this.monitor = monitor;
133
	}
134
135
	/**
136
	 * Abstract base class for content handlers
137
	 */
138
	protected abstract class AbstractHandler extends DefaultHandler {
139
140
		protected ContentHandler parentHandler = null;
141
		protected String elementHandled = null;
142
143
		protected StringBuffer characters = null; // character data inside an element
144
145
		public AbstractHandler() {
146
			// Empty constructor for a root handler
147
		}
148
149
		public AbstractHandler(ContentHandler parentHandler) {
150
			this.parentHandler = parentHandler;
151
			xmlReader.setContentHandler(this);
152
		}
153
154
		public AbstractHandler(ContentHandler parentHandler, String elementHandled) {
155
			this.parentHandler = parentHandler;
156
			xmlReader.setContentHandler(this);
157
			this.elementHandled = elementHandled;
158
		}
159
160
		/**
161
		 * Set the document locator for the parser
162
		 * 
163
		 * @see org.xml.sax.ContentHandler#setDocumentLocator
164
		 */
165
		public void setDocumentLocator(Locator docLocator) {
166
			locator = docLocator;
167
		}
168
169
		public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
170
			finishCharacters();
171
			String name = makeSimpleName(localName, qName);
172
			trace(name, attributes);
173
			startElement(name, attributes);
174
		}
175
176
		public abstract void startElement(String name, Attributes attributes) throws SAXException;
177
178
		public void invalidElement(String name, Attributes attributes) {
179
			unexpectedElement(this, name, attributes);
180
			new IgnoringHandler(this);
181
		}
182
183
		public void endElement(String namespaceURI, String localName, String qName) {
184
			// TODO: throw a bad state error if makeSimpleName(localName, qName) != elementHandled
185
			finishCharacters();
186
			finished();
187
			// Restore the parent content handler
188
			xmlReader.setContentHandler(parentHandler);
189
		}
190
191
		/**
192
		 * 	An implementation for startElement when there are no sub-elements
193
		 */
194
		protected void noSubElements(String name, Attributes attributes) {
195
			unexpectedElement(this, name, attributes);
196
			// Create a new handler to ignore subsequent nested elements			
197
			new IgnoringHandler(this);
198
		}
199
200
		/*
201
		 * Save up character data until endElement or nested startElement
202
		 * 
203
		 * @see org.xml.sax.ContentHandler#characters
204
		 */
205
		public void characters(char[] chars, int start, int length) {
206
			if (this.characters == null) {
207
				this.characters = new StringBuffer();
208
			}
209
			this.characters.append(chars, start, length);
210
		}
211
212
		// Consume the characters accumulated in this.characters.
213
		// Called before startElement or endElement
214
		private String finishCharacters() {
215
			// common case -- no characters or only whitespace
216
			if (this.characters == null || this.characters.length() == 0) {
217
				return null;
218
			}
219
			if (allWhiteSpace(this.characters)) {
220
				this.characters.setLength(0);
221
				return null;
222
			}
223
224
			// process the characters
225
			try {
226
				String trimmedChars = this.characters.toString().trim();
227
				if (trimmedChars.length() == 0) {
228
					// this shouldn't happen due to the test for allWhiteSpace above
229
					System.err.println("Unexpected non-whitespace characters: " //$NON-NLS-1$
230
							+ trimmedChars);
231
					return null;
232
				}
233
				processCharacters(trimmedChars);
234
				return trimmedChars;
235
			} finally {
236
				this.characters.setLength(0);
237
			}
238
		}
239
240
		// Method to override in the handler of an element with CDATA. 
241
		protected void processCharacters(String data) {
242
			if (data.length() > 0) {
243
				unexpectedCharacterData(this, data);
244
			}
245
		}
246
247
		private boolean allWhiteSpace(StringBuffer sb) {
248
			int length = sb.length();
249
			for (int i = 0; i < length; i += 1) {
250
				if (!Character.isWhitespace(sb.charAt(i))) {
251
					return false;
252
				}
253
			}
254
			return true;
255
		}
256
257
		/**
258
		 * 	Called when this element and all elements nested into it have been
259
		 * 	handled.
260
		 */
261
		protected void finished() {
262
			// Do nothing by default
263
		}
264
265
		/*
266
		 * 	A name used to identify the handler.
267
		 */
268
		public String getName() {
269
			return (elementHandled != null ? elementHandled : "NoName"); //$NON-NLS-1$
270
		}
271
272
		/**
273
		 * In p2 1.0 we stored URLs, in 1.1 and later we store URIs. This method will
274
		 * first check for a URI, and then resort to looking for a URL attribute for
275
		 * backwards compatibility.
276
		 * @param attributes The attributes to parse
277
		 * @param required If true, an exception is thrown if no URI or URL attribute is present
278
		 */
279
		protected URI parseURIAttribute(Attributes attributes, boolean required) {
280
			String location = parseOptionalAttribute(attributes, URI_ATTRIBUTE);
281
			try {
282
				if (location != null)
283
					return new URI(location);
284
				if (required)
285
					location = parseRequiredAttributes(attributes, new String[] {URL_ATTRIBUTE})[0];
286
				else
287
					location = parseOptionalAttribute(attributes, URL_ATTRIBUTE);
288
				if (location == null)
289
					return null;
290
				return URIUtil.toURI(new URL(location));
291
			} catch (MalformedURLException e) {
292
				invalidAttributeValue(elementHandled, URL_ATTRIBUTE, location, e);
293
			} catch (URISyntaxException e) {
294
				invalidAttributeValue(elementHandled, URL_ATTRIBUTE, location, e);
295
			}
296
			return null;
297
		}
298
299
		/**
300
		 * Parse the attributes of an element with two required attributes.
301
		 */
302
		protected String[] parseRequiredAttributes(Attributes attributes, String name1, String name2) {
303
			return parseRequiredAttributes(attributes, new String[] {name1, name2});
304
		}
305
306
		/**
307
		 * Parse the attributes of an element with only required attributes.
308
		 */
309
		protected String[] parseRequiredAttributes(Attributes attributes, String[] required) {
310
			return parseAttributes(attributes, required, noAttributes);
311
		}
312
313
		/**
314
		 * Parse the attributes of an element with a single optional attribute.
315
		 */
316
		protected String parseOptionalAttribute(Attributes attributes, String name) {
317
			return parseAttributes(attributes, noAttributes, new String[] {name})[0];
318
		}
319
320
		/**
321
		 * Parse the attributes of an element, given the list of required and optional ones.
322
		 * Return values in same order, null for those not present.
323
		 * Log warnings for extra attributes or missing required attributes.
324
		 */
325
		protected String[] parseAttributes(Attributes attributes, String[] required, String[] optional) {
326
			String[] result = new String[required.length + optional.length];
327
			for (int i = 0; i < attributes.getLength(); i += 1) {
328
				String name = attributes.getLocalName(i);
329
				String value = canonicalize(attributes.getValue(i).trim());
330
				int j;
331
				if ((j = indexOf(required, name)) >= 0) {
332
					result[j] = value;
333
				} else if ((j = indexOf(optional, name)) >= 0) {
334
					result[required.length + j] = value;
335
				} else {
336
					unexpectedAttribute(elementHandled, name, value);
337
				}
338
			}
339
			for (int i = 0; i < required.length; i += 1) {
340
				checkRequiredAttribute(elementHandled, required[i], result[i]);
341
			}
342
			return result;
343
		}
344
345
	}
346
347
	/**
348
	 *	Handler for an XML document.
349
	 *
350
	 *	Using the inelegant name 'DocHandler' to clearly distinguish
351
	 *	this class from the deprecated org.xml.sax.DocumentHandler.
352
	 */
353
	protected class DocHandler extends AbstractHandler {
354
355
		RootHandler rootHandler;
356
357
		public DocHandler(String rootName, RootHandler rootHandler) {
358
			super(null, rootName);
359
			this.rootHandler = rootHandler;
360
		}
361
362
		public void startElement(String name, Attributes attributes) {
363
			if (name.equals(elementHandled)) {
364
				rootHandler.initialize(this, name, attributes);
365
				xmlReader.setContentHandler(rootHandler);
366
			} else {
367
				this.noSubElements(name, attributes);
368
			}
369
		}
370
371
	}
372
373
	/**
374
	 * 	Abstract handler for the root element.
375
	 */
376
	protected abstract class RootHandler extends AbstractHandler {
377
378
		public RootHandler() {
379
			super();
380
		}
381
382
		public void initialize(DocHandler document, String rootName, Attributes attributes) {
383
			this.parentHandler = document;
384
			this.elementHandled = rootName;
385
			handleRootAttributes(attributes);
386
		}
387
388
		protected abstract void handleRootAttributes(Attributes attributes);
389
390
	}
391
392
	/**
393
	 * 	Handler for an ordered properties collection.
394
	 */
395
	protected class PropertiesHandler extends AbstractHandler {
396
397
		private OrderedProperties properties;
398
399
		public PropertiesHandler(ContentHandler parentHandler, Attributes attributes) {
400
			super(parentHandler, PROPERTIES_ELEMENT);
401
			String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
402
			properties = (size != null ? new OrderedProperties(new Integer(size).intValue()) : new OrderedProperties());
403
		}
404
405
		public OrderedProperties getProperties() {
406
			return properties;
407
		}
408
409
		public void startElement(String name, Attributes attributes) {
410
			if (name.equals(PROPERTY_ELEMENT)) {
411
				new PropertyHandler(this, attributes, properties);
412
			} else {
413
				invalidElement(name, attributes);
414
			}
415
		}
416
417
	}
418
419
	/**
420
	 * 	Handler for a property in an ordered properties collection.
421
	 */
422
	protected class PropertyHandler extends AbstractHandler {
423
424
		public PropertyHandler(ContentHandler parentHandler, Attributes attributes, OrderedProperties properties) {
425
			super(parentHandler, PROPERTY_ELEMENT);
426
			String[] property = parseProperty(attributes);
427
			if (isValidProperty(property)) {
428
				properties.setProperty(property[0], property[1]);
429
			}
430
		}
431
432
		public void startElement(String name, Attributes attributes) {
433
			invalidElement(name, attributes);
434
		}
435
436
		private String[] parseProperty(Attributes attributes) {
437
			return parseRequiredAttributes(attributes, PROPERTY_NAME_ATTRIBUTE, PROPERTY_VALUE_ATTRIBUTE);
438
		}
439
440
		private boolean isValidProperty(String[] property) {
441
			return (property.length == 2 && property[0] != null && property[1] != null);
442
		}
443
	}
444
445
	/**
446
	 * 	Handler for an element with only cdata and no sub-elements.
447
	 */
448
	protected class TextHandler extends AbstractHandler {
449
450
		private String text = null;
451
452
		private List texts = null;
453
454
		// Constructor for a subclass that processes the attributes
455
		public TextHandler(AbstractHandler parent, String elementName) {
456
			super(parent, elementName);
457
		}
458
459
		// Constructor for a subclass with no attributes
460
		public TextHandler(AbstractHandler parent, String elementName, Attributes attributes) {
461
			super(parent, elementName);
462
			parseAttributes(attributes, noAttributes, noAttributes);
463
		}
464
465
		public TextHandler(AbstractHandler parent, String elementName, Attributes attributes, List texts) {
466
			super(parent, elementName);
467
			parseAttributes(attributes, noAttributes, noAttributes);
468
			this.texts = texts;
469
		}
470
471
		public String getText() {
472
			return (text != null ? text : ""); //$NON-NLS-1$
473
		}
474
475
		public void startElement(String name, Attributes attributes) {
476
			invalidElement(name, attributes);
477
		}
478
479
		protected void processCharacters(String data) {
480
			this.text = canonicalize(data);
481
			if (texts != null) {
482
				texts.add(getText());
483
			}
484
		}
485
486
	}
487
488
	/**
489
	 * 	Handler for ignoring content.
490
	 */
491
	protected class IgnoringHandler extends AbstractHandler {
492
493
		public IgnoringHandler(AbstractHandler parent) {
494
			super(parent);
495
			this.elementHandled = "IgnoringAll"; //$NON-NLS-1$
496
		}
497
498
		public void startElement(String name, Attributes attributes) {
499
			noSubElements(name, attributes);
500
		}
501
502
	}
503
504
	// Helpers for processing instructions that include a Class and/or a Version.
505
506
	public String extractPIClass(String data) {
507
		return extractPIAttribute(data, PI_CLASS_ATTRIBUTE);
508
	}
509
510
	public Version extractPIVersion(String target, String data) {
511
		return checkVersion(target, PI_VERSION_ATTRIBUTE, extractPIAttribute(data, PI_VERSION_ATTRIBUTE));
512
	}
513
514
	private String extractPIAttribute(String data, String key) {
515
		StringTokenizer piTokenizer = new StringTokenizer(data, " \'\""); //$NON-NLS-1$
516
		String[] tokens = new String[piTokenizer.countTokens()];
517
		int index = 0;
518
		int valueIndex = -1;
519
		while (piTokenizer.hasMoreTokens() && index < tokens.length) {
520
			tokens[index] = piTokenizer.nextToken();
521
			if (tokens[index].equals(key + '=') && index < tokens.length) {
522
				valueIndex = index + 1;
523
			}
524
			index++;
525
		}
526
		return (valueIndex >= 0 ? tokens[valueIndex] : ""); //$NON-NLS-1$
527
	}
528
529
	public void error(SAXParseException ex) {
530
		addError(IStatus.WARNING, ex.getMessage(), ex);
531
	}
532
533
	public void fatalError(SAXParseException ex) {
534
		addError(IStatus.ERROR, ex.getMessage(), ex);
535
	}
536
537
	protected String getErrorPrefix() {
538
		return null;
539
	}
540
541
	protected String getErrorSuffix() {
542
		return null;
543
	}
544
545
	/**
546
	 * Collects an error or warning that occurred during parsing.
547
	 */
548
	public final void addError(int severity, String msg, Throwable exception) {
549
		int line = 0;
550
		int column = 0;
551
		String key = msg;
552
		Object[] args = new Object[] {};
553
		String root = (getRootObject() == null ? "" //$NON-NLS-1$
554
				: " (" + getRootObject() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
555
		if (this.locator != null) {
556
			String name = this.locator.getSystemId();
557
			line = this.locator.getLineNumber();
558
			column = this.locator.getColumnNumber();
559
			if (line > 0) {
560
				args = new Object[] {msg, root, name, new Integer(line), new Integer(column)};
561
				if (column > 0) {
562
					key = (name != null ? Messages.XMLParser_Error_At_Name_Line_Column //
563
							: Messages.XMLParser_Error_At_Line_Column);
564
				} else {
565
					key = (name != null ? Messages.XMLParser_Error_At_Name_Line //
566
							: Messages.XMLParser_Error_At_Line);
567
				}
568
			}
569
		}
570
		String errMsg = NLS.bind(key, args);
571
		String prefix = getErrorPrefix();
572
		String suffix = getErrorSuffix();
573
		if (prefix != null) {
574
			errMsg = prefix + errMsg;
575
		}
576
		if (suffix != null) {
577
			errMsg = errMsg + suffix;
578
		}
579
		IStatus currStatus = new Status(severity, Activator.ID, errMsg, exception);
580
		if (this.status == null) {
581
			this.status = new MultiStatus(bundleId, IStatus.OK, new IStatus[] {currStatus}, getErrorMessage(), null);
582
		} else {
583
			this.status.add(currStatus);
584
		}
585
	}
586
587
	public void trace(String element, Attributes attributes) {
588
		// TODO: support logging
589
		//		if (!getLogger().isDebugLoggable()) {
590
		//			return;
591
		//		}
592
		//		int indentSize = (this.stateStack != null ? this.stateStack.size() - 1 : 1);
593
		//		if (attributes == null) {
594
		//			indentSize -= 1;
595
		//		}
596
		//		char[] indent = new char[2 * indentSize];
597
		//		Arrays.fill(indent, ' ');
598
		//		StringBuffer sb = new StringBuffer();
599
		//		sb.append(indent);
600
		//		sb.append('<');
601
		//		if (attributes != null) {
602
		//			sb.append(element);
603
		//			toString(sb, attributes);
604
		//		} else {
605
		//			sb.append('/').append(element);
606
		//		}
607
		//		sb.append('>');
608
		//		getLogger().debug(sb.toString());
609
	}
610
611
	private static String toString(Attributes attributes) {
612
		StringBuffer result = new StringBuffer();
613
		toString(result, attributes);
614
		return result.toString();
615
	}
616
617
	private static void toString(StringBuffer sb, Attributes attributes) {
618
		for (int i = 0; i < attributes.getLength(); i += 1) {
619
			String name = attributes.getLocalName(i);
620
			String value = attributes.getValue(i).trim();
621
			sb.append(' ').append(name);
622
			sb.append('=').append('"');
623
			sb.append(value);
624
			sb.append('"');
625
		}
626
	}
627
628
	public void checkRequiredAttribute(String element, String name, Object value) {
629
		if (value == null) {
630
			addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Missing_Required_Attribute, element, name), null);
631
		}
632
	}
633
634
	// Check the format of a required boolean attribute
635
	public Boolean checkBoolean(String element, String attribute, String value) {
636
		try {
637
			return Boolean.valueOf(value);
638
		} catch (IllegalArgumentException iae) {
639
			invalidAttributeValue(element, attribute, value);
640
		} catch (NullPointerException npe) {
641
			invalidAttributeValue(element, attribute, null);
642
		}
643
		return Boolean.FALSE;
644
	}
645
646
	// Check the format of an optional boolean attribute
647
	public Boolean checkBoolean(String element, String attribute, String value, boolean defaultValue) {
648
		Boolean result = (defaultValue ? Boolean.TRUE : Boolean.FALSE);
649
		if (value != null) {
650
			try {
651
				return Boolean.valueOf(value);
652
			} catch (IllegalArgumentException iae) {
653
				invalidAttributeValue(element, attribute, value);
654
			}
655
		}
656
		return result;
657
	}
658
659
	// Check the format of a required integer attribute
660
	public int checkInteger(String element, String attribute, String value) {
661
		try {
662
			return Integer.parseInt(value);
663
		} catch (IllegalArgumentException iae) {
664
			invalidAttributeValue(element, attribute, value);
665
		}
666
		return 0;
667
	}
668
669
	// Check the format of a required URI attribute
670
	public URI checkURI(String element, String attribute, String value) {
671
		try {
672
			return URIUtil.fromString(value);
673
		} catch (URISyntaxException e) {
674
			invalidAttributeValue(element, attribute, value);
675
		}
676
		//TODO ok to return null?
677
		return null;
678
	}
679
680
	public void checkCancel() {
681
		if (monitor != null && monitor.isCanceled())
682
			throw new OperationCanceledException();
683
	}
684
685
	/**
686
	 * Converts a version string to a Version object. Returns the version object,
687
	 * or {@link Version#emptyVersion} if the value was not a valid version.
688
	 */
689
	public Version checkVersion(String element, String attribute, String value) {
690
		try {
691
			if (value != null)
692
				return new Version(value);
693
		} catch (IllegalArgumentException iae) {
694
			invalidAttributeValue(element, attribute, value);
695
		} catch (NullPointerException npe) {
696
			invalidAttributeValue(element, attribute, null);
697
		}
698
		return Version.emptyVersion;
699
	}
700
701
	public VersionRange checkVersionRange(String element, String attribute, String value) {
702
		try {
703
			return new VersionRange(value);
704
		} catch (IllegalArgumentException iae) {
705
			invalidAttributeValue(element, attribute, value);
706
		} catch (NullPointerException npe) {
707
			invalidAttributeValue(element, attribute, null);
708
		}
709
		return VersionRange.emptyRange;
710
	}
711
712
	public void unexpectedAttribute(String element, String attribute, String value) {
713
		if (Tracing.DEBUG_PARSE_PROBLEMS)
714
			Tracing.debug("Unexpected attribute for element " + element + ": " + attribute + '=' + value); //$NON-NLS-1$ //$NON-NLS-2$
715
	}
716
717
	public void invalidAttributeValue(String element, String attribute, String value) {
718
		invalidAttributeValue(element, attribute, value, null);
719
	}
720
721
	public void invalidAttributeValue(String element, String attribute, String value, Throwable exception) {
722
		addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Illegal_Value_For_Attribute, new Object[] {attribute, element, value}), exception);
723
	}
724
725
	public void unexpectedElement(AbstractHandler handler, String element, Attributes attributes) {
726
		if (Tracing.DEBUG_PARSE_PROBLEMS)
727
			Tracing.debug("Unexpected element in element " + handler.getName() + ": <" + element + toString(attributes) + '>'); //$NON-NLS-1$ //$NON-NLS-2$
728
	}
729
730
	public void duplicateElement(AbstractHandler handler, String element, Attributes attributes) {
731
		addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Duplicate_Element, new Object[] {handler.getName(), element, toString(attributes)}), null);
732
		//ignore the duplicate element entirely because we have already logged it
733
		new IgnoringHandler(handler);
734
	}
735
736
	public void unexpectedCharacterData(AbstractHandler handler, String cdata) {
737
		if (Tracing.DEBUG_PARSE_PROBLEMS)
738
			Tracing.debug("Unexpected character data in element " + handler.getName() + ": " + cdata.trim()); //$NON-NLS-1$ //$NON-NLS-2$
739
	}
740
741
	/**
742
	 * Find the index of the first occurrence of object in array, or -1.
743
	 * Use Arrays.binarySearch if array is big and sorted.
744
	 */
745
	protected static int indexOf(String[] array, String value) {
746
		for (int i = 0; i < array.length; i += 1) {
747
			if (value == null ? array[i] == null : value.equals(array[i])) {
748
				return i;
749
			}
750
		}
751
		return -1;
752
	}
753
754
	//	public class BadStateError extends AssertionError {
755
	//		private static final long serialVersionUID = 1L; // not serialized
756
	//
757
	//		public BadStateError() {
758
	//			super("unexpected state" + //$NON-NLS-1$
759
	//					(XMLParser.this.stateStack != null ? ": " + XMLParser.this.stateStack //$NON-NLS-1$
760
	//					: "")); //$NON-NLS-1$
761
	//		}
762
	//
763
	//		public BadStateError(String element) {
764
	//			super("unexpected state for " + element + //$NON-NLS-1$
765
	//					(XMLParser.this.stateStack != null ? ": " + XMLParser.this.stateStack //$NON-NLS-1$
766
	//					: "")); //$NON-NLS-1$
767
	//		}
768
	//	}
769
770
}
(-)META-INF/MANIFEST.MF (-41 / +8 lines)
Lines 18-24 Link Here
18
 org.osgi.util.tracker;version="1.3.3",
18
 org.osgi.util.tracker;version="1.3.3",
19
 org.xml.sax,
19
 org.xml.sax,
20
 org.xml.sax.helpers
20
 org.xml.sax.helpers
21
Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.publisher",
21
Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.repository",
22
 org.eclipse.equinox.internal.p2.core.helpers;
22
 org.eclipse.equinox.internal.p2.core.helpers;
23
  x-friends:="org.eclipse.equinox.p2.director,
23
  x-friends:="org.eclipse.equinox.p2.director,
24
   org.eclipse.equinox.p2.artifact.processors,
24
   org.eclipse.equinox.p2.artifact.processors,
Lines 47-54 Link Here
47
   org.eclipse.equinox.p2.reconciler.dropins,
47
   org.eclipse.equinox.p2.reconciler.dropins,
48
   org.eclipse.equinox.p2.extensionlocation,
48
   org.eclipse.equinox.p2.extensionlocation,
49
   org.eclipse.equinox.p2.publisher,
49
   org.eclipse.equinox.p2.publisher,
50
   org.eclipse.equinox.p2.repository.tools",
50
   org.eclipse.equinox.p2.repository.tools,
51
 org.eclipse.equinox.internal.p2.persistence;x-friends:="org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.metadata.repository",
51
   org.eclipse.equinox.p2.repository",
52
 org.eclipse.equinox.internal.provisional.p2.core;
52
 org.eclipse.equinox.internal.provisional.p2.core;
53
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
53
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
54
   org.eclipse.equinox.p2.artifact.processors,
54
   org.eclipse.equinox.p2.artifact.processors,
Lines 74-80 Link Here
74
   org.eclipse.equinox.p2.updatesite,
74
   org.eclipse.equinox.p2.updatesite,
75
   org.eclipse.pde.ui,
75
   org.eclipse.pde.ui,
76
   org.eclipse.equinox.p2.metadata,
76
   org.eclipse.equinox.p2.metadata,
77
   org.eclipse.equinox.p2.repository.tools",
77
   org.eclipse.equinox.p2.repository.tools,
78
   org.eclipse.equinox.p2.repository",
78
 org.eclipse.equinox.internal.provisional.p2.core.eventbus;
79
 org.eclipse.equinox.internal.provisional.p2.core.eventbus;
79
  x-friends:="org.eclipse.equinox.p2.metadata,
80
  x-friends:="org.eclipse.equinox.p2.metadata,
80
   org.eclipse.equinox.p2.metadata.generator,
81
   org.eclipse.equinox.p2.metadata.generator,
Lines 90-96 Link Here
90
   org.eclipse.equinox.p2.artifact.repository,
91
   org.eclipse.equinox.p2.artifact.repository,
91
   org.eclipse.equinox.p2.touchpoint.eclipse,
92
   org.eclipse.equinox.p2.touchpoint.eclipse,
92
   org.eclipse.equinox.p2.touchpoint.natives,
93
   org.eclipse.equinox.p2.touchpoint.natives,
93
   org.eclipse.equinox.p2.publisher",
94
   org.eclipse.equinox.p2.publisher,
95
   org.eclipse.equinox.p2.repository",
94
 org.eclipse.equinox.internal.provisional.p2.core.location;
96
 org.eclipse.equinox.internal.provisional.p2.core.location;
95
  x-friends:="org.eclipse.equinox.p2.artifact.repository,
97
  x-friends:="org.eclipse.equinox.p2.artifact.repository,
96
   org.eclipse.equinox.p2.touchpoint.natives,
98
   org.eclipse.equinox.p2.touchpoint.natives,
Lines 98-132 Link Here
98
   org.eclipse.equinox.p2.director,
100
   org.eclipse.equinox.p2.director,
99
   org.eclipse.equinox.p2.engine,
101
   org.eclipse.equinox.p2.engine,
100
   org.eclipse.equinox.p2.touchpoint.eclipse",
102
   org.eclipse.equinox.p2.touchpoint.eclipse",
101
 org.eclipse.equinox.internal.provisional.p2.core.repository;
102
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
103
   org.eclipse.equinox.p2.artifact.processors,
104
   org.eclipse.equinox.p2.artifact.repository,
105
   org.eclipse.equinox.p2.core,
106
   org.eclipse.equinox.p2.director,
107
   org.eclipse.equinox.p2.engine,
108
   org.eclipse.equinox.p2.exemplarysetup,
109
   org.eclipse.equinox.p2.extensionlocation,
110
   org.eclipse.equinox.p2.garbagecollector,
111
   org.eclipse.equinox.p2.installer,
112
   org.eclipse.equinox.p2.jarprocessor,
113
   org.eclipse.equinox.p2.metadata,
114
   org.eclipse.equinox.p2.metadata.generator,
115
   org.eclipse.equinox.p2.metadata.repository,
116
   org.eclipse.equinox.p2.reconciler.dropins,
117
   org.eclipse.equinox.p2.touchpoint.eclipse,
118
   org.eclipse.equinox.p2.touchpoint.natives,
119
   org.eclipse.equinox.p2.ui,
120
   org.eclipse.equinox.p2.ui.admin,
121
   org.eclipse.equinox.p2.ui.admin.rcp,
122
   org.eclipse.equinox.p2.ui.sdk,
123
   org.eclipse.equinox.p2.updatechecker,
124
   org.eclipse.equinox.p2.updatesite,
125
   org.eclipse.equinox.p2.console,
126
   org.eclipse.equinox.p2.directorywatcher,
127
   org.eclipse.equinox.p2.publisher,
128
   org.eclipse.equinox.p2.director.app,
129
   org.eclipse.equinox.p2.repository.tools",
130
 org.eclipse.equinox.internal.provisional.p2.query;
103
 org.eclipse.equinox.internal.provisional.p2.query;
131
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
104
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
132
   org.eclipse.equinox.p2.artifact.processors,
105
   org.eclipse.equinox.p2.artifact.processors,
Lines 156-168 Link Here
156
   org.eclipse.equinox.p2.console,
129
   org.eclipse.equinox.p2.console,
157
   org.eclipse.equinox.p2.publisher,
130
   org.eclipse.equinox.p2.publisher,
158
   org.eclipse.pde.ui,
131
   org.eclipse.pde.ui,
159
   org.eclipse.equinox.p2.repository.tools",
132
   org.eclipse.equinox.p2.repository.tools"
160
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository;
161
  x-friends:="org.eclipse.equinox.p2.artifact.repository,
162
   org.eclipse.equinox.p2.metadata.repository,
163
   org.eclipse.equinox.p2.extensionlocation,
164
   org.eclipse.equinox.p2.updatesite,
165
   org.eclipse.equinox.p2.engine"
166
Eclipse-LazyStart: true
133
Eclipse-LazyStart: true
167
Bundle-ClassPath: .
134
Bundle-ClassPath: .
168
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
135
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/core/repository/AbstractRepository.java (-134 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.spi.p2.core.repository;
12
13
import java.net.URI;
14
import java.util.Map;
15
import org.eclipse.core.runtime.PlatformObject;
16
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
18
19
/**
20
* AbstractRepository defines common properties that may be provided by various kinds
21
* of repositories.
22
* <p>
23
* Clients may extend this class.
24
* </p>
25
*/
26
public abstract class AbstractRepository extends PlatformObject implements IRepository {
27
	protected String description;
28
	protected transient URI location;
29
	protected String name;
30
	protected Map properties = new OrderedProperties();
31
	protected String provider;
32
	protected String type;
33
	protected String version;
34
35
	protected AbstractRepository(String name, String type, String version, URI location, String description, String provider, Map properties) {
36
		this.name = name;
37
		this.type = type;
38
		this.version = version;
39
		this.location = location;
40
		this.description = description == null ? "" : description; //$NON-NLS-1$
41
		this.provider = provider == null ? "" : provider; //$NON-NLS-1$
42
		if (properties != null)
43
			this.properties.putAll(properties);
44
	}
45
46
	/**
47
	 * Asserts that this repository is modifiable, throwing a runtime exception if
48
	 * it is not. This is suitable for use by subclasses when an attempt is made
49
	 * to write to a repository.
50
	 */
51
	protected void assertModifiable() {
52
		if (!isModifiable())
53
			throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
54
	}
55
56
	/**
57
	 * Returns a brief description of the repository.
58
	 * @return the description of the repository.
59
	 */
60
	public synchronized String getDescription() {
61
		return description;
62
	}
63
64
	/**
65
	 * Returns the location of this repository.
66
	 * TODO: Should we use URL or URI? URL requires a protocol handler
67
	 * to be installed in Java.  Can the URL have any protocol?
68
	 * @return the URL of the repository.
69
	 */
70
	public synchronized URI getLocation() {
71
		return location;
72
	}
73
74
	/**
75
	 * Returns the name of the repository.
76
	 * @return the name of the repository.
77
	 */
78
	public synchronized String getName() {
79
		return name;
80
	}
81
82
	/**
83
	 * Returns a read-only collection of the properties of the repository.
84
	 * @return the properties of this repository.
85
	 */
86
	public synchronized Map getProperties() {
87
		return OrderedProperties.unmodifiableProperties(properties);
88
	}
89
90
	/**
91
	 * Returns the name of the provider of the repository.
92
	 * @return the provider of this repository.
93
	 */
94
	public synchronized String getProvider() {
95
		return provider;
96
	}
97
98
	/**
99
	 * Returns a string representing the type of the repository.
100
	 * @return the type of the repository.
101
	 */
102
	public synchronized String getType() {
103
		return type;
104
	}
105
106
	/**
107
	 * Returns a string representing the version for the repository type.
108
	 * @return the version of the type of the repository.
109
	 */
110
	public synchronized String getVersion() {
111
		return version;
112
	}
113
114
	public boolean isModifiable() {
115
		return false;
116
	}
117
118
	public synchronized void setDescription(String description) {
119
		this.description = description;
120
	}
121
122
	public synchronized void setName(String value) {
123
		this.name = value;
124
	}
125
126
	public synchronized String setProperty(String key, String value) {
127
		assertModifiable();
128
		return (String) (value == null ? properties.remove(key) : properties.put(key, value));
129
	}
130
131
	public synchronized void setProvider(String provider) {
132
		this.provider = provider;
133
	}
134
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 9-15 Link Here
9
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
9
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
10
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
10
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
11
 org.eclipse.equinox.internal.provisional.p2.core,
11
 org.eclipse.equinox.internal.provisional.p2.core,
12
 org.eclipse.equinox.internal.provisional.p2.core.repository,
12
 org.eclipse.equinox.internal.provisional.p2.repository,
13
 org.eclipse.equinox.internal.provisional.p2.director,
13
 org.eclipse.equinox.internal.provisional.p2.director,
14
 org.eclipse.equinox.internal.provisional.p2.engine,
14
 org.eclipse.equinox.internal.provisional.p2.engine,
15
 org.eclipse.equinox.internal.provisional.p2.metadata,
15
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java (-1 / +1 lines)
Lines 17-23 Link Here
17
import org.eclipse.core.runtime.Status;
17
import org.eclipse.core.runtime.Status;
18
import org.eclipse.equinox.internal.p2.core.helpers.*;
18
import org.eclipse.equinox.internal.p2.core.helpers.*;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
20
import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
22
import org.eclipse.equinox.internal.provisional.p2.engine.*;
21
import org.eclipse.equinox.internal.provisional.p2.engine.*;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
Lines 25-30 Link Here
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
25
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
27
import org.eclipse.equinox.internal.provisional.p2.query.Query;
26
import org.eclipse.equinox.internal.provisional.p2.query.Query;
27
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*;
28
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*;
29
29
30
/**
30
/**
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableArtifactRepositoryManager.java (-2 / +3 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.provisional.p2.ui;
12
package org.eclipse.equinox.internal.provisional.p2.ui;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
16
14
import java.net.URI;
17
import java.net.URI;
15
import java.util.Arrays;
18
import java.util.Arrays;
16
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IProgressMonitor;
Lines 19-26 Link Here
19
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
22
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
25
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
25
import org.eclipse.equinox.internal.provisional.p2.query.Query;
26
import org.eclipse.equinox.internal.provisional.p2.query.Query;
26
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
27
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/RepositoryLocationQuery.java (-1 / +2 lines)
Lines 11-20 Link Here
11
11
12
package org.eclipse.equinox.internal.provisional.p2.ui;
12
package org.eclipse.equinox.internal.provisional.p2.ui;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.Iterator;
17
import java.util.Iterator;
16
import org.eclipse.equinox.internal.p2.core.helpers.QueryHelpers;
18
import org.eclipse.equinox.internal.p2.core.helpers.QueryHelpers;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
18
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
19
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
19
import org.eclipse.equinox.internal.provisional.p2.query.Query;
20
import org.eclipse.equinox.internal.provisional.p2.query.Query;
20
21
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIProvisioningListener.java (-4 / +3 lines)
Lines 11-24 Link Here
11
11
12
package org.eclipse.equinox.internal.provisional.p2.ui;
12
package org.eclipse.equinox.internal.provisional.p2.ui;
13
13
14
import java.util.EventObject;
14
import org.eclipse.equinox.internal.p2.ui.BatchChangeBeginningEvent;
15
import org.eclipse.equinox.internal.p2.ui.BatchChangeBeginningEvent;
15
import org.eclipse.equinox.internal.p2.ui.BatchChangeCompleteEvent;
16
import org.eclipse.equinox.internal.p2.ui.BatchChangeCompleteEvent;
16
17
import java.util.EventObject;
18
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
17
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
21
import org.eclipse.equinox.internal.provisional.p2.engine.ProfileEvent;
18
import org.eclipse.equinox.internal.provisional.p2.engine.ProfileEvent;
19
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
20
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
22
21
23
/**
22
/**
24
 * ProvisioningListener which handles event batching and other
23
 * ProvisioningListener which handles event batching and other
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableRepositoryManager.java (-2 / +3 lines)
Lines 10-23 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.ui;
11
package org.eclipse.equinox.internal.provisional.p2.ui;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
13
import java.net.URI;
16
import java.net.URI;
14
import java.util.*;
17
import java.util.*;
15
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
19
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
17
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
20
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.query.*;
22
import org.eclipse.equinox.internal.provisional.p2.query.*;
22
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
23
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
23
import org.eclipse.osgi.util.NLS;
24
import org.eclipse.osgi.util.NLS;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableMetadataRepositoryManager.java (-2 / +2 lines)
Lines 19-28 Link Here
19
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
19
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
20
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
20
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.query.*;
23
import org.eclipse.equinox.internal.provisional.p2.query.*;
24
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
26
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
27
import org.eclipse.osgi.util.NLS;
27
import org.eclipse.osgi.util.NLS;
28
import org.eclipse.ui.statushandlers.StatusManager;
28
import org.eclipse.ui.statushandlers.StatusManager;
(-)src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java (-2 / +3 lines)
Lines 11-24 Link Here
11
11
12
package org.eclipse.equinox.internal.p2.ui.model;
12
package org.eclipse.equinox.internal.p2.ui.model;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
16
14
import java.net.URI;
17
import java.net.URI;
15
import java.util.*;
18
import java.util.*;
16
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.jobs.Job;
20
import org.eclipse.core.runtime.jobs.Job;
18
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
21
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
24
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
24
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
25
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
(-)src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java (-1 / +1 lines)
Lines 15-27 Link Here
15
import org.eclipse.core.runtime.SubMonitor;
15
import org.eclipse.core.runtime.SubMonitor;
16
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
16
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
19
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
18
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
20
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
19
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
21
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
20
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
22
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
21
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
24
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
25
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
26
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
26
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
27
import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
27
import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
(-)src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.model;
11
package org.eclipse.equinox.internal.p2.ui.model;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.OperationCanceledException;
17
import org.eclipse.core.runtime.OperationCanceledException;
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
19
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
22
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
23
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
23
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
24
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
(-)src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.model;
11
package org.eclipse.equinox.internal.p2.ui.model;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
17
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
19
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
18
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
20
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
24
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
(-)plugin.xml (-1 / +1 lines)
Lines 8-14 Link Here
8
            class="org.eclipse.equinox.internal.p2.ui.ProvUIAdapterFactory">
8
            class="org.eclipse.equinox.internal.p2.ui.ProvUIAdapterFactory">
9
         <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit"/>
9
         <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit"/>
10
         <adapter type="org.eclipse.equinox.internal.provisional.p2.engine.IProfile"/>
10
         <adapter type="org.eclipse.equinox.internal.provisional.p2.engine.IProfile"/>
11
         <adapter type="org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository"/>
11
         <adapter type="org.eclipse.equinox.internal.provisional.p2.repository.IRepository"/>
12
         <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository"/>
12
         <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository"/>
13
         <adapter type="org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository"/>
13
         <adapter type="org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository"/>
14
      </factory>
14
      </factory>
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AvailableIUGroup.java (-2 / +2 lines)
Lines 20-28 Link Here
20
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
20
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
21
import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
21
import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
26
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
26
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
27
import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
28
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RepositoryManipulationPage.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
11
package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
14
13
import java.lang.reflect.InvocationTargetException;
15
import java.lang.reflect.InvocationTargetException;
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.ArrayList;
17
import java.util.ArrayList;
Lines 23-29 Link Here
23
import org.eclipse.equinox.internal.p2.ui.viewers.MetadataRepositoryElementComparator;
25
import org.eclipse.equinox.internal.p2.ui.viewers.MetadataRepositoryElementComparator;
24
import org.eclipse.equinox.internal.p2.ui.viewers.RepositoryDetailsLabelProvider;
26
import org.eclipse.equinox.internal.p2.ui.viewers.RepositoryDetailsLabelProvider;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
27
import org.eclipse.equinox.internal.provisional.p2.ui.*;
28
import org.eclipse.equinox.internal.provisional.p2.ui.*;
28
import org.eclipse.equinox.internal.provisional.p2.ui.model.MetadataRepositories;
29
import org.eclipse.equinox.internal.provisional.p2.ui.model.MetadataRepositories;
29
import org.eclipse.equinox.internal.provisional.p2.ui.operations.*;
30
import org.eclipse.equinox.internal.provisional.p2.ui.operations.*;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/operations/AddColocatedRepositoryOperation.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.ui.operations;
11
package org.eclipse.equinox.internal.provisional.p2.ui.operations;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
17
18
18
/**
19
/**
19
 * Operation that adds colocated artifact and metadata repositories
20
 * Operation that adds colocated artifact and metadata repositories
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/operations/ProvisioningUtil.java (-2 / +3 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.equinox.internal.provisional.p2.ui.operations;
12
package org.eclipse.equinox.internal.provisional.p2.ui.operations;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
16
14
import java.net.URI;
17
import java.net.URI;
15
import java.util.Map;
18
import java.util.Map;
16
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
Lines 21-28 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
26
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
26
import org.eclipse.equinox.internal.provisional.p2.director.*;
27
import org.eclipse.equinox.internal.provisional.p2.director.*;
27
import org.eclipse.equinox.internal.provisional.p2.engine.*;
28
import org.eclipse.equinox.internal.provisional.p2.engine.*;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/StructuredViewerProvisioningListener.java (-2 / +1 lines)
Lines 11-19 Link Here
11
11
12
package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
12
package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
14
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIProvisioningListener;
15
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIProvisioningListener;
15
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
17
import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
16
import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
18
import org.eclipse.jface.viewers.StructuredViewer;
17
import org.eclipse.jface.viewers.StructuredViewer;
19
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.swt.widgets.Display;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementLabelProvider.java (-1 / +2 lines)
Lines 11-21 Link Here
11
11
12
package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
12
package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
16
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
15
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
17
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
16
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
19
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
20
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/policy/IUViewQueryContext.java (-1 / +2 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.ui.policy;
11
package org.eclipse.equinox.internal.provisional.p2.ui.policy;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
14
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
15
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
15
16
16
/**
17
/**
(-)src/org/eclipse/equinox/internal/p2/ui/UIRepositoryEvent.java (-1 / +2 lines)
Lines 11-18 Link Here
11
11
12
package org.eclipse.equinox.internal.p2.ui;
12
package org.eclipse.equinox.internal.p2.ui;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
15
14
import java.net.URI;
16
import java.net.URI;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
16
17
17
/**
18
/**
18
 * UIMetadataRepositoryEvent is used to distinguish those metadata repository
19
 * UIMetadataRepositoryEvent is used to distinguish those metadata repository
(-)src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java (-1 / +2 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui;
11
package org.eclipse.equinox.internal.p2.ui;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import org.eclipse.core.runtime.IAdapterFactory;
15
import org.eclipse.core.runtime.IAdapterFactory;
14
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
16
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
16
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
17
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
17
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/internal/p2/ui/DefaultMetadataURLValidator.java (-1 / +2 lines)
Lines 11-20 Link Here
11
11
12
package org.eclipse.equinox.internal.p2.ui;
12
package org.eclipse.equinox.internal.p2.ui;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
14
import java.net.URI;
16
import java.net.URI;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryLocationValidator;
20
import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryLocationValidator;
20
21
(-)src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java (-2 / +2 lines)
Lines 18-27 Link Here
18
import org.eclipse.equinox.internal.p2.ui.*;
18
import org.eclipse.equinox.internal.p2.ui.*;
19
import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
19
import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
23
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
21
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
25
import org.eclipse.equinox.internal.provisional.p2.ui.*;
25
import org.eclipse.equinox.internal.provisional.p2.ui.*;
26
import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AddRepositoryDialog;
26
import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AddRepositoryDialog;
27
import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AvailableIUGroup;
27
import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AvailableIUGroup;
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/model/IRepositoryElement.java (-1 / +2 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.ui.model;
11
package org.eclipse.equinox.internal.provisional.p2.ui.model;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
16
17
17
/**
18
/**
18
 * Interface for elements that represent repositories.
19
 * Interface for elements that represent repositories.
(-)META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 16-22 Link Here
16
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
16
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
17
 org.eclipse.equinox.internal.provisional.p2.core,
17
 org.eclipse.equinox.internal.provisional.p2.core,
18
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
18
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
19
 org.eclipse.equinox.internal.provisional.p2.core.repository,
19
 org.eclipse.equinox.internal.provisional.p2.repository,
20
 org.eclipse.equinox.internal.provisional.p2.director,
20
 org.eclipse.equinox.internal.provisional.p2.director,
21
 org.eclipse.equinox.internal.provisional.p2.engine,
21
 org.eclipse.equinox.internal.provisional.p2.engine,
22
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
22
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
Lines 24-30 Link Here
24
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
24
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.p2.query,
26
 org.eclipse.equinox.internal.provisional.p2.query,
27
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
27
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
28
 org.eclipse.osgi.service.resolver;version="1.1.0",
28
 org.eclipse.osgi.service.resolver;version="1.1.0",
29
 org.eclipse.osgi.util;version="1.1.0",
29
 org.eclipse.osgi.util;version="1.1.0",
30
 org.osgi.framework;version="1.3.0",
30
 org.osgi.framework;version="1.3.0",
(-)src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java (-1 / +2 lines)
Lines 11-21 Link Here
11
11
12
package org.eclipse.equinox.internal.p2.ui.viewers;
12
package org.eclipse.equinox.internal.p2.ui.viewers;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
16
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
15
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
17
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
16
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
18
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
20
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
21
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
21
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
22
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
(-)src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java (-1 / +2 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.ui.query;
11
package org.eclipse.equinox.p2.tests.ui.query;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
14
import org.eclipse.equinox.internal.provisional.p2.query.MatchQuery;
15
import org.eclipse.equinox.internal.provisional.p2.query.MatchQuery;
15
import org.eclipse.equinox.internal.provisional.p2.query.Query;
16
import org.eclipse.equinox.internal.provisional.p2.query.Query;
16
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
17
import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
(-)src/org/eclipse/equinox/p2/tests/ui/operations/ProvisioningUtilTest.java (-2 / +3 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.ui.operations;
11
package org.eclipse.equinox.p2.tests.ui.operations;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
13
import java.net.URI;
16
import java.net.URI;
14
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
17
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
18
import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
19
import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
19
20
(-)src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.ui;
11
package org.eclipse.equinox.p2.tests.ui;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.URI;
16
import java.net.URI;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.Version;
21
import org.eclipse.equinox.internal.provisional.p2.core.Version;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
22
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
22
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
23
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
23
import org.eclipse.equinox.internal.provisional.p2.engine.*;
24
import org.eclipse.equinox.internal.provisional.p2.engine.*;
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 17-20 Link Here
17
 org.eclipse.equinox.p2.engine;bundle-version="1.0.100",
17
 org.eclipse.equinox.p2.engine;bundle-version="1.0.100",
18
 org.eclipse.equinox.p2.director;bundle-version="1.0.100",
18
 org.eclipse.equinox.p2.director;bundle-version="1.0.100",
19
 org.eclipse.equinox.p2.artifact.repository;bundle-version="1.0.100",
19
 org.eclipse.equinox.p2.artifact.repository;bundle-version="1.0.100",
20
 org.junit;bundle-version="[3.8.0,4.0.0)"
20
 org.junit;bundle-version="[3.8.0,4.0.0)",
21
 org.eclipse.equinox.p2.repository;bundle-version="1.0.0"
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 17-23 Link Here
17
 org.eclipse.equinox.p2.core,
17
 org.eclipse.equinox.p2.core,
18
 org.eclipse.equinox.p2.artifact.repository,
18
 org.eclipse.equinox.p2.artifact.repository,
19
 org.eclipse.swt,
19
 org.eclipse.swt,
20
 org.eclipse.core.net;bundle-version="1.1.0"
20
 org.eclipse.core.net;bundle-version="1.1.0",
21
 org.eclipse.equinox.p2.repository;bundle-version="1.0.0"
21
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
22
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
22
 J2SE-1.4
23
 J2SE-1.4
23
Export-Package: org.eclipse.equinox.internal.p2.installer;x-internal:=true,
24
Export-Package: org.eclipse.equinox.internal.p2.installer;x-internal:=true,
(-)src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.engine.phases;
11
package org.eclipse.equinox.internal.provisional.p2.engine.phases;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.*;
16
import java.util.*;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
19
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.engine.*;
22
import org.eclipse.equinox.internal.provisional.p2.engine.*;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType;
(-)src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java (-2 / +3 lines)
Lines 1-5 Link Here
1
package org.eclipse.equinox.internal.p2.engine;
1
package org.eclipse.equinox.internal.p2.engine;
2
2
3
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
4
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
5
3
import java.io.File;
6
import java.io.File;
4
import java.net.URI;
7
import java.net.URI;
5
import java.net.URISyntaxException;
8
import java.net.URISyntaxException;
Lines 10-17 Link Here
10
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
13
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
11
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
14
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
12
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
15
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
13
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
15
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
16
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
16
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
17
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
17
import org.eclipse.equinox.internal.provisional.p2.query.Query;
18
import org.eclipse.equinox.internal.provisional.p2.query.Query;
(-)src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java (-1 / +2 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.engine;
11
package org.eclipse.equinox.internal.p2.engine;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
20
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
20
21
(-)src/org/eclipse/equinox/internal/p2/engine/MetadataCache.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.engine;
11
package org.eclipse.equinox.internal.p2.engine;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.*;
16
import java.util.*;
15
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
17
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
20
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
19
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
21
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
20
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
22
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.p2.engine.*;
23
import org.eclipse.equinox.internal.provisional.p2.engine.*;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java (-1 / +2 lines)
Lines 11-23 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.engine;
12
package org.eclipse.equinox.internal.p2.engine;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.*;
17
import java.util.*;
16
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
17
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
19
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
22
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
22
23
23
public class DownloadManager {
24
public class DownloadManager {
(-)META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 36-48 Link Here
36
 org.eclipse.equinox.internal.provisional.p2.core,
36
 org.eclipse.equinox.internal.provisional.p2.core,
37
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
37
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
38
 org.eclipse.equinox.internal.provisional.p2.core.location,
38
 org.eclipse.equinox.internal.provisional.p2.core.location,
39
 org.eclipse.equinox.internal.provisional.p2.core.repository,
40
 org.eclipse.equinox.internal.provisional.p2.metadata,
39
 org.eclipse.equinox.internal.provisional.p2.metadata,
41
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
40
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
42
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
41
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
43
 org.eclipse.equinox.internal.provisional.p2.query,
42
 org.eclipse.equinox.internal.provisional.p2.query,
44
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
43
 org.eclipse.equinox.internal.provisional.p2.repository,
45
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
44
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
45
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
46
 org.eclipse.osgi.service.datalocation;version="1.0.0",
46
 org.eclipse.osgi.service.datalocation;version="1.0.0",
47
 org.eclipse.osgi.service.resolver;version="1.1.0",
47
 org.eclipse.osgi.service.resolver;version="1.1.0",
48
 org.eclipse.osgi.signedcontent;version="1.0.0",
48
 org.eclipse.osgi.signedcontent;version="1.0.0",
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java (-1 / +1 lines)
Lines 21-33 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.director.*;
24
import org.eclipse.equinox.internal.provisional.p2.director.*;
26
import org.eclipse.equinox.internal.provisional.p2.engine.*;
25
import org.eclipse.equinox.internal.provisional.p2.engine.*;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
30
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
29
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
30
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
31
import org.eclipse.osgi.service.environment.EnvironmentInfo;
31
import org.eclipse.osgi.service.environment.EnvironmentInfo;
32
import org.osgi.framework.BundleContext;
32
import org.osgi.framework.BundleContext;
33
import org.osgi.framework.ServiceReference;
33
import org.osgi.framework.ServiceReference;
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.reconciler.dropins;
12
package org.eclipse.equinox.internal.p2.reconciler.dropins;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import java.io.*;
16
import java.io.*;
15
import java.net.URI;
17
import java.net.URI;
16
import java.net.URISyntaxException;
18
import java.net.URISyntaxException;
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
29
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.RepositoryListener;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.reconciler.dropins;
11
package org.eclipse.equinox.internal.p2.reconciler.dropins;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.URI;
16
import java.net.URI;
15
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
Lines 20-26 Link Here
20
import org.eclipse.equinox.internal.p2.update.*;
22
import org.eclipse.equinox.internal.p2.update.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
24
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener;
25
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.osgi.util.NLS;
27
import org.eclipse.osgi.util.NLS;
(-)META-INF/MANIFEST.MF (-3 / +3 lines)
Lines 9-23 Link Here
9
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
9
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
10
 CDC-1.1/Foundation-1.1
10
 CDC-1.1/Foundation-1.1
11
Import-Package: org.eclipse.equinox.app;version="1.0.0",
11
Import-Package: org.eclipse.equinox.app;version="1.0.0",
12
 org.eclipse.equinox.internal.p2.artifact.repository,
12
 org.eclipse.equinox.internal.p2.core.helpers,
13
 org.eclipse.equinox.internal.p2.core.helpers,
13
 org.eclipse.equinox.internal.p2.extensionlocation,
14
 org.eclipse.equinox.internal.p2.extensionlocation,
14
 org.eclipse.equinox.internal.p2.artifact.repository,
15
 org.eclipse.equinox.internal.p2.metadata.repository,
15
 org.eclipse.equinox.internal.p2.metadata.repository,
16
 org.eclipse.equinox.internal.p2.update,
16
 org.eclipse.equinox.internal.p2.update,
17
 org.eclipse.equinox.internal.provisional.configurator,
17
 org.eclipse.equinox.internal.provisional.configurator,
18
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
18
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
19
 org.eclipse.equinox.internal.provisional.p2.core,
19
 org.eclipse.equinox.internal.provisional.p2.core,
20
 org.eclipse.equinox.internal.provisional.p2.core.repository,
20
 org.eclipse.equinox.internal.provisional.p2.repository,
21
 org.eclipse.equinox.internal.provisional.p2.director,
21
 org.eclipse.equinox.internal.provisional.p2.director,
22
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
22
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
23
 org.eclipse.equinox.internal.provisional.p2.engine,
23
 org.eclipse.equinox.internal.provisional.p2.engine,
Lines 26-33 Link Here
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
27
 org.eclipse.equinox.internal.provisional.p2.query,
27
 org.eclipse.equinox.internal.provisional.p2.query,
28
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
28
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
29
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
30
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
29
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
30
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
31
 org.eclipse.osgi.service.datalocation;version="1.0.0",
31
 org.eclipse.osgi.service.datalocation;version="1.0.0",
32
 org.eclipse.osgi.service.environment;version="1.1.0",
32
 org.eclipse.osgi.service.environment;version="1.1.0",
33
 org.eclipse.osgi.util;version="1.1.0",
33
 org.eclipse.osgi.util;version="1.1.0",
(-)src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.updatesite;
11
package org.eclipse.equinox.p2.tests.updatesite;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.ByteArrayOutputStream;
15
import java.io.ByteArrayOutputStream;
14
import java.io.File;
16
import java.io.File;
15
import java.net.URI;
17
import java.net.URI;
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.core.*;
28
import org.eclipse.equinox.internal.provisional.p2.core.*;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java (-1 / +1 lines)
Lines 17-27 Link Here
17
import org.eclipse.core.runtime.NullProgressMonitor;
17
import org.eclipse.core.runtime.NullProgressMonitor;
18
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.core.runtime.URIUtil;
19
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
19
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IUPropertyQuery;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.query.IUPropertyQuery;
23
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
22
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
24
import org.eclipse.equinox.internal.provisional.p2.query.Query;
23
import org.eclipse.equinox.internal.provisional.p2.query.Query;
24
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.RepositoryReference;
25
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.RepositoryReference;
26
import org.eclipse.equinox.p2.publisher.*;
26
import org.eclipse.equinox.p2.publisher.*;
27
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
27
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java (-1 / +1 lines)
Lines 22-28 Link Here
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.*;
25
import org.eclipse.equinox.internal.provisional.p2.repository.*;
26
import org.eclipse.equinox.p2.tests.*;
26
import org.eclipse.equinox.p2.tests.*;
27
import org.osgi.framework.BundleException;
27
import org.osgi.framework.BundleException;
28
import org.osgi.service.prefs.BackingStoreException;
28
import org.osgi.service.prefs.BackingStoreException;
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.artifact.repository;
11
package org.eclipse.equinox.p2.tests.artifact.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.*;
15
import java.io.*;
14
import java.net.URI;
16
import java.net.URI;
15
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
Lines 25-31 Link Here
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.Version;
29
import org.eclipse.equinox.internal.provisional.p2.core.Version;
28
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
30
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
31
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
31
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
32
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java (-2 / +3 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.p2.tests.artifact.repository;
12
package org.eclipse.equinox.p2.tests.artifact.repository;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
16
14
import java.io.File;
17
import java.io.File;
15
import java.net.URI;
18
import java.net.URI;
16
import java.net.URISyntaxException;
19
import java.net.URISyntaxException;
Lines 21-28 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.Version;
26
import org.eclipse.equinox.internal.provisional.p2.core.Version;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
27
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
28
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
28
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
29
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/TransferTest.java (-2 / +2 lines)
Lines 13-19 Link Here
13
import java.io.*;
13
import java.io.*;
14
import java.net.*;
14
import java.net.*;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.p2.artifact.repository.ECFTransport;
16
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
17
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
17
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
18
import org.osgi.framework.Bundle;
18
import org.osgi.framework.Bundle;
19
import org.osgi.framework.BundleException;
19
import org.osgi.framework.BundleException;
Lines 32-38 Link Here
32
		} catch (BundleException e) {
32
		} catch (BundleException e) {
33
			fail("1.5", e);
33
			fail("1.5", e);
34
		}
34
		}
35
		IStatus s = ECFTransport.getInstance().download("http://download.eclipse.org/eclipse/updates/3.4/plugins/javax.servlet.jsp_2.0.0.v200806031607.jar.pack.gz", fos, new NullProgressMonitor());
35
		IStatus s = RepositoryTransport.getInstance().download("http://download.eclipse.org/eclipse/updates/3.4/plugins/javax.servlet.jsp_2.0.0.v200806031607.jar.pack.gz", fos, new NullProgressMonitor());
36
		assertOK("2.0", s);
36
		assertOK("2.0", s);
37
		int httpSize = -1;
37
		int httpSize = -1;
38
		URL u;
38
		URL u;
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactOutputStreamTest.java (-1 / +3 lines)
Lines 17-26 Link Here
17
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
17
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
18
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.ArtifactOutputStream;
18
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.ArtifactOutputStream;
19
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
19
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.ArtifactDescriptor;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
22
import org.eclipse.equinox.internal.provisional.p2.core.Version;
23
import org.eclipse.equinox.internal.provisional.p2.core.Version;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
25
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
24
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
26
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
25
27
26
public class ArtifactOutputStreamTest extends TestCase {
28
public class ArtifactOutputStreamTest extends TestCase {
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java (-1 / +1 lines)
Lines 25-35 Link Here
25
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
25
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
26
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
26
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
27
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
27
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
28
import org.eclipse.equinox.internal.provisional.p2.core.repository.*;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
32
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
31
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
32
import org.eclipse.equinox.internal.provisional.p2.repository.*;
33
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
33
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
34
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
34
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
35
import org.eclipse.equinox.p2.tests.*;
35
import org.eclipse.equinox.p2.tests.*;
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java (-1 / +2 lines)
Lines 12-17 Link Here
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.equinox.p2.tests.metadata.repository;
13
package org.eclipse.equinox.p2.tests.metadata.repository;
14
14
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
16
15
import java.io.File;
17
import java.io.File;
16
import java.net.URI;
18
import java.net.URI;
17
import java.net.URISyntaxException;
19
import java.net.URISyntaxException;
Lines 22-28 Link Here
22
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
24
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.Version;
26
import org.eclipse.equinox.internal.provisional.p2.core.Version;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java (-1 / +2 lines)
Lines 9-14 Link Here
9
******************************************************************************/
9
******************************************************************************/
10
package org.eclipse.equinox.p2.tests.metadata.repository;
10
package org.eclipse.equinox.p2.tests.metadata.repository;
11
11
12
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
13
12
import org.eclipse.equinox.internal.p2.metadata.ProvidedCapability;
14
import org.eclipse.equinox.internal.p2.metadata.ProvidedCapability;
13
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
15
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
14
16
Lines 23-29 Link Here
23
import org.eclipse.core.runtime.NullProgressMonitor;
25
import org.eclipse.core.runtime.NullProgressMonitor;
24
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
26
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
25
import org.eclipse.equinox.internal.provisional.p2.core.*;
27
import org.eclipse.equinox.internal.provisional.p2.core.*;
26
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitPatchDescription;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitPatchDescription;
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java (-2 / +3 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.p2.tests.metadata.repository;
12
package org.eclipse.equinox.p2.tests.metadata.repository;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
16
14
import java.io.File;
17
import java.io.File;
15
import java.net.URI;
18
import java.net.URI;
16
import java.util.*;
19
import java.util.*;
Lines 18-25 Link Here
18
import org.eclipse.equinox.internal.provisional.p2.core.Version;
21
import org.eclipse.equinox.internal.provisional.p2.core.Version;
19
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
22
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
20
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
23
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLRepositoryTest.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.p2.tests.metadata.repository;
12
package org.eclipse.equinox.p2.tests.metadata.repository;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import java.io.File;
16
import java.io.File;
15
import java.net.URI;
17
import java.net.URI;
16
import java.net.URISyntaxException;
18
import java.net.URISyntaxException;
Lines 20-26 Link Here
20
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
22
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.Version;
24
import org.eclipse.equinox.internal.provisional.p2.core.Version;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
(-)src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java (-2 / +7 lines)
Lines 17-27 Link Here
17
import junit.framework.Assert;
17
import junit.framework.Assert;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRequest;
19
import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRequest;
20
import org.eclipse.equinox.internal.p2.artifact.repository.Transport;
20
import org.eclipse.equinox.internal.p2.repository.Transport;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryCreationException;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
24
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryCreationException;
25
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
25
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
26
26
27
/**
27
/**
Lines 51-56 Link Here
51
	Set artifactDescriptors = new HashSet();
51
	Set artifactDescriptors = new HashSet();
52
52
53
	Transport testhandler = new Transport() {
53
	Transport testhandler = new Transport() {
54
		@Deprecated
54
		public IStatus download(String toDownload, OutputStream target, IProgressMonitor pm) {
55
		public IStatus download(String toDownload, OutputStream target, IProgressMonitor pm) {
55
			byte[] contents = (byte[]) locationsToContents.get(toDownload);
56
			byte[] contents = (byte[]) locationsToContents.get(toDownload);
56
			if (contents == null)
57
			if (contents == null)
Lines 63-68 Link Here
63
			}
64
			}
64
			return Status.OK_STATUS;
65
			return Status.OK_STATUS;
65
		}
66
		}
67
68
		public IStatus download(URI toDownload, OutputStream target, IProgressMonitor pm) {
69
			return download(toDownload.toString(), target, pm);
70
		}
66
	};
71
	};
67
72
68
	public TestArtifactRepository() {
73
	public TestArtifactRepository() {
(-)src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java (-1 / +2 lines)
Lines 8-20 Link Here
8
 ******************************************************************************/
8
 ******************************************************************************/
9
package org.eclipse.equinox.p2.tests;
9
package org.eclipse.equinox.p2.tests;
10
10
11
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
12
11
import java.net.URI;
13
import java.net.URI;
12
import java.net.URISyntaxException;
14
import java.net.URISyntaxException;
13
import java.util.*;
15
import java.util.*;
14
import junit.framework.Assert;
16
import junit.framework.Assert;
15
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.equinox.internal.provisional.p2.core.Version;
18
import org.eclipse.equinox.internal.provisional.p2.core.Version;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java (-1 / +2 lines)
Lines 8-13 Link Here
8
 ******************************************************************************/
8
 ******************************************************************************/
9
package org.eclipse.equinox.p2.tests;
9
package org.eclipse.equinox.p2.tests;
10
10
11
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
12
11
import java.io.*;
13
import java.io.*;
12
import java.net.URI;
14
import java.net.URI;
13
import java.net.URL;
15
import java.net.URL;
Lines 21-27 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
22
import org.eclipse.equinox.internal.provisional.p2.core.*;
24
import org.eclipse.equinox.internal.provisional.p2.core.*;
23
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
25
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.director.*;
26
import org.eclipse.equinox.internal.provisional.p2.director.*;
26
import org.eclipse.equinox.internal.provisional.p2.engine.*;
27
import org.eclipse.equinox.internal.provisional.p2.engine.*;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
(-)src/org/eclipse/equinox/p2/tests/TestRepositoryListener.java (-1 / +2 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests;
11
package org.eclipse.equinox.p2.tests;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.EventObject;
16
import java.util.EventObject;
15
import junit.framework.Assert;
17
import junit.framework.Assert;
16
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
18
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
18
19
19
/**
20
/**
20
 * A provisioning event listener used for testing purposes. If a location is provided,
21
 * A provisioning event listener used for testing purposes. If a location is provided,
(-)src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.mirror;
11
package org.eclipse.equinox.p2.tests.mirror;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.*;
15
import java.io.*;
14
import java.net.*;
16
import java.net.*;
15
import java.util.*;
17
import java.util.*;
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.Version;
28
import org.eclipse.equinox.internal.provisional.p2.core.Version;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
29
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
30
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
30
import org.eclipse.equinox.p2.tests.TestActivator;
31
import org.eclipse.equinox.p2.tests.TestActivator;
(-)src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.mirror;
11
package org.eclipse.equinox.p2.tests.mirror;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.*;
16
import java.net.*;
15
import java.util.HashMap;
17
import java.util.HashMap;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.p2.metadata.mirror.MirrorApplication;
20
import org.eclipse.equinox.internal.p2.metadata.mirror.MirrorApplication;
19
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
21
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/p2/tests/director/DirectorAppTest.java (-1 / +2 lines)
Lines 8-13 Link Here
8
 ******************************************************************************/
8
 ******************************************************************************/
9
package org.eclipse.equinox.p2.tests.director;
9
package org.eclipse.equinox.p2.tests.director;
10
10
11
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
12
11
import java.io.*;
13
import java.io.*;
12
import java.lang.reflect.InvocationTargetException;
14
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.Method;
15
import java.lang.reflect.Method;
Lines 22-28 Link Here
22
import org.eclipse.equinox.internal.p2.director.app.Application;
24
import org.eclipse.equinox.internal.p2.director.app.Application;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.query.*;
29
import org.eclipse.equinox.internal.provisional.p2.query.*;
(-)src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java (-1 / +2 lines)
Lines 10-22 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.extensionlocation;
11
package org.eclipse.equinox.p2.tests.extensionlocation;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.File;
15
import java.io.File;
14
import java.io.IOException;
16
import java.io.IOException;
15
import java.net.*;
17
import java.net.*;
16
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
18
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
17
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepositoryFactory;
19
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepositoryFactory;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
23
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
(-)src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.extensionlocation;
11
package org.eclipse.equinox.p2.tests.extensionlocation;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.File;
15
import java.io.File;
14
import java.io.IOException;
16
import java.io.IOException;
15
import java.net.*;
17
import java.net.*;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepositoryFactory;
20
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepositoryFactory;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
22
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
23
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
23
import org.eclipse.equinox.p2.tests.TestActivator;
24
import org.eclipse.equinox.p2.tests.TestActivator;
24
25
(-)META-INF/MANIFEST.MF (-5 / +6 lines)
Lines 5-11 Link Here
5
Bundle-Vendor: %providerName
5
Bundle-Vendor: %providerName
6
Bundle-Localization: plugin
6
Bundle-Localization: plugin
7
Bundle-Version: 1.1.0.qualifier
7
Bundle-Version: 1.1.0.qualifier
8
Import-Package: javax.xml.parsers, 
8
Import-Package: javax.xml.parsers,
9
 org.eclipse.equinox.internal.p2.artifact.mirror,
9
 org.eclipse.equinox.internal.p2.artifact.mirror,
10
 org.eclipse.equinox.internal.p2.artifact.processors.md5,
10
 org.eclipse.equinox.internal.p2.artifact.processors.md5,
11
 org.eclipse.equinox.internal.p2.artifact.processors.pack200,
11
 org.eclipse.equinox.internal.p2.artifact.processors.pack200,
Lines 38-44 Link Here
38
 org.eclipse.equinox.internal.provisional.p2.core,
38
 org.eclipse.equinox.internal.provisional.p2.core,
39
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
39
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
40
 org.eclipse.equinox.internal.provisional.p2.core.location,
40
 org.eclipse.equinox.internal.provisional.p2.core.location,
41
 org.eclipse.equinox.internal.provisional.p2.core.repository,
41
 org.eclipse.equinox.internal.provisional.p2.repository,
42
 org.eclipse.equinox.internal.provisional.p2.director,
42
 org.eclipse.equinox.internal.provisional.p2.director,
43
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
43
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
44
 org.eclipse.equinox.internal.provisional.p2.engine,
44
 org.eclipse.equinox.internal.provisional.p2.engine,
Lines 48-55 Link Here
48
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
48
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
49
 org.eclipse.equinox.internal.provisional.p2.query,
49
 org.eclipse.equinox.internal.provisional.p2.query,
50
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
50
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
51
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
52
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
51
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
52
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
53
 org.eclipse.equinox.spi.p2.publisher,
53
 org.eclipse.equinox.spi.p2.publisher,
54
 org.eclipse.internal.provisional.equinox.p2.jarprocessor,
54
 org.eclipse.internal.provisional.equinox.p2.jarprocessor,
55
 org.eclipse.osgi.service.datalocation,
55
 org.eclipse.osgi.service.datalocation,
Lines 75-83 Link Here
75
 org.sat4j.core;bundle-version="2.0.0",
75
 org.sat4j.core;bundle-version="2.0.0",
76
 org.sat4j.pb;bundle-version="2.0.0",
76
 org.sat4j.pb;bundle-version="2.0.0",
77
 org.eclipse.equinox.p2.installer;bundle-version="[1.0.0,2.0.0)",
77
 org.eclipse.equinox.p2.installer;bundle-version="[1.0.0,2.0.0)",
78
 org.eclipse.equinox.simpleconfigurator;bundle-version="1.0.100", 
78
 org.eclipse.equinox.simpleconfigurator;bundle-version="1.0.100",
79
 org.eclipse.equinox.p2.updatechecker;bundle-version="1.0.0",
79
 org.eclipse.equinox.p2.updatechecker;bundle-version="1.0.0",
80
 org.eclipse.equinox.simpleconfigurator.manipulator;bundle-version="1.0.100"
80
 org.eclipse.equinox.simpleconfigurator.manipulator;bundle-version="1.0.100",
81
 org.eclipse.equinox.p2.repository;bundle-version="1.0.0"
81
Bundle-ActivationPolicy: lazy
82
Bundle-ActivationPolicy: lazy
82
Eclipse-RegisterBuddy: org.eclipse.equinox.p2.artifact.repository
83
Eclipse-RegisterBuddy: org.eclipse.equinox.p2.artifact.repository
83
Bundle-RequiredExecutionEnvironment: J2SE-1.5
84
Bundle-RequiredExecutionEnvironment: J2SE-1.5
(-)src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveRepositoryActionTest.java (-1 / +2 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.touchpoint.eclipse;
11
package org.eclipse.equinox.p2.tests.touchpoint.eclipse;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.HashMap;
16
import java.util.HashMap;
15
import java.util.Map;
17
import java.util.Map;
16
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.RemoveRepositoryAction;
19
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.RemoveRepositoryAction;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
19
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
20
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
20
21
21
/**
22
/**
(-)src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddRepositoryActionTest.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.touchpoint.eclipse;
11
package org.eclipse.equinox.p2.tests.touchpoint.eclipse;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.net.URISyntaxException;
16
import java.net.URISyntaxException;
15
import java.util.HashMap;
17
import java.util.HashMap;
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.Version;
28
import org.eclipse.equinox.internal.provisional.p2.core.Version;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
29
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
29
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
30
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
30
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
31
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
(-)All p2 Tests.launch (-1 / +2 lines)
Lines 6-11 Link Here
6
<booleanAttribute key="automaticAdd" value="true"/>
6
<booleanAttribute key="automaticAdd" value="true"/>
7
<booleanAttribute key="automaticValidate" value="false"/>
7
<booleanAttribute key="automaticValidate" value="false"/>
8
<stringAttribute key="bootstrap" value=""/>
8
<stringAttribute key="bootstrap" value=""/>
9
<stringAttribute key="checked" value="[NONE]"/>
9
<booleanAttribute key="clearConfig" value="true"/>
10
<booleanAttribute key="clearConfig" value="true"/>
10
<booleanAttribute key="clearws" value="true"/>
11
<booleanAttribute key="clearws" value="true"/>
11
<booleanAttribute key="clearwslog" value="false"/>
12
<booleanAttribute key="clearwslog" value="false"/>
Lines 41-47 Link Here
41
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
42
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
42
<booleanAttribute key="default" value="true"/>
43
<booleanAttribute key="default" value="true"/>
43
<booleanAttribute key="includeOptional" value="true"/>
44
<booleanAttribute key="includeOptional" value="true"/>
44
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
45
<stringAttribute key="location" value="${workspace_loc}/../junit2-workspace"/>
45
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
46
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
46
<listEntry value="/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AutomatedTests.java"/>
47
<listEntry value="/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AutomatedTests.java"/>
47
</listAttribute>
48
</listAttribute>
(-)src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java (+1 lines)
Lines 21-26 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
24
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
24
import org.eclipse.equinox.p2.tests.TestActivator;
25
import org.eclipse.equinox.p2.tests.TestActivator;
25
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.osgi.util.NLS;
26
27
(-)src/org/eclipse/equinox/p2/tests/artifact/repository/TransferExceptionsTest.java (+75 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Cloudsmith Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Cloudsmith Inc. - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.artifact.repository;
12
13
import java.io.*;
14
import java.net.URI;
15
import java.net.URISyntaxException;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
18
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
19
import org.osgi.framework.BundleException;
20
21
/**
22
 * Test supposed to be used interactivly to monitor the error message output.
23
 * @author henrik.lindberg@cloudsmith.com
24
 *
25
 */
26
public class TransferExceptionsTest extends AbstractProvisioningTest {
27
28
	public void testErrorMessages() {
29
		FileOutputStream fos = null;
30
		File f = null;
31
		try {
32
			f = File.createTempFile("TransferTest", "dummy.txt");
33
			fos = new FileOutputStream(f);
34
			Platform.getBundle("org.eclipse.ecf.provider.filetransfer").start();
35
		} catch (IOException e) {
36
			fail("1.0", e);
37
		} catch (BundleException e) {
38
			fail("1.5", e);
39
		}
40
		try {
41
			IStatus s = RepositoryTransport.getInstance().download(new URI("bogus!bogus"), fos, new NullProgressMonitor());
42
			assertNotOK(s);
43
			printStatus("1", s);
44
			s = RepositoryTransport.getInstance().download(new URI("bogus://somewhere.else"), fos, new NullProgressMonitor());
45
			assertNotOK(s);
46
			printStatus("2", s);
47
			s = RepositoryTransport.getInstance().download(new URI("http:bogusURL"), fos, new NullProgressMonitor());
48
			assertNotOK(s);
49
			printStatus("3", s);
50
			s = RepositoryTransport.getInstance().download(new URI("http://bogusURL:80/"), fos, new NullProgressMonitor());
51
			assertNotOK(s);
52
			printStatus("4", s);
53
			s = RepositoryTransport.getInstance().download(new URI("http:/bogusURL:999999999999/"), fos, new NullProgressMonitor());
54
			assertNotOK(s);
55
			printStatus("5", s);
56
			s = RepositoryTransport.getInstance().download(new URI("http://bogus.nowhere"), fos, new NullProgressMonitor());
57
			assertNotOK(s);
58
			printStatus("6", s);
59
			s = RepositoryTransport.getInstance().download(new URI("http://www.eclipse.org/AFileThatDoesNotExist.foo"), fos, new NullProgressMonitor());
60
			assertNotOK(s);
61
			printStatus("7", s);
62
		} catch (URISyntaxException e) {
63
			fail("URI syntax exception where none was expected: " + e.getMessage());
64
		}
65
	}
66
67
	private static void printStatus(String msg, IStatus s) {
68
		System.err.print("TEST OUTPUT: " + msg + "\n");
69
		System.err.print("     ");
70
		System.err.print("Message [" + s.getMessage() + "] Exception Class[" + s.getException().getClass().getName() + "] ExceptionMessage[ ");
71
		System.err.print(s.getException().getMessage() + "]\n");
72
73
	}
74
75
}
(-)src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java (+80 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.tests.metadata.repository;
12
13
import java.io.File;
14
import java.net.URI;
15
import java.net.URISyntaxException;
16
import java.util.*;
17
import junit.framework.Test;
18
import junit.framework.TestSuite;
19
import org.eclipse.core.runtime.NullProgressMonitor;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepositoryFactory;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
25
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
26
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
27
import org.eclipse.equinox.p2.tests.TestActivator;
28
29
/**
30
 * Tests for API of {@link IMetadataRepositoryManager}.
31
 */
32
public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisioningTest {
33
	protected IMetadataRepositoryManager manager;
34
	/**
35
	 * Contains temp File handles that should be deleted at the end of the test.
36
	 */
37
	private final List toDelete = new ArrayList();
38
39
	public static Test suite() {
40
		return new TestSuite(MetadataRepositoryManagerExceptionsTest.class);
41
	}
42
43
	protected void setUp() throws Exception {
44
		super.setUp();
45
		manager = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.context, IMetadataRepositoryManager.class.getName());
46
	}
47
48
	protected void tearDown() throws Exception {
49
		super.tearDown();
50
		for (Iterator it = toDelete.iterator(); it.hasNext();)
51
			delete((File) it.next());
52
		toDelete.clear();
53
	}
54
55
	/**
56
	 * Adds a repository for a non existing site, should
57
	 * return REPOSITORY_NOT_FOUND, since any other status code gets logged.
58
	 * 
59
	 * @throws URISyntaxException
60
	 */
61
	public void testFailedConnection() throws URISyntaxException {
62
		//		URI location = new URI("invalid://example");
63
		URI location = new URI("http://bogus.nowhere");
64
		MetadataRepositoryFactory factory;
65
66
		factory = new SimpleMetadataRepositoryFactory();
67
		try {
68
			factory.load(location, 0, new NullProgressMonitor());
69
		} catch (ProvisionException e) {
70
			assertEquals(ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
71
		}
72
		factory = new UpdateSiteMetadataRepositoryFactory();
73
		try {
74
			factory.load(location, 0, new NullProgressMonitor());
75
		} catch (ProvisionException e) {
76
			assertEquals(ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
77
		}
78
	}
79
80
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 11-17 Link Here
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
12
 org.eclipse.equinox.internal.provisional.p2.core,
12
 org.eclipse.equinox.internal.provisional.p2.core,
13
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
13
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
14
 org.eclipse.equinox.internal.provisional.p2.core.repository,
14
 org.eclipse.equinox.internal.provisional.p2.repository,
15
 org.eclipse.equinox.internal.provisional.p2.director,
15
 org.eclipse.equinox.internal.provisional.p2.director,
16
 org.eclipse.equinox.internal.provisional.p2.engine,
16
 org.eclipse.equinox.internal.provisional.p2.engine,
17
 org.eclipse.equinox.internal.provisional.p2.metadata,
17
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java (-1 / +2 lines)
Lines 10-22 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.sdk;
11
package org.eclipse.equinox.internal.p2.ui.sdk;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.*;
15
import java.io.*;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.p2.ui.sdk.prefs.PreferenceConstants;
17
import org.eclipse.equinox.internal.p2.ui.sdk.prefs.PreferenceConstants;
16
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
18
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
20
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
21
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
21
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
22
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
22
import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
23
import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
(-)src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java (-2 / +3 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.equinox.p2.internal.repository.tools;
12
package org.eclipse.equinox.p2.internal.repository.tools;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
16
14
import java.io.File;
17
import java.io.File;
15
import java.io.IOException;
18
import java.io.IOException;
16
import java.net.URI;
19
import java.net.URI;
Lines 20-27 Link Here
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
26
import org.eclipse.osgi.util.NLS;
27
import org.eclipse.osgi.util.NLS;
27
28
(-)src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java (-1 / +2 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.internal.repository.tools;
11
package org.eclipse.equinox.p2.internal.repository.tools;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
15
16
16
public class RepositoryDescriptor {
17
public class RepositoryDescriptor {
17
18
(-)src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.p2.internal.repository.tools;
11
package org.eclipse.equinox.p2.internal.repository.tools;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
13
import java.net.URI;
16
import java.net.URI;
14
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
15
import java.util.*;
18
import java.util.*;
Lines 19-26 Link Here
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
27
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 19-25 Link Here
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
21
 org.eclipse.equinox.internal.provisional.p2.core,
21
 org.eclipse.equinox.internal.provisional.p2.core,
22
 org.eclipse.equinox.internal.provisional.p2.core.repository,
22
 org.eclipse.equinox.internal.provisional.p2.repository,
23
 org.eclipse.equinox.internal.provisional.p2.engine,
23
 org.eclipse.equinox.internal.provisional.p2.engine,
24
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
24
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
25
 org.eclipse.equinox.internal.provisional.p2.metadata,
25
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository;
11
package org.eclipse.equinox.internal.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.*;
15
import java.io.*;
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.Map;
17
import java.util.Map;
Lines 20-26 Link Here
20
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
22
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
21
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
23
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
26
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
26
import org.eclipse.osgi.util.NLS;
27
import org.eclipse.osgi.util.NLS;
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/Messages.java (+3 lines)
Lines 22-27 Link Here
22
		// Do not instantiate
22
		// Do not instantiate
23
	}
23
	}
24
24
25
	public static String CacheManager_AuthenticationFaileFor_0;
26
	public static String CacheManager_FailedCommunicationWithRepo_0;
27
	public static String CacheManager_Neither_0_nor_1_found;
25
	public static String io_failedRead;
28
	public static String io_failedRead;
26
	public static String ecf_configuration_error;
29
	public static String ecf_configuration_error;
27
30
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java (-2 / +3 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.metadata.repository;
12
package org.eclipse.equinox.internal.p2.metadata.repository;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.ICompositeRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
16
14
import java.io.*;
17
import java.io.*;
15
import java.net.URI;
18
import java.net.URI;
16
import java.net.URISyntaxException;
19
import java.net.URISyntaxException;
Lines 23-30 Link Here
23
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
26
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
24
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
27
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.repository.ICompositeRepository;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java (-2 / +4 lines)
Lines 11-22 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.metadata.repository;
12
package org.eclipse.equinox.internal.p2.metadata.repository;
13
13
14
import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager;
15
16
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
17
14
import java.net.URI;
18
import java.net.URI;
15
import java.util.*;
19
import java.util.*;
16
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
17
import org.eclipse.equinox.internal.p2.core.helpers.AbstractRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.query.*;
24
import org.eclipse.equinox.internal.provisional.p2.query.*;
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/messages.properties (+3 lines)
Lines 1-3 Link Here
1
CacheManager_FailedCommunicationWithRepo_0=Failed to communicate with repository: {0}
2
CacheManager_Neither_0_nor_1_found=Neither: {0} nor: {0} available
1
###############################################################################
3
###############################################################################
2
# Copyright (c) 2007, 2008 IBM Corporation and others.
4
# Copyright (c) 2007, 2008 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
5
# All rights reserved. This program and the accompanying materials
Lines 9-14 Link Here
9
#     IBM Corporation - initial API and implementation
11
#     IBM Corporation - initial API and implementation
10
###############################################################################
12
###############################################################################
11
13
14
CacheManager_AuthenticationFaileFor_0=Authentication failed for: {0}
12
io_failedRead=Unable to read repository at {0}
15
io_failedRead=Unable to read repository at {0}
13
io_IncompatibleVersion=\
16
io_IncompatibleVersion=\
14
Metadata repository has incompatible version {0}; expected {1}
17
Metadata repository has incompatible version {0}; expected {1}
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/ECFMetadataTransport.java (-405 / +6 lines)
Lines 10-420 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository;
11
package org.eclipse.equinox.internal.p2.metadata.repository;
12
12
13
import java.io.*;
13
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
14
import java.net.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.jobs.Job;
17
import org.eclipse.ecf.core.*;
18
import org.eclipse.ecf.core.security.ConnectContextFactory;
19
import org.eclipse.ecf.core.security.IConnectContext;
20
import org.eclipse.ecf.filetransfer.*;
21
import org.eclipse.ecf.filetransfer.events.*;
22
import org.eclipse.ecf.filetransfer.identity.FileCreateException;
23
import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
24
import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
25
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
26
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
27
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
29
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI.AuthenticationInfo;
30
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
31
import org.eclipse.equinox.security.storage.*;
32
import org.eclipse.osgi.util.NLS;
33
import org.osgi.framework.Bundle;
34
import org.osgi.framework.BundleException;
35
import org.osgi.service.packageadmin.PackageAdmin;
36
import org.osgi.util.tracker.ServiceTracker;
37
14
15
/**
16
 * @deprecated
17
 * PLEASE REMOVE THIS CLASS - It is replaced by {@link RepositoryTransport}.
18
 */
38
public class ECFMetadataTransport {
19
public class ECFMetadataTransport {
39
	private static final String SERVER_REDIRECT = "Server redirected too many times"; //$NON-NLS-1$
20
	// TODO: remove this class
40
	/**
41
	 * The number of password retry attempts allowed before failing.
42
	 */
43
	private static final int LOGIN_RETRIES = 3;
44
	private static final ProtocolException ERROR_401 = new ProtocolException();
45
46
	/**
47
	 * A job that waits on a barrier.
48
	 */
49
	static class WaitJob extends Job {
50
		private final Object[] barrier;
51
52
		/**
53
		 * Creates a wait job.
54
		 * @param location A location string that is used in the job name
55
		 * @param barrier The job will wait until the first entry in the barrier is non-null
56
		 */
57
		WaitJob(String location, Object[] barrier) {
58
			super(NLS.bind(Messages.repo_loading, location));
59
			this.barrier = barrier;
60
			setSystem(true);
61
		}
62
63
		/* (non-Javadoc)
64
		 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
65
		 */
66
		protected IStatus run(IProgressMonitor monitor) {
67
			synchronized (barrier) {
68
				while (barrier[0] == null) {
69
					try {
70
						barrier.wait();
71
					} catch (InterruptedException e) {
72
						//ignore
73
					}
74
				}
75
			}
76
			return Status.OK_STATUS;
77
		}
78
	}
79
80
	/**
81
	 * The singleton transport instance.
82
	 */
83
	private static ECFMetadataTransport instance;
84
85
	private final ServiceTracker retrievalFactoryTracker;
86
87
	public static synchronized ECFMetadataTransport getInstance() {
88
		if (instance == null) {
89
			instance = new ECFMetadataTransport();
90
		}
91
		return instance;
92
	}
93
94
	private ECFMetadataTransport() {
95
		retrievalFactoryTracker = new ServiceTracker(Activator.getContext(), IRetrieveFileTransferFactory.class.getName(), null);
96
		retrievalFactoryTracker.open();
97
		startBundle("org.eclipse.ecf.provider.filetransfer"); //$NON-NLS-1$
98
	}
99
100
	private boolean startBundle(String bundleId) {
101
		PackageAdmin packageAdmin = (PackageAdmin) ServiceHelper.getService(Activator.getContext(), PackageAdmin.class.getName());
102
		if (packageAdmin == null)
103
			return false;
104
105
		Bundle[] bundles = packageAdmin.getBundles(bundleId, null);
106
		if (bundles != null && bundles.length > 0) {
107
			for (int i = 0; i < bundles.length; i++) {
108
				try {
109
					if ((bundles[0].getState() & Bundle.INSTALLED) == 0) {
110
						bundles[0].start();
111
						return true;
112
					}
113
				} catch (BundleException e) {
114
					// failed, try next bundle
115
				}
116
			}
117
		}
118
		return false;
119
	}
120
121
	public IStatus download(String url, OutputStream destination, IProgressMonitor monitor) {
122
		try {
123
			IConnectContext context = getConnectionContext(url, false);
124
			for (int i = 0; i < LOGIN_RETRIES; i++) {
125
				try {
126
					return performDownload(url, destination, context, monitor);
127
				} catch (ProtocolException e) {
128
					if (e == ERROR_401)
129
						context = getConnectionContext(url, true);
130
				}
131
			}
132
		} catch (UserCancelledException e) {
133
			return Status.CANCEL_STATUS;
134
		} catch (ProvisionException e) {
135
			return e.getStatus();
136
		}
137
		//reached maximum number of retries without success
138
		return new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.io_failedRead, url), null);
139
	}
140
141
	public IStatus performDownload(String toDownload, OutputStream target, IConnectContext context, IProgressMonitor monitor) throws ProtocolException {
142
		IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory) retrievalFactoryTracker.getService();
143
		if (factory == null)
144
			return new Status(IStatus.ERROR, Activator.ID, Messages.ecf_configuration_error);
145
		return transfer(factory.newInstance(), toDownload, target, context, monitor);
146
	}
147
148
	/**
149
	 * Gets the last modified date for the specified file.
150
	 * @param location - The URL location of the file.
151
	 * @return A <code>long</code> representing the date. Returns <code>0</code> if the file is not found or an error occurred.
152
	 * @exception OperationCanceledException if the request was canceled.
153
	 */
154
	public long getLastModified(URI location) throws ProvisionException {
155
		String locationString = location.toString();
156
		try {
157
			IConnectContext context = getConnectionContext(locationString, false);
158
			for (int i = 0; i < LOGIN_RETRIES; i++) {
159
				try {
160
					return doGetLastModified(locationString, context);
161
				} catch (ProtocolException e) {
162
					if (ERROR_401 == e)
163
						context = getConnectionContext(locationString, true);
164
				} catch (Exception e) {
165
					e.getMessage();
166
				}
167
			}
168
		} catch (UserCancelledException e) {
169
			throw new OperationCanceledException();
170
		}
171
		//too many retries, so report as failure
172
		throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.io_failedRead, locationString), null));
173
	}
174
175
	/**
176
	 * Perform the ECF call to get the last modified time, failing if there is any
177
	 * protocol failure such as an authentication failure.
178
	 */
179
	private long doGetLastModified(String location, IConnectContext context) throws ProtocolException {
180
		IContainer container;
181
		try {
182
			container = ContainerFactory.getDefault().createContainer();
183
		} catch (ContainerCreateException e) {
184
			return 0;
185
		}
186
		IRemoteFileSystemBrowserContainerAdapter adapter = (IRemoteFileSystemBrowserContainerAdapter) container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class);
187
		if (adapter == null) {
188
			return 0;
189
		}
190
		IRemoteFile remoteFile = checkFile(adapter, location, context);
191
		if (remoteFile == null) {
192
			return 0;
193
		}
194
		return remoteFile.getInfo().getLastModified();
195
	}
196
197
	/**
198
	 * Returns the connection context for the given URL. This may prompt the
199
	 * user for user name and password as required.
200
	 *
201
	 * @param xmlLocation - the file location requiring login details
202
	 * @param prompt - use <code>true</code> to prompt the user instead of
203
	 * looking at the secure preference store for login, use <code>false</code>
204
	 * to only try the secure preference store
205
	 * @throws UserCancelledException when the user cancels the login prompt
206
	 * @throws ProvisionException if the password cannot be read or saved
207
	 * @return The connection context
208
	 */
209
	public IConnectContext getConnectionContext(String xmlLocation, boolean prompt) throws UserCancelledException, ProvisionException {
210
		ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
211
		IPath hostLocation = new Path(xmlLocation).removeLastSegments(1);
212
		String nodeKey;
213
		try {
214
			nodeKey = URLEncoder.encode(hostLocation.toString(), "UTF-8"); //$NON-NLS-1$
215
		} catch (UnsupportedEncodingException e2) {
216
			//fall back to default platform encoding
217
			nodeKey = URLEncoder.encode(hostLocation.toString());
218
		}
219
		String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
220
		ISecurePreferences prefNode = null;
221
		if (securePreferences.nodeExists(nodeName))
222
			prefNode = securePreferences.node(nodeName);
223
		if (!prompt) {
224
			if (prefNode == null)
225
				return null;
226
			try {
227
				String username = prefNode.get(IRepository.PROP_USERNAME, null);
228
				String password = prefNode.get(IRepository.PROP_PASSWORD, null);
229
				//if we don't have stored connection data just return a null connection context
230
				if (username == null || password == null)
231
					return null;
232
				return ConnectContextFactory.createUsernamePasswordConnectContext(username, password);
233
			} catch (StorageException e) {
234
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
235
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
236
			}
237
		}
238
		//need to prompt user for user name and password
239
		ServiceTracker adminUITracker = new ServiceTracker(Activator.getContext(), IServiceUI.class.getName(), null);
240
		adminUITracker.open();
241
		IServiceUI adminUIService = (IServiceUI) adminUITracker.getService();
242
		AuthenticationInfo loginDetails = null;
243
		if (adminUIService != null)
244
			loginDetails = adminUIService.getUsernamePassword(hostLocation.toString());
245
		//null result means user canceled password dialog
246
		if (loginDetails == null)
247
			throw new UserCancelledException();
248
		//save user name and password if requested by user
249
		if (loginDetails.saveResult()) {
250
			if (prefNode == null)
251
				prefNode = securePreferences.node(nodeName);
252
			try {
253
				prefNode.put(IRepository.PROP_USERNAME, loginDetails.getUserName(), true);
254
				prefNode.put(IRepository.PROP_PASSWORD, loginDetails.getPassword(), true);
255
				prefNode.flush();
256
			} catch (StorageException e1) {
257
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
258
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
259
			} catch (IOException e) {
260
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
261
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
262
			}
263
		}
264
		return ConnectContextFactory.createUsernamePasswordConnectContext(loginDetails.getUserName(), loginDetails.getPassword());
265
	}
266
267
	private IRemoteFile checkFile(final IRemoteFileSystemBrowserContainerAdapter retrievalContainer, final String location, IConnectContext context) throws ProtocolException {
268
		final Object[] result = new Object[2];
269
		final Object FAIL = new Object();
270
		IRemoteFileSystemListener listener = new IRemoteFileSystemListener() {
271
			public void handleRemoteFileEvent(IRemoteFileSystemEvent event) {
272
				Exception exception = event.getException();
273
				if (exception != null) {
274
					synchronized (result) {
275
						result[0] = FAIL;
276
						result[1] = exception;
277
						result.notify();
278
					}
279
				} else if (event instanceof IRemoteFileSystemBrowseEvent) {
280
					IRemoteFileSystemBrowseEvent fsbe = (IRemoteFileSystemBrowseEvent) event;
281
					IRemoteFile[] remoteFiles = fsbe.getRemoteFiles();
282
					if (remoteFiles != null && remoteFiles.length > 0 && remoteFiles[0] != null) {
283
						synchronized (result) {
284
							result[0] = remoteFiles[0];
285
							result.notify();
286
						}
287
					} else {
288
						synchronized (result) {
289
							result[0] = FAIL;
290
							result.notify();
291
						}
292
					}
293
				}
294
			}
295
		};
296
		try {
297
			retrievalContainer.setConnectContextForAuthentication(context);
298
			retrievalContainer.sendBrowseRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getBrowseNamespace(), location), listener);
299
		} catch (RemoteFileSystemException e) {
300
			return null;
301
		} catch (FileCreateException e) {
302
			return null;
303
		}
304
		waitFor(location, result);
305
		if (result[0] == FAIL && result[1] instanceof IOException) {
306
			IOException ioException = (IOException) result[1];
307
			//throw a special exception for authentication failure so we know to prompt for username/password
308
			String message = ioException.getMessage();
309
			if (message != null && (message.indexOf(" 401 ") != -1 || message.indexOf(SERVER_REDIRECT) != -1)) //$NON-NLS-1$
310
				throw ERROR_401;
311
		}
312
		if (result[0] instanceof IRemoteFile)
313
			return (IRemoteFile) result[0];
314
		return null;
315
	}
316
317
	/**
318
	 * Check if the given exception represents a permission failure (401 for HTTP),
319
	 * and throw a special marker exception if a permission failure was encountered.
320
	 */
321
	private void checkPermissionDenied(Throwable t) throws ProtocolException {
322
		if (!(t instanceof IncomingFileTransferException))
323
			return;
324
		IncomingFileTransferException e = (IncomingFileTransferException) t;
325
		if (e.getErrorCode() == 401)
326
			throw ERROR_401;
327
		//try to figure out if we have a 401 by parsing the exception message
328
		IStatus status = e.getStatus();
329
		Throwable exception = status.getException();
330
		if (exception instanceof IOException)
331
			if (exception.getMessage() != null && (exception.getMessage().indexOf(" 401 ") != -1 || exception.getMessage().indexOf(SERVER_REDIRECT) != -1)) //$NON-NLS-1$
332
				throw ERROR_401;
333
	}
334
335
	/**
336
	 * Waits until the first entry in the given array is non-null.
337
	 */
338
	private void waitFor(String location, Object[] barrier) {
339
		WaitJob wait = new WaitJob(location, barrier);
340
		wait.schedule();
341
		while (barrier[0] == null) {
342
			boolean logged = false;
343
			try {
344
				wait.join();
345
			} catch (InterruptedException e) {
346
				if (!logged)
347
					LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Unexpected interrupt while waiting on ECF transfer", e)); //$NON-NLS-1$
348
			}
349
		}
350
	}
351
352
	private IStatus transfer(final IRetrieveFileTransferContainerAdapter retrievalContainer, final String toDownload, final OutputStream target, IConnectContext context, final IProgressMonitor monitor) throws ProtocolException {
353
		final IStatus[] result = new IStatus[1];
354
		IFileTransferListener listener = new IFileTransferListener() {
355
356
			public void handleTransferEvent(IFileTransferEvent event) {
357
				if (event instanceof IFileTransferConnectStartEvent) {
358
					IFileTransferConnectStartEvent cse = (IFileTransferConnectStartEvent) event;
359
					FileTransferJob connectJob = cse.prepareConnectJob(null);
360
					cse.connectUsingJob(connectJob);
361
				} else if (event instanceof IIncomingFileTransferReceiveStartEvent) {
362
					IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
363
					if (target != null) {
364
						try {
365
							rse.receive(target);
366
						} catch (IOException e) {
367
							IStatus status = convertToStatus(e);
368
							synchronized (result) {
369
								result[0] = status;
370
								result.notify();
371
							}
372
						}
373
					}
374
				}
375
				if (event instanceof IIncomingFileTransferReceiveDataEvent) {
376
					IIncomingFileTransfer source = ((IIncomingFileTransferReceiveDataEvent) event).getSource();
377
					if (monitor != null) {
378
						if (monitor.isCanceled())
379
							source.cancel();
380
					}
381
				}
382
				if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
383
					IStatus status = convertToStatus(((IIncomingFileTransferReceiveDoneEvent) event).getException());
384
					synchronized (result) {
385
						result[0] = status;
386
						result.notify();
387
					}
388
				}
389
			}
390
		};
391
392
		try {
393
			retrievalContainer.setConnectContextForAuthentication(context);
394
			retrievalContainer.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getRetrieveNamespace(), toDownload), listener, null);
395
		} catch (IncomingFileTransferException e) {
396
			checkPermissionDenied(e);
397
			return e.getStatus();
398
		} catch (FileCreateException e) {
399
			return e.getStatus();
400
		}
401
		waitFor(toDownload, result);
402
		final Throwable exception = result[0].getException();
403
		checkPermissionDenied(exception);
404
		//if the transfer failed, return the underlying exception status, otherwise return top level DownloadStatus
405
		if (exception instanceof IncomingFileTransferException) {
406
			IStatus cause = ((IncomingFileTransferException) exception).getStatus();
407
			if (!cause.isOK())
408
				return cause;
409
		}
410
		return result[0];
411
	}
412
413
	protected IStatus convertToStatus(Exception e) {
414
		if (e == null)
415
			return Status.OK_STATUS;
416
		if (e instanceof UserCancelledException)
417
			return new Status(IStatus.CANCEL, Activator.ID, e.getMessage(), e);
418
		return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e);
419
	}
420
}
21
}
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java (-104 / +104 lines)
Lines 15-27 Link Here
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.*;
16
import java.util.*;
17
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.ecf.filetransfer.UserCancelledException;
18
import org.eclipse.equinox.internal.p2.core.helpers.*;
19
import org.eclipse.equinox.internal.p2.core.helpers.*;
20
import org.eclipse.equinox.internal.p2.repository.AuthenticationFailedException;
21
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
23
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
21
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
24
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
22
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
25
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
26
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
27
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
28
import org.eclipse.osgi.util.NLS;
25
import org.osgi.framework.BundleContext;
29
import org.osgi.framework.BundleContext;
26
import org.osgi.framework.ServiceReference;
30
import org.osgi.framework.ServiceReference;
27
31
Lines 38-59 Link Here
38
	private static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$
42
	private static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$
39
	private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
43
	private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
40
44
41
	/**
42
	 * Could not find a remote file corresponding to the cache.
43
	 */
44
	private static final int CACHE_MISSING_REMOTE = 0;
45
	/**
46
	 * The local cache is stale or missing.
47
	 */
48
	private static final int CACHE_STALE = 1;
49
	/**
50
	 * A remote JAR file exists, and is newer than the cache.
51
	 */
52
	private static final int CACHE_STALE_REMOTE_JAR = 2;
53
	/**
54
	 * The remote file exists, and the local cache is up to date.
55
	 */
56
	private static final int CACHE_OK = 3;
57
	private final HashSet knownPrefixes = new HashSet(5);
45
	private final HashSet knownPrefixes = new HashSet(5);
58
46
59
	/**
47
	/**
Lines 72-131 Link Here
72
	 * @param monitor a progress monitor
60
	 * @param monitor a progress monitor
73
	 * @return A {@link File} object pointing to the cache file or <code>null</code>
61
	 * @return A {@link File} object pointing to the cache file or <code>null</code>
74
	 * if the location is not a repository.
62
	 * if the location is not a repository.
75
	 * @throws IOException
63
	 * @throws FileNotFound exception if neither jar nor xml index file exists at given location 
76
	 * @throws ProvisionException
64
	 * @throws AuthenticationFailedException if jar not available and xml causes authentication fail
65
	 * @throws IOException on general IO errors
66
	 * @throws ProvisionException on any error (e.g. user cancellation, unknown host, malformed address, connection refused, etc.)
77
	 */
67
	 */
78
	public File createCache(URI repositoryLocation, String prefix, IProgressMonitor monitor) throws IOException, ProvisionException {
68
	public File createCache(URI repositoryLocation, String prefix, IProgressMonitor monitor) throws IOException, ProvisionException {
79
		knownPrefixes.add(prefix);
69
80
		File cacheFile = getCache(repositoryLocation, prefix);
70
		SubMonitor submonitor = SubMonitor.convert(monitor, 1000);
81
		URI jarLocation = URIUtil.append(repositoryLocation, prefix + JAR_EXTENSION);
82
		URI xmlLocation = URIUtil.append(repositoryLocation, prefix + XML_EXTENSION);
83
		AgentLocation agentLocation = (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
84
		URL dataArea = agentLocation.getDataArea(Activator.ID + "/cache/"); //$NON-NLS-1$
85
		File dataAreaFile = URLUtil.toFile(dataArea);
86
		int hashCode = computeHash(repositoryLocation);
87
		int state = getCacheState(repositoryLocation, prefix, cacheFile);
88
		URI remoteFile;
89
		switch (state) {
90
			case CACHE_OK :
91
				return cacheFile;
92
			case CACHE_MISSING_REMOTE :
93
				return null;
94
			case CACHE_STALE_REMOTE_JAR :
95
				//we know there is a remote jar at this point
96
				cacheFile = new File(dataAreaFile, prefix + hashCode + JAR_EXTENSION);
97
				remoteFile = jarLocation;
98
				break;
99
			case CACHE_STALE :
100
			default :
101
				//find the best available remote file
102
				long lastModifiedRemote = getTransport().getLastModified(jarLocation);
103
				if (lastModifiedRemote > 0) {
104
					cacheFile = new File(dataAreaFile, prefix + hashCode + JAR_EXTENSION);
105
					remoteFile = jarLocation;
106
				} else {
107
					lastModifiedRemote = getTransport().getLastModified(xmlLocation);
108
					if (lastModifiedRemote <= 0)
109
						// no jar or xml file found
110
						return null;
111
					cacheFile = new File(dataAreaFile, prefix + hashCode + XML_EXTENSION);
112
					remoteFile = xmlLocation;
113
				}
114
		}
115
		cacheFile.getParentFile().mkdirs();
116
		OutputStream metadata = new BufferedOutputStream(new FileOutputStream(cacheFile));
117
		IStatus result;
118
		try {
71
		try {
119
			result = getTransport().download(remoteFile.toString(), metadata, monitor);
72
			knownPrefixes.add(prefix);
73
			File cacheFile = getCache(repositoryLocation, prefix);
74
			URI jarLocation = URIUtil.append(repositoryLocation, prefix + JAR_EXTENSION);
75
			URI xmlLocation = URIUtil.append(repositoryLocation, prefix + XML_EXTENSION);
76
			AgentLocation agentLocation = (AgentLocation) ServiceHelper.getService(Activator.getContext(), AgentLocation.class.getName());
77
			URL dataArea = agentLocation.getDataArea(Activator.ID + "/cache/"); //$NON-NLS-1$
78
			File dataAreaFile = URLUtil.toFile(dataArea);
79
			int hashCode = computeHash(repositoryLocation);
80
81
			// Knowing if cache is stale is complicated by the fact that a jar could have been 
82
			// produced after an xml index (and vice versa), and by the need to capture any
83
			// errors, as these needs to be reported to the user as something meaningful - instead of
84
			// just a general "can't read repository".
85
			// (Previous impl of stale checking ignored errors, and caused multiple round-trips)
86
			boolean stale = true;
87
			long lastModified = 0L;
88
			String name = null;
89
			String useExtension = JAR_EXTENSION;
90
			URI remoteFile = jarLocation;
91
92
			if (cacheFile != null) {
93
				cacheFile.lastModified();
94
				name = cacheFile.getName();
95
			}
96
			// get last modified on jar
97
			long lastModifiedRemote = 0L;
98
			try {
99
				lastModifiedRemote = getTransport().getLastModified(jarLocation, submonitor.newChild(1));
100
			} catch (Exception e) {
101
				// just set to 0 and test if xml exists, report general error for the xml file
102
				lastModifiedRemote = 0;
103
			}
104
			if (monitor.isCanceled())
105
				throw new ProvisionException(Status.CANCEL_STATUS);
106
107
			if (lastModifiedRemote != 0) {
108
				// There is a jar, and it should be used - cache is stale if it is xml based or
109
				// if older (irrespective of jar or xml).
110
				stale = lastModifiedRemote > lastModified || (name != null && name.endsWith(XML_EXTENSION));
111
			} else {
112
				// Also need to check remote XML file, and handle cancel, and errors
113
				// (Status is reported based on finding the XML file as giving up on certain errors
114
				// when checking for the jar may not be correct).
115
				try {
116
					lastModifiedRemote = getTransport().getLastModified(xmlLocation, submonitor.newChild(1));
117
					// if lastModifiedRemote is 0 - something is wrong in the communication stack, as 
118
					// a FileNotFound exception should have been thrown.
119
					if (lastModifiedRemote == 0)
120
						throw new FileNotFoundException();
121
				} catch (UserCancelledException e) {
122
					throw new ProvisionException(Status.CANCEL_STATUS);
123
				} catch (FileNotFoundException e) {
124
					throw new FileNotFoundException(NLS.bind(Messages.CacheManager_Neither_0_nor_1_found, jarLocation, xmlLocation));
125
				} catch (AuthenticationFailedException e) {
126
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_AuthenticationFaileFor_0, repositoryLocation), e));
127
				} catch (CoreException e) {
128
					throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_FailedCommunicationWithRepo_0, repositoryLocation), e));
129
130
				}
131
				// There is an xml, and it should be used - cache is stale if it is jar based or
132
				// if older (irrespective of jar or xml).
133
				stale = lastModifiedRemote > lastModified || (name != null && name.endsWith(JAR_EXTENSION));
134
				useExtension = XML_EXTENSION;
135
				remoteFile = xmlLocation;
136
			}
137
138
			if (!stale)
139
				return cacheFile;
140
141
			// Need to update cache
142
			cacheFile = new File(dataAreaFile, prefix + hashCode + useExtension);
143
			cacheFile.getParentFile().mkdirs();
144
			OutputStream metadata = new BufferedOutputStream(new FileOutputStream(cacheFile));
145
			IStatus result;
146
			try {
147
				submonitor.setWorkRemaining(1000);
148
				result = getTransport().download(remoteFile, metadata, submonitor.newChild(1000));
149
			} finally {
150
				metadata.close();
151
			}
152
			if (!result.isOK()) {
153
				//don't leave a partial cache file lying around
154
				// TODO: HENRIK Handle resume
155
				cacheFile.delete();
156
				throw new ProvisionException(result);
157
			}
158
			return cacheFile;
159
120
		} finally {
160
		} finally {
121
			metadata.close();
161
			if (monitor != null)
162
				monitor.done();
122
		}
163
		}
123
		if (!result.isOK()) {
124
			//don't leave a partial cache file lying around
125
			cacheFile.delete();
126
			throw new ProvisionException(result);
127
		}
128
		return cacheFile;
129
	}
164
	}
130
165
131
	/**
166
	/**
Lines 171-213 Link Here
171
		return result;
206
		return result;
172
	}
207
	}
173
208
174
	private ECFMetadataTransport getTransport() {
209
	private RepositoryTransport getTransport() {
175
		return ECFMetadataTransport.getInstance();
210
		return RepositoryTransport.getInstance();
176
	}
177
178
	/**
179
	 * Checks if the repository's local cache file is out of date.
180
	 * @param repositoryLocation The remote location of the file
181
	 * @param prefix The prefix to use when creating the cache file
182
	 * @param cacheFile The current local cache of the remote location
183
	 * @return One of the CACHE_* constants
184
	 */
185
	private int getCacheState(URI repositoryLocation, String prefix, File cacheFile) {
186
		if (cacheFile == null)
187
			return CACHE_STALE;
188
		long lastModified = cacheFile.lastModified();
189
		String name = cacheFile.getName();
190
		URI metadataLocation = null;
191
192
		if (name.endsWith(XML_EXTENSION)) {
193
			metadataLocation = URIUtil.append(repositoryLocation, prefix + XML_EXTENSION);
194
		} else if (name.endsWith(JAR_EXTENSION)) {
195
			metadataLocation = URIUtil.append(repositoryLocation, prefix + JAR_EXTENSION);
196
		} else {
197
			return CACHE_STALE;
198
		}
199
		long lastModifiedRemote = 0;
200
		try {
201
			lastModifiedRemote = getTransport().getLastModified(metadataLocation);
202
		} catch (ProvisionException e) {
203
			// cache is stale
204
			return CACHE_MISSING_REMOTE;
205
		}
206
		if (lastModifiedRemote <= 0)
207
			return CACHE_MISSING_REMOTE;
208
		if (lastModifiedRemote > lastModified)
209
			return name.endsWith(XML_EXTENSION) ? CACHE_STALE : CACHE_STALE_REMOTE_JAR;
210
		return CACHE_OK;
211
	}
211
	}
212
212
213
	/**
213
	/**
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java (-2 / +3 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.metadata.repository;
12
package org.eclipse.equinox.internal.p2.metadata.repository;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
16
14
import java.io.*;
17
import java.io.*;
15
import java.net.URI;
18
import java.net.URI;
16
import java.util.*;
19
import java.util.*;
Lines 21-28 Link Here
21
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
24
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
26
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
29
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
(-)src/org/eclipse/equinox/internal/p2/metadata/mirror/MirrorApplication.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.mirror;
11
package org.eclipse.equinox.internal.p2.metadata.mirror;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.net.URISyntaxException;
16
import java.net.URISyntaxException;
15
import java.util.*;
17
import java.util.*;
Lines 20-26 Link Here
20
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
22
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
21
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
23
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
27
(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/repository/IMetadataRepositoryManager.java (-1 / +2 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.metadata.repository;
11
package org.eclipse.equinox.internal.provisional.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
19
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
20
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
20
21
21
/**
22
/**
(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/repository/IMetadataRepository.java (-1 / +2 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.metadata.repository;
11
package org.eclipse.equinox.internal.provisional.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
16
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
17
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
17
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
18
import org.eclipse.equinox.internal.provisional.p2.query.IQueryable;
18
import org.eclipse.equinox.internal.provisional.p2.query.Query;
19
import org.eclipse.equinox.internal.provisional.p2.query.Query;
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java (-1 / +2 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
20
21
21
/**
22
/**
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/AbstractMetadataRepository.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.p2.query.Query;
21
import org.eclipse.equinox.internal.provisional.p2.query.Query;
20
import org.eclipse.equinox.internal.provisional.spi.p2.core.repository.AbstractRepository;
21
22
22
/**
23
/**
23
 * The common base class for all metadata repositories.
24
 * The common base class for all metadata repositories.
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
11
package org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.io.*;
15
import java.io.*;
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.Map;
17
import java.util.Map;
Lines 19-25 Link Here
19
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
21
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
20
import org.eclipse.equinox.internal.p2.metadata.repository.*;
22
import org.eclipse.equinox.internal.p2.metadata.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
24
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.osgi.util.NLS;
25
26
Lines 60-65 Link Here
60
		localFile = Activator.getCacheManager().createCache(location, URLMetadataRepository.CONTENT_FILENAME, monitor);
61
		localFile = Activator.getCacheManager().createCache(location, URLMetadataRepository.CONTENT_FILENAME, monitor);
61
		if (localFile == null) {
62
		if (localFile == null) {
62
			//there is no remote file in either form
63
			//there is no remote file in either form
64
			// TODO HENRIK: Cause of problem is unknown (can be Unknown Host, etc.) - this must be communicated.
63
			String msg = NLS.bind(Messages.io_failedRead, location);
65
			String msg = NLS.bind(Messages.io_failedRead, location);
64
			throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null));
66
			throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null));
65
		}
67
		}
(-)plugin.properties (-1 / +1 lines)
Lines 6-12 Link Here
6
# http://www.eclipse.org/legal/epl-v10.html
6
# http://www.eclipse.org/legal/epl-v10.html
7
# 
7
# 
8
# Contributors:
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
9
#     henrik.lindberg@cloudsmith.com
10
###############################################################################
10
###############################################################################
11
pluginName = Equinox Provisioning Metadata Repository
11
pluginName = Equinox Provisioning Metadata Repository
12
providerName = Eclipse.org - Equinox
12
providerName = Eclipse.org - Equinox
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.net.URISyntaxException;
16
import java.net.URISyntaxException;
15
import java.util.HashMap;
17
import java.util.HashMap;
Lines 21-27 Link Here
21
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
23
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
22
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
24
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
27
28
(-)META-INF/MANIFEST.MF (-2 / +4 lines)
Lines 39-52 Link Here
39
 org.eclipse.equinox.internal.p2.core.helpers,
39
 org.eclipse.equinox.internal.p2.core.helpers,
40
 org.eclipse.equinox.internal.p2.metadata,
40
 org.eclipse.equinox.internal.p2.metadata,
41
 org.eclipse.equinox.internal.p2.persistence,
41
 org.eclipse.equinox.internal.p2.persistence,
42
 org.eclipse.equinox.internal.p2.repository,
43
 org.eclipse.equinox.internal.p2.repository.helpers,
42
 org.eclipse.equinox.internal.provisional.p2.core,
44
 org.eclipse.equinox.internal.provisional.p2.core,
43
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
45
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
44
 org.eclipse.equinox.internal.provisional.p2.core.location,
46
 org.eclipse.equinox.internal.provisional.p2.core.location,
45
 org.eclipse.equinox.internal.provisional.p2.core.repository,
46
 org.eclipse.equinox.internal.provisional.p2.metadata,
47
 org.eclipse.equinox.internal.provisional.p2.metadata,
47
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
48
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
48
 org.eclipse.equinox.internal.provisional.p2.query,
49
 org.eclipse.equinox.internal.provisional.p2.query,
49
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
50
 org.eclipse.equinox.internal.provisional.p2.repository,
51
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
50
 org.eclipse.equinox.security.storage,
52
 org.eclipse.equinox.security.storage,
51
 org.eclipse.osgi.service.resolver;version="1.1.0",
53
 org.eclipse.osgi.service.resolver;version="1.1.0",
52
 org.eclipse.osgi.util;version="1.1.0",
54
 org.eclipse.osgi.util;version="1.1.0",
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 20-26 Link Here
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
21
 org.eclipse.equinox.internal.provisional.p2.core,
21
 org.eclipse.equinox.internal.provisional.p2.core,
22
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
22
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
23
 org.eclipse.equinox.internal.provisional.p2.core.repository,
23
 org.eclipse.equinox.internal.provisional.p2.repository,
24
 org.eclipse.equinox.internal.provisional.p2.metadata,
24
 org.eclipse.equinox.internal.provisional.p2.metadata,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
(-)src/org/eclipse/equinox/p2/publisher/Publisher.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.p2.publisher;
11
package org.eclipse.equinox.p2.publisher;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
13
import java.net.URI;
16
import java.net.URI;
14
import java.util.Collection;
17
import java.util.Collection;
15
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
Lines 18-25 Link Here
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
(-)src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.p2.publisher.eclipse;
11
package org.eclipse.equinox.p2.publisher.eclipse;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.*;
15
import java.io.*;
14
import java.net.URI;
16
import java.net.URI;
15
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
Lines 25-31 Link Here
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
26
import org.eclipse.equinox.internal.provisional.p2.core.Version;
28
import org.eclipse.equinox.internal.provisional.p2.core.Version;
27
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
29
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
28
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitPatchDescription;
32
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitPatchDescription;
(-)src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java (-46 / +74 lines)
Lines 16-23 Link Here
16
import java.util.Map;
16
import java.util.Map;
17
import java.util.zip.*;
17
import java.util.zip.*;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.ecf.filetransfer.UserCancelledException;
19
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
20
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
20
import org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureParser;
21
import org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureParser;
22
import org.eclipse.equinox.internal.p2.repository.AuthenticationFailedException;
23
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.p2.publisher.eclipse.*;
25
import org.eclipse.equinox.p2.publisher.eclipse.*;
23
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.osgi.util.NLS;
Lines 121-168 Link Here
121
	 * Returns a local file containing the contents of the update site at the given location.
124
	 * Returns a local file containing the contents of the update site at the given location.
122
	 */
125
	 */
123
	private static File loadSiteFile(URI location, IProgressMonitor monitor) throws ProvisionException {
126
	private static File loadSiteFile(URI location, IProgressMonitor monitor) throws ProvisionException {
124
		Throwable failure;
127
		SubMonitor submonitor = SubMonitor.convert(monitor, 1000);
125
		File siteFile = null;
126
		IStatus transferResult;
127
		boolean deleteSiteFile = false;
128
		try {
128
		try {
129
			URI actualLocation = getSiteURI(location);
129
			File siteFile = null;
130
			if (PROTOCOL_FILE.equals(actualLocation.getScheme())) {
130
			IStatus transferResult = null;
131
				siteFile = URIUtil.toFile(actualLocation);
131
			boolean deleteSiteFile = false;
132
				if (siteFile.exists())
132
			try {
133
					transferResult = Status.OK_STATUS;
133
				URI actualLocation = getSiteURI(location);
134
				else {
134
				if (PROTOCOL_FILE.equals(actualLocation.getScheme())) {
135
					String msg = NLS.bind(Messages.ErrorReadingSite, location);
135
					siteFile = URIUtil.toFile(actualLocation);
136
					transferResult = new Status(IStatus.ERROR, Activator.ID, msg, new FileNotFoundException(siteFile.getAbsolutePath()));
136
					if (siteFile.exists())
137
						transferResult = Status.OK_STATUS;
138
					else {
139
						String msg = NLS.bind(Messages.ErrorReadingSite, location);
140
						transferResult = new Status(IStatus.ERROR, Activator.ID, ProvisionException.ARTIFACT_NOT_FOUND, msg, new FileNotFoundException(siteFile.getAbsolutePath()));
141
					}
142
				} else {
143
					// creating a temp file. In the event of an error we want to delete it.
144
					deleteSiteFile = true;
145
					OutputStream destination = null;
146
					try {
147
						siteFile = File.createTempFile("site", ".xml"); //$NON-NLS-1$//$NON-NLS-2$
148
						destination = new BufferedOutputStream(new FileOutputStream(siteFile));
149
					} catch (IOException e) {
150
						throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, // 
151
								"Can not create tempfile for site.xml", e)); //$NON-NLS-1$
152
					}
153
					transferResult = getTransport().download(actualLocation, destination, submonitor.newChild(999));
154
				}
155
				if (monitor.isCanceled())
156
					throw new OperationCanceledException();
157
				if (transferResult.isOK()) {
158
					// successful. If the siteFile is the download of a remote site.xml it will get cleaned up later
159
					deleteSiteFile = false;
160
					return siteFile;
137
				}
161
				}
138
			} else {
139
				// creating a temp file. In the event of an error we want to delete it.
140
				deleteSiteFile = true;
141
				siteFile = File.createTempFile("site", ".xml"); //$NON-NLS-1$//$NON-NLS-2$
142
				OutputStream destination = new BufferedOutputStream(new FileOutputStream(siteFile));
143
				transferResult = getTransport().download(actualLocation.toString(), destination, monitor);
144
			}
145
			if (monitor.isCanceled())
146
				throw new OperationCanceledException();
147
			if (transferResult.isOK()) {
148
				// successful. If the siteFile is the download of a remote site.xml it will get cleaned up later
149
				deleteSiteFile = false;
150
				return siteFile;
151
			}
152
			// The transfer failed. Check if the file is not present
153
			if (0 == getTransport().getLastModified(actualLocation))
154
				throw new FileNotFoundException(actualLocation.toString());
155
162
156
			failure = transferResult.getException();
163
				// The transferStatus from download has a well formatted message that should
157
		} catch (IOException e) {
164
				// be used as it contains useful feedback to the user.
158
			failure = e;
165
				// The only thing needed is to translate the error code ARTIFACT_NOT_FOUND to
166
				// REPOSITORY_NOT_FOUND as the download does not know what the file represents.
167
				//
168
				// TODO: ? Tests dictate that REPOSITORY_NOT_FOUND is the correct response to 
169
				// issues like "unknown host", "malformed url" - it is almost impossible to differentiate
170
				// between "not found" and "error while reading something found" at this point.
171
				int code = transferResult.getCode();
172
				MultiStatus ms = new MultiStatus(Activator.ID, //
173
						ProvisionException.REPOSITORY_NOT_FOUND,
174
						// (code == ProvisionException.ARTIFACT_NOT_FOUND || code == ProvisionException.REPOSITORY_NOT_FOUND ? ProvisionException.REPOSITORY_NOT_FOUND : ProvisionException.REPOSITORY_FAILED_READ), //
175
						new IStatus[] {transferResult}, //
176
						NLS.bind(Messages.ErrorReadingSite, location), null);
177
				throw new ProvisionException(ms);
178
179
			} finally {
180
				if (deleteSiteFile && siteFile != null)
181
					siteFile.delete();
182
			}
159
		} finally {
183
		} finally {
160
			if (deleteSiteFile && siteFile != null)
184
			if (monitor != null)
161
				siteFile.delete();
185
				monitor.done();
162
		}
186
		}
163
		int code = (failure instanceof FileNotFoundException) ? ProvisionException.REPOSITORY_NOT_FOUND : ProvisionException.REPOSITORY_FAILED_READ;
164
		String msg = NLS.bind(Messages.ErrorReadingSite, location);
165
		throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, code, msg, failure));
166
	}
187
	}
167
188
168
	/*
189
	/*
Lines 183-189 Link Here
183
				if (monitor.isCanceled())
204
				if (monitor.isCanceled())
184
					throw new OperationCanceledException();
205
					throw new OperationCanceledException();
185
				OutputStream destination = new BufferedOutputStream(new FileOutputStream(featureFile));
206
				OutputStream destination = new BufferedOutputStream(new FileOutputStream(featureFile));
186
				transferResult = getTransport().download(featureURI.toString(), destination, monitor);
207
				transferResult = getTransport().download(featureURI, destination, monitor);
187
				if (transferResult.isOK())
208
				if (transferResult.isOK())
188
					break;
209
					break;
189
			}
210
			}
Lines 203-217 Link Here
203
		return null;
224
		return null;
204
	}
225
	}
205
226
206
	/*
227
	/**
207
	 * Throw an exception if the site pointed to by the given URI is not valid.
228
	 * Throw an exception if the site pointed to by the given URI is not valid.
229
	 * @param url the site file to check
230
	 * @param monitor a monitor
231
	 * @throws UserCancelledException if user canceled during authentication
232
	 * @throws AuthenticationFailedException if too many attempts made to login
233
	 * @throws FileNotFoundException if the remote file does not exist
234
	 * @throws CoreException on errors in communication (unknown host, connection refused, etc.)
208
	 */
235
	 */
209
	public static void validate(URI url, IProgressMonitor monitor) throws ProvisionException {
236
	public static void validate(URI url, IProgressMonitor monitor) throws UserCancelledException, AuthenticationFailedException, FileNotFoundException, CoreException {
210
		URI siteURI = getSiteURI(url);
237
		URI siteURI = getSiteURI(url);
211
		long lastModified = getTransport().getLastModified(siteURI);
238
		long lastModified = getTransport().getLastModified(siteURI, monitor);
212
		if (lastModified == 0) {
239
		if (lastModified == 0) {
213
			String msg = NLS.bind(Messages.ErrorReadingSite, url);
240
			throw new FileNotFoundException(url.toString());
214
			throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, msg, null));
241
			//			String msg = NLS.bind(Messages.ErrorReadingSite, url);
242
			//			throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, msg, null));
215
		}
243
		}
216
	}
244
	}
217
245
Lines 369-375 Link Here
369
			} else {
397
			} else {
370
				digestFile = File.createTempFile("digest", ".zip"); //$NON-NLS-1$ //$NON-NLS-2$
398
				digestFile = File.createTempFile("digest", ".zip"); //$NON-NLS-1$ //$NON-NLS-2$
371
				BufferedOutputStream destination = new BufferedOutputStream(new FileOutputStream(digestFile));
399
				BufferedOutputStream destination = new BufferedOutputStream(new FileOutputStream(digestFile));
372
				IStatus result = getTransport().download(digestURI.toString(), destination, monitor);
400
				IStatus result = getTransport().download(digestURI, destination, monitor);
373
				if (result.getSeverity() == IStatus.CANCEL || monitor.isCanceled())
401
				if (result.getSeverity() == IStatus.CANCEL || monitor.isCanceled())
374
					throw new OperationCanceledException();
402
					throw new OperationCanceledException();
375
				if (!result.isOK())
403
				if (!result.isOK())
Lines 476-482 Link Here
476
		}
504
		}
477
	}
505
	}
478
506
479
	private static ECFTransport getTransport() {
507
	private static RepositoryTransport getTransport() {
480
		return ECFTransport.getInstance();
508
		return RepositoryTransport.getInstance();
481
	}
509
	}
482
}
510
}
(-)src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.internal.p2.updatesite;
11
package org.eclipse.equinox.internal.p2.updatesite;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.URI;
16
import java.net.URI;
15
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
Lines 17-23 Link Here
17
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
18
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
20
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
19
import org.eclipse.equinox.internal.provisional.p2.core.*;
21
import org.eclipse.equinox.internal.provisional.p2.core.*;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
(-)src/org/eclipse/equinox/internal/p2/updatesite/ECFTransport.java (-407 / +4 lines)
Lines 11-425 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.updatesite;
12
package org.eclipse.equinox.internal.p2.updatesite;
13
13
14
import java.io.*;
14
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
15
import java.net.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.jobs.Job;
18
import org.eclipse.ecf.core.*;
19
import org.eclipse.ecf.core.security.ConnectContextFactory;
20
import org.eclipse.ecf.core.security.IConnectContext;
21
import org.eclipse.ecf.filetransfer.*;
22
import org.eclipse.ecf.filetransfer.events.*;
23
import org.eclipse.ecf.filetransfer.identity.FileCreateException;
24
import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
25
import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
26
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IStateful;
28
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
29
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
30
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI.AuthenticationInfo;
31
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
32
import org.eclipse.equinox.security.storage.*;
33
import org.eclipse.osgi.util.NLS;
34
import org.osgi.util.tracker.ServiceTracker;
35
15
36
/**
16
/**
37
 * A transport implementation that uses ECF file transfer API.
17
 * TODO: Remove this class it is not used.
18
 * @deprecated Please use {@link RepositoryTransport} instead.
38
 */
19
 */
39
public class ECFTransport {
20
public class ECFTransport {
40
	/**
21
	// TO BE REMOVED
41
	 * The number of password retry attempts allowed before failing.
42
	 */
43
	private static final int LOGIN_RETRIES = 3;
44
45
	private static final ProtocolException ERROR_401 = new ProtocolException();
46
47
	private static final String SERVER_REDIRECT = "Server redirected too many times"; //$NON-NLS-1$
48
49
	/**
50
	 * The singleton transport instance.
51
	 */
52
	private static ECFTransport instance;
53
54
	/**
55
	 * A job that waits on a barrier.
56
	 */
57
	static class WaitJob extends Job {
58
		private final Object[] barrier;
59
60
		/**
61
		 * Creates a wait job.
62
		 * @param location A location string that is used in the job name
63
		 * @param barrier The job will wait until the first entry in the barrier is non-null
64
		 */
65
		WaitJob(String location, Object[] barrier) {
66
			super(NLS.bind(Messages.repo_loading, location));
67
			this.barrier = barrier;
68
			setSystem(true);
69
		}
70
71
		/* (non-Javadoc)
72
		 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
73
		 */
74
		protected IStatus run(IProgressMonitor monitor) {
75
			synchronized (barrier) {
76
				while (barrier[0] == null) {
77
					try {
78
						barrier.wait();
79
					} catch (InterruptedException e) {
80
						//ignore
81
					}
82
				}
83
			}
84
			return Status.OK_STATUS;
85
		}
86
	}
87
88
	private final ServiceTracker retrievalFactoryTracker;
89
90
	/**
91
	 * Returns an initialized instance of ECFTransport
92
	 */
93
	public static synchronized ECFTransport getInstance() {
94
		if (instance == null) {
95
			instance = new ECFTransport();
96
		}
97
		return instance;
98
	}
99
100
	/**
101
	 * Private to avoid client instantiation.
102
	 */
103
	private ECFTransport() {
104
		retrievalFactoryTracker = new ServiceTracker(Activator.getBundleContext(), IRetrieveFileTransferFactory.class.getName(), null);
105
		retrievalFactoryTracker.open();
106
	}
107
108
	/**
109
	 * Gets the last modified date for the specified file.
110
	 * @param location - The URL location of the file.
111
	 * @return A <code>long</code> representing the date. Returns <code>0</code> if the file is not found or an error occurred.
112
	 * @exception OperationCanceledException if the request was canceled.
113
	 */
114
	public long getLastModified(URI location) throws ProvisionException {
115
		String locationString = location.toString();
116
		try {
117
			IConnectContext context = getConnectionContext(locationString, false);
118
			for (int i = 0; i < LOGIN_RETRIES; i++) {
119
				try {
120
					return doGetLastModified(locationString, context);
121
				} catch (ProtocolException e) {
122
					if (ERROR_401 == e)
123
						context = getConnectionContext(locationString, true);
124
				} catch (Exception e) {
125
					e.getMessage();
126
				}
127
			}
128
		} catch (UserCancelledException e) {
129
			throw new OperationCanceledException();
130
		}
131
		//too many retries, so report as failure
132
		throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.io_failedRead, locationString), null));
133
	}
134
135
	/**
136
	 * Perform the ECF call to get the last modified time, failing if there is any
137
	 * protocol failure such as an authentication failure.
138
	 */
139
	private long doGetLastModified(String location, IConnectContext context) throws ProtocolException {
140
		IContainer container;
141
		try {
142
			container = ContainerFactory.getDefault().createContainer();
143
		} catch (ContainerCreateException e) {
144
			return 0;
145
		}
146
		IRemoteFileSystemBrowserContainerAdapter adapter = (IRemoteFileSystemBrowserContainerAdapter) container.getAdapter(IRemoteFileSystemBrowserContainerAdapter.class);
147
		if (adapter == null) {
148
			return 0;
149
		}
150
		IRemoteFile remoteFile = checkFile(adapter, location, context);
151
		if (remoteFile == null) {
152
			return 0;
153
		}
154
		return remoteFile.getInfo().getLastModified();
155
	}
156
157
	/**
158
	 * Downloads the contents of the given URL to the given output stream. The
159
	 * destination stream will be closed by this method whether it succeeds
160
	 * to download or not.
161
	 */
162
	public IStatus download(String url, OutputStream destination, IProgressMonitor monitor) {
163
		try {
164
			IConnectContext context = getConnectionContext(url, false);
165
			for (int i = 0; i < LOGIN_RETRIES; i++) {
166
				try {
167
					return performDownload(url, destination, context, monitor);
168
				} catch (ProtocolException e) {
169
					if (e == ERROR_401)
170
						context = getConnectionContext(url, true);
171
				}
172
			}
173
		} catch (UserCancelledException e) {
174
			return Status.CANCEL_STATUS;
175
		} catch (ProvisionException e) {
176
			return e.getStatus();
177
		} finally {
178
			try {
179
				destination.close();
180
			} catch (IOException e) {
181
				//ignore secondary failure
182
			}
183
		}
184
		//reached maximum number of retries without success
185
		return new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.io_failedRead, url), null);
186
	}
187
188
	public IStatus performDownload(String toDownload, OutputStream target, IConnectContext context, IProgressMonitor monitor) throws ProtocolException {
189
		IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory) retrievalFactoryTracker.getService();
190
		if (factory == null)
191
			return statusOn(target, new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ecf_configuration_error, toDownload)));
192
193
		return transfer(factory.newInstance(), toDownload, target, context, monitor);
194
	}
195
196
	private IRemoteFile checkFile(final IRemoteFileSystemBrowserContainerAdapter retrievalContainer, final String location, IConnectContext context) throws ProtocolException {
197
		final Object[] result = new Object[2];
198
		final Object FAIL = new Object();
199
		IRemoteFileSystemListener listener = new IRemoteFileSystemListener() {
200
			public void handleRemoteFileEvent(IRemoteFileSystemEvent event) {
201
				Exception exception = event.getException();
202
				if (exception != null) {
203
					synchronized (result) {
204
						result[0] = FAIL;
205
						result[1] = exception;
206
						result.notify();
207
					}
208
				} else if (event instanceof IRemoteFileSystemBrowseEvent) {
209
					IRemoteFileSystemBrowseEvent fsbe = (IRemoteFileSystemBrowseEvent) event;
210
					IRemoteFile[] remoteFiles = fsbe.getRemoteFiles();
211
					if (remoteFiles != null && remoteFiles.length > 0 && remoteFiles[0] != null) {
212
						synchronized (result) {
213
							result[0] = remoteFiles[0];
214
							result.notify();
215
						}
216
					} else {
217
						synchronized (result) {
218
							result[0] = FAIL;
219
							result.notify();
220
						}
221
					}
222
				}
223
			}
224
		};
225
		try {
226
			retrievalContainer.setConnectContextForAuthentication(context);
227
			retrievalContainer.sendBrowseRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getBrowseNamespace(), location), listener);
228
		} catch (RemoteFileSystemException e) {
229
			return null;
230
		} catch (FileCreateException e) {
231
			return null;
232
		}
233
		waitFor(location, result);
234
		if (result[0] == FAIL && result[1] instanceof IOException) {
235
			IOException ioException = (IOException) result[1];
236
			//throw a special exception for authentication failure so we know to prompt for username/password
237
			String message = ioException.getMessage();
238
			if (message != null && (message.indexOf(" 401 ") != -1 || message.indexOf(SERVER_REDIRECT) != -1)) //$NON-NLS-1$
239
				throw ERROR_401;
240
		}
241
		if (result[0] instanceof IRemoteFile)
242
			return (IRemoteFile) result[0];
243
		return null;
244
	}
245
246
	/**
247
	 * Check if the given exception represents a permission failure (401 for HTTP),
248
	 * and throw a special marker exception if a permission failure was encountered.
249
	 */
250
	private void checkPermissionDenied(Throwable t) throws ProtocolException {
251
		if (!(t instanceof IncomingFileTransferException))
252
			return;
253
		IncomingFileTransferException e = (IncomingFileTransferException) t;
254
		if (e.getErrorCode() == 401)
255
			throw ERROR_401;
256
		//try to figure out if we have a 401 by parsing the exception message
257
		IStatus status = e.getStatus();
258
		Throwable exception = status.getException();
259
		if (exception instanceof IOException)
260
			if (exception.getMessage() != null && (exception.getMessage().indexOf(" 401 ") != -1 || exception.getMessage().indexOf(SERVER_REDIRECT) != -1)) //$NON-NLS-1$
261
				throw ERROR_401;
262
	}
263
264
	private IStatus transfer(final IRetrieveFileTransferContainerAdapter retrievalContainer, final String toDownload, final OutputStream target, IConnectContext context, final IProgressMonitor monitor) throws ProtocolException {
265
		final IStatus[] result = new IStatus[1];
266
		IFileTransferListener listener = new IFileTransferListener() {
267
			public void handleTransferEvent(IFileTransferEvent event) {
268
				if (event instanceof IFileTransferConnectStartEvent) {
269
					IFileTransferConnectStartEvent cse = (IFileTransferConnectStartEvent) event;
270
					FileTransferJob connectJob = cse.prepareConnectJob(null);
271
					cse.connectUsingJob(connectJob);
272
				} else if (event instanceof IIncomingFileTransferReceiveStartEvent) {
273
					IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
274
					try {
275
						if (target != null) {
276
							rse.receive(target);
277
						}
278
					} catch (IOException e) {
279
						IStatus status = convertToStatus(e);
280
						synchronized (result) {
281
							result[0] = status;
282
							result.notify();
283
						}
284
					}
285
				}
286
				if (event instanceof IIncomingFileTransferReceiveDataEvent) {
287
					IIncomingFileTransfer source = ((IIncomingFileTransferReceiveDataEvent) event).getSource();
288
					if (monitor != null) {
289
						if (monitor.isCanceled())
290
							source.cancel();
291
					}
292
				}
293
				if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
294
					Exception exception = ((IIncomingFileTransferReceiveDoneEvent) event).getException();
295
					IStatus status = convertToStatus(exception);
296
					synchronized (result) {
297
						result[0] = status;
298
						result.notify();
299
					}
300
				}
301
			}
302
		};
303
304
		try {
305
			retrievalContainer.setConnectContextForAuthentication(context);
306
			retrievalContainer.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getRetrieveNamespace(), toDownload), listener, null);
307
		} catch (IncomingFileTransferException e) {
308
			checkPermissionDenied(e);
309
			return statusOn(target, e.getStatus());
310
		} catch (FileCreateException e) {
311
			return statusOn(target, e.getStatus());
312
		}
313
		waitFor(toDownload, result);
314
		final Throwable exception = result[0].getException();
315
		checkPermissionDenied(exception);
316
		//if the transfer failed, return the underlying exception status, otherwise return top level DownloadStatus
317
		if (exception instanceof IncomingFileTransferException) {
318
			IStatus status = ((IncomingFileTransferException) exception).getStatus();
319
			if (!status.isOK())
320
				return statusOn(target, status);
321
		}
322
		return statusOn(target, result[0]);
323
	}
324
325
	/**
326
	 * Returns the connection context for the given URL. This may prompt the
327
	 * user for user name and password as required.
328
	 *
329
	 * @param xmlLocation - the file location requiring login details
330
	 * @param prompt - use <code>true</code> to prompt the user instead of
331
	 * looking at the secure preference store for login, use <code>false</code>
332
	 * to only try the secure preference store
333
	 * @throws UserCancelledException when the user cancels the login prompt
334
	 * @throws ProvisionException if the password cannot be read or saved
335
	 * @return The connection context
336
	 */
337
	public IConnectContext getConnectionContext(String xmlLocation, boolean prompt) throws UserCancelledException, ProvisionException {
338
		ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
339
		IPath hostLocation = new Path(xmlLocation).removeLastSegments(1);
340
		String nodeKey;
341
		try {
342
			nodeKey = URLEncoder.encode(hostLocation.toString(), "UTF-8"); //$NON-NLS-1$
343
		} catch (UnsupportedEncodingException e2) {
344
			//fall back to default platform encoding
345
			nodeKey = URLEncoder.encode(hostLocation.toString());
346
		}
347
		String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
348
		ISecurePreferences prefNode = null;
349
		if (securePreferences.nodeExists(nodeName))
350
			prefNode = securePreferences.node(nodeName);
351
		if (!prompt) {
352
			if (prefNode == null)
353
				return null;
354
			try {
355
				String username = prefNode.get(IRepository.PROP_USERNAME, null);
356
				String password = prefNode.get(IRepository.PROP_PASSWORD, null);
357
				//if we don't have stored connection data just return a null connection context
358
				if (username == null || password == null)
359
					return null;
360
				return ConnectContextFactory.createUsernamePasswordConnectContext(username, password);
361
			} catch (StorageException e) {
362
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
363
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
364
			}
365
		}
366
		//need to prompt user for user name and password
367
		ServiceTracker adminUITracker = new ServiceTracker(Activator.getBundleContext(), IServiceUI.class.getName(), null);
368
		adminUITracker.open();
369
		IServiceUI adminUIService = (IServiceUI) adminUITracker.getService();
370
		AuthenticationInfo loginDetails = null;
371
		if (adminUIService != null)
372
			loginDetails = adminUIService.getUsernamePassword(hostLocation.toString());
373
		//null result means user canceled password dialog
374
		if (loginDetails == null)
375
			throw new UserCancelledException();
376
		//save user name and password if requested by user
377
		if (loginDetails.saveResult()) {
378
			if (prefNode == null)
379
				prefNode = securePreferences.node(nodeName);
380
			try {
381
				prefNode.put(IRepository.PROP_USERNAME, loginDetails.getUserName(), true);
382
				prefNode.put(IRepository.PROP_PASSWORD, loginDetails.getPassword(), true);
383
				prefNode.flush();
384
			} catch (StorageException e1) {
385
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
386
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
387
			} catch (IOException e) {
388
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
389
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
390
			}
391
		}
392
		return ConnectContextFactory.createUsernamePasswordConnectContext(loginDetails.getUserName(), loginDetails.getPassword());
393
	}
394
395
	protected IStatus convertToStatus(Exception e) {
396
		if (e == null)
397
			return Status.OK_STATUS;
398
		if (e instanceof UserCancelledException)
399
			return new Status(IStatus.CANCEL, Activator.ID, e.getMessage(), e);
400
		return new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e);
401
	}
402
403
	private static IStatus statusOn(OutputStream target, IStatus status) {
404
		if (target instanceof IStateful)
405
			((IStateful) target).setStatus(status);
406
		return status;
407
	}
408
409
	/**
410
	 * Waits until the first entry in the given array is non-null.
411
	 */
412
	private void waitFor(String location, Object[] barrier) {
413
		WaitJob wait = new WaitJob(location, barrier);
414
		wait.schedule();
415
		while (barrier[0] == null) {
416
			boolean logged = false;
417
			try {
418
				wait.join();
419
			} catch (InterruptedException e) {
420
				if (!logged)
421
					LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Unexpected interrupt while waiting on ECF transfer", e)); //$NON-NLS-1$
422
			}
423
		}
424
	}
425
}
22
}
(-)src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.updatesite.artifact;
12
package org.eclipse.equinox.internal.p2.updatesite.artifact;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.*;
17
import java.util.*;
16
import org.eclipse.core.runtime.IProgressMonitor;
18
import org.eclipse.core.runtime.IProgressMonitor;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepositoryFactory;
20
import org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepositoryFactory;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
24
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
24
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
25
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
(-)META-INF/MANIFEST.MF (-2 / +4 lines)
Lines 12-28 Link Here
12
 org.eclipse.equinox.app;version="1.0.0";resolution:=optional,
12
 org.eclipse.equinox.app;version="1.0.0";resolution:=optional,
13
 org.eclipse.equinox.internal.p2.core.helpers,
13
 org.eclipse.equinox.internal.p2.core.helpers,
14
 org.eclipse.equinox.internal.p2.publisher.eclipse,
14
 org.eclipse.equinox.internal.p2.publisher.eclipse,
15
 org.eclipse.equinox.internal.p2.repository,
16
 org.eclipse.equinox.internal.p2.repository.helpers,
15
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
17
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
16
 org.eclipse.equinox.internal.provisional.p2.core,
18
 org.eclipse.equinox.internal.provisional.p2.core,
17
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
19
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
18
 org.eclipse.equinox.internal.provisional.p2.core.repository,
19
 org.eclipse.equinox.internal.provisional.p2.metadata,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
20
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
21
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
21
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
22
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
22
 org.eclipse.equinox.internal.provisional.p2.query,
23
 org.eclipse.equinox.internal.provisional.p2.query,
24
 org.eclipse.equinox.internal.provisional.p2.repository,
23
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
25
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
24
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
25
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
27
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
26
 org.eclipse.equinox.p2.publisher,
28
 org.eclipse.equinox.p2.publisher,
27
 org.eclipse.equinox.p2.publisher.actions,
29
 org.eclipse.equinox.p2.publisher.actions,
28
 org.eclipse.equinox.p2.publisher.eclipse,
30
 org.eclipse.equinox.p2.publisher.eclipse,
(-)src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java (-1 / +13 lines)
Lines 13-29 Link Here
13
package org.eclipse.equinox.internal.p2.updatesite.metadata;
13
package org.eclipse.equinox.internal.p2.updatesite.metadata;
14
14
15
import java.io.File;
15
import java.io.File;
16
import java.io.FileNotFoundException;
16
import java.net.URI;
17
import java.net.URI;
17
import java.util.Map;
18
import java.util.Map;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.core.runtime.*;
20
import org.eclipse.ecf.filetransfer.UserCancelledException;
19
import org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository;
21
import org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository;
22
import org.eclipse.equinox.internal.p2.repository.AuthenticationFailedException;
20
import org.eclipse.equinox.internal.p2.updatesite.*;
23
import org.eclipse.equinox.internal.p2.updatesite.*;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
27
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
25
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
28
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
26
import org.eclipse.equinox.p2.publisher.*;
29
import org.eclipse.equinox.p2.publisher.*;
30
import org.eclipse.osgi.util.NLS;
27
31
28
public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFactory {
32
public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFactory {
29
	private static final String PROP_SITE_CHECKSUM = "site.checksum"; //$NON-NLS-1$
33
	private static final String PROP_SITE_CHECKSUM = "site.checksum"; //$NON-NLS-1$
Lines 47-52 Link Here
47
			UpdateSite.validate(location, monitor);
51
			UpdateSite.validate(location, monitor);
48
		} catch (ProvisionException e) {
52
		} catch (ProvisionException e) {
49
			return e.getStatus();
53
			return e.getStatus();
54
		} catch (UserCancelledException e) {
55
			return Status.CANCEL_STATUS;
56
		} catch (AuthenticationFailedException e) {
57
			return new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.getString("UpdateSiteMetadataRepositoryFactory.AuthenticationFailedFor_0"), location.toString()), e); //$NON-NLS-1$
58
		} catch (FileNotFoundException e) {
59
			return new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.getString("UpdateSiteMetadataRepositoryFactory.RepositoryNotFound_0"), location.toString()), e); //$NON-NLS-1$
60
		} catch (CoreException e) {
61
			return e.getStatus();
50
		}
62
		}
51
		return Status.OK_STATUS;
63
		return Status.OK_STATUS;
52
	}
64
	}
(-)src/org/eclipse/equinox/internal/p2/updatesite/metadata/messages.properties (+2 lines)
Added Link Here
1
UpdateSiteMetadataRepositoryFactory.AuthenticationFailedFor_0=Authentication failed {0}
2
UpdateSiteMetadataRepositoryFactory.RepositoryNotFound_0=Repository not found {0}
(-)src/org/eclipse/equinox/internal/p2/updatesite/metadata/Messages.java (+21 lines)
Added Link Here
1
package org.eclipse.equinox.internal.p2.updatesite.metadata;
2
3
import java.util.MissingResourceException;
4
import java.util.ResourceBundle;
5
6
public class Messages {
7
	private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.updatesite.metadata.messages"; //$NON-NLS-1$
8
9
	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
10
11
	private Messages() {
12
	}
13
14
	public static String getString(String key) {
15
		try {
16
			return RESOURCE_BUNDLE.getString(key);
17
		} catch (MissingResourceException e) {
18
			return '!' + key + '!';
19
		}
20
	}
21
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 9-15 Link Here
9
 org.eclipse.equinox.internal.provisional.p2.core,
9
 org.eclipse.equinox.internal.provisional.p2.core,
10
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
10
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
11
 org.eclipse.equinox.internal.provisional.p2.core.location,
11
 org.eclipse.equinox.internal.provisional.p2.core.location,
12
 org.eclipse.equinox.internal.provisional.p2.core.repository,
12
 org.eclipse.equinox.internal.provisional.p2.repository,
13
 org.eclipse.equinox.internal.provisional.p2.engine,
13
 org.eclipse.equinox.internal.provisional.p2.engine,
14
 org.eclipse.equinox.internal.provisional.p2.metadata,
14
 org.eclipse.equinox.internal.provisional.p2.metadata,
15
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
15
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
(-)src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java (-1 / +1 lines)
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.p2.resolution.ResolutionHelper;
17
import org.eclipse.equinox.internal.p2.resolution.ResolutionHelper;
18
import org.eclipse.equinox.internal.p2.rollback.FormerState;
18
import org.eclipse.equinox.internal.p2.rollback.FormerState;
19
import org.eclipse.equinox.internal.provisional.p2.core.*;
19
import org.eclipse.equinox.internal.provisional.p2.core.*;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.director.*;
20
import org.eclipse.equinox.internal.provisional.p2.director.*;
22
import org.eclipse.equinox.internal.provisional.p2.engine.*;
21
import org.eclipse.equinox.internal.provisional.p2.engine.*;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
Lines 27-32 Link Here
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
29
import org.eclipse.equinox.internal.provisional.p2.query.*;
28
import org.eclipse.equinox.internal.provisional.p2.query.*;
29
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
30
30
31
public class SimplePlanner implements IPlanner {
31
public class SimplePlanner implements IPlanner {
32
	private static boolean DEBUG = Tracing.DEBUG_PLANNER_OPERANDS;
32
	private static boolean DEBUG = Tracing.DEBUG_PLANNER_OPERANDS;
(-)META-INF/MANIFEST.MF (+1 lines)
Lines 18-23 Link Here
18
 org.eclipse.equinox.internal.provisional.frameworkadmin,
18
 org.eclipse.equinox.internal.provisional.frameworkadmin,
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
21
 org.eclipse.equinox.internal.provisional.p2.repository,
21
 org.eclipse.equinox.internal.provisional.p2.metadata,
22
 org.eclipse.equinox.internal.provisional.p2.metadata,
22
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
23
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
23
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
24
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
(-)src/org/eclipse/equinox/internal/p2/metadata/generator/EclipseGeneratorApplication.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.generator;
11
package org.eclipse.equinox.internal.p2.metadata.generator;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.URI;
16
import java.net.URI;
15
import java.net.URISyntaxException;
17
import java.net.URISyntaxException;
Lines 27-33 Link Here
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
29
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
30
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
29
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
31
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
30
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.generator.EclipseInstallGeneratorInfoProvider;
32
import org.eclipse.equinox.internal.provisional.p2.metadata.generator.EclipseInstallGeneratorInfoProvider;
32
import org.eclipse.equinox.internal.provisional.p2.metadata.generator.Generator;
33
import org.eclipse.equinox.internal.provisional.p2.metadata.generator.Generator;
33
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
34
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java (-1 / +1 lines)
Lines 25-31 Link Here
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
26
import org.eclipse.equinox.internal.provisional.p2.core.*;
26
import org.eclipse.equinox.internal.provisional.p2.core.*;
27
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
27
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
28
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription;
Lines 33-38 Link Here
33
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
32
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
34
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
33
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
35
import org.eclipse.equinox.internal.provisional.p2.query.Query;
34
import org.eclipse.equinox.internal.provisional.p2.query.Query;
35
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
36
import org.eclipse.osgi.service.environment.Constants;
36
import org.eclipse.osgi.service.environment.Constants;
37
import org.eclipse.osgi.service.resolver.*;
37
import org.eclipse.osgi.service.resolver.*;
38
import org.eclipse.osgi.util.NLS;
38
import org.eclipse.osgi.util.NLS;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 24-30 Link Here
24
 org.eclipse.equinox.internal.provisional.frameworkadmin,
24
 org.eclipse.equinox.internal.provisional.frameworkadmin,
25
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
25
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
26
 org.eclipse.equinox.internal.provisional.p2.core,
26
 org.eclipse.equinox.internal.provisional.p2.core,
27
 org.eclipse.equinox.internal.provisional.p2.core.repository,
27
 org.eclipse.equinox.internal.provisional.p2.repository,
28
 org.eclipse.equinox.internal.provisional.p2.director,
28
 org.eclipse.equinox.internal.provisional.p2.director,
29
 org.eclipse.equinox.internal.provisional.p2.engine,
29
 org.eclipse.equinox.internal.provisional.p2.engine,
30
 org.eclipse.equinox.internal.provisional.p2.metadata,
30
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)META-INF/MANIFEST.MF (+1 lines)
Lines 24-29 Link Here
24
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
24
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
25
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
25
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
26
 org.eclipse.equinox.internal.provisional.p2.metadata,
26
 org.eclipse.equinox.internal.provisional.p2.metadata,
27
 org.eclipse.equinox.internal.provisional.p2.repository,
27
 org.osgi.framework;version="1.4.0"
28
 org.osgi.framework;version="1.4.0"
28
Bundle-ActivationPolicy: lazy
29
Bundle-ActivationPolicy: lazy
29
Bundle-Activator: org.eclipse.equinox.p2.tests.optimizers.TestActivator
30
Bundle-Activator: org.eclipse.equinox.p2.tests.optimizers.TestActivator
(-)src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
11
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.io.File;
15
import java.io.File;
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.*;
17
import java.util.*;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.p2.update.Site;
20
import org.eclipse.equinox.internal.p2.update.Site;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 11-17 Link Here
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
12
 org.eclipse.equinox.internal.provisional.p2.core,
12
 org.eclipse.equinox.internal.provisional.p2.core,
13
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
13
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
14
 org.eclipse.equinox.internal.provisional.p2.core.repository,
14
 org.eclipse.equinox.internal.provisional.p2.repository,
15
 org.eclipse.equinox.internal.provisional.p2.metadata,
15
 org.eclipse.equinox.internal.provisional.p2.metadata,
16
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
16
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
17
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
17
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 12-18 Link Here
12
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
12
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
13
 org.eclipse.equinox.internal.provisional.p2.core,
13
 org.eclipse.equinox.internal.provisional.p2.core,
14
 org.eclipse.equinox.internal.provisional.p2.core.location,
14
 org.eclipse.equinox.internal.provisional.p2.core.location,
15
 org.eclipse.equinox.internal.provisional.p2.core.repository,
15
 org.eclipse.equinox.internal.provisional.p2.repository,
16
 org.eclipse.equinox.internal.provisional.p2.director,
16
 org.eclipse.equinox.internal.provisional.p2.director,
17
 org.eclipse.equinox.internal.provisional.p2.engine,
17
 org.eclipse.equinox.internal.provisional.p2.engine,
18
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
18
 org.eclipse.equinox.internal.provisional.p2.engine.phases,
(-)src/org/eclipse/equinox/internal/p2/ui/admin/ProvAdminUIActivator.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.admin;
11
package org.eclipse.equinox.internal.p2.ui.admin;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import org.eclipse.equinox.internal.p2.ui.admin.dialogs.AddProfileDialog;
15
import org.eclipse.equinox.internal.p2.ui.admin.dialogs.AddProfileDialog;
14
import org.eclipse.equinox.internal.p2.ui.admin.preferences.PreferenceConstants;
16
import org.eclipse.equinox.internal.p2.ui.admin.preferences.PreferenceConstants;
15
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
17
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
17
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
18
import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
18
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
19
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
(-)src/org/eclipse/equinox/internal/p2/ui/admin/AddMetadataRepositoryOperation.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.admin;
11
package org.eclipse.equinox.internal.p2.ui.admin;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
17
import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddRepositoryOperation;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddRepositoryOperation;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
20
(-)src/org/eclipse/equinox/internal/p2/ui/admin/AddArtifactRepositoryOperation.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.admin;
11
package org.eclipse.equinox.internal.p2.ui.admin;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.net.URI;
15
import java.net.URI;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
17
import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddRepositoryOperation;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddRepositoryOperation;
18
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
19
20
(-)src/org/eclipse/equinox/internal/p2/ui/admin/MetadataRepositoriesView.java (-1 / +2 lines)
Lines 11-22 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.ui.admin;
12
package org.eclipse.equinox.internal.p2.ui.admin;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
14
import java.net.URI;
16
import java.net.URI;
15
import java.util.ArrayList;
17
import java.util.ArrayList;
16
import java.util.List;
18
import java.util.List;
17
import org.eclipse.equinox.internal.p2.ui.admin.dialogs.AddMetadataRepositoryDialog;
19
import org.eclipse.equinox.internal.p2.ui.admin.dialogs.AddMetadataRepositoryDialog;
18
import org.eclipse.equinox.internal.p2.ui.admin.preferences.PreferenceConstants;
20
import org.eclipse.equinox.internal.p2.ui.admin.preferences.PreferenceConstants;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
21
import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
21
import org.eclipse.equinox.internal.provisional.p2.ui.actions.InstallAction;
22
import org.eclipse.equinox.internal.provisional.p2.ui.actions.InstallAction;
22
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
23
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
(-)src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/RepositoryImplementationPropertyPage.java (-1 / +2 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.ui.admin.dialogs;
11
package org.eclipse.equinox.internal.p2.ui.admin.dialogs;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
14
13
import java.util.Map;
15
import java.util.Map;
14
import org.eclipse.equinox.internal.p2.ui.admin.ProvAdminUIMessages;
16
import org.eclipse.equinox.internal.p2.ui.admin.ProvAdminUIMessages;
15
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
16
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
17
import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
17
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
18
import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.SWT;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 14-20 Link Here
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
15
 org.eclipse.equinox.internal.provisional.p2.core,
15
 org.eclipse.equinox.internal.provisional.p2.core,
16
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
16
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
17
 org.eclipse.equinox.internal.provisional.p2.core.repository,
17
 org.eclipse.equinox.internal.provisional.p2.repository,
18
 org.eclipse.equinox.internal.provisional.p2.director,
18
 org.eclipse.equinox.internal.provisional.p2.director,
19
 org.eclipse.equinox.internal.provisional.p2.engine,
19
 org.eclipse.equinox.internal.provisional.p2.engine,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)plugin.xml (-1 / +1 lines)
Lines 92-98 Link Here
92
            class="org.eclipse.equinox.internal.p2.ui.admin.dialogs.RepositoryImplementationPropertyPage"
92
            class="org.eclipse.equinox.internal.p2.ui.admin.dialogs.RepositoryImplementationPropertyPage"
93
            id="org.eclipse.equinox.internal.p2.ui.admin.dialogs.RepositoryImplementationPropertyPage">
93
            id="org.eclipse.equinox.internal.p2.ui.admin.dialogs.RepositoryImplementationPropertyPage">
94
            <enabledWhen>
94
            <enabledWhen>
95
             <adapt type="org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository"/>
95
             <adapt type="org.eclipse.equinox.internal.provisional.p2.repository.IRepository"/>
96
           </enabledWhen>
96
           </enabledWhen>
97
      </page>
97
      </page>
98
      
98
      
(-)src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.console;
11
package org.eclipse.equinox.internal.p2.console;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.*;
16
import java.util.*;
15
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.director.*;
23
import org.eclipse.equinox.internal.provisional.p2.director.*;
23
import org.eclipse.equinox.internal.provisional.p2.engine.*;
24
import org.eclipse.equinox.internal.provisional.p2.engine.*;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 13-19 Link Here
13
 org.eclipse.equinox.internal.provisional.configurator,
13
 org.eclipse.equinox.internal.provisional.configurator,
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
15
 org.eclipse.equinox.internal.provisional.p2.core,
15
 org.eclipse.equinox.internal.provisional.p2.core,
16
 org.eclipse.equinox.internal.provisional.p2.core.repository,
16
 org.eclipse.equinox.internal.provisional.p2.repository,
17
 org.eclipse.equinox.internal.provisional.p2.director,
17
 org.eclipse.equinox.internal.provisional.p2.director,
18
 org.eclipse.equinox.internal.provisional.p2.engine,
18
 org.eclipse.equinox.internal.provisional.p2.engine,
19
 org.eclipse.equinox.internal.provisional.p2.metadata,
19
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 10-16 Link Here
10
 org.eclipse.equinox.internal.p2.ui.query,
10
 org.eclipse.equinox.internal.p2.ui.query,
11
 org.eclipse.equinox.internal.provisional.p2.core,
11
 org.eclipse.equinox.internal.provisional.p2.core,
12
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
12
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
13
 org.eclipse.equinox.internal.provisional.p2.core.repository,
13
 org.eclipse.equinox.internal.provisional.p2.repository,
14
 org.eclipse.equinox.internal.provisional.p2.director,
14
 org.eclipse.equinox.internal.provisional.p2.director,
15
 org.eclipse.equinox.internal.provisional.p2.engine,
15
 org.eclipse.equinox.internal.provisional.p2.engine,
16
 org.eclipse.equinox.internal.provisional.p2.metadata,
16
 org.eclipse.equinox.internal.provisional.p2.metadata,
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 18-24 Link Here
18
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
18
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
19
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
20
 org.eclipse.equinox.internal.provisional.p2.core,
20
 org.eclipse.equinox.internal.provisional.p2.core,
21
 org.eclipse.equinox.internal.provisional.p2.core.repository,
21
 org.eclipse.equinox.internal.provisional.p2.repository,
22
 org.eclipse.equinox.internal.provisional.p2.metadata,
22
 org.eclipse.equinox.internal.provisional.p2.metadata,
23
 org.eclipse.equinox.internal.p2.sar,
23
 org.eclipse.equinox.internal.p2.sar,
24
 org.eclipse.internal.provisional.equinox.p2.jarprocessor
24
 org.eclipse.internal.provisional.equinox.p2.jarprocessor
(-)src/org/eclipse/equinox/internal/p2/artifact/processors/AbstractDeltaProcessorStep.java (-1 / +1 lines)
Lines 11-17 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.artifact.processors;
12
package org.eclipse.equinox.internal.p2.artifact.processors;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
15
15
16
import java.net.URI;
16
import java.net.URI;
17
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.IStatus;
(-)src/org/eclipse/equinox/internal/p2/touchpoint/natives/Util.java (-1 / +2 lines)
Lines 1-5 Link Here
1
package org.eclipse.equinox.internal.p2.touchpoint.natives;
1
package org.eclipse.equinox.internal.p2.touchpoint.natives;
2
2
3
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
4
3
import java.net.URI;
5
import java.net.URI;
4
import java.util.HashMap;
6
import java.util.HashMap;
5
import java.util.Map;
7
import java.util.Map;
Lines 10-16 Link Here
10
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
12
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
11
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
13
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
12
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
14
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
13
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
14
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
15
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
15
import org.eclipse.osgi.util.NLS;
16
import org.eclipse.osgi.util.NLS;
16
17
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 11-17 Link Here
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
11
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
12
 org.eclipse.equinox.internal.provisional.p2.core,
12
 org.eclipse.equinox.internal.provisional.p2.core,
13
 org.eclipse.equinox.internal.provisional.p2.core.location,
13
 org.eclipse.equinox.internal.provisional.p2.core.location,
14
 org.eclipse.equinox.internal.provisional.p2.core.repository,
14
 org.eclipse.equinox.internal.provisional.p2.repository,
15
 org.eclipse.equinox.internal.provisional.p2.engine,
15
 org.eclipse.equinox.internal.provisional.p2.engine,
16
 org.eclipse.equinox.internal.provisional.p2.metadata,
16
 org.eclipse.equinox.internal.provisional.p2.metadata,
17
 org.eclipse.osgi.service.datalocation;version="1.0.0",
17
 org.eclipse.osgi.service.datalocation;version="1.0.0",
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 16-30 Link Here
16
 org.eclipse.equinox.internal.p2.engine,
16
 org.eclipse.equinox.internal.p2.engine,
17
 org.eclipse.equinox.internal.p2.metadata,
17
 org.eclipse.equinox.internal.p2.metadata,
18
 org.eclipse.equinox.internal.p2.metadata.repository,
18
 org.eclipse.equinox.internal.p2.metadata.repository,
19
 org.eclipse.equinox.internal.p2.repository.helpers,
19
 org.eclipse.equinox.internal.p2.updatechecker,
20
 org.eclipse.equinox.internal.p2.updatechecker,
20
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
21
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
21
 org.eclipse.equinox.internal.provisional.p2.core,
22
 org.eclipse.equinox.internal.provisional.p2.core,
22
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
23
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
23
 org.eclipse.equinox.internal.provisional.p2.core.repository,
24
 org.eclipse.equinox.internal.provisional.p2.metadata,
24
 org.eclipse.equinox.internal.provisional.p2.metadata,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
25
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
27
 org.eclipse.equinox.internal.provisional.p2.query,
27
 org.eclipse.equinox.internal.provisional.p2.query,
28
 org.eclipse.equinox.internal.provisional.p2.repository,
28
 org.eclipse.equinox.internal.provisional.p2.updatechecker,
29
 org.eclipse.equinox.internal.provisional.p2.updatechecker,
29
 org.eclipse.osgi.service.resolver,
30
 org.eclipse.osgi.service.resolver,
30
 org.osgi.framework;version="1.4.0",
31
 org.osgi.framework;version="1.4.0",
(-)src/org/eclipse/equinox/internal/p2/tools/mirror/RepositoryMirroring.java (-1 / +2 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.tools.mirror;
12
package org.eclipse.equinox.internal.p2.tools.mirror;
13
13
14
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
15
14
import java.io.IOException;
16
import java.io.IOException;
15
import java.io.OutputStream;
17
import java.io.OutputStream;
16
import java.net.URI;
18
import java.net.URI;
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
26
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
28
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
31
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
(-)META-INF/MANIFEST.MF (+2 lines)
Lines 6-15 Link Here
6
Bundle-Localization: plugin
6
Bundle-Localization: plugin
7
Bundle-Version: 1.0.0.qualifier
7
Bundle-Version: 1.0.0.qualifier
8
Import-Package: org.eclipse.equinox.internal.p2.core,
8
Import-Package: org.eclipse.equinox.internal.p2.core,
9
 org.eclipse.equinox.internal.p2.core.helpers,
9
 org.eclipse.equinox.internal.p2.director,
10
 org.eclipse.equinox.internal.p2.director,
10
 org.eclipse.equinox.internal.p2.engine,
11
 org.eclipse.equinox.internal.p2.engine,
11
 org.eclipse.equinox.internal.p2.garbagecollector,
12
 org.eclipse.equinox.internal.p2.garbagecollector,
12
 org.eclipse.equinox.internal.p2.metadata.repository,
13
 org.eclipse.equinox.internal.p2.metadata.repository,
14
 org.eclipse.equinox.internal.p2.repository.helpers,
13
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
15
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
14
 org.eclipse.equinox.internal.provisional.p2.core.location,
16
 org.eclipse.equinox.internal.provisional.p2.core.location,
15
 org.eclipse.equinox.internal.provisional.p2.director,
17
 org.eclipse.equinox.internal.provisional.p2.director,
(-)META-INF/MANIFEST.MF (-2 / +3 lines)
Lines 10-22 Link Here
10
 org.eclipse.equinox.app;version="1.0.0",
10
 org.eclipse.equinox.app;version="1.0.0",
11
 org.eclipse.equinox.internal.p2.core.helpers,
11
 org.eclipse.equinox.internal.p2.core.helpers,
12
 org.eclipse.equinox.internal.p2.metadata,
12
 org.eclipse.equinox.internal.p2.metadata,
13
 org.eclipse.equinox.internal.p2.repository.helpers,
14
 org.eclipse.equinox.internal.p2.sar,
13
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
15
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
16
 org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
15
 org.eclipse.equinox.internal.provisional.p2.core,
17
 org.eclipse.equinox.internal.provisional.p2.core,
16
 org.eclipse.equinox.internal.provisional.p2.core.repository,
17
 org.eclipse.equinox.internal.provisional.p2.metadata,
18
 org.eclipse.equinox.internal.provisional.p2.metadata,
18
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
19
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
19
 org.eclipse.equinox.internal.p2.sar,
20
 org.eclipse.equinox.internal.provisional.p2.repository,
20
 org.eclipse.internal.provisional.equinox.p2.jarprocessor,
21
 org.eclipse.internal.provisional.equinox.p2.jarprocessor,
21
 org.eclipse.osgi.util;version="1.1.0",
22
 org.eclipse.osgi.util;version="1.1.0",
22
 org.osgi.framework;version="1.3.0"
23
 org.osgi.framework;version="1.3.0"
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java (-1 / +1 lines)
Lines 23-29 Link Here
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
26
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
27
27
28
/**
28
/**
29
 * Ant task for creating a new composite artifact repository.
29
 * Ant task for creating a new composite artifact repository.
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/ECFTransport.java (-319 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *		compeople AG (Stefan Liebig) - various ongoing maintenance
11
 *******************************************************************************/
12
package org.eclipse.equinox.internal.p2.artifact.repository;
13
14
import java.io.*;
15
import java.net.ProtocolException;
16
import java.net.URLEncoder;
17
import org.eclipse.core.runtime.*;
18
import org.eclipse.ecf.core.security.ConnectContextFactory;
19
import org.eclipse.ecf.core.security.IConnectContext;
20
import org.eclipse.ecf.filetransfer.*;
21
import org.eclipse.ecf.filetransfer.events.*;
22
import org.eclipse.ecf.filetransfer.identity.FileCreateException;
23
import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
24
import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
25
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
26
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IStateful;
28
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
29
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
30
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI.AuthenticationInfo;
31
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
32
import org.eclipse.equinox.security.storage.*;
33
import org.eclipse.osgi.util.NLS;
34
import org.osgi.framework.Bundle;
35
import org.osgi.framework.BundleException;
36
import org.osgi.service.packageadmin.PackageAdmin;
37
import org.osgi.util.tracker.ServiceTracker;
38
39
/**
40
 * A transport implementation that uses ECF file transfer API.
41
 */
42
public class ECFTransport extends Transport {
43
	/**
44
	 * The number of password retry attempts allowed before failing.
45
	 */
46
	private static final int LOGIN_RETRIES = 3;
47
48
	private static final ProtocolException ERROR_401 = new ProtocolException();
49
50
	private static final String SERVER_REDIRECT = "Server redirected too many times"; //$NON-NLS-1$
51
52
	/**
53
	 * The singleton transport instance.
54
	 */
55
	private static ECFTransport instance;
56
57
	private final ServiceTracker retrievalFactoryTracker;
58
59
	/**
60
	 * Returns an initialized instance of ECFTransport
61
	 */
62
	public static synchronized ECFTransport getInstance() {
63
		if (instance == null) {
64
			instance = new ECFTransport();
65
		}
66
		return instance;
67
	}
68
69
	/**
70
	 * Private to avoid client instantiation.
71
	 */
72
	private ECFTransport() {
73
		retrievalFactoryTracker = new ServiceTracker(Activator.getContext(), IRetrieveFileTransferFactory.class.getName(), null);
74
		retrievalFactoryTracker.open();
75
		startBundle("org.eclipse.ecf.provider.filetransfer"); //$NON-NLS-1$
76
	}
77
78
	private boolean startBundle(String bundleId) {
79
		PackageAdmin packageAdmin = (PackageAdmin) ServiceHelper.getService(Activator.getContext(), PackageAdmin.class.getName());
80
		if (packageAdmin == null)
81
			return false;
82
83
		Bundle[] bundles = packageAdmin.getBundles(bundleId, null);
84
		if (bundles != null && bundles.length > 0) {
85
			for (int i = 0; i < bundles.length; i++) {
86
				try {
87
					if ((bundles[0].getState() & Bundle.INSTALLED) == 0) {
88
						bundles[0].start();
89
						return true;
90
					}
91
				} catch (BundleException e) {
92
					// failed, try next bundle
93
				}
94
			}
95
		}
96
		return false;
97
	}
98
99
	/**
100
	 * Check if the given exception represents a permission failure (401 for HTTP),
101
	 * and throw a special marker exception if a permission failure was encountered.
102
	 */
103
	private void checkPermissionDenied(Throwable t) throws ProtocolException {
104
		if (!(t instanceof IncomingFileTransferException))
105
			return;
106
		IncomingFileTransferException e = (IncomingFileTransferException) t;
107
		if (e.getErrorCode() == 401)
108
			throw ERROR_401;
109
		//try to figure out if we have a 401 by parsing the exception message
110
		IStatus status = e.getStatus();
111
		Throwable exception = status.getException();
112
		if (exception instanceof IOException)
113
			if (exception.getMessage() != null && (exception.getMessage().indexOf(" 401 ") != -1 || exception.getMessage().indexOf(SERVER_REDIRECT) != -1)) //$NON-NLS-1$
114
				throw ERROR_401;
115
	}
116
117
	protected IStatus convertToStatus(IFileTransferEvent event, Exception failure, long startTime, String location) {
118
		long speed = DownloadStatus.UNKNOWN_RATE;
119
		if (event instanceof IIncomingFileTransferEvent) {
120
			long bytes = ((IIncomingFileTransferEvent) event).getSource().getBytesReceived();
121
			if (bytes > 0) {
122
				long elapsed = (System.currentTimeMillis() - startTime) / 1000;//in seconds
123
				if (elapsed == 0)
124
					elapsed = 1;
125
				speed = bytes / elapsed;
126
			}
127
		}
128
		DownloadStatus result = null;
129
		if (failure == null)
130
			result = new DownloadStatus(IStatus.OK, Activator.ID, Status.OK_STATUS.getMessage());
131
		else if (failure instanceof UserCancelledException)
132
			result = new DownloadStatus(IStatus.CANCEL, Activator.ID, failure.getMessage(), failure);
133
		else
134
			result = new DownloadStatus(IStatus.ERROR, Activator.ID, NLS.bind(Messages.io_failedRead, location), failure);
135
		result.setTransferRate(speed);
136
		return result;
137
	}
138
139
	public IStatus download(String url, OutputStream destination, IProgressMonitor monitor) {
140
		try {
141
			IConnectContext context = getConnectionContext(url, false);
142
			for (int i = 0; i < LOGIN_RETRIES; i++) {
143
				try {
144
					return performDownload(url, destination, context, monitor);
145
				} catch (ProtocolException e) {
146
					if (e == ERROR_401)
147
						context = getConnectionContext(url, true);
148
				}
149
			}
150
		} catch (UserCancelledException e) {
151
			return Status.CANCEL_STATUS;
152
		} catch (ProvisionException e) {
153
			return e.getStatus();
154
		}
155
		//reached maximum number of retries without success
156
		return new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_AUTHENTICATION, NLS.bind(Messages.io_failedRead, url), null);
157
	}
158
159
	public IStatus performDownload(String toDownload, OutputStream target, IConnectContext context, IProgressMonitor monitor) throws ProtocolException {
160
		IRetrieveFileTransferFactory factory = (IRetrieveFileTransferFactory) retrievalFactoryTracker.getService();
161
		if (factory == null)
162
			return statusOn(target, new Status(IStatus.ERROR, Activator.ID, Messages.ecf_configuration_error));
163
164
		return transfer(factory.newInstance(), toDownload, target, context, monitor);
165
	}
166
167
	private IStatus transfer(final IRetrieveFileTransferContainerAdapter retrievalContainer, final String toDownload, final OutputStream target, IConnectContext context, final IProgressMonitor monitor) throws ProtocolException {
168
		final IStatus[] result = new IStatus[1];
169
		final long startTime = System.currentTimeMillis();
170
		IFileTransferListener listener = new IFileTransferListener() {
171
			public void handleTransferEvent(IFileTransferEvent event) {
172
				if (event instanceof IFileTransferConnectStartEvent) {
173
					IFileTransferConnectStartEvent cse = (IFileTransferConnectStartEvent) event;
174
					FileTransferJob connectJob = cse.prepareConnectJob(null);
175
					cse.connectUsingJob(connectJob);
176
				} else if (event instanceof IIncomingFileTransferReceiveStartEvent) {
177
					IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
178
					try {
179
						if (target != null) {
180
							rse.receive(target);
181
						}
182
					} catch (IOException e) {
183
						IStatus status = convertToStatus(event, e, startTime, toDownload);
184
						synchronized (result) {
185
							result[0] = status;
186
							result.notify();
187
						}
188
					}
189
				}
190
				if (event instanceof IIncomingFileTransferReceiveDataEvent) {
191
					IIncomingFileTransfer source = ((IIncomingFileTransferReceiveDataEvent) event).getSource();
192
					if (monitor != null) {
193
						if (monitor.isCanceled()) {
194
							synchronized (result) {
195
								result[0] = Status.CANCEL_STATUS;
196
								source.cancel();
197
								result.notify();
198
							}
199
						}
200
					}
201
				}
202
				if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
203
					Exception exception = ((IIncomingFileTransferReceiveDoneEvent) event).getException();
204
					IStatus status = convertToStatus(event, exception, startTime, toDownload);
205
					synchronized (result) {
206
						result[0] = status;
207
						result.notify();
208
					}
209
				}
210
			}
211
		};
212
213
		try {
214
			retrievalContainer.setConnectContextForAuthentication(context);
215
			retrievalContainer.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(retrievalContainer.getRetrieveNamespace(), toDownload), listener, null);
216
		} catch (IncomingFileTransferException e) {
217
			checkPermissionDenied(e);
218
			return statusOn(target, e.getStatus());
219
		} catch (FileCreateException e) {
220
			return statusOn(target, e.getStatus());
221
		}
222
		synchronized (result) {
223
			while (result[0] == null) {
224
				boolean logged = false;
225
				try {
226
					result.wait();
227
				} catch (InterruptedException e) {
228
					if (!logged)
229
						LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Unexpected interrupt while waiting on ECF transfer", e)); //$NON-NLS-1$
230
				}
231
			}
232
		}
233
		final Throwable exception = result[0].getException();
234
		checkPermissionDenied(exception);
235
		//if the transfer failed, return the underlying exception status, otherwise return top level DownloadStatus
236
		if (exception instanceof IncomingFileTransferException) {
237
			IStatus cause = ((IncomingFileTransferException) exception).getStatus();
238
			if (!cause.isOK())
239
				return statusOn(target, cause);
240
		}
241
		return statusOn(target, result[0]);
242
	}
243
244
	/**
245
	 * Returns the connection context for the given URL. This may prompt the
246
	 * user for user name and password as required.
247
	 *
248
	 * @param xmlLocation - the file location requiring login details
249
	 * @param prompt - use <code>true</code> to prompt the user instead of
250
	 * looking at the secure preference store for login, use <code>false</code>
251
	 * to only try the secure preference store
252
	 * @throws UserCancelledException when the user cancels the login prompt
253
	 * @throws ProvisionException if the password cannot be read or saved
254
	 * @return The connection context
255
	 */
256
	public IConnectContext getConnectionContext(String xmlLocation, boolean prompt) throws UserCancelledException, ProvisionException {
257
		ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault();
258
		IPath hostLocation = new Path(xmlLocation).removeLastSegments(1);
259
		String nodeKey;
260
		try {
261
			nodeKey = URLEncoder.encode(hostLocation.toString(), "UTF-8"); //$NON-NLS-1$
262
		} catch (UnsupportedEncodingException e2) {
263
			//fall back to default platform encoding
264
			nodeKey = URLEncoder.encode(hostLocation.toString());
265
		}
266
		String nodeName = IRepository.PREFERENCE_NODE + '/' + nodeKey;
267
		ISecurePreferences prefNode = null;
268
		if (securePreferences.nodeExists(nodeName))
269
			prefNode = securePreferences.node(nodeName);
270
		if (!prompt) {
271
			if (prefNode == null)
272
				return null;
273
			try {
274
				String username = prefNode.get(IRepository.PROP_USERNAME, null);
275
				String password = prefNode.get(IRepository.PROP_PASSWORD, null);
276
				//if we don't have stored connection data just return a null connection context
277
				if (username == null || password == null)
278
					return null;
279
				return ConnectContextFactory.createUsernamePasswordConnectContext(username, password);
280
			} catch (StorageException e) {
281
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
282
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
283
			}
284
		}
285
		//need to prompt user for user name and password
286
		ServiceTracker adminUITracker = new ServiceTracker(Activator.getContext(), IServiceUI.class.getName(), null);
287
		adminUITracker.open();
288
		IServiceUI adminUIService = (IServiceUI) adminUITracker.getService();
289
		AuthenticationInfo loginDetails = null;
290
		if (adminUIService != null)
291
			loginDetails = adminUIService.getUsernamePassword(hostLocation.toString());
292
		//null result means user canceled password dialog
293
		if (loginDetails == null)
294
			throw new UserCancelledException();
295
		//save user name and password if requested by user
296
		if (loginDetails.saveResult()) {
297
			if (prefNode == null)
298
				prefNode = securePreferences.node(nodeName);
299
			try {
300
				prefNode.put(IRepository.PROP_USERNAME, loginDetails.getUserName(), true);
301
				prefNode.put(IRepository.PROP_PASSWORD, loginDetails.getPassword(), true);
302
				prefNode.flush();
303
			} catch (StorageException e1) {
304
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
305
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
306
			} catch (IOException e) {
307
				String msg = NLS.bind(Messages.repoMan_internalError, xmlLocation.toString());
308
				throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.INTERNAL_ERROR, msg, null));
309
			}
310
		}
311
		return ConnectContextFactory.createUsernamePasswordConnectContext(loginDetails.getUserName(), loginDetails.getPassword());
312
	}
313
314
	private static IStatus statusOn(OutputStream target, IStatus status) {
315
		if (target instanceof IStateful)
316
			((IStateful) target).setStatus(status);
317
		return status;
318
	}
319
}
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java (-5 / +4 lines)
Lines 13-24 Link Here
13
import java.net.URI;
13
import java.net.URI;
14
import java.util.*;
14
import java.util.*;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.p2.core.helpers.*;
16
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
17
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
18
import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
21
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
20
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
22
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
24
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
23
25
24
/**
26
/**
Lines 82-90 Link Here
82
		return IRepository.TYPE_ARTIFACT;
84
		return IRepository.TYPE_ARTIFACT;
83
	}
85
	}
84
86
85
	/**
86
	 * @deprecated see {@link #loadRepository(URI, int, IProgressMonitor)}
87
	 */
88
	public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
87
	public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
89
		return loadRepository(location, 0, monitor);
88
		return loadRepository(location, 0, monitor);
90
	}
89
	}
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java (+1 lines)
Lines 20-25 Link Here
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepHandler;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
23
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
23
import org.eclipse.osgi.util.NLS;
24
import org.eclipse.osgi.util.NLS;
24
25
25
/**
26
/**
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java (-1 / +1 lines)
Lines 18-24 Link Here
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
19
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
20
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
20
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
21
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
21
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
22
import org.w3c.dom.*;
22
import org.w3c.dom.*;
23
23
24
/**
24
/**
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/Transport.java (-19 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository;
12
13
import java.io.OutputStream;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IStatus;
16
17
public abstract class Transport {
18
	public abstract IStatus download(String toDownload, OutputStream target, IProgressMonitor pm);
19
}
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java (-2 / +2 lines)
Lines 23-30 Link Here
23
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
23
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.repository.ICompositeRepository;
26
import org.eclipse.equinox.internal.provisional.p2.repository.ICompositeRepository;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
27
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
28
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
29
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
29
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
30
30
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java (-2 / +4 lines)
Lines 19-27 Link Here
19
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
19
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
20
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
20
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
21
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
21
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
22
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
23
import org.eclipse.equinox.internal.p2.repository.Transport;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
27
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
26
import org.eclipse.osgi.util.NLS;
28
import org.eclipse.osgi.util.NLS;
27
29
Lines 120-125 Link Here
120
	}
122
	}
121
123
122
	private Transport getTransport() {
124
	private Transport getTransport() {
123
		return ECFTransport.getInstance();
125
		return RepositoryTransport.getInstance();
124
	}
126
	}
125
}
127
}
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java (-1 / +1 lines)
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
20
import org.eclipse.equinox.internal.provisional.spi.p2.core.repository.AbstractRepository;
20
import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
21
21
22
public abstract class AbstractArtifactRepository extends AbstractRepository implements IArtifactRepository {
22
public abstract class AbstractArtifactRepository extends AbstractRepository implements IArtifactRepository {
23
23
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java (-3 / +6 lines)
Lines 16-28 Link Here
16
import java.util.jar.JarEntry;
16
import java.util.jar.JarEntry;
17
import java.util.jar.JarInputStream;
17
import java.util.jar.JarInputStream;
18
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
19
import org.eclipse.equinox.internal.p2.artifact.repository.*;
19
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
20
import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
20
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
21
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
21
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryIO;
22
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryIO;
22
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
23
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
24
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
25
import org.eclipse.equinox.internal.p2.repository.Transport;
23
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
24
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
25
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
28
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
26
import org.eclipse.osgi.util.NLS;
29
import org.eclipse.osgi.util.NLS;
27
30
28
public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
31
public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
Lines 117-122 Link Here
117
	}
120
	}
118
121
119
	private Transport getTransport() {
122
	private Transport getTransport() {
120
		return ECFTransport.getInstance();
123
		return RepositoryTransport.getInstance();
121
	}
124
	}
122
}
125
}
(-)src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java (-1 / +1 lines)
Lines 15-21 Link Here
15
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
16
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
19
19
20
/**
20
/**
21
 * An artifact repository factory is responsible for creating and loading instances
21
 * An artifact repository factory is responsible for creating and loading instances
(-)src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java (-2 / +5 lines)
Lines 22-32 Link Here
22
import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
22
import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
23
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
23
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
24
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
24
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
25
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
26
import org.eclipse.equinox.internal.p2.repository.Transport;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
27
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
26
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*;
28
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*;
27
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
29
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
28
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
29
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
30
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
31
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
32
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
30
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
33
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
31
import org.eclipse.osgi.util.NLS;
34
import org.eclipse.osgi.util.NLS;
32
35
Lines 755-761 Link Here
755
	}
758
	}
756
759
757
	private Transport getTransport() {
760
	private Transport getTransport() {
758
		return ECFTransport.getInstance();
761
		return RepositoryTransport.getInstance();
759
	}
762
	}
760
763
761
	// use this method to setup any transient fields etc after the object has been restored from a stream
764
	// use this method to setup any transient fields etc after the object has been restored from a stream
(-)src/org/eclipse/equinox/internal/p2/artifact/mirror/MirrorApplication.java (-1 / +1 lines)
Lines 24-30 Link Here
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
24
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
26
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
27
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
27
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
28
import org.eclipse.osgi.framework.log.FrameworkLog;
28
import org.eclipse.osgi.framework.log.FrameworkLog;
29
import org.eclipse.osgi.util.NLS;
29
import org.eclipse.osgi.util.NLS;
30
30
(-)src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java (-1 / +1 lines)
Lines 14-20 Link Here
14
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
16
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
17
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
19
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
20
20
(-)src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepositoryManager.java (-1 / +1 lines)
Lines 15-21 Link Here
15
import java.util.Properties;
15
import java.util.Properties;
16
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
20
20
21
/**
21
/**
(-)src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IStateful.java (-33 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 compeople AG and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * 	compeople AG (Stefan Liebig) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.provisional.p2.artifact.repository;
12
13
import org.eclipse.core.runtime.IStatus;
14
15
/**
16
 * Implementing <code>IStateful</code> adds the ability to store status information.
17
 */
18
public interface IStateful {
19
20
	/**
21
	 * Set the status.
22
	 * 
23
	 * @param status if status equals null => getStatus().isOK
24
	 */
25
	void setStatus(IStatus status);
26
27
	/**
28
	 * Get status.
29
	 * @return status
30
	 */
31
	public IStatus getStatus();
32
33
}
(-)META-INF/MANIFEST.MF (-2 / +5 lines)
Lines 10-15 Link Here
10
 org.eclipse.equinox.internal.p2.artifact.processors.md5;x-internal:=true,
10
 org.eclipse.equinox.internal.p2.artifact.processors.md5;x-internal:=true,
11
 org.eclipse.equinox.internal.p2.artifact.processors.pack200;x-friends:="org.eclipse.equinox.p2.artifact.processors,org.eclipse.equinox.p2.artifact.optimizers",
11
 org.eclipse.equinox.internal.p2.artifact.processors.pack200;x-friends:="org.eclipse.equinox.p2.artifact.processors,org.eclipse.equinox.p2.artifact.optimizers",
12
 org.eclipse.equinox.internal.p2.artifact.repository;x-friends:="org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.reconciler.dropins",
12
 org.eclipse.equinox.internal.p2.artifact.repository;x-friends:="org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.reconciler.dropins",
13
 org.eclipse.equinox.internal.p2.artifact.repository.ant,
13
 org.eclipse.equinox.internal.p2.artifact.repository.simple;x-friends:="org.eclipse.equinox.p2.selfhosting,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.tests",
14
 org.eclipse.equinox.internal.p2.artifact.repository.simple;x-friends:="org.eclipse.equinox.p2.selfhosting,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.tests",
14
 org.eclipse.equinox.internal.provisional.p2.artifact.repository;
15
 org.eclipse.equinox.internal.provisional.p2.artifact.repository;
15
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
16
  x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
Lines 51-61 Link Here
51
 org.eclipse.equinox.internal.p2.jarprocessor,
52
 org.eclipse.equinox.internal.p2.jarprocessor,
52
 org.eclipse.equinox.internal.p2.metadata,
53
 org.eclipse.equinox.internal.p2.metadata,
53
 org.eclipse.equinox.internal.p2.persistence,
54
 org.eclipse.equinox.internal.p2.persistence,
55
 org.eclipse.equinox.internal.p2.repository,
56
 org.eclipse.equinox.internal.p2.repository.helpers,
54
 org.eclipse.equinox.internal.provisional.p2.core,
57
 org.eclipse.equinox.internal.provisional.p2.core,
55
 org.eclipse.equinox.internal.provisional.p2.core.location,
58
 org.eclipse.equinox.internal.provisional.p2.core.location,
56
 org.eclipse.equinox.internal.provisional.p2.core.repository,
57
 org.eclipse.equinox.internal.provisional.p2.metadata,
59
 org.eclipse.equinox.internal.provisional.p2.metadata,
58
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
60
 org.eclipse.equinox.internal.provisional.p2.repository,
61
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
59
 org.eclipse.equinox.security.storage,
62
 org.eclipse.equinox.security.storage,
60
 org.eclipse.internal.provisional.equinox.p2.jarprocessor;resolution:=optional,
63
 org.eclipse.internal.provisional.equinox.p2.jarprocessor;resolution:=optional,
61
 org.eclipse.osgi.framework.log;version="1.0.0",
64
 org.eclipse.osgi.framework.log;version="1.0.0",
(-)src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java (-1 / +2 lines)
Lines 17-23 Link Here
17
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
17
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
18
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.ArtifactOutputStream;
18
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.ArtifactOutputStream;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
20
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IStateful;
20
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
21
21
22
/**
22
/**
23
 * Creates processing step instances from extensions and executes them.
23
 * Creates processing step instances from extensions and executes them.
Lines 25-30 Link Here
25
public class ProcessingStepHandler {
25
public class ProcessingStepHandler {
26
26
27
	private static final String PROCESSING_STEPS_EXTENSION_ID = "org.eclipse.equinox.p2.artifact.repository.processingSteps"; //$NON-NLS-1$
27
	private static final String PROCESSING_STEPS_EXTENSION_ID = "org.eclipse.equinox.p2.artifact.repository.processingSteps"; //$NON-NLS-1$
28
28
	//TODO This method can go
29
	//TODO This method can go
29
	public static IStatus checkStatus(OutputStream output) {
30
	public static IStatus checkStatus(OutputStream output) {
30
		return getStatus(output, true);
31
		return getStatus(output, true);
(-)src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java (-1 / +1 lines)
Lines 15-21 Link Here
15
import java.io.OutputStream;
15
import java.io.OutputStream;
16
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IStateful;
18
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
19
19
20
/**
20
/**
21
 * ProcessingSteps process the data written to them and pass the resultant data on
21
 * ProcessingSteps process the data written to them and pass the resultant data on
(-)META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 15-29 Link Here
15
 org.eclipse.equinox.internal.p2.update,
15
 org.eclipse.equinox.internal.p2.update,
16
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
16
 org.eclipse.equinox.internal.provisional.p2.artifact.repository,
17
 org.eclipse.equinox.internal.provisional.p2.core,
17
 org.eclipse.equinox.internal.provisional.p2.core,
18
 org.eclipse.equinox.internal.provisional.p2.core.repository,
19
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
18
 org.eclipse.equinox.internal.provisional.p2.directorywatcher,
20
 org.eclipse.equinox.internal.provisional.p2.engine,
19
 org.eclipse.equinox.internal.provisional.p2.engine,
21
 org.eclipse.equinox.internal.provisional.p2.metadata,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
22
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
21
 org.eclipse.equinox.internal.provisional.p2.metadata.repository,
23
 org.eclipse.equinox.internal.provisional.p2.query,
22
 org.eclipse.equinox.internal.provisional.p2.query,
23
 org.eclipse.equinox.internal.provisional.p2.repository,
24
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
24
 org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
25
 org.eclipse.equinox.internal.provisional.spi.p2.core.repository,
26
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
25
 org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
26
 org.eclipse.equinox.internal.provisional.spi.p2.repository,
27
 org.eclipse.equinox.p2.publisher.eclipse,
27
 org.eclipse.equinox.p2.publisher.eclipse,
28
 org.eclipse.osgi.service.datalocation;version="1.1.0",
28
 org.eclipse.osgi.service.datalocation;version="1.1.0",
29
 org.eclipse.osgi.service.resolver;version="1.2.0",
29
 org.eclipse.osgi.service.resolver;version="1.2.0",
(-)src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java (-1 / +1 lines)
Lines 172-178 Link Here
172
	}
172
	}
173
173
174
	/* (non-Javadoc)
174
	/* (non-Javadoc)
175
	 * @see org.eclipse.equinox.internal.provisional.spi.p2.core.repository.AbstractRepository#getProperties()
175
	 * @see org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository#getProperties()
176
	 */
176
	 */
177
	public Map getProperties() {
177
	public Map getProperties() {
178
		ensureInitialized();
178
		ensureInitialized();
(-)src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java (-1 / +1 lines)
Lines 18-24 Link Here
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
20
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
21
import org.eclipse.equinox.internal.provisional.spi.p2.core.repository.AbstractRepository;
21
import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
22
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.osgi.util.NLS;
23
import org.osgi.framework.BundleContext;
23
import org.osgi.framework.BundleContext;
24
24
(-)src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java (-1 / +2 lines)
Lines 10-22 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.extensionlocation;
11
package org.eclipse.equinox.internal.p2.extensionlocation;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
18
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
17
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
19
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
20
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
19
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
20
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
21
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
21
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
22
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
22
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.osgi.util.NLS;
(-)src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java (-1 / +2 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.extensionlocation;
11
package org.eclipse.equinox.internal.p2.extensionlocation;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
14
13
import java.net.URI;
15
import java.net.URI;
14
import java.util.Map;
16
import java.util.Map;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
16
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
18
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
17
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
18
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
19
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
20
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
20
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
21
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
(-)src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
11
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
14
13
import java.util.Map;
15
import java.util.Map;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.p2.engine.Profile;
17
import org.eclipse.equinox.internal.p2.engine.Profile;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
17
18
18
/**
19
/**
19
 * An action that adds a repository to the list of known repositories.
20
 * An action that adds a repository to the list of known repositories.
(-)src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java (-1 / +2 lines)
Lines 10-19 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
11
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
12
12
13
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
14
13
import java.util.Map;
15
import java.util.Map;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.equinox.internal.p2.engine.Profile;
17
import org.eclipse.equinox.internal.p2.engine.Profile;
16
import org.eclipse.equinox.internal.provisional.p2.core.repository.RepositoryEvent;
17
18
18
/**
19
/**
19
 * An action that adds a repository to the list of known repositories.
20
 * An action that adds a repository to the list of known repositories.
(-)src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java (-1 / +1 lines)
Lines 20-28 Link Here
20
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator;
20
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator;
21
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
21
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.*;
24
import org.eclipse.equinox.internal.provisional.p2.engine.*;
23
import org.eclipse.equinox.internal.provisional.p2.engine.*;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
25
import org.eclipse.equinox.internal.provisional.p2.repository.*;
26
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.osgi.util.NLS;
27
import org.osgi.service.prefs.BackingStoreException;
27
import org.osgi.service.prefs.BackingStoreException;
28
import org.osgi.service.prefs.Preferences;
28
import org.osgi.service.prefs.Preferences;
(-)src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java (-1 / +1 lines)
Lines 21-29 Link Here
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
23
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
24
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
26
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
25
import org.eclipse.equinox.internal.provisional.p2.metadata.*;
26
import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
27
import org.eclipse.osgi.service.datalocation.Location;
27
import org.eclipse.osgi.service.datalocation.Location;
28
import org.eclipse.osgi.service.environment.EnvironmentInfo;
28
import org.eclipse.osgi.service.environment.EnvironmentInfo;
29
import org.eclipse.osgi.util.ManifestElement;
29
import org.eclipse.osgi.util.ManifestElement;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 15-21 Link Here
15
 org.eclipse.equinox.internal.provisional.p2.core,
15
 org.eclipse.equinox.internal.provisional.p2.core,
16
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
16
 org.eclipse.equinox.internal.provisional.p2.core.eventbus,
17
 org.eclipse.equinox.internal.provisional.p2.core.location,
17
 org.eclipse.equinox.internal.provisional.p2.core.location,
18
 org.eclipse.equinox.internal.provisional.p2.core.repository,
18
 org.eclipse.equinox.internal.provisional.p2.repository,
19
 org.eclipse.equinox.internal.provisional.p2.engine,
19
 org.eclipse.equinox.internal.provisional.p2.engine,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
20
 org.eclipse.equinox.internal.provisional.p2.metadata,
21
 org.eclipse.equinox.internal.provisional.p2.metadata.query,
21
 org.eclipse.equinox.internal.provisional.p2.metadata.query,

Return to bug 216278