use of org.apache.aries.application.modelling.impl.ModelledResourceImpl in project aries by apache.
the class DeployedBundlesTest method createModelledResource.
public static ModelledResource createModelledResource(String bundleName, String bundleVersion, Collection<String> importedPackages, Collection<String> exportedPackages) throws InvalidAttributeException {
Attributes att = new Attributes();
att.put(new Attributes.Name(Constants.BUNDLE_SYMBOLICNAME), bundleName);
att.put(new Attributes.Name(Constants.BUNDLE_VERSION), bundleVersion);
att.put(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION), "2");
StringBuilder builder = new StringBuilder();
for (String iPackage : importedPackages) {
builder.append(iPackage).append(",");
}
if (builder.length() > 0) {
builder.deleteCharAt(builder.length() - 1);
att.put(new Attributes.Name(Constants.IMPORT_PACKAGE), builder.toString());
}
builder = new StringBuilder();
for (String ePackage : exportedPackages) {
builder.append(ePackage).append(",");
}
if (builder.length() > 0) {
builder.deleteCharAt(builder.length() - 1);
att.put(new Attributes.Name(Constants.EXPORT_PACKAGE), builder.toString());
}
return new ModelledResourceImpl(null, att, null, null);
}
use of org.apache.aries.application.modelling.impl.ModelledResourceImpl in project aries by apache.
the class BundleResourceTest method instantiateBundleResource.
/**
* @return
* @throws IOException
* @throws FileNotFoundException
* @throws ResolverException
* @throws InvalidAttributeException
*/
protected ModelledResource instantiateBundleResource() throws Exception {
File file = new File(TEST_APP_MANIFEST_PATH, MANIFEST_MF);
Manifest man = new Manifest(new FileInputStream(file));
ModelledResource br = new ModelledResourceImpl(null, man.getMainAttributes(), null, null);
return br;
}
use of org.apache.aries.application.modelling.impl.ModelledResourceImpl in project aries by apache.
the class DeployedBundlesTest method createModelledServiceBundle.
public static ModelledResource createModelledServiceBundle(String bundleName, String bundleVersion, Collection<String> importService, Collection<String> exportService) throws InvalidAttributeException {
Attributes att = new Attributes();
att.put(new Attributes.Name(Constants.BUNDLE_SYMBOLICNAME), bundleName);
att.put(new Attributes.Name(Constants.BUNDLE_VERSION), bundleVersion);
att.put(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION), "2");
List<ImportedService> importedServices = new ArrayList<ImportedService>();
for (String s : importService) {
importedServices.add(new ImportedServiceImpl(false, s, null, null, null, false));
}
List<ExportedService> exportedServices = new ArrayList<ExportedService>();
for (String s : exportService) {
exportedServices.add(new ExportedServiceImpl(null, 0, Collections.singleton(s), Collections.<String, Object>emptyMap()));
}
return new ModelledResourceImpl(null, att, importedServices, exportedServices);
}
Aggregations