use of org.apache.felix.dm.ResourceDependency in project felix by apache.
the class DependencyBuilder method createResourceDependency.
private Dependency createResourceDependency(DependencyManager dm, String added, String changed, String removed, boolean required, String filter, boolean propagate, String autoConfigField) {
ResourceDependency rd = dm.createResourceDependency();
rd.setCallbacks(added, changed, removed);
rd.setRequired(required);
if (filter != null) {
rd.setFilter(filter);
}
if (autoConfigField != null) {
rd.setAutoConfig(autoConfigField);
}
rd.setPropagate(propagate);
return rd;
}
use of org.apache.felix.dm.ResourceDependency in project felix by apache.
the class DependencyBuilder method build.
public Dependency build(Bundle b, DependencyManager dm) throws Exception {
Dependency dp = null;
DependencyType type;
try {
type = DependencyType.valueOf(m_metaData.getString(Params.type));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("no \"type\" parameter found from metaData: " + m_metaData);
}
switch(type) {
case ServiceDependency:
dp = createServiceDependency(b, dm);
break;
case ConfigurationDependency:
dp = createConfigurationDependency(b, dm);
break;
case BundleDependency:
dp = createBundleDependency(dm);
break;
case ResourceDependency:
dp = createResourceDependency(dm);
break;
default:
throw new IllegalArgumentException("Can't build service dependency: " + type);
}
return dp;
}
Aggregations