use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project smarthome by eclipse.
the class MissingServiceAnalyzer method printUnsatisfiedServices.
private <T> void printUnsatisfiedServices(ServiceComponentRuntime scr, String interfaceName, String prefix) {
Bundle[] allBundlesArrays = getAllBundles();
List<ComponentDescriptionDTO> descriptions = getComponentDescriptions(scr, interfaceName, allBundlesArrays);
if (descriptions.isEmpty()) {
ps.println(prefix + "No component implementing " + interfaceName + " is currently registered.");
} else {
for (ComponentDescriptionDTO description : descriptions) {
Collection<ComponentConfigurationDTO> configurations = scr.getComponentConfigurationDTOs(description);
for (ComponentConfigurationDTO configuration : configurations) {
ps.println(prefix + configuration.id + " [" + getState(configuration.state) + "] " + description.implementationClass + " in " + description.bundle.symbolicName);
for (ReferenceDTO ref : getUnsatisfiedReferences(description, configuration)) {
ps.println(prefix + "\t" + ref.name + " (" + ref.interfaceName + ")");
printUnsatisfiedServices(scr, ref.interfaceName, prefix + "\t\t");
}
}
}
}
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project acs-aem-commons by Adobe-Consulting-Services.
the class ComponentDisablerDriverDS13 method disable.
@Override
public void disable(String componentName) {
for (Bundle bundle : bundleContext.getBundles()) {
ComponentDescriptionDTO dto = scr.getComponentDescriptionDTO(bundle, componentName);
if (dto != null && scr.isComponentEnabled(dto)) {
log.info("Component {} disabled by configuration.", dto.implementationClass);
scr.disableComponent(dto);
}
}
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project karaf by apache.
the class ListAction method doScrAction.
@Override
protected Object doScrAction(ServiceComponentRuntime serviceComponentRuntime) throws Exception {
ShellTable table = new ShellTable();
table.column("ID");
table.column("State");
table.column("Component Name");
List<ComponentConfigurationDTO> configs = new ArrayList<>();
for (ComponentDescriptionDTO component : serviceComponentRuntime.getComponentDescriptionDTOs()) {
configs.addAll(serviceComponentRuntime.getComponentConfigurationDTOs(component));
}
Collections.sort(configs, idComparator);
for (ComponentConfigurationDTO config : configs) {
// Display only non hidden components, or all if showHidden is true
if (showHidden || !ScrActionSupport.isHiddenComponent(config)) {
table.addRow().addContent(config.id, ScrUtils.getState(config.state), config.description.name);
}
}
table.print(System.out);
return null;
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project karaf by apache.
the class ScrBundleStateService method getDiag.
@Override
public String getDiag(Bundle bundle) {
StringBuilder sb = new StringBuilder();
for (ComponentDescriptionDTO desc : scr.getComponentDescriptionDTOs(bundle)) {
for (ComponentConfigurationDTO cfg : scr.getComponentConfigurationDTOs(desc)) {
if (cfg.state != ComponentConfigurationDTO.ACTIVE && cfg.state != ComponentConfigurationDTO.SATISFIED) {
sb.append(cfg.description.name).append(" (").append(cfg.id).append(")\n");
if ((cfg.state & ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION) != 0) {
sb.append(" missing configurations: ");
boolean first = true;
for (String s : cfg.description.configurationPid) {
if (!first) {
sb.append(", ");
}
sb.append(s);
first = false;
}
sb.append("\n");
}
if ((cfg.state & ComponentConfigurationDTO.UNSATISFIED_REFERENCE) != 0) {
sb.append(" missing references: ");
boolean first = true;
for (UnsatisfiedReferenceDTO ur : cfg.unsatisfiedReferences) {
if (!first) {
sb.append(", ");
}
sb.append(ur.name);
first = false;
}
sb.append("\n");
}
}
}
}
return sb.toString();
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project karaf by apache.
the class ActivateAction method doScrAction.
@Override
protected Object doScrAction(ServiceComponentRuntime serviceComponentRuntime) throws Exception {
logger.debug("Activate Action");
logger.debug(" Activating the Component: " + name);
for (ComponentDescriptionDTO component : serviceComponentRuntime.getComponentDescriptionDTOs()) {
if (name.equals(component.name)) {
serviceComponentRuntime.enableComponent(component);
}
}
return null;
}
Aggregations