use of org.apache.aries.application.InvalidAttributeException in project aries by apache.
the class ModelledResourceManagerImpl method model.
private ModelledResource model(String uri, BundleManifest bm, ParsedServiceElements pse) throws ModellerException {
Attributes attributes = bm.getRawAttributes();
ModelledResource mbi = null;
try {
mbi = _modellingManager.getModelledResource(uri, attributes, pse.getReferences(), pse.getServices());
} catch (InvalidAttributeException iae) {
ModellerException me = new ModellerException(iae);
_logger.debug(LOG_EXIT, "getModelledResource", me);
throw me;
}
_logger.debug(LOG_EXIT, "getModelledResource", mbi);
return mbi;
}
use of org.apache.aries.application.InvalidAttributeException in project aries by apache.
the class ModellingHelperImpl method buildFragmentHost_.
public static ImportedBundle buildFragmentHost_(String fragmentHostHeader) throws InvalidAttributeException {
logger.debug(LOG_ENTRY, "buildFragmentHost_", new Object[] { fragmentHostHeader });
if (fragmentHostHeader == null) {
return null;
}
Map<String, Map<String, String>> parsedFragHost = ManifestHeaderProcessor.parseImportString(fragmentHostHeader);
if (parsedFragHost.size() != 1)
throw new InvalidAttributeException(MessageUtil.getMessage("MORE_THAN_ONE_FRAG_HOST", new Object[] { fragmentHostHeader }, "An internal error occurred. A bundle fragment manifest must define exactly one Fragment-Host entry. The following entry was found" + fragmentHostHeader + "."));
String hostName = parsedFragHost.keySet().iterator().next();
Map<String, String> attribs = parsedFragHost.get(hostName);
String bundleVersion = attribs.remove(BUNDLE_VERSION_ATTRIBUTE);
if (bundleVersion != null && attribs.get(VERSION_ATTRIBUTE) == null) {
attribs.put(VERSION_ATTRIBUTE, bundleVersion);
}
attribs.put(ModellingConstants.OBR_SYMBOLIC_NAME, hostName);
String filter = ManifestHeaderProcessor.generateFilter(attribs);
ImportedBundle result = new ImportedBundleImpl(filter, attribs);
logger.debug(LOG_EXIT, "buildFragmentHost_", result);
return result;
}
use of org.apache.aries.application.InvalidAttributeException in project aries by apache.
the class OBRAriesResolver method toImportedBundle.
private Collection<ImportedBundle> toImportedBundle(Collection<Content> content) throws ResolverException {
log.debug(LOG_ENTRY, "toImportedBundle", content);
List<ImportedBundle> result = new ArrayList<ImportedBundle>();
for (Content c : content) {
try {
result.add(modellingManager.getImportedBundle(c.getContentName(), c.getVersion().toString()));
} catch (InvalidAttributeException iae) {
throw new ResolverException(iae);
}
}
log.debug(LOG_EXIT, "toImportedBundle", result);
return result;
}
use of org.apache.aries.application.InvalidAttributeException in project aries by apache.
the class DeploymentManifestManagerImpl method toImportedBundle.
/**
* Covert a collection of contents to a collection of ImportedBundle objects
* @param content a collection of content
* @return a collection of ImportedBundle objects
* @throws ResolverException
*/
private Set<ImportedBundle> toImportedBundle(Collection<Content> content) throws ResolverException {
_logger.debug(LOG_ENTRY, "toImportedBundle", new Object[] { content });
Set<ImportedBundle> result = new HashSet<ImportedBundle>();
for (Content c : content) {
try {
result.add(modellingManager.getImportedBundle(c.getContentName(), c.getVersion().toString()));
} catch (InvalidAttributeException iax) {
ResolverException rx = new ResolverException(iax);
_logger.debug(LOG_EXIT, "toImportedBundle", new Object[] { rx });
throw rx;
}
}
_logger.debug(LOG_EXIT, "toImportedBundle", new Object[] { result });
return result;
}
use of org.apache.aries.application.InvalidAttributeException in project aries by apache.
the class DeploymentMetadataImpl method getFilters.
private Collection<Filter> getFilters(String filterString) throws InvalidAttributeException {
Collection<Filter> filters = new ArrayList<Filter>();
List<String> fs = ManifestProcessor.split(filterString, ",");
if ((fs != null) && (!!!fs.isEmpty())) {
for (String filter : fs) {
try {
filters.add(FrameworkUtil.createFilter(FilterUtils.removeMandatoryFilterToken(filter)));
} catch (InvalidSyntaxException ise) {
InvalidAttributeException iae = new InvalidAttributeException(ise);
throw iae;
}
}
}
return filters;
}
Aggregations