shell/core/src/main/java/org/apache/karaf/shell/impl/action/osgi/RegistryImpl.java [151:203]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                            } catch (Exception e) {
                                // TODO: log exception
                            }
                        }
                    }
                } else if (clazz.isInstance(service)) {
                    if (isVisible(service)) {
                        list.add(clazz.cast(service));
                    }
                }
            }
        }
        if (parent != null) {
            list.addAll(parent.getServices(clazz));
        }
        return list;
    }

    @Override
    public boolean hasService(Class<?> clazz) {
        synchronized (services) {
            for (Object service : services.values()) {
                if (service instanceof Factory) {
                    if (clazz.isAssignableFrom(((Factory<?>) service).clazz)) {
                        if (isVisible(service)) {
                            return true;
                        }
                    }
                } else if (clazz.isInstance(service)) {
                    if (isVisible(service)) {
                        return true;
                    }
                }
            }
        }
        if (parent != null) {
            return parent.hasService(clazz);
        }
        return false;
    }

    protected boolean isVisible(Object service) {
        return true;
    }

    static class Factory<T> {

        final Class<T> clazz;
        final Callable<T> callable;

        Factory(Class<T> clazz, Callable<T> callable) {
            this.clazz = clazz;
            this.callable = callable;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



shell/core/src/main/java/org/apache/karaf/shell/impl/console/RegistryImpl.java [144:196]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                            } catch (Exception e) {
                                // TODO: log exception
                            }
                        }
                    }
                } else if (clazz.isInstance(service)) {
                    if (isVisible(service)) {
                        list.add(clazz.cast(service));
                    }
                }
            }
        }
        if (parent != null) {
            list.addAll(parent.getServices(clazz));
        }
        return list;
    }

    @Override
    public boolean hasService(Class<?> clazz) {
        synchronized (services) {
            for (Object service : services.values()) {
                if (service instanceof Factory) {
                    if (clazz.isAssignableFrom(((Factory<?>) service).clazz)) {
                        if (isVisible(service)) {
                            return true;
                        }
                    }
                } else if (clazz.isInstance(service)) {
                    if (isVisible(service)) {
                        return true;
                    }
                }
            }
        }
        if (parent != null) {
            return parent.hasService(clazz);
        }
        return false;
    }

    protected boolean isVisible(Object service) {
        return true;
    }

    static class Factory<T> {

        final Class<T> clazz;
        final Callable<T> callable;

        Factory(Class<T> clazz, Callable<T> callable) {
            this.clazz = clazz;
            this.callable = callable;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



