View | Details | Raw Unified | Return to bug 303269 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java (-6 / +30 lines)
Lines 82-110 Link Here
82
		state = value;
82
		state = value;
83
	}
83
	}
84
84
85
	// TODO remove
86
	@Override
87
	public void addInstallableUnits(IInstallableUnit[] installableUnits) {
88
		throw new UnsupportedOperationException();
89
	}
90
85
	/* (non-Javadoc)
91
	/* (non-Javadoc)
86
	 * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#addInstallableUnits(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
92
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
87
	 */
93
	 */
88
	public void addInstallableUnits(IInstallableUnit[] installableUnits) {
94
	@Override
95
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
89
		throw new UnsupportedOperationException();
96
		throw new UnsupportedOperationException();
90
	}
97
	}
91
98
92
	/* (non-Javadoc)
99
	/* (non-Javadoc)
93
	 * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#removeAll()
100
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
94
	 */
101
	 */
102
	@Override
95
	public void removeAll() {
103
	public void removeAll() {
96
		throw new UnsupportedOperationException();
104
		throw new UnsupportedOperationException();
97
	}
105
	}
98
106
107
	// TODO remove
108
	@Override
109
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
110
		throw new UnsupportedOperationException();
111
	}
112
99
	/* (non-Javadoc)
113
	/* (non-Javadoc)
100
	 * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#removeInstallableUnits(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.core.runtime.IProgressMonitor)
114
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
101
	 */
115
	 */
102
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
116
	@Override
117
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
103
		throw new UnsupportedOperationException();
118
		throw new UnsupportedOperationException();
104
	}
119
	}
105
120
106
	/* (non-Javadoc)
121
	/* (non-Javadoc)
107
	 * @see org.eclipse.equinox.internal.provisional.p2.query.IQueryable#query(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
122
	 * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
108
	 */
123
	 */
109
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
124
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
110
		ensureInitialized();
125
		ensureInitialized();
Lines 177-191 Link Here
177
	/* (non-Javadoc)
192
	/* (non-Javadoc)
178
	 * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#getProperties()
193
	 * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#getProperties()
179
	 */
194
	 */
195
	@Override
180
	public Map<String, String> getProperties() {
196
	public Map<String, String> getProperties() {
181
		ensureInitialized();
197
		ensureInitialized();
182
		return metadataRepository.getProperties();
198
		return metadataRepository.getProperties();
183
	}
199
	}
184
200
201
	/* (non-Javadoc)
202
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#initialize(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository.RepositoryState)
203
	 */
204
	@Override
185
	public void initialize(RepositoryState repositoryState) {
205
	public void initialize(RepositoryState repositoryState) {
186
		//nothing to do
206
		//nothing to do
187
	}
207
	}
188
208
209
	/* (non-Javadoc)
210
	 * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#setProperty(java.lang.String, java.lang.String)
211
	 */
212
	@Override
189
	public String setProperty(String key, String value) {
213
	public String setProperty(String key, String value) {
190
		ensureInitialized();
214
		ensureInitialized();
191
		String oldValue = metadataRepository.setProperty(key, value);
215
		String oldValue = metadataRepository.setProperty(key, value);
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java (-4 / +43 lines)
Lines 123-128 Link Here
123
		return result;
123
		return result;
124
	}
124
	}
125
125
126
	/* (non-Javadoc)
127
	 * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
128
	 */
126
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
129
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
127
		if (monitor == null)
130
		if (monitor == null)
128
			monitor = new NullProgressMonitor();
131
			monitor = new NullProgressMonitor();
Lines 161-170 Link Here
161
		}
164
		}
162
	}
165
	}
163
166
167
	/* (non-Javadoc)
168
	 * @see org.eclipse.equinox.p2.repository.ICompositeRepository#addChild(java.net.URI)
169
	 */
164
	public void addChild(URI childURI) {
170
	public void addChild(URI childURI) {
165
		addChild(childURI, true);
171
		addChild(childURI, true);
166
	}
172
	}
167
173
174
	/* (non-Javadoc)
175
	 * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeChild(java.net.URI)
176
	 */
168
	public void removeChild(URI childURI) {
177
	public void removeChild(URI childURI) {
169
		boolean removed = childrenURIs.remove(childURI);
178
		boolean removed = childrenURIs.remove(childURI);
170
		// if the child wasn't there make sure and try the other permutation
179
		// if the child wasn't there make sure and try the other permutation
Lines 189-210 Link Here
189
		}
198
		}
190
	}
199
	}
191
200
201
	/* (non-Javadoc)
202
	 * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeAllChildren()
203
	 */
192
	public void removeAllChildren() {
204
	public void removeAllChildren() {
193
		childrenURIs.clear();
205
		childrenURIs.clear();
194
		loadedRepos.clear();
206
		loadedRepos.clear();
195
		save();
207
		save();
196
	}
208
	}
197
209
210
	// TODO remove
211
	@Override
198
	public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
212
	public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
199
		throw new UnsupportedOperationException("Cannot add IUs to a composite repository");
213
		throw new UnsupportedOperationException("Cannot add IUs to a composite repository"); //$NON-NLS-1$
200
	}
214
	}
201
215
216
	/* (non-Javadoc)
217
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
218
	 */
219
	@Override
220
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
221
		throw new UnsupportedOperationException("Cannot add IUs to a composite repository"); //$NON-NLS-1$
222
	}
223
224
	/* (non-Javadoc)
225
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
226
	 */
227
	@Override
202
	public synchronized void removeAll() {
228
	public synchronized void removeAll() {
203
		throw new UnsupportedOperationException("Cannot remove IUs to a composite repository");
229
		throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
204
	}
230
	}
205
231
232
	// TODO remove
233
	@Override
206
	public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
234
	public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
207
		throw new UnsupportedOperationException("Cannot remove IUs to a composite repository");
235
		throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
236
	}
237
238
	/* (non-Javadoc)
239
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
240
	 */
241
	@Override
242
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
243
		throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
208
	}
244
	}
209
245
210
	private static File getActualLocation(URI location, String extension) {
246
	private static File getActualLocation(URI location, String extension) {
Lines 227-233 Link Here
227
	}
263
	}
228
264
229
	public synchronized void addReference(URI repositoryLocation, int repositoryType, int options) {
265
	public synchronized void addReference(URI repositoryLocation, int repositoryType, int options) {
230
		throw new UnsupportedOperationException("Cannot add References to a composite repository");
266
		throw new UnsupportedOperationException("Cannot add References to a composite repository"); //$NON-NLS-1$
231
	}
267
	}
232
268
233
	// caller should be synchronized
269
	// caller should be synchronized
Lines 270-275 Link Here
270
		}
306
		}
271
	}
307
	}
272
308
309
	/* (non-Javadoc)
310
	 * @see org.eclipse.equinox.p2.repository.ICompositeRepository#getChildren()
311
	 */
273
	public List<URI> getChildren() {
312
	public List<URI> getChildren() {
274
		List<URI> result = new ArrayList<URI>();
313
		List<URI> result = new ArrayList<URI>();
275
		for (URI childURI : childrenURIs)
314
		for (URI childURI : childrenURIs)
(-)src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java (-3 / +52 lines)
Lines 93-111 Link Here
93
		save();
93
		save();
94
	}
94
	}
95
95
96
	// TODO remove
97
	@Override
96
	public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
98
	public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
97
		if (installableUnits == null || installableUnits.length == 0)
99
		addInstallableUnits(Arrays.asList(installableUnits));
100
	}
101
102
	/* (non-Javadoc)
103
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
104
	 */
105
	@Override
106
	public synchronized void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
107
		if (installableUnits == null || !installableUnits.isEmpty())
98
			return;
108
			return;
99
		units.addAll(installableUnits);
109
		units.addAll(installableUnits);
100
		capabilityIndex = null; // Generated, not backed by units
110
		capabilityIndex = null; // Generated, not backed by units
101
		save();
111
		save();
102
	}
112
	}
103
113
114
	/* (non-Javadoc)
115
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
116
	 */
117
	@Override
104
	public synchronized void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
118
	public synchronized void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
105
		assertModifiable();
119
		assertModifiable();
106
		repositories.add(new RepositoryReference(repositoryLocation, nickname, repositoryType, options));
120
		repositories.add(new RepositoryReference(repositoryLocation, nickname, repositoryType, options));
107
	}
121
	}
108
122
123
	/* (non-Javadoc)
124
	 * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#getIndex(java.lang.String)
125
	 */
109
	public synchronized IIndex<IInstallableUnit> getIndex(String memberName) {
126
	public synchronized IIndex<IInstallableUnit> getIndex(String memberName) {
110
		if (InstallableUnit.MEMBER_ID.equals(memberName)) {
127
		if (InstallableUnit.MEMBER_ID.equals(memberName)) {
111
			if (idIndex == null)
128
			if (idIndex == null)
Lines 121-126 Link Here
121
		return null;
138
		return null;
122
	}
139
	}
123
140
141
	/* (non-Javadoc)
142
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#initialize(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository.RepositoryState)
143
	 */
144
	@Override
124
	public void initialize(RepositoryState state) {
145
	public void initialize(RepositoryState state) {
125
		synchronized (this) {
146
		synchronized (this) {
126
			this.name = state.Name;
147
			this.name = state.Name;
Lines 162-190 Link Here
162
		this.location = aLocation;
183
		this.location = aLocation;
163
	}
184
	}
164
185
186
	/* (non-Javadoc)
187
	 * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#isModifiable()
188
	 */
189
	@Override
165
	public boolean isModifiable() {
190
	public boolean isModifiable() {
166
		return true;
191
		return true;
167
	}
192
	}
168
193
194
	/* (non-Javadoc)
195
	 * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
196
	 */
169
	public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
197
	public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
170
		return query instanceof IQueryWithIndex<?> ? ((IQueryWithIndex<IInstallableUnit>) query).perform(this) : query.perform(units.iterator());
198
		return query instanceof IQueryWithIndex<?> ? ((IQueryWithIndex<IInstallableUnit>) query).perform(this) : query.perform(units.iterator());
171
	}
199
	}
172
200
201
	/* (non-Javadoc)
202
	 * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#everything()
203
	 */
173
	public Iterator<IInstallableUnit> everything() {
204
	public Iterator<IInstallableUnit> everything() {
174
		return units.iterator();
205
		return units.iterator();
175
	}
206
	}
176
207
208
	/* (non-Javadoc)
209
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
210
	 */
211
	@Override
177
	public synchronized void removeAll() {
212
	public synchronized void removeAll() {
178
		units.clear();
213
		units.clear();
179
		capabilityIndex = null; // Generated, not backed by units.
214
		capabilityIndex = null; // Generated, not backed by units.
180
		save();
215
		save();
181
	}
216
	}
182
217
218
	// TODO remove
219
	@Override
183
	public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
220
	public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
221
		return removeInstallableUnits(Arrays.asList(installableUnits));
222
	}
223
224
	/* (non-Javadoc)
225
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
226
	 */
227
	@Override
228
	public synchronized boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
184
		boolean changed = false;
229
		boolean changed = false;
185
		if (installableUnits != null && installableUnits.length > 0) {
230
		if (installableUnits != null && !installableUnits.isEmpty()) {
186
			changed = true;
231
			changed = true;
187
			units.removeAll(Arrays.asList(installableUnits));
232
			units.removeAll(installableUnits);
188
			capabilityIndex = null; // Generated, not backed by units.
233
			capabilityIndex = null; // Generated, not backed by units.
189
		}
234
		}
190
		if (changed)
235
		if (changed)
Lines 230-235 Link Here
230
		}
275
		}
231
	}
276
	}
232
277
278
	/* (non-Javadoc)
279
	 * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#setProperty(java.lang.String, java.lang.String)
280
	 */
281
	@Override
233
	public String setProperty(String key, String newValue) {
282
	public String setProperty(String key, String newValue) {
234
		String oldValue = null;
283
		String oldValue = null;
235
		synchronized (this) {
284
		synchronized (this) {
(-)src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java (-5 / +14 lines)
Lines 11-16 Link Here
11
package org.eclipse.equinox.p2.repository.metadata;
11
package org.eclipse.equinox.p2.repository.metadata;
12
12
13
import java.net.URI;
13
import java.net.URI;
14
import java.util.Collection;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
16
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
16
import org.eclipse.equinox.p2.repository.IRepository;
17
import org.eclipse.equinox.p2.repository.IRepository;
Lines 28-38 Link Here
28
 */
29
 */
29
public interface IMetadataRepository extends IRepository<IInstallableUnit> {
30
public interface IMetadataRepository extends IRepository<IInstallableUnit> {
30
31
32
	/**
33
	 * @deprecated use {@link #addInstallableUnits(Collection)}
34
	 */
35
	public void addInstallableUnits(IInstallableUnit[] installableUnits);
36
31
	/** 
37
	/** 
32
	 * Add the given installable units to this repository
38
	 * Add the given installable units to this repository
33
	 * @param installableUnits the installable units to add
39
	 * @param installableUnits the installable units to add
34
	 */
40
	 */
35
	public void addInstallableUnits(IInstallableUnit[] installableUnits);
41
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits);
36
42
37
	/**
43
	/**
38
	 * Adds a reference to another repository to this repository. When a repository
44
	 * Adds a reference to another repository to this repository. When a repository
Lines 60-74 Link Here
60
	public void addReference(URI location, String nickname, int type, int options);
66
	public void addReference(URI location, String nickname, int type, int options);
61
67
62
	/**
68
	/**
63
	 * Removes all installable units that match the given query from this repository.
69
	 * @deprecated use {@link #removeInstallableUnits(Collection)}
70
	 */
71
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor);
72
73
	/**
74
	 * Removes all installable units in the given collection from this repository.
64
	 * 
75
	 * 
65
	 * @param installableUnits the installable units to remove
76
	 * @param installableUnits the installable units to remove
66
	 * @param monitor a progress monitor, or <code>null</code> if progress
67
	 *    reporting is not desired
68
	 * @return <code>true</code> if any units were actually removed, and
77
	 * @return <code>true</code> if any units were actually removed, and
69
	 * <code>false</code> otherwise
78
	 * <code>false</code> otherwise
70
	 */
79
	 */
71
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor);
80
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits);
72
81
73
	/**
82
	/**
74
	 * Remove all installable units from this repository.  
83
	 * Remove all installable units from this repository.  
(-)src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java (+24 lines)
Lines 11-16 Link Here
11
package org.eclipse.equinox.p2.repository.metadata.spi;
11
package org.eclipse.equinox.p2.repository.metadata.spi;
12
12
13
import java.net.URI;
13
import java.net.URI;
14
import java.util.Collection;
14
import java.util.Map;
15
import java.util.Map;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.equinox.p2.core.IProvisioningAgent;
17
import org.eclipse.equinox.p2.core.IProvisioningAgent;
Lines 53-73 Link Here
53
		super(agent, name, type, version, location, description, provider, properties);
54
		super(agent, name, type, version, location, description, provider, properties);
54
	}
55
	}
55
56
57
	// TODO remove
56
	public void addInstallableUnits(IInstallableUnit[] installableUnit) {
58
	public void addInstallableUnits(IInstallableUnit[] installableUnit) {
57
		assertModifiable();
59
		assertModifiable();
58
	}
60
	}
59
61
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
64
	 */
65
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
66
		assertModifiable();
67
	}
68
69
	/* (non-Javadoc)
70
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
71
	 */
60
	public void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
72
	public void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
61
		assertModifiable();
73
		assertModifiable();
62
	}
74
	}
63
75
76
	/* (non-Javadoc)
77
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll()
78
	 */
64
	public void removeAll() {
79
	public void removeAll() {
65
		assertModifiable();
80
		assertModifiable();
66
	}
81
	}
67
82
83
	// TODO remove
68
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
84
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
69
		assertModifiable();
85
		assertModifiable();
70
		return false;
86
		return false;
71
	}
87
	}
72
88
89
	/* (non-Javadoc)
90
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
91
	 */
92
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
93
		assertModifiable();
94
		return false;
95
	}
96
73
}
97
}
(-)src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java (-5 / +24 lines)
Lines 55-62 Link Here
55
		units.addAll(Arrays.asList(ius));
55
		units.addAll(Arrays.asList(ius));
56
	}
56
	}
57
57
58
	// TODO remove
59
	@Override
58
	public void addInstallableUnits(IInstallableUnit[] toAdd) {
60
	public void addInstallableUnits(IInstallableUnit[] toAdd) {
59
		units.addAll(Arrays.asList(toAdd));
61
		addInstallableUnits(Arrays.asList(toAdd));
62
	}
63
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
66
	 */
67
	@Override
68
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
69
		units.addAll(installableUnits);
60
	}
70
	}
61
71
62
	public IInstallableUnit find(String id, String versionString) {
72
	public IInstallableUnit find(String id, String versionString) {
Lines 79-89 Link Here
79
		units.clear();
89
		units.clear();
80
	}
90
	}
81
91
82
	public boolean removeInstallableUnits(IInstallableUnit[] toRemove) {
92
	// TODO remove
93
	@Override
94
	public boolean removeInstallableUnits(IInstallableUnit[] toRemove, IProgressMonitor monitor) {
95
		return removeInstallableUnits(Arrays.asList(toRemove));
96
	}
97
98
	/* (non-Javadoc)
99
	 * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
100
	 */
101
	@Override
102
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
83
		boolean modified = false;
103
		boolean modified = false;
84
		for (int i = 0; i < toRemove.length; i++) {
104
		for (IInstallableUnit iu : installableUnits)
85
			modified |= units.remove(toRemove[i]);
105
			modified |= units.remove(iu);
86
		}
87
		return modified;
106
		return modified;
88
	}
107
	}
89
108
(-)src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java (-1 / +66 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 *  Copyright (c) 2008, 2009 IBM Corporation and others.
2
 *  Copyright (c) 2008, 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
5
 *  which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
package org.eclipse.equinox.internal.p2.updatesite.metadata;
11
package org.eclipse.equinox.internal.p2.updatesite.metadata;
12
12
13
import java.net.URI;
13
import java.net.URI;
14
import java.util.Collection;
14
import java.util.Map;
15
import java.util.Map;
15
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.equinox.p2.core.IProvisioningAgent;
17
import org.eclipse.equinox.p2.core.IProvisioningAgent;
Lines 32-101 Link Here
32
		this.delegate = repository;
33
		this.delegate = repository;
33
	}
34
	}
34
35
36
	// TODO remove
35
	public void addInstallableUnits(IInstallableUnit[] installableUnits) {
37
	public void addInstallableUnits(IInstallableUnit[] installableUnits) {
36
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
38
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
37
	}
39
	}
38
40
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
43
	 */
44
	public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
45
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
46
	}
47
48
	/* (non-Javadoc)
49
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
50
	 */
39
	public void addReference(URI location, String nickname, int type, int options) {
51
	public void addReference(URI location, String nickname, int type, int options) {
40
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
52
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
41
	}
53
	}
42
54
55
	/* (non-Javadoc)
56
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll()
57
	 */
43
	public void removeAll() {
58
	public void removeAll() {
44
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
59
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
45
	}
60
	}
46
61
62
	// TODO remove
47
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
63
	public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
48
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
64
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
49
	}
65
	}
50
66
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
69
	 */
70
	public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
71
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
72
	}
73
74
	/* (non-Javadoc)
75
	 * @see org.eclipse.equinox.p2.repository.IRepository#getDescription()
76
	 */
51
	public String getDescription() {
77
	public String getDescription() {
52
		return delegate.getDescription();
78
		return delegate.getDescription();
53
	}
79
	}
54
80
81
	/* (non-Javadoc)
82
	 * @see org.eclipse.equinox.p2.repository.IRepository#getLocation()
83
	 */
55
	public URI getLocation() {
84
	public URI getLocation() {
56
		return location;
85
		return location;
57
	}
86
	}
58
87
88
	/* (non-Javadoc)
89
	 * @see org.eclipse.equinox.p2.repository.IRepository#getName()
90
	 */
59
	public String getName() {
91
	public String getName() {
60
		return delegate.getName();
92
		return delegate.getName();
61
	}
93
	}
62
94
95
	/* (non-Javadoc)
96
	 * @see org.eclipse.equinox.p2.repository.IRepository#getProperties()
97
	 */
63
	public Map<String, String> getProperties() {
98
	public Map<String, String> getProperties() {
64
		return delegate.getProperties();
99
		return delegate.getProperties();
65
	}
100
	}
66
101
102
	/* (non-Javadoc)
103
	 * @see org.eclipse.equinox.p2.repository.IRepository#getProvider()
104
	 */
67
	public String getProvider() {
105
	public String getProvider() {
68
		return delegate.getProvider();
106
		return delegate.getProvider();
69
	}
107
	}
70
108
109
	/* (non-Javadoc)
110
	 * @see org.eclipse.equinox.p2.repository.IRepository#getProvisioningAgent()
111
	 */
71
	public IProvisioningAgent getProvisioningAgent() {
112
	public IProvisioningAgent getProvisioningAgent() {
72
		return delegate.getProvisioningAgent();
113
		return delegate.getProvisioningAgent();
73
	}
114
	}
74
115
116
	/* (non-Javadoc)
117
	 * @see org.eclipse.equinox.p2.repository.IRepository#getType()
118
	 */
75
	public String getType() {
119
	public String getType() {
76
		return TYPE;
120
		return TYPE;
77
	}
121
	}
78
122
123
	/* (non-Javadoc)
124
	 * @see org.eclipse.equinox.p2.repository.IRepository#getVersion()
125
	 */
79
	public String getVersion() {
126
	public String getVersion() {
80
		return VERSION;
127
		return VERSION;
81
	}
128
	}
82
129
130
	/* (non-Javadoc)
131
	 * @see org.eclipse.equinox.p2.repository.IRepository#isModifiable()
132
	 */
83
	public boolean isModifiable() {
133
	public boolean isModifiable() {
84
		return false;
134
		return false;
85
	}
135
	}
86
136
137
	/* (non-Javadoc)
138
	 * @see org.eclipse.equinox.p2.repository.IRepository#setDescription(java.lang.String)
139
	 */
87
	public void setDescription(String description) {
140
	public void setDescription(String description) {
88
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
141
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
89
	}
142
	}
90
143
144
	/* (non-Javadoc)
145
	 * @see org.eclipse.equinox.p2.repository.IRepository#setName(java.lang.String)
146
	 */
91
	public void setName(String name) {
147
	public void setName(String name) {
92
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
148
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
93
	}
149
	}
94
150
151
	/* (non-Javadoc)
152
	 * @see org.eclipse.equinox.p2.repository.IRepository#setProperty(java.lang.String, java.lang.String)
153
	 */
95
	public String setProperty(String key, String value) {
154
	public String setProperty(String key, String value) {
96
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
155
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
97
	}
156
	}
98
157
158
	/* (non-Javadoc)
159
	 * @see org.eclipse.equinox.p2.repository.IRepository#setProvider(java.lang.String)
160
	 */
99
	public void setProvider(String provider) {
161
	public void setProvider(String provider) {
100
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
162
		throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
101
	}
163
	}
Lines 105-110 Link Here
105
		return delegate.getAdapter(adapter);
167
		return delegate.getAdapter(adapter);
106
	}
168
	}
107
169
170
	/* (non-Javadoc)
171
	 * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
172
	 */
108
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
173
	public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
109
		return delegate.query(query, monitor);
174
		return delegate.query(query, monitor);
110
	}
175
	}

Return to bug 303269