hasImportedPackages = hasDynamicImports = SystemBundleLoader.getSystemPackages() != null;
hasDynamicImports = SystemBundleLoader.getSystemPackages() != null;
	protected void initialize(BundleDescription description) {		hasImportedPackages = hasDynamicImports = SystemBundleLoader.getSystemPackages() != null;		//This is the fastest way to access to the description for fragments since the hostdescription.getFragments() is slow		org.osgi.framework.Bundle[] fragmentObjects = bundle.getFragments();		BundleDescription[] fragments = new BundleDescription[fragmentObjects == null ? 0 : fragmentObjects.length];		for (int i = 0; i < fragments.length; i++) {			fragments[i] = ((Bundle) fragmentObjects[i]).getBundleDescription();		}		// init the imported packages list taking the bundle...		addImportedPackages(description.getPackages());		// ...and its fragments		for (int i = 0; i < fragments.length; i++)			if (fragments[i].isResolved())				addImportedPackages(fragments[i].getPackages());		// init the require bundles list.  Need to account for optional bundles so bundles with		// no supplier should be skipped.		BundleSpecification[] required = description.getRequiredBundles();		ArrayList bundles = new ArrayList(Arrays.asList(required == null ? new BundleSpecification[0] : required));		for (int i = 0; i < fragments.length; i++)			if (fragments[i].isResolved()) {				BundleSpecification[] fragmentRequires = fragments[i].getRequiredBundles();				if (fragmentRequires != null)					bundles.addAll(Arrays.asList(fragmentRequires));			}		if (bundles.size() > 0) {			ArrayList bound = new ArrayList(bundles.size());			int[] reexported = new int[bundles.size()];			int reexportIndex = 0;			for (int i = 0; i < bundles.size(); i++) {				BundleSpecification spec = (BundleSpecification) bundles.get(i);				if (spec.isResolved()) {					String bundleKey = new StringBuffer(spec.getName()).append("_").append(spec.getActualVersion().toString()).toString();					BundleLoaderProxy loaderProxy = (BundleLoaderProxy) bundle.framework.packageAdmin.exportedBundles.getByKey(bundleKey);					if (loaderProxy != null) {						bound.add(loaderProxy);						if (spec.isExported())							reexported[reexportIndex++] = i;					} else {						// TODO log error						System.out.println("Could not find loaderProxy: " + bundleKey);					}				}			}			requiredBundles = (BundleLoaderProxy[]) bound.toArray(new BundleLoaderProxy[bound.size()]);			if (reexportIndex > 0) {				reexportTable = new int[reexportIndex];				System.arraycopy(reexported, 0, reexportTable, 0, reexportIndex);			}		}		// init the provided packages		String[] provides = description.getProvidedPackages();		ArrayList packages = new ArrayList(Arrays.asList(required == null ? new String[0] : provides));		for (int i = 0; i < fragments.length; i++)			if (fragments[i].isResolved()) {				String[] fragmentProvides = fragments[i].getProvidedPackages();				if (fragmentProvides != null)					packages.addAll(Arrays.asList(fragmentProvides));			}		if (packages.size() > 0) {			providedPackages = new KeyedHashSet(packages.size());			for (int i = 0; i < packages.size(); i++)				providedPackages.add(new SingleSourcePackage((String) packages.get(i), bundle.getLoaderProxy()));		}		// init the dynamic imports tables		try {			String spec = bundle.getBundleData().getDynamicImports();			ManifestElement[] imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE,spec);			addDynamicImportPackage(imports);			// ...and its fragments			for (int i = 0; i < fragments.length; i++)				if (fragments[i].isResolved()) {					spec = ((Bundle) fragmentObjects[i]).getBundleData().getDynamicImports();					imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE,spec);					addDynamicImportPackage(imports);				}		} catch (BundleException e) {			// TODO log an error		}	}