本文整理汇总了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();
}
}