本文整理匯總了Java中org.osgi.framework.BundleException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java BundleException.printStackTrace方法的具體用法?Java BundleException.printStackTrace怎麽用?Java BundleException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.osgi.framework.BundleException
的用法示例。
在下文中一共展示了BundleException.printStackTrace方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installBundle
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
/**
* Installs the specified jar bundle and adds the Bundle instance to the local bundle vector {@link #getBundleVector()}.
* @param bundleJarFilePath the bundle jar file path
*/
public void installBundle(String bundleJarFilePath) {
Bundle bundle = null;
try {
BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
bundle = bundleContext.installBundle(bundleJarFilePath);
if (this.debug) System.out.println("=> + " + bundle.getSymbolicName() + " installed.");
} catch (BundleException bEx) {
bEx.printStackTrace();
}
// --- Remind this bundle ---------------
if (bundle!=null) this.getBundleVector().addElement(bundle);
}
示例2: stopAndUninstallBundles
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
/**
* Stops and un-installs the current bundle.
*/
public void stopAndUninstallBundles() {
// --- Get a copy of loaded bundles -----
Vector<Bundle> bundlesToRemove = new Vector<>(this.getBundleVector());
for (Bundle bundle: bundlesToRemove) {
try {
// --- Remove, if active --------
if (bundle.getState()==Bundle.ACTIVE) {
bundle.stop();
bundle.uninstall();
}
// --- Remove from vector -------
this.getBundleVector().remove(bundle);
if (this.debug) System.out.println("=> - " + bundle.getSymbolicName() + " stoped & uninstalled");
} catch (BundleException bEx) {
bEx.printStackTrace();
}
}
}
示例3: installFromFile
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
/**
* installs a bundle from file
*/
void installFromFile(File file) {
try {
Bundle bundle = context.installBundle(file.toURI().toString());
plugins.add(bundle);
System.out.println ("Loading " + file.toURI());
bundles.put (bundle, file.toURI().toString());
}
catch (BundleException e)
{
if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR)
{
// duplicate bundle is a warning, not an error
System.out.println("WARNING " + file.getName() + "; " + e.getMessage());
}
else
{
System.out.println("Could not install bundle from file " + file.getName());
e.printStackTrace();
}
}
}
示例4: startBundle
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
/**
* Starts the specified bundle and return true if successful.
*
* @param bundle the bundle
* @return true, if successful
*/
public boolean startBundle(Bundle bundle) {
boolean bundleStarted = false;
try {
bundle.start();
bundleStarted = true;
if (this.debug) System.out.println("=> ! " + bundle.getSymbolicName() + " started");
} catch (BundleException bEx) {
bEx.printStackTrace();
}
return bundleStarted;
}
示例5: unloadBootstrapBundle
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
public void unloadBootstrapBundle() {
if (ybootstrapBundle != null) {
try {
ybootstrapBundle.uninstall();
ybootstrapBundle = null;
}
catch (BundleException e) {
e.printStackTrace();
}
}
}
示例6: destroy
import org.osgi.framework.BundleException; //導入方法依賴的package包/類
@Override
public void destroy() {
log.finer("Destroying application loader.");
watchdog.close();
try {
osgiFramework.stop();
} catch (BundleException e) {
e.printStackTrace();
}
}