public ApplicationContextImpl (BundleContext b, AriesApplication app) throws BundleException, ManagementException {
_bundleContext = b;
_application = app;
_bundles = new HashMap<BundleInfo, Bundle>();
DeploymentMetadata meta = _application.getDeploymentMetadata();
AriesApplicationResolver resolver = null;
PackageAdmin packageAdmin = null;
ServiceReference resolverRef = b.getServiceReference(AriesApplicationResolver.class.getName());
ServiceReference packageAdminRef = b.getServiceReference(PackageAdmin.class.getName());
try {
resolver = getService(resolverRef, AriesApplicationResolver.class);
packageAdmin = getService(packageAdminRef, PackageAdmin.class);
List<DeploymentContent> bundlesToInstall = new ArrayList<DeploymentContent>(meta.getApplicationDeploymentContents());
bundlesToInstall.addAll(meta.getApplicationProvisionBundles());
bundlesToInstall.addAll(meta.getDeployedUseBundle());
for (DeploymentContent content : bundlesToInstall) {
String bundleSymbolicName = content.getContentName();
Version bundleVersion = content.getExactVersion();
// Step 1: See if bundle is already installed in the framework