本文整理汇总了Java中org.osgi.framework.wiring.BundleRevision.TYPE_FRAGMENT属性的典型用法代码示例。如果您正苦于以下问题:Java BundleRevision.TYPE_FRAGMENT属性的具体用法?Java BundleRevision.TYPE_FRAGMENT怎么用?Java BundleRevision.TYPE_FRAGMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osgi.framework.wiring.BundleRevision
的用法示例。
在下文中一共展示了BundleRevision.TYPE_FRAGMENT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitBundleStarted
public static void waitBundleStarted(Bundle bundle) {
if ((bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) {
return;
}
BundleContext ctx;
int state;
// 自旋锁
for (;;) {
state = bundle.getState();
if (state != Bundle.STARTING && state != Bundle.ACTIVE) {
return;
}
ctx = bundle.getBundleContext();
if (ctx == null) {
Thread.yield();
} else {
return;
}
}
}
示例2: isFragment
private boolean isFragment(Bundle bundle) {
BundleRevision bundleRevision = bundle.adapt(BundleRevision.class);
if (bundleRevision == null)
throw new NullPointerException("Null bundle revision means that bundle has probably been uninstalled: " +
bundle.getSymbolicName() + ":" + bundle.getVersion());
return (bundleRevision.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}
示例3: isFragment
private static boolean isFragment(Bundle bundle) {
return (bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) > 0;
}
示例4: updateDependenciesState
private void updateDependenciesState(Map<MavenArtifact, ArtifactLoader> artifact2loader, Set<PluginDescription> toInstall, Set<PluginDescription> toUninstall) {
Objects.requireNonNull(artifact2loader);
Objects.requireNonNull(toInstall);
Objects.requireNonNull(toUninstall);
LOGGER.fine(format("Update state: toInstall=%s, toUninstall=%s", toInstall, toUninstall));
IllegalStateException startExCollection = null;
try {
synchronized (lock) {
try {
performActions(computeActions(toInstall, toUninstall), artifact2loader);
checkDependenciesState();
} finally {
FrameworkWiring frameworkWiring = bundleContext.getBundle(0).adapt(FrameworkWiring.class);
CountDownLatch latch = new CountDownLatch(1);
frameworkWiring.refreshBundles(null, event -> latch.countDown());
latch.await();
Set<Bundle> bundles = bundle2artifact.keySet();
frameworkWiring.resolveBundles(bundles);
for (Bundle bundle : bundles) {
if (bundle.getState() != Bundle.ACTIVE &&
bundle.getState() != Bundle.STARTING &&
(bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) == 0) {
try {
bundle.start(Bundle.START_ACTIVATION_POLICY);
} catch (Throwable exStart) {
LOGGER.log(Level.WARNING, format("Bundle %s couldn't start", bundle), exStart);
if (startExCollection == null)
startExCollection = new IllegalStateException("One or more bundles couldn't start");
startExCollection.addSuppressed(exStart);
}
}
}
}
}
} catch (Throwable ex) {
LOGGER.log(Level.SEVERE, "Couldn't finish updating dependencies state", ex);
IllegalStateException exToThrow = new IllegalStateException("Couldn't finish updating dependencies state", ex);
if (startExCollection != null)
exToThrow.addSuppressed(startExCollection);
throw exToThrow;
}
if (startExCollection != null)
throw startExCollection;
}
示例5: isFragment
private static boolean isFragment(BundleWiring wiring) {
return (wiring.getRevision().getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}
示例6: isFragment
public boolean isFragment ()
{
return ( this.bundleRevision.getTypes () & BundleRevision.TYPE_FRAGMENT ) > 0;
}
示例7: isFragment
private boolean isFragment(Bundle bundle) {
return (bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}
示例8: isFragment
public static boolean isFragment(Bundle bundle) {
return (bundle.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0;
}