blob: 39e656ad37c65b39ca42885c1f20bf68fe83a3bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.internal.resolver;
import org.eclipse.osgi.service.resolver.BundleDelta;
import org.eclipse.osgi.service.resolver.BundleDescription;
public class BundleDeltaImpl implements BundleDelta {
private BundleDescription bundleDescription;
private int type;
public BundleDeltaImpl(BundleDescription bundleDescription) {
this(bundleDescription, 0);
}
public BundleDeltaImpl(BundleDescription bundleDescription, int type) {
this.bundleDescription = bundleDescription;
this.type = type;
}
public BundleDescription getBundle() {
return bundleDescription;
}
public int getType() {
return type;
}
protected void setBundle(BundleDescription bundleDescription) {
this.bundleDescription = bundleDescription;
}
protected void setType(int type) {
this.type = type;
}
public String toString() {
return bundleDescription.getSymbolicName() + '_' + bundleDescription.getVersion() + " (" + toTypeString(type) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
private static String toTypeString(int type) {
StringBuffer typeStr = new StringBuffer();
if ((type & BundleDelta.ADDED) != 0)
typeStr.append("ADDED,"); //$NON-NLS-1$
if ((type & BundleDelta.REMOVED) != 0)
typeStr.append("REMOVED,"); //$NON-NLS-1$
if ((type & BundleDelta.RESOLVED) != 0)
typeStr.append("RESOLVED,"); //$NON-NLS-1$
if ((type & BundleDelta.UNRESOLVED) != 0)
typeStr.append("UNRESOLVED,"); //$NON-NLS-1$
if ((type & BundleDelta.LINKAGE_CHANGED) != 0)
typeStr.append("LINKAGE_CHANGED,"); //$NON-NLS-1$
if ((type & BundleDelta.UPDATED) != 0)
typeStr.append("UPDATED,"); //$NON-NLS-1$
if ((type & BundleDelta.REMOVAL_PENDING) != 0)
typeStr.append("REMOVAL_PENDING,"); //$NON-NLS-1$
if ((type & BundleDelta.REMOVAL_COMPLETE) != 0)
typeStr.append("REMOVAL_COMPLETE,"); //$NON-NLS-1$
if (typeStr.length() > 0)
typeStr.deleteCharAt(typeStr.length() - 1);
return typeStr.toString();
}
}
|