本文整理汇总了Java中org.eclipse.osgi.service.resolver.BundleDescription类的典型用法代码示例。如果您正苦于以下问题:Java BundleDescription类的具体用法?Java BundleDescription怎么用?Java BundleDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BundleDescription类属于org.eclipse.osgi.service.resolver包,在下文中一共展示了BundleDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBundle
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private Bundle addBundle(Version version, String id) {
Manifest manifest = version.findManifest(id);
if (manifest != null) {
if (manifest instanceof Bundle)
return (Bundle) manifest;
else
return null;
}
Bundle bundle = ModelFactory.eINSTANCE.createBundle();
bundle.setId(id);
version.getBundles().add(bundle);
IPluginModelBase entry = PDECore.getDefault().getModelManager().findModel(id);
if (entry != null) {
BundleDescription bundleDescription = entry.getBundleDescription();
bundle.setName(bundleDescription.getName());
bundle.setVendor(bundleDescription.getSupplier().getName());
bundle.setVersion(bundleDescription.getVersion().toString());
}
return bundle;
}
示例2: addFragment
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private Fragment addFragment(Version version, String Id) {
Manifest manifest = version.findManifest(Id);
if (manifest != null) {
if (manifest instanceof Fragment)
return (Fragment) manifest;
else
return null;
}
Fragment fragment = ModelFactory.eINSTANCE.createFragment();
fragment.setId(Id);
version.getFragments().add(fragment);
IPluginModelBase entry = PDECore.getDefault().getModelManager().findModel(Id);
if (entry != null) {
BundleDescription bundleDescription = entry.getBundleDescription().getHost()
.getHosts()[0];
Bundle bundle = addBundle(version, bundleDescription.getSymbolicName());
fragment.setName(bundleDescription.getName());
fragment.setParentBundle(bundle);
fragment.setVendor(bundleDescription.getSupplier().getName());
fragment.setVersion(bundleDescription.getVersion().toString());
}
return fragment;
}
示例3: populateStartupStateModel
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
/**
* Populates the startup state model with the {@link BundleDescriptions} of
* the bundles found in the startup configuration.
*/
protected void populateStartupStateModel() {
final File rootBundleDir = getParent().getPluginRootDirectory().toFile();
for (Object o : getProperties().keySet()) {
// In karaf-3.0.0, mvn urls are sored instead of raw paths.
// Then first try to convert mvn urls to raw path.
final File bundleLocation = new File(rootBundleDir, getPath((String) o));
final BundleDescription desc = getParent().getState().getBundleByLocation(
bundleLocation.getAbsolutePath());
if (desc == null) {
KarafCorePluginActivator.getLogger().error(
"Unable to locate bundle description for: "
+ bundleLocation.getAbsolutePath());
} else {
final BundleStartEntry se = new BundleStartEntry(desc, (String) getProperties()
.get(o));
startupStateModel.put(desc.getSymbolicName(), se);
}
}
}
示例4: getColumnName
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private String getColumnName(IPluginModelBase pm)
{
BundleDescription bundleDescription = pm.getBundleDescription();
String pluginName = (bundleDescription != null) ? bundleDescription.getName() : "NO NAME ???";
for (String prefix : prefixFilters)
{
if (pluginName.startsWith(prefix))
{
if (prefix.length() < pluginName.length())
{
pluginName = pluginName.substring(prefix.length());
// Adjust to remove the first '.' if present
if ((pluginName.startsWith(".")) && pluginName.length() > 2)
pluginName = pluginName.substring(1);
}
break;
}
}
return pluginName;
}
示例5: resolve
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
State resolve(List<SimpleManifest> manifests) {
State state = factory.createState(true);
// Create bundle descriptions from our manifests
BundleDescription[] descriptions = new BundleDescription[manifests
.size()];
for (int i = 0; i < descriptions.length; i++) {
Dictionary<String, String> dict = manifests.get(i).toDictionary();
try {
descriptions[i] = factory.createBundleDescription(state, dict,
Integer.toString(i), i);
} catch (BundleException e) {
handleBundleException(e, manifests.get(i));
continue;
}
state.addBundle(descriptions[i]);
}
// This does the work...
state.resolve();
return state;
}
示例6: fillWithDependent
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private void fillWithDependent(LinkedList<BundleDescription> bundleDescriptions) {
HashSet<String> added = new HashSet<String>();
for (BundleDescription bundleDescription : new LinkedList<BundleDescription>(bundleDescriptions) ) {
//BundleSpecification[] deps = bundleDescription.getRequiredBundles();
// for (BundleSpecification depSpec : deps) {
// if ( depDescription.getSymbolicName().contains("commons.logging") )
// break;
// BundleDescription depDescription = depSpec.getBundle();
BundleDescription deps[] = bundleDescription.getResolvedRequires();
for(BundleDescription depDescription : deps) {
if ( ! added.contains( depDescription.getSymbolicName() )) {
bundleDescriptions.add( depDescription );
added.add( depDescription.getSymbolicName() );
}
}
}
}
示例7: getSymbolicName
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private String getSymbolicName(String bundleUrl) {
File bundlePath = new File(baseBundlesDir, converter.getPath(bundleUrl));
BundleDescription bundleDescription = karafPlatformModel.getState().getBundleByLocation(bundlePath.getAbsolutePath());
if (bundleDescription != null) {
return bundleDescription.getSymbolicName();
} else {
return null;
}
}
示例8: createPluginClassPath
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private static String[] createPluginClassPath(IJavaProject javaProject) throws CoreException {
String[] javaClassPath = createJavaClasspath(javaProject);
IPluginModelBase model = PluginRegistry.findModel(javaProject.getProject());
if (model == null || model.getPluginBase().getId() == null) {
return javaClassPath;
}
List<String> pdeClassPath = new ArrayList<String>();
pdeClassPath.addAll(Arrays.asList(javaClassPath));
BundleDescription target = model.getBundleDescription();
Set<BundleDescription> bundles = new HashSet<BundleDescription>();
// target is null if plugin uses non OSGI format
if (target != null) {
addDependentBundles(target, bundles);
}
// convert default location (relative to wsp) to absolute path
IPath defaultOutputLocation = ResourceUtils.relativeToAbsolute(javaProject.getOutputLocation());
for (BundleDescription bd : bundles) {
appendBundleToClasspath(bd, pdeClassPath, defaultOutputLocation);
}
if(defaultOutputLocation != null) {
String defaultOutput = defaultOutputLocation.toOSString();
if(pdeClassPath.indexOf(defaultOutput) > 0) {
pdeClassPath.remove(defaultOutput);
pdeClassPath.add(0, defaultOutput);
}
}
return pdeClassPath.toArray(new String[pdeClassPath.size()]);
}
示例9: addDependentBundles
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private static void addDependentBundles(BundleDescription bd, Set<BundleDescription> bundles) {
// TODO for some reasons, this does not add "native" fragments for the
// platform. See also: ContributedClasspathEntriesEntry, RequiredPluginsClasspathContainer
// BundleDescription[] requires = PDEState.getDependentBundles(target);
BundleDescription[] bundles2 = PDEState.getDependentBundlesWithFragments(bd);
for (BundleDescription bundleDescription : bundles2) {
if(bundleDescription == null) {
continue;
}
if (!bundles.contains(bundleDescription)) {
bundles.add(bundleDescription);
addDependentBundles(bundleDescription, bundles);
}
}
}
示例10: reportResolutionProblems
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
void reportResolutionProblems(State state) {
boolean resolutionErrors = hasUnresolvedBundles(state);
BundleDescription[] descriptions = state.getBundles();
VersionConstraint[] rootcauses = state.getStateHelper()
.getUnsatisfiedLeaves(descriptions);
// There may be warnings of unresolved constraints, show errors and
// warnings
if (resolutionErrors || rootcauses.length != 0) {
if (resolutionErrors) {
System.err.println("ERROR: There were resolution errors");
} else {
System.err.println("WARNING: There were resolution warnings");
}
System.err.println();
// Just being cute
System.err.print("The following ");
if (rootcauses.length == 1) {
System.err.println("root cause was identified");
} else {
System.err.println(rootcauses.length
+ " root causes were identified");
}
for (VersionConstraint constraint : rootcauses) {
System.err.print("Could not resolve following constraint in ");
System.err.println(constraint.getBundle().getName());
System.err.println("\t" + constraint);
}
} else {
System.out.println("There were no resolution problems.");
}
}
示例11: hasUnresolvedBundles
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
boolean hasUnresolvedBundles(State state) {
BundleDescription[] descriptions = state.getBundles();
for (int i = 0; i < descriptions.length; i++) {
if (!descriptions[i].isResolved()) {
return true;
}
}
return false;
}
示例12: getAllCapabilities
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
private List<BundleCapability> getAllCapabilities(final Bundle[] bundles, final State state) {
List<BundleCapability> availableCapabilities = new ArrayList<BundleCapability>();
for (Bundle bundle : bundles) {
BundleDescription bundleDescription = state.getBundle(bundle.getBundleId());
List<BundleCapability> declaredCapabilities = bundleDescription.getDeclaredCapabilities(null);
availableCapabilities.addAll(declaredCapabilities);
}
return availableCapabilities;
}
示例13: resolveLibraryInFragments
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
protected static IPluginModelBase resolveLibraryInFragments(IPluginModelBase model, String libraryName) {
BundleDescription desc = model.getBundleDescription();
if (desc != null) {
BundleDescription[] fragments = desc.getFragments();
for (int i = 0; i < fragments.length; i++) {
if (new File(fragments[i].getLocation(), libraryName).exists())
return PluginRegistry.findModel(fragments[i]);
}
}
return null;
}
示例14: resolve
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
@Override
public void resolve(BundleDescription[] discard, Dictionary<Object, Object>[] platformProperties) {
preInitialize();
realResolver.resolve(discard, platformProperties);
}
示例15: resolveDynamicImport
import org.eclipse.osgi.service.resolver.BundleDescription; //导入依赖的package包/类
@Override
public ExportPackageDescription resolveDynamicImport(BundleDescription importingBundle, String requestedPackage) {
preInitialize();
return realResolver.resolveDynamicImport(importingBundle, requestedPackage);
}