本文整理汇总了Java中org.osgi.framework.startlevel.BundleStartLevel类的典型用法代码示例。如果您正苦于以下问题:Java BundleStartLevel类的具体用法?Java BundleStartLevel怎么用?Java BundleStartLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BundleStartLevel类属于org.osgi.framework.startlevel包,在下文中一共展示了BundleStartLevel类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setStartLevel
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
private void setStartLevel ( final String symbolicName, final int startLevel ) throws BundleException
{
final Bundle bundle = findBundle ( symbolicName );
if ( bundle == null )
{
return;
}
final BundleStartLevel bundleStartLevel = bundle.adapt ( BundleStartLevel.class );
if ( bundleStartLevel == null )
{
return;
}
bundleStartLevel.setStartLevel ( startLevel < 0 ? this.defaultStartLevel : startLevel );
bundle.start ();
}
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:Activator.java
示例2: uninstallBundle
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
/**
* Uninstalling an existing bundle
*
* @param symbolicName
* The symbolicName of the bundle
* @param version
* The version of the bundle, optional. In case this parameter is null, the first bundle with the given
* symbolic name will be uninstalled.
*/
public void uninstallBundle(final String symbolicName, final String version) {
Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null);
if (bundle != null) {
stateChanged = true;
Logger.info("Uninstalling bundle: " + bundle);
BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class);
if (bundleStartLevel.getStartLevel() < currentFrameworkStartLevelValue) {
setFrameworkStartLevel(bundleStartLevel.getStartLevel());
}
try {
bundle.uninstall();
} catch (BundleException e) {
Logger.error("Error during uninstalling bundle: " + bundle.toString(), e);
}
}
}
开发者ID:everit-org,项目名称:osgi-richconsole,代码行数:26,代码来源:UpgradeProcess.java
示例3: startBundles
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
/**
* @param array
*/
private static IStatus startBundles(Collection<Bundle> bundles) {
final BundleContext context = JavaLanguageServerPlugin.getBundleContext();
MultiStatus status = new MultiStatus(context.getBundle().getSymbolicName(), IStatus.OK, "Starting added bundles", null);
for (Bundle bundle : bundles) {
if (bundle.getState() == Bundle.UNINSTALLED) {
status.add(new Status(IStatus.ERROR, context.getBundle().getSymbolicName(), "Could not start: " + bundle.getSymbolicName() + '(' + bundle.getLocation() + ':' + bundle.getBundleId() + ')' + ". It's state is uninstalled."));
continue;
}
if (bundle.getState() == Bundle.STARTING) {
continue;
}
if (bundle.getBundleId() == 0) {
continue;
}
try {
// set to the default value for osgi.bundles.defaultStartLevel
bundle.adapt(BundleStartLevel.class).setStartLevel(4);
bundle.start(Bundle.START_ACTIVATION_POLICY);
JavaLanguageServerPlugin.logInfo("Started " + bundle.getLocation());
} catch (BundleException e) {
status.add(new Status(IStatus.ERROR, context.getBundle().getSymbolicName(), "Bundle startup failed " + bundle.getLocation(), e));
}
}
return status;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:31,代码来源:BundleUtils.java
示例4: hookDarkerCore
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
private void hookDarkerCore() {
Bundle bundle = FrameworkUtil.getBundle(DarkerWeavingHook.class);
try {
if (bundle.getState()==Bundle.RESOLVED)
bundle.start();
} catch (BundleException e) {
// TODO use log in future
e.printStackTrace();
}
bundle.adapt(BundleStartLevel.class).setStartLevel(1);
}
开发者ID:jvanzyl,项目名称:eclipse.darker.theme,代码行数:12,代码来源:DarkerThemer.java
示例5: getStartLevel
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
public int getStartLevel() {
BundleStartLevel bundleStartLevel = m_bundle.adapt(BundleStartLevel.class);
return bundleStartLevel.getStartLevel();
}
开发者ID:ow2-chameleon,项目名称:everest,代码行数:5,代码来源:BundleResource.java
示例6: setStartLevel
import org.osgi.framework.startlevel.BundleStartLevel; //导入依赖的package包/类
public void setStartLevel(int startLevel) {
BundleStartLevel bundleStartLevel = m_bundle.adapt(BundleStartLevel.class);
bundleStartLevel.setStartLevel(startLevel);
}
开发者ID:ow2-chameleon,项目名称:everest,代码行数:5,代码来源:BundleResource.java
注:本文中的org.osgi.framework.startlevel.BundleStartLevel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论