use of org.osgi.framework.BundleException in project azure-tools-for-java by Microsoft.
the class HDInsightHelperImpl method openJobViewEditor.
public void openJobViewEditor(Object projectObject, String uuid) {
try {
loadHDInsightPlugin();
} catch (BundleException bundleException) {
Activator.getDefault().log("Error loading plugin " + HDINSIHGT_BUNDLE_ID, bundleException);
}
IClusterDetail clusterDetail = JobViewManager.getCluster(uuid);
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azure.hdinsight.jobview");
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart newEditor = page.openEditor(new JobViewInput(clusterDetail, uuid), editorDescriptor.getId());
} catch (PartInitException e2) {
Activator.getDefault().log("Error opening " + clusterDetail.getName(), e2);
}
}
use of org.osgi.framework.BundleException in project aries by apache.
the class BundleFrameworkManagerImpl method isolatedInstall.
private BundleFramework isolatedInstall(Collection<BundleSuggestion> bundlesToBeInstalled, BundleContext parentCtx, AriesApplication app) throws BundleException {
LOGGER.debug(LOG_ENTRY, "isolatedInstall", new Object[] { bundlesToBeInstalled, app });
/**
* Build the configuration information for this application framework
*/
BundleFrameworkConfiguration config = _bundleFrameworkConfigurationFactory.createBundleFrameworkConfig(app.getApplicationMetadata().getApplicationScope(), parentCtx, app);
/**
* Install and start the new isolated bundle framework
*/
BundleFramework bundleFramework = _bundleFrameworkFactory.createBundleFramework(parentCtx, config);
// We should now have a bundleFramework
if (bundleFramework != null) {
try {
bundleFramework.init();
/**
* Install the bundles into the new framework
*/
BundleContext frameworkBundleContext = bundleFramework.getIsolatedBundleContext();
if (frameworkBundleContext != null) {
for (BundleSuggestion suggestion : bundlesToBeInstalled) bundleFramework.install(suggestion, app);
}
} catch (BundleException be) {
bundleFramework.close();
throw be;
} catch (RuntimeException re) {
bundleFramework.close();
throw re;
}
}
LOGGER.debug(LOG_EXIT, "isolatedInstall", bundleFramework);
return bundleFramework;
}
use of org.osgi.framework.BundleException in project aries by apache.
the class ApplicationContextImpl method installBundles.
/**
* This method finds bundles matching the list of content passed in
* @param bundlesToFind bundles to find and start if the bundle is shared. If isolated, install it.
* @param shared whether the bundles will be shared or isolated
* @return the result of execution
*/
private void installBundles(List<DeploymentContent> bundlesToFind, boolean shared) throws BundleException {
LOGGER.debug(LOG_ENTRY, "install", new Object[] { bundlesToFind, Boolean.valueOf(shared) });
if (!bundlesToFind.isEmpty() || !shared) {
Iterator<DeploymentContent> it = bundlesToFind.iterator();
/**
* Dont install any bundles from the list which are already
* installed
*/
Bundle[] sharedBundles = _bundleFrameworkManager.getSharedBundleFramework().getIsolatedBundleContext().getBundles();
if (shared) {
if (sharedBundles.length > 0) {
while (it.hasNext()) {
DeploymentContent bundleToFind = it.next();
for (Bundle b : sharedBundles) {
if (bundleToFind.getContentName().equals(b.getSymbolicName()) && bundleToFind.getExactVersion().equals(b.getVersion())) {
it.remove();
_bundles.add(b);
break;
}
}
}
}
}
/**
* Ask the repository manager to find us a list of suggested bundles
* to install based on our content list
*/
Map<DeploymentContent, BundleSuggestion> bundlesToBeInstalled = findBundleSuggestions(bundlesToFind);
/**
* Perform the install of the bundles
*/
try {
if (shared)
_bundles.addAll(_bundleFrameworkManager.installSharedBundles(new ArrayList<BundleSuggestion>(bundlesToBeInstalled.values()), makeAppProxy()));
else
_bundles.add(_bundleFrameworkManager.installIsolatedBundles(new ArrayList<BundleSuggestion>(bundlesToBeInstalled.values()), makeAppProxy()));
} catch (BundleException e) {
LOGGER.debug(LOG_EXCEPTION, e);
throw e;
}
}
LOGGER.debug(LOG_EXIT, "install");
}
use of org.osgi.framework.BundleException in project aries by apache.
the class ApplicationContextImpl method uninstall.
/**
* Called to remove the application, if called multiple times the subsequent
* calls will be ignored.
* @return whether the uninstallation is successful
*/
protected synchronized void uninstall() throws BundleException {
LOGGER.debug(LOG_ENTRY, "uninstall");
if (_state != ApplicationState.UNINSTALLED) {
// and attempt to stop and uninstall each of them.
for (Iterator<Bundle> bundleIter = _bundles.iterator(); bundleIter.hasNext(); ) {
Bundle bundleToRemove = bundleIter.next();
if (bundleToRemove.getState() != Bundle.UNINSTALLED) {
try {
// If Bundle is active, stop it first.
if (bundleToRemove.getState() == Bundle.ACTIVE) {
_bundleFrameworkManager.stopBundle(bundleToRemove);
}
} catch (BundleException be) {
LOGGER.debug(LOG_EXCEPTION, be);
}
try {
// Delegate the uninstall to the bundleFrameworkManager
_bundleFrameworkManager.uninstallBundle(bundleToRemove);
} catch (BundleException be) {
LOGGER.debug(LOG_EXCEPTION, be);
}
}
bundleIter.remove();
}
_state = ApplicationState.UNINSTALLED;
}
LOGGER.debug(LOG_EXIT, "uninstall");
}
use of org.osgi.framework.BundleException in project aries by apache.
the class ApplicationContextManagerImpl method bindBundleFrameworkManager.
public void bindBundleFrameworkManager(BundleFrameworkManager bfm) {
LOGGER.debug(LOG_ENTRY, "bindBundleFrameworkManager", bfm);
List<AriesApplicationContext> contexts = new ArrayList<AriesApplicationContext>();
synchronized (_appToContextMap) {
contexts.addAll(_appToContextMap.values());
}
for (AriesApplicationContext ctx : contexts) {
try {
((ApplicationContextImpl) ctx).open();
} catch (BundleException e) {
LOGGER.debug(LOG_EXCEPTION, e);
}
}
LOGGER.debug(LOG_EXIT, "bindBundleFrameworkManager");
}
Aggregations