use of org.apache.aries.util.manifest.BundleManifest in project aries by apache.
the class ModelledResourceManagerImpl method getServiceElements.
public ParsedServiceElements getServiceElements(InputStreamProvider archive) throws ModellerException {
ICloseableDirectory dir = null;
try {
dir = FileSystem.getFSRoot(archive.open());
BundleManifest bm = BundleManifest.fromBundle(dir);
return getServiceElements(bm, dir);
} catch (IOException e) {
throw new ModellerException(e);
} finally {
IOUtils.close(dir);
}
}
use of org.apache.aries.util.manifest.BundleManifest in project aries by apache.
the class ModelledResourceManagerImpl method getModelledResource.
public ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException {
_logger.debug(LOG_ENTRY, "getModelledResource", new Object[] { uri, bundle });
if (bundle != null) {
BundleManifest bm = BundleManifest.fromBundle(bundle);
ParsedServiceElements pse = getServiceElements(bm, bundle);
return model(uri, bm, pse);
} else {
// The bundle does not exist
ModellerException me = new ModellerException(MessageUtil.getMessage("INVALID_BUNDLE_LOCATION", bundle));
_logger.debug(LOG_EXIT, "getModelledResource", me);
throw me;
}
}
use of org.apache.aries.util.manifest.BundleManifest in project aries by apache.
the class SemanticVersioningChecker method getBundles.
private Map<String, BundleInfo> getBundles(IDirectory ds) {
Map<String, BundleInfo> bundles = new HashMap<String, BundleInfo>();
List<IFile> includedFiles = ds.listAllFiles();
for (IFile ifile : includedFiles) {
if (ifile.getName().endsWith(SemanticVersioningUtils.jarExt)) {
// scan its manifest
try {
BundleManifest manifest = BundleManifest.fromBundle(ifile.open());
// find the bundle symbolic name, store them in a map with bundle symbolic name as key, bundleInfo as value
if (manifest.getSymbolicName() != null) {
bundles.put(manifest.getSymbolicName(), new BundleInfo(manifest, new File(ifile.toURL().getPath())));
}
} catch (MalformedURLException mue) {
_logger.debug("Exception thrown when processing" + ifile.getName(), mue);
} catch (IOException ioe) {
_logger.debug("Exception thrown when processing" + ifile.getName(), ioe);
}
}
}
return bundles;
}
use of org.apache.aries.util.manifest.BundleManifest in project aries by apache.
the class EJBModellerTest method testModelServicesNoneExportEJB.
@Test
public void testModelServicesNoneExportEJB() throws ModellerException {
Manifest man = new Manifest();
setBasicHeaders(man);
man.getMainAttributes().putValue("Export-EJB", "NONE,anEJB , another");
modeller.modelServices(new BundleManifest(man), bundleLocation);
ejbLocator.assertSkeletonNotCalled();
}
use of org.apache.aries.util.manifest.BundleManifest in project aries by apache.
the class EJBModellerTest method testModelServicesEmptyExportEJB.
@Test
public void testModelServicesEmptyExportEJB() throws ModellerException {
Manifest man = new Manifest();
setBasicHeaders(man);
man.getMainAttributes().putValue("Export-EJB", "");
modeller.modelServices(new BundleManifest(man), bundleLocation);
ejbLocator.assertCalled(new MethodCall(EJBLocator.class, "findEJBs", BundleManifest.class, bundleLocation, ParsedEJBServices.class));
}
Aggregations