Lines 15-20
Link Here
|
15 |
import java.security.AccessController; |
15 |
import java.security.AccessController; |
16 |
import java.security.PrivilegedAction; |
16 |
import java.security.PrivilegedAction; |
17 |
import java.util.ArrayList; |
17 |
import java.util.ArrayList; |
|
|
18 |
import java.util.HashMap; |
18 |
import org.eclipse.osgi.framework.adaptor.BundleClassLoader; |
19 |
import org.eclipse.osgi.framework.adaptor.BundleClassLoader; |
19 |
import org.eclipse.osgi.framework.adaptor.BundleData; |
20 |
import org.eclipse.osgi.framework.adaptor.BundleData; |
20 |
import org.eclipse.osgi.framework.debug.Debug; |
21 |
import org.eclipse.osgi.framework.debug.Debug; |
Lines 49-55
Link Here
|
49 |
public class PackageAdminImpl implements PackageAdmin { |
50 |
public class PackageAdminImpl implements PackageAdmin { |
50 |
/** framework object */ |
51 |
/** framework object */ |
51 |
protected Framework framework; |
52 |
protected Framework framework; |
52 |
|
53 |
private HashMap multiSourceCache = new HashMap(5); |
53 |
/** |
54 |
/** |
54 |
* Constructor. |
55 |
* Constructor. |
55 |
* |
56 |
* |
Lines 188-193
Link Here
|
188 |
} |
189 |
} |
189 |
} |
190 |
} |
190 |
StateDelta stateDelta = framework.adaptor.getState().resolve(descriptions); |
191 |
StateDelta stateDelta = framework.adaptor.getState().resolve(descriptions); |
|
|
192 |
clearMultiSourceCache(); |
191 |
refreshedBundles = processDelta(stateDelta.getChanges(), refreshPackages); |
193 |
refreshedBundles = processDelta(stateDelta.getChanges(), refreshPackages); |
192 |
if (refreshPackages) { |
194 |
if (refreshPackages) { |
193 |
AbstractBundle[] allBundles = framework.getAllBundles(); |
195 |
AbstractBundle[] allBundles = framework.getAllBundles(); |
Lines 586-589
Link Here
|
586 |
} |
588 |
} |
587 |
FrameworkProperties.setProperty(Constants.OSGI_IMPL_VERSION_KEY, systemBundle.getVersion().toString()); |
589 |
FrameworkProperties.setProperty(Constants.OSGI_IMPL_VERSION_KEY, systemBundle.getVersion().toString()); |
588 |
} |
590 |
} |
|
|
591 |
|
592 |
MultiSourcePackage createMultiSourcePackage(String id, SingleSourcePackage[] suppliers) { |
593 |
synchronized (multiSourceCache) { |
594 |
MultiSourcePackage[] multiSources = (MultiSourcePackage[]) multiSourceCache.get(id); |
595 |
if (multiSources == null) { |
596 |
multiSources = new MultiSourcePackage[1]; |
597 |
multiSources[0] = new MultiSourcePackage(id, suppliers); |
598 |
multiSourceCache.put(id, multiSources); |
599 |
return multiSources[0]; |
600 |
} |
601 |
for (int i = 0; i < multiSources.length; i++) |
602 |
if (multiSources[i].equals(id, suppliers)) |
603 |
return multiSources[i]; |
604 |
MultiSourcePackage[] temp = multiSources; |
605 |
multiSources = new MultiSourcePackage[temp.length + 1]; |
606 |
System.arraycopy(temp, 0, multiSources, 0, temp.length); |
607 |
multiSources[temp.length] = new MultiSourcePackage(id, suppliers); |
608 |
multiSourceCache.put(id, multiSources); |
609 |
return multiSources[temp.length]; |
610 |
} |
611 |
} |
612 |
|
613 |
private void clearMultiSourceCache() { |
614 |
synchronized (multiSourceCache) { |
615 |
multiSourceCache.clear(); |
616 |
} |
617 |
} |
589 |
} |
618 |
} |