protected ComponentConfigurationDTO getComponentId(final String componentIdPar) { try { final long componentId = Long.parseLong(componentIdPar); for(final ComponentDescriptionDTO desc : this.descriptions) { for(final ComponentConfigurationDTO cfg : runtime.getComponentConfigurationDTOs(desc)) { if ( cfg.id == componentId ) { return cfg; } } } } catch (NumberFormatException nfe) { // don't care } return null; }
@Override public BundleState getState(Bundle bundle) { if (bundle.getState() == Bundle.ACTIVE) { for (ComponentDescriptionDTO desc : scr.getComponentDescriptionDTOs(bundle)) { for (ComponentConfigurationDTO cfg : scr.getComponentConfigurationDTOs(desc)) { if (cfg.state != ComponentConfigurationDTO.ACTIVE && cfg.state != ComponentConfigurationDTO.SATISFIED) { return BundleState.Waiting; } } } } return BundleState.Unknown; } }
private Component toComponent(ComponentDescriptionDTO dto) { Collection<ComponentConfigurationDTO> configs = scr.getComponentConfigurationDTOs(dto); if (configs.isEmpty()) { return null; } return new ComponentImpl(configs.iterator().next()); }
@Override public BundleState getState(Bundle bundle) { if (bundle.getState() == Bundle.ACTIVE) { for (ComponentDescriptionDTO desc : scr.getComponentDescriptionDTOs(bundle)) { for (ComponentConfigurationDTO cfg : scr.getComponentConfigurationDTOs(desc)) { if (cfg.state != ComponentConfigurationDTO.ACTIVE && cfg.state != ComponentConfigurationDTO.SATISFIED) { return BundleState.Waiting; } } } } return BundleState.Unknown; } }
@Override public TabularData getComponentConfigs() { return JmxComponentConfiguration.tableFrom( scrService.getComponentDescriptionDTOs().stream() .map(c -> scrService.getComponentConfigurationDTOs(c)) .flatMap(Collection::stream)); }
/** * @see org.apache.felix.scr.ScrService#getComponents(java.lang.String) */ public Component[] getComponents( final String componentName ) { List<Component> result = new ArrayList<Component>(); final Collection<ComponentDescriptionDTO> descriptions = this.runtime.getComponentDescriptionDTOs(); for(final ComponentDescriptionDTO descDTO : descriptions ) { if ( descDTO.name.equals(componentName) ) { final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO); ComponentConfigurationDTO configDTO = null; if ( !configs.isEmpty() ) { configDTO = configs.iterator().next(); } result.add(new ComponentWrapper(this.context, this.runtime, descDTO, configDTO)); } } return result.isEmpty() ? null : result.toArray( new Component[result.size()] ); }
/** * @see org.apache.felix.scr.ScrService#getComponents(org.osgi.framework.Bundle) */ public Component[] getComponents( final Bundle bundle ) { List<Component> result = new ArrayList<Component>(); final Collection<ComponentDescriptionDTO> descriptions = (bundle == null ? this.runtime.getComponentDescriptionDTOs() : this.runtime.getComponentDescriptionDTOs(bundle)); for(final ComponentDescriptionDTO descDTO : descriptions ) { final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO); ComponentConfigurationDTO configDTO = null; if ( !configs.isEmpty() ) { configDTO = configs.iterator().next(); } result.add(new ComponentWrapper(this.context, this.runtime, descDTO, configDTO)); } return result.isEmpty() ? null : result.toArray( new Component[result.size()] ); }
@Override public TabularData getComponentConfigs(long bundleId, String componentName) { return JmxComponentConfiguration.tableFrom( scrService.getComponentConfigurationDTOs( findComponent(bundleId, componentName))); }
private boolean isFullyStarted(Bundle bundle) { for (ComponentDescriptionDTO component : scrService.getComponentDescriptionDTOs(bundle)) { if (scrService.isComponentEnabled(component)) { for (ComponentConfigurationDTO config : scrService.getComponentConfigurationDTOs(component)) { if (config.state != ComponentConfigurationDTO.ACTIVE) { return false; } } } } return true; }
Collection<ComponentConfigurationDTO> childrenTmp = scr.getComponentConfigurationDTOs(dto); if (childrenTmp == null) { children = Collections.emptyList();
Collection<ComponentConfigurationDTO> childrenTmp = scr.getComponentConfigurationDTOs(dto); if (childrenTmp == null) { children = Collections.emptyList();
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) {
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) {
/** * @see org.apache.felix.scr.ScrService#getComponent(long) */ public Component getComponent( long componentId ) { final Collection<ComponentDescriptionDTO> descriptions = this.runtime.getComponentDescriptionDTOs(); for(final ComponentDescriptionDTO descDTO : descriptions ) { final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO); for(final ComponentConfigurationDTO configDTO : configs) { if ( configDTO.id == componentId ) { return new ComponentWrapper(this.context, this.runtime, descDTO, configDTO); } } } return null; }
@Descriptor("Dump information of a component configuration") public ComponentConfigurationDTO info(@Descriptor("ID of the component configuration") long id) { for (ComponentDescriptionDTO descDto : scr.getComponentDescriptionDTOs()) { for (ComponentConfigurationDTO configDto : scr.getComponentConfigurationDTOs(descDto)) { if (configDto.id == id) return configDto; } } return null; }
@Descriptor("Dump information of a component configuration") public ComponentConfigurationDTO info(@Descriptor("ID of the component configuration") long id) { for (ComponentDescriptionDTO descDto : scr.getComponentDescriptionDTOs()) { for (ComponentConfigurationDTO configDto : scr.getComponentConfigurationDTOs(descDto)) { if (configDto.id == id) return configDto; } } return null; }
.forEach(componentDto -> { try { scrService.getComponentConfigurationDTOs(componentDto) .forEach(configurationDto -> { String state;
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."); ps.println( "Make sure to add the appropriate bundle and set 'Default Auto-Start=true' in the launch config."); } 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"); } } } } }
final Collection<ComponentConfigurationDTO> configs = scrService.getComponentConfigurationDTOs(d); if ( configs.isEmpty() )
final Collection<ComponentConfigurationDTO> configs = scrService.getComponentConfigurationDTOs(d); if ( configs.isEmpty() )