org.apache.wicket.request.resource.AbstractResource Java Examples

The following examples show how to use org.apache.wicket.request.resource.AbstractResource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassPathScanImplementationLookup.java    From syncope with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public void load() {
    pages = new ArrayList<>();
    previewers = new ArrayList<>();
    extPages = new ArrayList<>();
    ssoLoginFormPanels = new ArrayList<>();
    resources = new ArrayList<>();

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
    scanner.addIncludeFilter(new AssignableTypeFilter(AbstractResource.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(BaseExtPage.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(BaseSSOLoginFormPanel.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(AbstractBinaryPreviewer.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(BaseEnduserWebPage.class));

    for (BeanDefinition bd : scanner.findCandidateComponents(getBasePackage())) {
        try {
            Class<?> clazz = ClassUtils.resolveClassName(Objects.requireNonNull(bd.getBeanClassName()),
                ClassUtils.getDefaultClassLoader());
            boolean isAbstractClazz = Modifier.isAbstract(clazz.getModifiers());
            if (!isAbstractClazz) {
                if (BaseExtPage.class.isAssignableFrom(clazz)) {
                    if (clazz.isAnnotationPresent(ExtPage.class)) {
                        extPages.add((Class<? extends BaseExtPage>) clazz);
                    } else {
                        LOG.error("Could not find annotation {} in {}, ignoring",
                                ExtPage.class.getName(), clazz.getName());
                    }
                } else if (AbstractResource.class.isAssignableFrom(clazz)) {
                    if (clazz.isAnnotationPresent(Resource.class)) {
                        resources.add((Class<? extends AbstractResource>) clazz);
                    } else {
                        LOG.error("Could not find annotation {} in {}, ignoring",
                                Resource.class.getName(), clazz.getName());
                    }
                } else if (AbstractBinaryPreviewer.class.isAssignableFrom(clazz)) {
                    previewers.add((Class<? extends AbstractBinaryPreviewer>) clazz);
                } else if (BaseSSOLoginFormPanel.class.isAssignableFrom(clazz)) {
                    ssoLoginFormPanels.add((Class<? extends BaseSSOLoginFormPanel>) clazz);
                } else if (BaseEnduserWebPage.class.isAssignableFrom(clazz)) {
                    pages.add((Class<? extends BaseEnduserWebPage>) clazz);
                }
            }
        } catch (Throwable t) {
            LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
        }
    }
    resources = Collections.unmodifiableList(resources);

    ssoLoginFormPanels = Collections.unmodifiableList(ssoLoginFormPanels);

    pages = Collections.unmodifiableList(pages);

    LOG.debug("Binary previewers found: {}", previewers);
    LOG.debug("Extension pages found: {}", extPages);
    LOG.debug("SSO Login pages found: {}", ssoLoginFormPanels);
    LOG.debug("Wicket Resources found: {}", resources);
}
 
Example #2
Source File: ClassPathScanImplementationLookup.java    From syncope with Apache License 2.0 4 votes vote down vote up
public List<Class<? extends AbstractResource>> getResources() {
    return resources;
}
 
Example #3
Source File: ClassPathScanImplementationLookup.java    From syncope with Apache License 2.0 4 votes vote down vote up
public List<Class<? extends AbstractResource>> getResources() {
    return resources;
}